Struct rustc_trait_selection::infer::error_reporting::TypeErrCtxt
source · pub struct TypeErrCtxt<'a, 'tcx> {
pub infcx: &'a InferCtxt<'tcx>,
pub typeck_results: Option<Ref<'a, TypeckResults<'tcx>>>,
pub fallback_has_occurred: bool,
pub normalize_fn_sig: Box<dyn Fn(Binder<'tcx, FnSig<'tcx>>) -> Binder<'tcx, FnSig<'tcx>> + 'a>,
pub autoderef_steps: Box<dyn Fn(Ty<'tcx>) -> Vec<(Ty<'tcx>, Vec<Obligation<'tcx, Predicate<'tcx>>>)> + 'a>,
}Expand description
A helper for building type related errors. The typeck_results
field is only populated during an in-progress typeck.
Get an instance by calling InferCtxt::err_ctxt or FnCtxt::err_ctxt.
You must only create this if you intend to actually emit an error (or perhaps a warning, though preferably not.) It provides a lot of utility methods which should not be used during the happy path.
Fields§
§infcx: &'a InferCtxt<'tcx>§typeck_results: Option<Ref<'a, TypeckResults<'tcx>>>§fallback_has_occurred: bool§normalize_fn_sig: Box<dyn Fn(Binder<'tcx, FnSig<'tcx>>) -> Binder<'tcx, FnSig<'tcx>> + 'a>§autoderef_steps: Box<dyn Fn(Ty<'tcx>) -> Vec<(Ty<'tcx>, Vec<Obligation<'tcx, Predicate<'tcx>>>)> + 'a>Trait Implementations§
source§impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx>
impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx>
source§fn get_parent_trait_ref(
&self,
code: &ObligationCauseCode<'tcx>
) -> Option<(Ty<'tcx>, Option<Span>)>
fn get_parent_trait_ref( &self, code: &ObligationCauseCode<'tcx> ) -> Option<(Ty<'tcx>, Option<Span>)>
Gets the parent trait chain start
source§fn note_version_mismatch(
&self,
err: &mut Diagnostic,
trait_ref: &PolyTraitRef<'tcx>
) -> bool
fn note_version_mismatch( &self, err: &mut Diagnostic, trait_ref: &PolyTraitRef<'tcx> ) -> bool
If the Self type of the unsatisfied trait trait_ref implements a trait
with the same path as trait_ref, a help message about
a probable version mismatch is added to err
source§fn predicate_can_apply(
&self,
param_env: ParamEnv<'tcx>,
pred: PolyTraitPredicate<'tcx>
) -> bool
fn predicate_can_apply( &self, param_env: ParamEnv<'tcx>, pred: PolyTraitPredicate<'tcx> ) -> bool
Returns true if the trait predicate may apply for some assignment
to the type parameters.
fn error_implies(&self, cond: Predicate<'tcx>, error: Predicate<'tcx>) -> bool
fn report_fulfillment_error( &self, error: &FulfillmentError<'tcx> ) -> ErrorGuaranteed
fn report_projection_error( &self, obligation: &PredicateObligation<'tcx>, error: &MismatchedProjectionTypes<'tcx> ) -> ErrorGuaranteed
fn maybe_detailed_projection_msg( &self, pred: ProjectionPredicate<'tcx>, normalized_ty: Term<'tcx>, expected_ty: Term<'tcx> ) -> Option<String>
fn fuzzy_match_tys( &self, a: Ty<'tcx>, b: Ty<'tcx>, ignoring_lifetimes: bool ) -> Option<CandidateSimilarity>
fn describe_closure(&self, kind: ClosureKind) -> &'static str
fn find_similar_impl_candidates( &self, trait_pred: PolyTraitPredicate<'tcx> ) -> Vec<ImplCandidate<'tcx>>
fn report_similar_impl_candidates( &self, impl_candidates: &[ImplCandidate<'tcx>], trait_ref: PolyTraitRef<'tcx>, body_def_id: LocalDefId, err: &mut Diagnostic, other: bool, param_env: ParamEnv<'tcx> ) -> bool
fn report_similar_impl_candidates_for_root_obligation( &self, obligation: &PredicateObligation<'tcx>, trait_predicate: Binder<'tcx, TraitPredicate<'tcx>>, body_def_id: LocalDefId, err: &mut Diagnostic )
source§fn mk_trait_obligation_with_new_self_ty(
&self,
param_env: ParamEnv<'tcx>,
trait_ref_and_ty: Binder<'tcx, (TraitPredicate<'tcx>, Ty<'tcx>)>
) -> PredicateObligation<'tcx>
fn mk_trait_obligation_with_new_self_ty( &self, param_env: ParamEnv<'tcx>, trait_ref_and_ty: Binder<'tcx, (TraitPredicate<'tcx>, Ty<'tcx>)> ) -> PredicateObligation<'tcx>
PredicateObligation with new_self_ty replacing the existing type in the
trait_ref. Read morefn maybe_report_ambiguity( &self, obligation: &PredicateObligation<'tcx> ) -> ErrorGuaranteed
fn annotate_source_of_ambiguity( &self, err: &mut Diagnostic, ambiguities: &[Ambiguity], predicate: Predicate<'tcx> )
fn note_obligation_cause( &self, err: &mut Diagnostic, obligation: &PredicateObligation<'tcx> )
fn suggest_unsized_bound_if_applicable( &self, err: &mut Diagnostic, obligation: &PredicateObligation<'tcx> )
fn maybe_suggest_unsized_generics( &self, err: &mut Diagnostic, span: Span, node: Node<'tcx> )
fn maybe_indirection_for_unsized( &self, err: &mut Diagnostic, item: &Item<'tcx>, param: &GenericParam<'tcx> ) -> bool
fn is_recursive_obligation( &self, obligated_types: &mut Vec<Ty<'tcx>>, cause_code: &ObligationCauseCode<'tcx> ) -> bool
fn get_standard_error_message( &self, trait_predicate: &PolyTraitPredicate<'tcx>, message: Option<String>, predicate_is_const: bool, append_const_msg: Option<AppendConstMessage>, post_message: String ) -> String
fn get_safe_transmute_error_and_reason( &self, obligation: PredicateObligation<'tcx>, trait_ref: PolyTraitRef<'tcx>, span: Span ) -> GetSafeTransmuteErrorAndReason
fn add_tuple_trait_message( &self, obligation_cause_code: &ObligationCauseCode<'tcx>, err: &mut Diagnostic )
fn try_to_add_help_message( &self, obligation: &PredicateObligation<'tcx>, trait_ref: PolyTraitRef<'tcx>, trait_predicate: &PolyTraitPredicate<'tcx>, err: &mut Diagnostic, span: Span, is_fn_trait: bool, suggested: bool, unsatisfied_const: bool )
fn add_help_message_for_fn_trait( &self, trait_ref: PolyTraitRef<'tcx>, err: &mut Diagnostic, implemented_kind: ClosureKind, params: Binder<'tcx, Ty<'tcx>> )
fn maybe_add_note_for_unsatisfied_const( &self, _trait_predicate: &PolyTraitPredicate<'tcx>, _err: &mut Diagnostic, _span: Span ) -> UnsatisfiedConst
fn report_closure_error( &self, obligation: &PredicateObligation<'tcx>, closure_def_id: DefId, found_kind: ClosureKind, kind: ClosureKind ) -> DiagnosticBuilder<'tcx>
fn report_cyclic_signature_error( &self, obligation: &PredicateObligation<'tcx>, found_trait_ref: Binder<'tcx, TraitRef<'tcx>>, expected_trait_ref: Binder<'tcx, TraitRef<'tcx>>, terr: TypeError<'tcx> ) -> DiagnosticBuilder<'tcx>
fn report_opaque_type_auto_trait_leakage( &self, obligation: &PredicateObligation<'tcx>, def_id: DefId ) -> DiagnosticBuilder<'tcx>
fn report_signature_mismatch_error( &self, obligation: &PredicateObligation<'tcx>, span: Span, found_trait_ref: Binder<'tcx, TraitRef<'tcx>>, expected_trait_ref: Binder<'tcx, TraitRef<'tcx>> ) -> Result<DiagnosticBuilder<'tcx>, ErrorGuaranteed>
fn report_not_const_evaluatable_error( &self, obligation: &PredicateObligation<'tcx>, span: Span ) -> Result<DiagnosticBuilder<'tcx>, ErrorGuaranteed>
source§impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx>
impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx>
source§fn report_overflow_error<T>(
&self,
predicate: &T,
span: Span,
suggest_increasing_limit: bool,
mutate: impl FnOnce(&mut Diagnostic)
) -> !
fn report_overflow_error<T>( &self, predicate: &T, span: Span, suggest_increasing_limit: bool, mutate: impl FnOnce(&mut Diagnostic) ) -> !
Reports that an overflow has occurred and halts compilation. We halt compilation unconditionally because it is important that overflows never be masked – they basically represent computations whose result could not be truly determined and thus we can’t say if the program type checks or not – and they are unusual occurrences in any case.
source§fn report_overflow_obligation<T>(
&self,
obligation: &Obligation<'tcx, T>,
suggest_increasing_limit: bool
) -> !where
T: ToPredicate<'tcx> + Clone,
fn report_overflow_obligation<T>(
&self,
obligation: &Obligation<'tcx, T>,
suggest_increasing_limit: bool
) -> !where
T: ToPredicate<'tcx> + Clone,
Reports that an overflow has occurred and halts compilation. We halt compilation unconditionally because it is important that overflows never be masked – they basically represent computations whose result could not be truly determined and thus we can’t say if the program type checks or not – and they are unusual occurrences in any case.
source§fn report_overflow_obligation_cycle(
&self,
cycle: &[PredicateObligation<'tcx>]
) -> !
fn report_overflow_obligation_cycle( &self, cycle: &[PredicateObligation<'tcx>] ) -> !
Reports that a cycle was detected which led to overflow and halts
compilation. This is equivalent to report_overflow_obligation except
that we can give a more helpful error message (and, in particular,
we do not suggest increasing the overflow limit, which is not
going to help).
source§fn try_conversion_context(
&self,
obligation: &PredicateObligation<'tcx>,
trait_ref: TraitRef<'tcx>,
err: &mut Diagnostic
) -> bool
fn try_conversion_context( &self, obligation: &PredicateObligation<'tcx>, trait_ref: TraitRef<'tcx>, err: &mut Diagnostic ) -> bool
When the E of the resulting Result<T, E> in an expression foo().bar().baz()?,
identify thoe method chain sub-expressions that could or could not have been annotated
with ?.
fn report_fulfillment_errors( &self, errors: Vec<FulfillmentError<'tcx>> ) -> ErrorGuaranteed
fn build_overflow_error<T>( &self, predicate: &T, span: Span, suggest_increasing_limit: bool ) -> DiagnosticBuilder<'tcx>
fn suggest_new_overflow_limit(&self, err: &mut Diagnostic)
fn report_overflow_no_abort( &self, obligation: PredicateObligation<'tcx> ) -> ErrorGuaranteed
source§fn report_selection_error(
&self,
obligation: PredicateObligation<'tcx>,
root_obligation: &PredicateObligation<'tcx>,
error: &SelectionError<'tcx>
) -> ErrorGuaranteed
fn report_selection_error( &self, obligation: PredicateObligation<'tcx>, root_obligation: &PredicateObligation<'tcx>, error: &SelectionError<'tcx> ) -> ErrorGuaranteed
root_obligation parameter should be the root_obligation field
from a FulfillmentError. If no FulfillmentError is available,
then it should be the same as obligation.fn emit_specialized_closure_kind_error( &self, obligation: &PredicateObligation<'tcx>, trait_ref: PolyTraitRef<'tcx> ) -> Option<ErrorGuaranteed>
fn fn_arg_obligation( &self, obligation: &PredicateObligation<'tcx> ) -> Result<(), ErrorGuaranteed>
fn report_const_param_not_wf( &self, ty: Ty<'tcx>, obligation: &PredicateObligation<'tcx> ) -> DiagnosticBuilder<'tcx>
source§impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx>
impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx>
source§fn suggest_dereferences(
&self,
obligation: &PredicateObligation<'tcx>,
err: &mut Diagnostic,
trait_pred: PolyTraitPredicate<'tcx>
) -> bool
fn suggest_dereferences( &self, obligation: &PredicateObligation<'tcx>, err: &mut Diagnostic, trait_pred: PolyTraitPredicate<'tcx> ) -> bool
When after several dereferencing, the reference satisfies the trait binding. This function provides dereference suggestion for this specific situation.
source§fn get_closure_name(
&self,
def_id: DefId,
err: &mut Diagnostic,
msg: Cow<'static, str>
) -> Option<Symbol>
fn get_closure_name( &self, def_id: DefId, err: &mut Diagnostic, msg: Cow<'static, str> ) -> Option<Symbol>
Given a closure’s DefId, return the given name of the closure.
This doesn’t account for reassignments, but it’s only used for suggestions.
source§fn suggest_fn_call(
&self,
obligation: &PredicateObligation<'tcx>,
err: &mut Diagnostic,
trait_pred: PolyTraitPredicate<'tcx>
) -> bool
fn suggest_fn_call( &self, obligation: &PredicateObligation<'tcx>, err: &mut Diagnostic, trait_pred: PolyTraitPredicate<'tcx> ) -> bool
We tried to apply the bound to an fn or closure. Check whether calling it would
evaluate to a type that would satisfy the trait binding. If it would, suggest calling
it: bar(foo) → bar(foo()). This case is very likely to be hit if foo is async.
source§fn extract_callable_info(
&self,
body_id: LocalDefId,
param_env: ParamEnv<'tcx>,
found: Ty<'tcx>
) -> Option<(DefIdOrName, Ty<'tcx>, Vec<Ty<'tcx>>)>
fn extract_callable_info( &self, body_id: LocalDefId, param_env: ParamEnv<'tcx>, found: Ty<'tcx> ) -> Option<(DefIdOrName, Ty<'tcx>, Vec<Ty<'tcx>>)>
Extracts information about a callable type for diagnostics. This is a heuristic – it doesn’t necessarily mean that a type is always callable, because the callable type must also be well-formed to be called.
source§fn suggest_remove_reference(
&self,
obligation: &PredicateObligation<'tcx>,
err: &mut Diagnostic,
trait_pred: PolyTraitPredicate<'tcx>
) -> bool
fn suggest_remove_reference( &self, obligation: &PredicateObligation<'tcx>, err: &mut Diagnostic, trait_pred: PolyTraitPredicate<'tcx> ) -> bool
Whenever references are used by mistake, like for (i, e) in &vec.iter().enumerate(),
suggest removing these references until we reach a type that implements the trait.
source§fn suggest_change_mut(
&self,
obligation: &PredicateObligation<'tcx>,
err: &mut Diagnostic,
trait_pred: PolyTraitPredicate<'tcx>
)
fn suggest_change_mut( &self, obligation: &PredicateObligation<'tcx>, err: &mut Diagnostic, trait_pred: PolyTraitPredicate<'tcx> )
Check if the trait bound is implemented for a different mutability and note it in the final error.
source§fn suggest_impl_trait(
&self,
err: &mut Diagnostic,
obligation: &PredicateObligation<'tcx>,
trait_pred: PolyTraitPredicate<'tcx>
) -> bool
fn suggest_impl_trait( &self, err: &mut Diagnostic, obligation: &PredicateObligation<'tcx>, trait_pred: PolyTraitPredicate<'tcx> ) -> bool
If all conditions are met to identify a returned dyn Trait, suggest using impl Trait if
applicable and signal that the error has been expanded appropriately and needs to be
emitted.
source§fn maybe_note_obligation_cause_for_async_await(
&self,
err: &mut Diagnostic,
obligation: &PredicateObligation<'tcx>
) -> bool
fn maybe_note_obligation_cause_for_async_await( &self, err: &mut Diagnostic, obligation: &PredicateObligation<'tcx> ) -> bool
Adds an async-await specific note to the diagnostic when the future does not implement an auto trait because of a captured type.
note: future does not implement `Qux` as this value is used across an await
--> $DIR/issue-64130-3-other.rs:17:5
|
LL | let x = Foo;
| - has type `Foo`
LL | baz().await;
| ^^^^^^^^^^^ await occurs here, with `x` maybe used later
LL | }
| - `x` is later dropped here
When the diagnostic does not implement Send or Sync specifically, then the diagnostic
is “replaced” with a different message and a more specific error.
error: future cannot be sent between threads safely
--> $DIR/issue-64130-2-send.rs:21:5
|
LL | fn is_send<T: Send>(t: T) { }
| ---- required by this bound in `is_send`
...
LL | is_send(bar());
| ^^^^^^^ future returned by `bar` is not send
|
= help: within `impl std::future::Future`, the trait `std::marker::Send` is not
implemented for `Foo`
note: future is not send as this value is used across an await
--> $DIR/issue-64130-2-send.rs:15:5
|
LL | let x = Foo;
| - has type `Foo`
LL | baz().await;
| ^^^^^^^^^^^ await occurs here, with `x` maybe used later
LL | }
| - `x` is later dropped here
Returns true if an async-await specific note was added to the diagnostic.
source§fn note_obligation_cause_for_async_await(
&self,
err: &mut Diagnostic,
interior_or_upvar_span: CoroutineInteriorOrUpvar,
is_async: bool,
outer_coroutine: Option<DefId>,
trait_pred: TraitPredicate<'tcx>,
target_ty: Ty<'tcx>,
obligation: &PredicateObligation<'tcx>,
next_code: Option<&ObligationCauseCode<'tcx>>
)
fn note_obligation_cause_for_async_await( &self, err: &mut Diagnostic, interior_or_upvar_span: CoroutineInteriorOrUpvar, is_async: bool, outer_coroutine: Option<DefId>, trait_pred: TraitPredicate<'tcx>, target_ty: Ty<'tcx>, obligation: &PredicateObligation<'tcx>, next_code: Option<&ObligationCauseCode<'tcx>> )
Unconditionally adds the diagnostic note described in
maybe_note_obligation_cause_for_async_await’s documentation comment.
source§fn suggest_convert_to_slice(
&self,
err: &mut Diagnostic,
obligation: &PredicateObligation<'tcx>,
trait_ref: PolyTraitRef<'tcx>,
candidate_impls: &[ImplCandidate<'tcx>],
span: Span
)
fn suggest_convert_to_slice( &self, err: &mut Diagnostic, obligation: &PredicateObligation<'tcx>, trait_ref: PolyTraitRef<'tcx>, candidate_impls: &[ImplCandidate<'tcx>], span: Span )
If the type that failed selection is an array or a reference to an array, but the trait is implemented for slices, suggest that the user converts the array into a slice.
fn suggest_restricting_param_bound( &self, err: &mut Diagnostic, trait_pred: PolyTraitPredicate<'tcx>, associated_ty: Option<(&'static str, Ty<'tcx>)>, body_id: LocalDefId )
fn check_for_binding_assigned_block_without_tail_expression( &self, obligation: &PredicateObligation<'tcx>, err: &mut Diagnostic, trait_pred: PolyTraitPredicate<'tcx> )
fn suggest_add_clone_to_arg( &self, obligation: &PredicateObligation<'tcx>, err: &mut Diagnostic, trait_pred: PolyTraitPredicate<'tcx> ) -> bool
fn suggest_add_reference_to_arg( &self, obligation: &PredicateObligation<'tcx>, err: &mut Diagnostic, poly_trait_pred: PolyTraitPredicate<'tcx>, has_custom_message: bool ) -> bool
fn suggest_borrowing_for_object_cast( &self, err: &mut Diagnostic, obligation: &PredicateObligation<'tcx>, self_ty: Ty<'tcx>, target_ty: Ty<'tcx> )
fn suggest_remove_await( &self, obligation: &PredicateObligation<'tcx>, err: &mut Diagnostic )
fn suggest_semicolon_removal( &self, obligation: &PredicateObligation<'tcx>, err: &mut Diagnostic, span: Span, trait_pred: PolyTraitPredicate<'tcx> ) -> bool
fn return_type_span( &self, obligation: &PredicateObligation<'tcx> ) -> Option<Span>
fn point_at_returns_when_relevant( &self, err: &mut DiagnosticBuilder<'tcx>, obligation: &PredicateObligation<'tcx> )
fn report_closure_arg_mismatch( &self, span: Span, found_span: Option<Span>, found: PolyTraitRef<'tcx>, expected: PolyTraitRef<'tcx>, cause: &ObligationCauseCode<'tcx>, found_node: Option<Node<'_>>, param_env: ParamEnv<'tcx> ) -> DiagnosticBuilder<'tcx>
fn note_conflicting_fn_args( &self, err: &mut Diagnostic, cause: &ObligationCauseCode<'tcx>, expected: Ty<'tcx>, found: Ty<'tcx>, param_env: ParamEnv<'tcx> )
fn note_conflicting_closure_bounds( &self, cause: &ObligationCauseCode<'tcx>, err: &mut DiagnosticBuilder<'tcx> )
fn suggest_fully_qualified_path( &self, err: &mut Diagnostic, item_def_id: DefId, span: Span, trait_ref: DefId )
fn note_obligation_cause_code<T>(
&self,
body_id: LocalDefId,
err: &mut Diagnostic,
predicate: T,
param_env: ParamEnv<'tcx>,
cause_code: &ObligationCauseCode<'tcx>,
obligated_types: &mut Vec<Ty<'tcx>>,
seen_requirements: &mut FxHashSet<DefId>
)where
T: ToPredicate<'tcx>,
source§fn suggest_await_before_try(
&self,
err: &mut Diagnostic,
obligation: &PredicateObligation<'tcx>,
trait_pred: PolyTraitPredicate<'tcx>,
span: Span
)
fn suggest_await_before_try( &self, err: &mut Diagnostic, obligation: &PredicateObligation<'tcx>, trait_pred: PolyTraitPredicate<'tcx>, span: Span )
fn suggest_floating_point_literal( &self, obligation: &PredicateObligation<'tcx>, err: &mut Diagnostic, trait_ref: &PolyTraitRef<'tcx> )
fn suggest_derive( &self, obligation: &PredicateObligation<'tcx>, err: &mut Diagnostic, trait_pred: PolyTraitPredicate<'tcx> )
fn suggest_dereferencing_index( &self, obligation: &PredicateObligation<'tcx>, err: &mut Diagnostic, trait_pred: PolyTraitPredicate<'tcx> )
fn note_function_argument_obligation( &self, body_id: LocalDefId, err: &mut Diagnostic, arg_hir_id: HirId, parent_code: &ObligationCauseCode<'tcx>, param_env: ParamEnv<'tcx>, failed_pred: Predicate<'tcx>, call_hir_id: HirId )
fn suggest_option_method_if_applicable( &self, failed_pred: Predicate<'tcx>, param_env: ParamEnv<'tcx>, err: &mut Diagnostic, expr: &Expr<'_> )
fn look_for_iterator_item_mistakes( &self, assocs_in_this_method: &[Option<(Span, (DefId, Ty<'tcx>))>], typeck_results: &TypeckResults<'tcx>, type_diffs: &[TypeError<'tcx>], param_env: ParamEnv<'tcx>, path_segment: &PathSegment<'_>, args: &[Expr<'_>], err: &mut Diagnostic )
fn point_at_chain( &self, expr: &Expr<'_>, typeck_results: &TypeckResults<'tcx>, type_diffs: Vec<TypeError<'tcx>>, param_env: ParamEnv<'tcx>, err: &mut Diagnostic )
fn probe_assoc_types_at_expr( &self, type_diffs: &[TypeError<'tcx>], span: Span, prev_ty: Ty<'tcx>, body_id: HirId, param_env: ParamEnv<'tcx> ) -> Vec<Option<(Span, (DefId, Ty<'tcx>))>>
fn explain_hrtb_projection( &self, diag: &mut Diagnostic, pred: PolyTraitPredicate<'tcx>, param_env: ParamEnv<'tcx>, cause: &ObligationCause<'tcx> )
fn suggest_desugaring_async_fn_in_trait( &self, err: &mut Diagnostic, trait_ref: PolyTraitRef<'tcx> )
source§impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx>
impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx>
source§fn describe_enclosure(&self, def_id: LocalDefId) -> Option<&'static str>
fn describe_enclosure(&self, def_id: LocalDefId) -> Option<&'static str>
Used to set on_unimplemented’s ItemContext
to be the enclosing (async) block/function/closure
fn impl_similar_to( &self, trait_ref: PolyTraitRef<'tcx>, obligation: &PredicateObligation<'tcx> ) -> Option<(DefId, GenericArgsRef<'tcx>)>
fn on_unimplemented_note( &self, trait_ref: PolyTraitRef<'tcx>, obligation: &PredicateObligation<'tcx> ) -> OnUnimplementedNote
Auto Trait Implementations§
impl<'a, 'tcx> !RefUnwindSafe for TypeErrCtxt<'a, 'tcx>
impl<'a, 'tcx> !Send for TypeErrCtxt<'a, 'tcx>
impl<'a, 'tcx> !Sync for TypeErrCtxt<'a, 'tcx>
impl<'a, 'tcx> Unpin for TypeErrCtxt<'a, 'tcx>
impl<'a, 'tcx> !UnwindSafe for TypeErrCtxt<'a, 'tcx>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 64 bytes