pub(super) trait InferCtxtPrivExt<'a, 'tcx> {
Show 27 methods
// Required methods
fn can_match_trait(
&self,
goal: TraitPredicate<'tcx>,
assumption: PolyTraitPredicate<'tcx>,
) -> bool;
fn can_match_projection(
&self,
goal: ProjectionPredicate<'tcx>,
assumption: PolyProjectionPredicate<'tcx>,
) -> bool;
fn error_implies(
&self,
cond: Predicate<'tcx>,
error: Predicate<'tcx>,
) -> bool;
fn report_projection_error(
&self,
obligation: &PredicateObligation<'tcx>,
error: &MismatchedProjectionTypes<'tcx>,
) -> ErrorGuaranteed;
fn maybe_detailed_projection_msg(
&self,
projection_term: AliasTerm<'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 Diag<'_>,
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 Diag<'_>,
);
fn get_parent_trait_ref(
&self,
code: &ObligationCauseCode<'tcx>,
) -> Option<(Ty<'tcx>, Option<Span>)>;
fn note_version_mismatch(
&self,
err: &mut Diag<'_>,
trait_ref: PolyTraitRef<'tcx>,
) -> bool;
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 predicate_can_apply(
&self,
param_env: ParamEnv<'tcx>,
pred: PolyTraitPredicate<'tcx>,
) -> bool;
fn note_obligation_cause(
&self,
err: &mut Diag<'_>,
obligation: &PredicateObligation<'tcx>,
);
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 Diag<'_>,
);
fn try_to_add_help_message(
&self,
obligation: &PredicateObligation<'tcx>,
trait_predicate: PolyTraitPredicate<'tcx>,
err: &mut Diag<'_>,
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 Diag<'_>,
implemented_kind: ClosureKind,
params: Binder<'tcx, Ty<'tcx>>,
);
fn maybe_add_note_for_unsatisfied_const(
&self,
_trait_predicate: PolyTraitPredicate<'tcx>,
_err: &mut Diag<'_>,
_span: Span,
) -> UnsatisfiedConst;
fn report_closure_error(
&self,
obligation: &PredicateObligation<'tcx>,
closure_def_id: DefId,
found_kind: ClosureKind,
kind: ClosureKind,
trait_prefix: &'static str,
) -> Diag<'a>;
fn report_cyclic_signature_error(
&self,
obligation: &PredicateObligation<'tcx>,
found_trait_ref: TraitRef<'tcx>,
expected_trait_ref: TraitRef<'tcx>,
terr: TypeError<'tcx>,
) -> Diag<'a>;
fn report_opaque_type_auto_trait_leakage(
&self,
obligation: &PredicateObligation<'tcx>,
def_id: DefId,
) -> ErrorGuaranteed;
fn report_signature_mismatch_error(
&self,
obligation: &PredicateObligation<'tcx>,
span: Span,
found_trait_ref: TraitRef<'tcx>,
expected_trait_ref: TraitRef<'tcx>,
) -> Result<Diag<'a>, ErrorGuaranteed>;
fn report_not_const_evaluatable_error(
&self,
obligation: &PredicateObligation<'tcx>,
span: Span,
) -> Result<Diag<'a>, ErrorGuaranteed>;
}
Required Methods§
fn can_match_trait( &self, goal: TraitPredicate<'tcx>, assumption: PolyTraitPredicate<'tcx>, ) -> bool
fn can_match_projection( &self, goal: ProjectionPredicate<'tcx>, assumption: PolyProjectionPredicate<'tcx>, ) -> bool
fn error_implies(&self, cond: Predicate<'tcx>, error: Predicate<'tcx>) -> bool
fn report_projection_error( &self, obligation: &PredicateObligation<'tcx>, error: &MismatchedProjectionTypes<'tcx>, ) -> ErrorGuaranteed
fn maybe_detailed_projection_msg( &self, projection_term: AliasTerm<'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 Diag<'_>, 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 Diag<'_>, )
sourcefn 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
sourcefn note_version_mismatch(
&self,
err: &mut Diag<'_>,
trait_ref: PolyTraitRef<'tcx>,
) -> bool
fn note_version_mismatch( &self, err: &mut Diag<'_>, 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
sourcefn 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>
Creates a PredicateObligation
with new_self_ty
replacing the existing type in the
trait_ref
.
For this to work, new_self_ty
must have no escaping bound variables.
sourcefn 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 note_obligation_cause( &self, err: &mut Diag<'_>, obligation: &PredicateObligation<'tcx>, )
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 Diag<'_>, )
fn try_to_add_help_message( &self, obligation: &PredicateObligation<'tcx>, trait_predicate: PolyTraitPredicate<'tcx>, err: &mut Diag<'_>, 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 Diag<'_>, implemented_kind: ClosureKind, params: Binder<'tcx, Ty<'tcx>>, )
fn maybe_add_note_for_unsatisfied_const( &self, _trait_predicate: PolyTraitPredicate<'tcx>, _err: &mut Diag<'_>, _span: Span, ) -> UnsatisfiedConst
fn report_closure_error( &self, obligation: &PredicateObligation<'tcx>, closure_def_id: DefId, found_kind: ClosureKind, kind: ClosureKind, trait_prefix: &'static str, ) -> Diag<'a>
fn report_cyclic_signature_error( &self, obligation: &PredicateObligation<'tcx>, found_trait_ref: TraitRef<'tcx>, expected_trait_ref: TraitRef<'tcx>, terr: TypeError<'tcx>, ) -> Diag<'a>
fn report_opaque_type_auto_trait_leakage( &self, obligation: &PredicateObligation<'tcx>, def_id: DefId, ) -> ErrorGuaranteed
fn report_signature_mismatch_error( &self, obligation: &PredicateObligation<'tcx>, span: Span, found_trait_ref: TraitRef<'tcx>, expected_trait_ref: TraitRef<'tcx>, ) -> Result<Diag<'a>, ErrorGuaranteed>
fn report_not_const_evaluatable_error( &self, obligation: &PredicateObligation<'tcx>, span: Span, ) -> Result<Diag<'a>, ErrorGuaranteed>
Implementations on Foreign Types§
source§impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for TypeErrCtxt<'a, 'tcx>
impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for TypeErrCtxt<'a, '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 Diag<'_>,
trait_ref: PolyTraitRef<'tcx>,
) -> bool
fn note_version_mismatch( &self, err: &mut Diag<'_>, 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 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>
Creates a PredicateObligation
with new_self_ty
replacing the existing type in the
trait_ref
.
For this to work, new_self_ty
must have no escaping bound variables.
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.