pub trait TypeErrCtxtExt<'tcx> {
Show 35 methods
// Required methods
fn suggest_restricting_param_bound(
&self,
err: &mut Diagnostic,
trait_pred: PolyTraitPredicate<'tcx>,
associated_item: Option<(&'static str, Ty<'tcx>)>,
body_id: LocalDefId
);
fn suggest_dereferences(
&self,
obligation: &PredicateObligation<'tcx>,
err: &mut Diagnostic,
trait_pred: PolyTraitPredicate<'tcx>
) -> bool;
fn get_closure_name(
&self,
def_id: DefId,
err: &mut Diagnostic,
msg: Cow<'static, str>
) -> Option<Symbol>;
fn suggest_fn_call(
&self,
obligation: &PredicateObligation<'tcx>,
err: &mut Diagnostic,
trait_pred: PolyTraitPredicate<'tcx>
) -> bool;
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 extract_callable_info(
&self,
body_id: LocalDefId,
param_env: ParamEnv<'tcx>,
found: Ty<'tcx>
) -> Option<(DefIdOrName, Ty<'tcx>, Vec<Ty<'tcx>>)>;
fn suggest_add_reference_to_arg(
&self,
obligation: &PredicateObligation<'tcx>,
err: &mut Diagnostic,
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>,
object_ty: Ty<'tcx>
);
fn suggest_remove_reference(
&self,
obligation: &PredicateObligation<'tcx>,
err: &mut Diagnostic,
trait_pred: PolyTraitPredicate<'tcx>
) -> bool;
fn suggest_remove_await(
&self,
obligation: &PredicateObligation<'tcx>,
err: &mut Diagnostic
);
fn suggest_change_mut(
&self,
obligation: &PredicateObligation<'tcx>,
err: &mut Diagnostic,
trait_pred: PolyTraitPredicate<'tcx>
);
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 suggest_impl_trait(
&self,
err: &mut Diagnostic,
obligation: &PredicateObligation<'tcx>,
trait_pred: PolyTraitPredicate<'tcx>
) -> bool;
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 maybe_note_obligation_cause_for_async_await(
&self,
err: &mut Diagnostic,
obligation: &PredicateObligation<'tcx>
) -> bool;
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_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>;
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 suggest_option_method_if_applicable(
&self,
failed_pred: Predicate<'tcx>,
param_env: ParamEnv<'tcx>,
err: &mut Diagnostic,
expr: &Expr<'_>
);
fn note_function_argument_obligation(
&self,
body_id: LocalDefId,
err: &mut Diagnostic,
arg_hir_id: HirId,
parent_code: &ObligationCauseCode<'tcx>,
param_env: ParamEnv<'tcx>,
predicate: Predicate<'tcx>,
call_hir_id: HirId
);
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 suggest_convert_to_slice(
&self,
err: &mut Diagnostic,
obligation: &PredicateObligation<'tcx>,
trait_ref: PolyTraitRef<'tcx>,
candidate_impls: &[ImplCandidate<'tcx>],
span: Span
);
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>
);
}Required Methods§
fn suggest_restricting_param_bound( &self, err: &mut Diagnostic, trait_pred: PolyTraitPredicate<'tcx>, associated_item: Option<(&'static str, Ty<'tcx>)>, body_id: LocalDefId )
fn suggest_dereferences( &self, obligation: &PredicateObligation<'tcx>, err: &mut Diagnostic, trait_pred: PolyTraitPredicate<'tcx> ) -> bool
fn get_closure_name( &self, def_id: DefId, err: &mut Diagnostic, msg: Cow<'static, str> ) -> Option<Symbol>
fn suggest_fn_call( &self, obligation: &PredicateObligation<'tcx>, err: &mut Diagnostic, trait_pred: PolyTraitPredicate<'tcx> ) -> bool
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 extract_callable_info( &self, body_id: LocalDefId, param_env: ParamEnv<'tcx>, found: Ty<'tcx> ) -> Option<(DefIdOrName, Ty<'tcx>, Vec<Ty<'tcx>>)>
fn suggest_add_reference_to_arg( &self, obligation: &PredicateObligation<'tcx>, err: &mut Diagnostic, 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>, object_ty: Ty<'tcx> )
fn suggest_remove_reference( &self, obligation: &PredicateObligation<'tcx>, err: &mut Diagnostic, trait_pred: PolyTraitPredicate<'tcx> ) -> bool
fn suggest_remove_await( &self, obligation: &PredicateObligation<'tcx>, err: &mut Diagnostic )
fn suggest_change_mut( &self, obligation: &PredicateObligation<'tcx>, err: &mut Diagnostic, trait_pred: PolyTraitPredicate<'tcx> )
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 suggest_impl_trait( &self, err: &mut Diagnostic, obligation: &PredicateObligation<'tcx>, trait_pred: PolyTraitPredicate<'tcx> ) -> bool
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 maybe_note_obligation_cause_for_async_await( &self, err: &mut Diagnostic, obligation: &PredicateObligation<'tcx> ) -> bool
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_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>,
sourcefn 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 )
Suggest to await before try: future? => future.await?
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 suggest_option_method_if_applicable( &self, failed_pred: Predicate<'tcx>, param_env: ParamEnv<'tcx>, err: &mut Diagnostic, expr: &Expr<'_> )
fn note_function_argument_obligation( &self, body_id: LocalDefId, err: &mut Diagnostic, arg_hir_id: HirId, parent_code: &ObligationCauseCode<'tcx>, param_env: ParamEnv<'tcx>, predicate: Predicate<'tcx>, call_hir_id: HirId )
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 suggest_convert_to_slice( &self, err: &mut Diagnostic, obligation: &PredicateObligation<'tcx>, trait_ref: PolyTraitRef<'tcx>, candidate_impls: &[ImplCandidate<'tcx>], span: Span )
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> )
Object Safety§
This trait is not object safe.