Skip to main content

rustc_next_trait_solver/solve/
mod.rs

1//! The next-generation trait solver, currently still WIP.
2//!
3//! As a user of rust, you can use `-Znext-solver` to enable the new trait solver.
4//!
5//! As a developer of rustc, you shouldn't be using the new trait
6//! solver without asking the trait-system-refactor-initiative, but it can
7//! be enabled with `InferCtxtBuilder::with_next_trait_solver`. This will
8//! ensure that trait solving using that inference context will be routed
9//! to the new trait solver.
10//!
11//! For a high-level overview of how this solver works, check out the relevant
12//! section of the rustc-dev-guide.
13
14mod assembly;
15mod effect_goals;
16mod eval_ctxt;
17pub mod inspect;
18mod normalizes_to;
19mod project_goals;
20mod search_graph;
21mod trait_goals;
22
23use derive_where::derive_where;
24use rustc_type_ir::inherent::*;
25pub use rustc_type_ir::solve::*;
26use rustc_type_ir::{self as ty, Interner, Region, TypeVisitableExt};
27use tracing::instrument;
28
29pub use self::eval_ctxt::{
30    EvalCtxt, GenerateProofTree, SolverDelegateEvalExt,
31    evaluate_root_goal_for_proof_tree_raw_provider, fast_path,
32};
33use crate::delegate::SolverDelegate;
34use crate::solve::assembly::Candidate;
35
36/// How many fixpoint iterations we should attempt inside of the solver before bailing
37/// with overflow.
38///
39/// We previously used  `cx.recursion_limit().0.checked_ilog2().unwrap_or(0)` for this.
40/// However, it feels unlikely that uncreasing the recursion limit by a power of two
41/// to get one more iteration is ever useful or desirable. We now instead used a constant
42/// here. If there ever ends up some use-cases where a bigger number of fixpoint iterations
43/// is required, we can add a new attribute for that or revert this to be dependent on the
44/// recursion limit again. However, this feels very unlikely.
45const FIXPOINT_STEP_LIMIT: usize = 8;
46
47/// Whether evaluating this goal ended up changing the
48/// inference state.
49#[derive(#[automatically_derived]
impl ::core::marker::StructuralPartialEq for HasChanged { }
#[automatically_derived]
impl ::core::cmp::PartialEq for HasChanged {
    #[inline]
    fn eq(&self, other: &HasChanged) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for HasChanged { }Eq, #[automatically_derived]
impl ::core::fmt::Debug for HasChanged {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self { HasChanged::Yes => "Yes", HasChanged::No => "No", })
    }
}Debug, #[automatically_derived]
impl ::core::hash::Hash for HasChanged {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        ::core::hash::Hash::hash(&__self_discr, state)
    }
}Hash, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for HasChanged { }
#[automatically_derived]
impl ::core::clone::Clone for HasChanged {
    #[inline]
    fn clone(&self) -> HasChanged { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for HasChanged { }Copy)]
50pub enum HasChanged {
51    Yes,
52    No,
53}
54
55// FIXME(trait-system-refactor-initiative#117): we don't detect whether a response
56// ended up pulling down any universes.
57fn has_no_inference_or_external_constraints<I: Interner>(
58    response: ty::Canonical<I, Response<I>>,
59) -> bool {
60    let ExternalConstraintsData {
61        ref region_constraints,
62        ref opaque_types,
63        ref normalization_nested_goals,
64    } = *response.value.external_constraints;
65    response.value.var_values.is_identity()
66        && region_constraints.is_empty()
67        && opaque_types.is_empty()
68        && normalization_nested_goals.is_empty()
69}
70
71fn has_only_region_constraints<I: Interner>(response: ty::Canonical<I, Response<I>>) -> bool {
72    let ExternalConstraintsData {
73        region_constraints: _,
74        ref opaque_types,
75        ref normalization_nested_goals,
76    } = *response.value.external_constraints;
77    response.value.var_values.is_identity_modulo_regions()
78        && opaque_types.is_empty()
79        && normalization_nested_goals.is_empty()
80}
81
82impl<'a, D, I> EvalCtxt<'a, D>
83where
84    D: SolverDelegate<Interner = I>,
85    I: Interner,
86{
87    {}
#[allow(clippy :: suspicious_else_formatting)]
{
    let __tracing_attr_span;
    let __tracing_attr_guard;
    if ::tracing::Level::TRACE <= ::tracing::level_filters::STATIC_MAX_LEVEL
                &&
                ::tracing::Level::TRACE <=
                    ::tracing::level_filters::LevelFilter::current() ||
            { false } {
        __tracing_attr_span =
            {
                use ::tracing::__macro_support::Callsite as _;
                static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                    {
                        static META: ::tracing::Metadata<'static> =
                            {
                                ::tracing_core::metadata::Metadata::new("compute_type_outlives_goal",
                                    "rustc_next_trait_solver::solve", ::tracing::Level::TRACE,
                                    ::tracing_core::__macro_support::Option::Some("/rustc-dev/574ff7d98bd6d037e5236a8453029173b32631fd/compiler/rustc_next_trait_solver/src/solve/mod.rs"),
                                    ::tracing_core::__macro_support::Option::Some(87u32),
                                    ::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve"),
                                    ::tracing_core::field::FieldSet::new(&[{
                                                        const NAME:
                                                            ::tracing::__macro_support::FieldName<{
                                                                ::tracing::__macro_support::FieldName::len("goal")
                                                            }> =
                                                            ::tracing::__macro_support::FieldName::new("goal");
                                                        NAME.as_str()
                                                    }], ::tracing_core::callsite::Identifier(&__CALLSITE)),
                                    ::tracing::metadata::Kind::SPAN)
                            };
                        ::tracing::callsite::DefaultCallsite::new(&META)
                    };
                let mut interest = ::tracing::subscriber::Interest::never();
                if ::tracing::Level::TRACE <=
                                    ::tracing::level_filters::STATIC_MAX_LEVEL &&
                                ::tracing::Level::TRACE <=
                                    ::tracing::level_filters::LevelFilter::current() &&
                            { interest = __CALLSITE.interest(); !interest.is_never() }
                        &&
                        ::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
                            interest) {
                    let meta = __CALLSITE.metadata();
                    ::tracing::Span::new(meta,
                        &{
                                #[allow(unused_imports)]
                                use ::tracing::field::{debug, display, Value};
                                meta.fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&goal)
                                                            as &dyn ::tracing::field::Value))])
                            })
                } else {
                    let span =
                        ::tracing::__macro_support::__disabled_span(__CALLSITE.metadata());
                    {};
                    span
                }
            };
        __tracing_attr_guard = __tracing_attr_span.enter();
    }

    #[warn(clippy :: suspicious_else_formatting)]
    {

        #[allow(unknown_lints, unreachable_code, clippy ::
        diverging_sub_expression, clippy :: empty_loop, clippy ::
        let_unit_value, clippy :: let_with_type_underscore, clippy ::
        needless_return, clippy :: unreachable)]
        if false {
            let __tracing_attr_fake_return: QueryResultOrRerunNonErased<I> =
                loop {};
            return __tracing_attr_fake_return;
        }
        {
            let ty::OutlivesClause(ty, lt) = goal.predicate;
            let ty =
                self.normalize(GoalSource::Misc, goal.param_env,
                        ty::Unnormalized::new_wip(ty))?;
            if self.cx().assumptions_on_binders() {
                use rustc_type_ir::region_constraint::RegionConstraint;
                let constraint = self.destructure_type_outlives(ty, lt);
                self.register_solver_region_constraint(RegionConstraint::new_from_or(constraint));
            } else { self.register_ty_outlives(ty, lt); }
            if ty.has_non_region_infer() || ty.has_non_rigid_aliases() {
                self.evaluate_added_goals_and_make_canonical_response(Certainty::AMBIGUOUS)
            } else {
                self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
            }
        }
    }
}#[instrument(level = "trace", skip(self))]
88    fn compute_type_outlives_goal(
89        &mut self,
90        goal: Goal<I, ty::OutlivesClause<I, I::Ty>>,
91    ) -> QueryResultOrRerunNonErased<I> {
92        let ty::OutlivesClause(ty, lt) = goal.predicate;
93        let ty = self.normalize(GoalSource::Misc, goal.param_env, ty::Unnormalized::new_wip(ty))?;
94
95        if self.cx().assumptions_on_binders() {
96            use rustc_type_ir::region_constraint::RegionConstraint;
97
98            let constraint = self.destructure_type_outlives(ty, lt);
99            self.register_solver_region_constraint(RegionConstraint::new_from_or(constraint));
100        } else {
101            self.register_ty_outlives(ty, lt);
102        }
103
104        // The normalized type can still contain non-rigid higher ranked aliases if their
105        // normalization ends up with ambiguity. Or we have non-rigid aliases inside rigid ones.
106        // Infer vars may be resolved to types/consts containing non-rigid aliases later.
107        // Thus we should stall this goal to avoid registering non-rigid type outlives into
108        // the outer infcx.
109        if ty.has_non_region_infer() || ty.has_non_rigid_aliases() {
110            self.evaluate_added_goals_and_make_canonical_response(Certainty::AMBIGUOUS)
111        } else {
112            self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
113        }
114    }
115
116    {}
#[allow(clippy :: suspicious_else_formatting)]
{
    let __tracing_attr_span;
    let __tracing_attr_guard;
    if ::tracing::Level::TRACE <= ::tracing::level_filters::STATIC_MAX_LEVEL
                &&
                ::tracing::Level::TRACE <=
                    ::tracing::level_filters::LevelFilter::current() ||
            { false } {
        __tracing_attr_span =
            {
                use ::tracing::__macro_support::Callsite as _;
                static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                    {
                        static META: ::tracing::Metadata<'static> =
                            {
                                ::tracing_core::metadata::Metadata::new("compute_region_outlives_goal",
                                    "rustc_next_trait_solver::solve", ::tracing::Level::TRACE,
                                    ::tracing_core::__macro_support::Option::Some("/rustc-dev/574ff7d98bd6d037e5236a8453029173b32631fd/compiler/rustc_next_trait_solver/src/solve/mod.rs"),
                                    ::tracing_core::__macro_support::Option::Some(116u32),
                                    ::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve"),
                                    ::tracing_core::field::FieldSet::new(&[{
                                                        const NAME:
                                                            ::tracing::__macro_support::FieldName<{
                                                                ::tracing::__macro_support::FieldName::len("goal")
                                                            }> =
                                                            ::tracing::__macro_support::FieldName::new("goal");
                                                        NAME.as_str()
                                                    }], ::tracing_core::callsite::Identifier(&__CALLSITE)),
                                    ::tracing::metadata::Kind::SPAN)
                            };
                        ::tracing::callsite::DefaultCallsite::new(&META)
                    };
                let mut interest = ::tracing::subscriber::Interest::never();
                if ::tracing::Level::TRACE <=
                                    ::tracing::level_filters::STATIC_MAX_LEVEL &&
                                ::tracing::Level::TRACE <=
                                    ::tracing::level_filters::LevelFilter::current() &&
                            { interest = __CALLSITE.interest(); !interest.is_never() }
                        &&
                        ::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
                            interest) {
                    let meta = __CALLSITE.metadata();
                    ::tracing::Span::new(meta,
                        &{
                                #[allow(unused_imports)]
                                use ::tracing::field::{debug, display, Value};
                                meta.fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&goal)
                                                            as &dyn ::tracing::field::Value))])
                            })
                } else {
                    let span =
                        ::tracing::__macro_support::__disabled_span(__CALLSITE.metadata());
                    {};
                    span
                }
            };
        __tracing_attr_guard = __tracing_attr_span.enter();
    }

    #[warn(clippy :: suspicious_else_formatting)]
    {

        #[allow(unknown_lints, unreachable_code, clippy ::
        diverging_sub_expression, clippy :: empty_loop, clippy ::
        let_unit_value, clippy :: let_with_type_underscore, clippy ::
        needless_return, clippy :: unreachable)]
        if false {
            let __tracing_attr_fake_return: QueryResultOrRerunNonErased<I> =
                loop {};
            return __tracing_attr_fake_return;
        }
        {
            let ty::OutlivesClause(a, b) = goal.predicate;
            if self.cx().assumptions_on_binders() {
                use rustc_type_ir::region_constraint::{
                    LeafRegionConstraint, RegionConstraint,
                };
                let constraint =
                    RegionConstraint::new_leaf(LeafRegionConstraint::RegionOutlives(a,
                            b, ()));
                self.register_solver_region_constraint(constraint);
            } else {
                self.register_region_outlives(a, b, VisibleForLeakCheck::Yes);
            }
            self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
        }
    }
}#[instrument(level = "trace", skip(self))]
117    fn compute_region_outlives_goal(
118        &mut self,
119        goal: Goal<I, ty::OutlivesClause<I, Region<I>>>,
120    ) -> QueryResultOrRerunNonErased<I> {
121        let ty::OutlivesClause(a, b) = goal.predicate;
122
123        if self.cx().assumptions_on_binders() {
124            use rustc_type_ir::region_constraint::{LeafRegionConstraint, RegionConstraint};
125
126            let constraint =
127                RegionConstraint::new_leaf(LeafRegionConstraint::RegionOutlives(a, b, ()));
128            self.register_solver_region_constraint(constraint);
129        } else {
130            self.register_region_outlives(a, b, VisibleForLeakCheck::Yes);
131        }
132
133        self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
134    }
135
136    {}
#[allow(clippy :: suspicious_else_formatting)]
{
    let __tracing_attr_span;
    let __tracing_attr_guard;
    if ::tracing::Level::TRACE <= ::tracing::level_filters::STATIC_MAX_LEVEL
                &&
                ::tracing::Level::TRACE <=
                    ::tracing::level_filters::LevelFilter::current() ||
            { false } {
        __tracing_attr_span =
            {
                use ::tracing::__macro_support::Callsite as _;
                static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                    {
                        static META: ::tracing::Metadata<'static> =
                            {
                                ::tracing_core::metadata::Metadata::new("compute_coerce_goal",
                                    "rustc_next_trait_solver::solve", ::tracing::Level::TRACE,
                                    ::tracing_core::__macro_support::Option::Some("/rustc-dev/574ff7d98bd6d037e5236a8453029173b32631fd/compiler/rustc_next_trait_solver/src/solve/mod.rs"),
                                    ::tracing_core::__macro_support::Option::Some(136u32),
                                    ::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve"),
                                    ::tracing_core::field::FieldSet::new(&[{
                                                        const NAME:
                                                            ::tracing::__macro_support::FieldName<{
                                                                ::tracing::__macro_support::FieldName::len("goal")
                                                            }> =
                                                            ::tracing::__macro_support::FieldName::new("goal");
                                                        NAME.as_str()
                                                    }], ::tracing_core::callsite::Identifier(&__CALLSITE)),
                                    ::tracing::metadata::Kind::SPAN)
                            };
                        ::tracing::callsite::DefaultCallsite::new(&META)
                    };
                let mut interest = ::tracing::subscriber::Interest::never();
                if ::tracing::Level::TRACE <=
                                    ::tracing::level_filters::STATIC_MAX_LEVEL &&
                                ::tracing::Level::TRACE <=
                                    ::tracing::level_filters::LevelFilter::current() &&
                            { interest = __CALLSITE.interest(); !interest.is_never() }
                        &&
                        ::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
                            interest) {
                    let meta = __CALLSITE.metadata();
                    ::tracing::Span::new(meta,
                        &{
                                #[allow(unused_imports)]
                                use ::tracing::field::{debug, display, Value};
                                meta.fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&goal)
                                                            as &dyn ::tracing::field::Value))])
                            })
                } else {
                    let span =
                        ::tracing::__macro_support::__disabled_span(__CALLSITE.metadata());
                    {};
                    span
                }
            };
        __tracing_attr_guard = __tracing_attr_span.enter();
    }

    #[warn(clippy :: suspicious_else_formatting)]
    {

        #[allow(unknown_lints, unreachable_code, clippy ::
        diverging_sub_expression, clippy :: empty_loop, clippy ::
        let_unit_value, clippy :: let_with_type_underscore, clippy ::
        needless_return, clippy :: unreachable)]
        if false {
            let __tracing_attr_fake_return: QueryResultOrRerunNonErased<I> =
                loop {};
            return __tracing_attr_fake_return;
        }
        {
            self.compute_subtype_goal(Goal {
                    param_env: goal.param_env,
                    predicate: ty::SubtypePredicate {
                        a_is_expected: false,
                        a: goal.predicate.a,
                        b: goal.predicate.b,
                    },
                })
        }
    }
}#[instrument(level = "trace", skip(self))]
137    fn compute_coerce_goal(
138        &mut self,
139        goal: Goal<I, ty::CoercePredicate<I>>,
140    ) -> QueryResultOrRerunNonErased<I> {
141        self.compute_subtype_goal(Goal {
142            param_env: goal.param_env,
143            predicate: ty::SubtypePredicate {
144                a_is_expected: false,
145                a: goal.predicate.a,
146                b: goal.predicate.b,
147            },
148        })
149    }
150
151    {}
#[allow(clippy :: suspicious_else_formatting)]
{
    let __tracing_attr_span;
    let __tracing_attr_guard;
    if ::tracing::Level::TRACE <= ::tracing::level_filters::STATIC_MAX_LEVEL
                &&
                ::tracing::Level::TRACE <=
                    ::tracing::level_filters::LevelFilter::current() ||
            { false } {
        __tracing_attr_span =
            {
                use ::tracing::__macro_support::Callsite as _;
                static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                    {
                        static META: ::tracing::Metadata<'static> =
                            {
                                ::tracing_core::metadata::Metadata::new("compute_subtype_goal",
                                    "rustc_next_trait_solver::solve", ::tracing::Level::TRACE,
                                    ::tracing_core::__macro_support::Option::Some("/rustc-dev/574ff7d98bd6d037e5236a8453029173b32631fd/compiler/rustc_next_trait_solver/src/solve/mod.rs"),
                                    ::tracing_core::__macro_support::Option::Some(151u32),
                                    ::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve"),
                                    ::tracing_core::field::FieldSet::new(&[{
                                                        const NAME:
                                                            ::tracing::__macro_support::FieldName<{
                                                                ::tracing::__macro_support::FieldName::len("goal")
                                                            }> =
                                                            ::tracing::__macro_support::FieldName::new("goal");
                                                        NAME.as_str()
                                                    }], ::tracing_core::callsite::Identifier(&__CALLSITE)),
                                    ::tracing::metadata::Kind::SPAN)
                            };
                        ::tracing::callsite::DefaultCallsite::new(&META)
                    };
                let mut interest = ::tracing::subscriber::Interest::never();
                if ::tracing::Level::TRACE <=
                                    ::tracing::level_filters::STATIC_MAX_LEVEL &&
                                ::tracing::Level::TRACE <=
                                    ::tracing::level_filters::LevelFilter::current() &&
                            { interest = __CALLSITE.interest(); !interest.is_never() }
                        &&
                        ::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
                            interest) {
                    let meta = __CALLSITE.metadata();
                    ::tracing::Span::new(meta,
                        &{
                                #[allow(unused_imports)]
                                use ::tracing::field::{debug, display, Value};
                                meta.fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&goal)
                                                            as &dyn ::tracing::field::Value))])
                            })
                } else {
                    let span =
                        ::tracing::__macro_support::__disabled_span(__CALLSITE.metadata());
                    {};
                    span
                }
            };
        __tracing_attr_guard = __tracing_attr_span.enter();
    }

    #[warn(clippy :: suspicious_else_formatting)]
    {

        #[allow(unknown_lints, unreachable_code, clippy ::
        diverging_sub_expression, clippy :: empty_loop, clippy ::
        let_unit_value, clippy :: let_with_type_underscore, clippy ::
        needless_return, clippy :: unreachable)]
        if false {
            let __tracing_attr_fake_return: QueryResultOrRerunNonErased<I> =
                loop {};
            return __tracing_attr_fake_return;
        }
        {
            match (goal.predicate.a.kind(), goal.predicate.b.kind()) {
                (ty::Infer(ty::TyVar(a_vid)), ty::Infer(ty::TyVar(b_vid))) =>
                    {
                    self.sub_unify_ty_vids_raw(a_vid, b_vid);
                    self.evaluate_added_goals_and_make_canonical_response(Certainty::AMBIGUOUS)
                }
                _ => {
                    self.sub(goal.param_env, goal.predicate.a,
                            goal.predicate.b)?;
                    self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
                }
            }
        }
    }
}#[instrument(level = "trace", skip(self))]
152    fn compute_subtype_goal(
153        &mut self,
154        goal: Goal<I, ty::SubtypePredicate<I>>,
155    ) -> QueryResultOrRerunNonErased<I> {
156        match (goal.predicate.a.kind(), goal.predicate.b.kind()) {
157            (ty::Infer(ty::TyVar(a_vid)), ty::Infer(ty::TyVar(b_vid))) => {
158                self.sub_unify_ty_vids_raw(a_vid, b_vid);
159                self.evaluate_added_goals_and_make_canonical_response(Certainty::AMBIGUOUS)
160            }
161            _ => {
162                self.sub(goal.param_env, goal.predicate.a, goal.predicate.b)?;
163                self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
164            }
165        }
166    }
167
168    fn compute_dyn_compatible_goal(
169        &mut self,
170        trait_def_id: I::TraitId,
171    ) -> QueryResultOrRerunNonErased<I> {
172        if self.cx().trait_is_dyn_compatible(trait_def_id) {
173            self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
174        } else {
175            Err(NoSolution.into())
176        }
177    }
178
179    {}
#[allow(clippy :: suspicious_else_formatting)]
{
    let __tracing_attr_span;
    let __tracing_attr_guard;
    if ::tracing::Level::TRACE <= ::tracing::level_filters::STATIC_MAX_LEVEL
                &&
                ::tracing::Level::TRACE <=
                    ::tracing::level_filters::LevelFilter::current() ||
            { false } {
        __tracing_attr_span =
            {
                use ::tracing::__macro_support::Callsite as _;
                static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                    {
                        static META: ::tracing::Metadata<'static> =
                            {
                                ::tracing_core::metadata::Metadata::new("compute_well_formed_goal",
                                    "rustc_next_trait_solver::solve", ::tracing::Level::TRACE,
                                    ::tracing_core::__macro_support::Option::Some("/rustc-dev/574ff7d98bd6d037e5236a8453029173b32631fd/compiler/rustc_next_trait_solver/src/solve/mod.rs"),
                                    ::tracing_core::__macro_support::Option::Some(179u32),
                                    ::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve"),
                                    ::tracing_core::field::FieldSet::new(&[{
                                                        const NAME:
                                                            ::tracing::__macro_support::FieldName<{
                                                                ::tracing::__macro_support::FieldName::len("goal")
                                                            }> =
                                                            ::tracing::__macro_support::FieldName::new("goal");
                                                        NAME.as_str()
                                                    }], ::tracing_core::callsite::Identifier(&__CALLSITE)),
                                    ::tracing::metadata::Kind::SPAN)
                            };
                        ::tracing::callsite::DefaultCallsite::new(&META)
                    };
                let mut interest = ::tracing::subscriber::Interest::never();
                if ::tracing::Level::TRACE <=
                                    ::tracing::level_filters::STATIC_MAX_LEVEL &&
                                ::tracing::Level::TRACE <=
                                    ::tracing::level_filters::LevelFilter::current() &&
                            { interest = __CALLSITE.interest(); !interest.is_never() }
                        &&
                        ::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
                            interest) {
                    let meta = __CALLSITE.metadata();
                    ::tracing::Span::new(meta,
                        &{
                                #[allow(unused_imports)]
                                use ::tracing::field::{debug, display, Value};
                                meta.fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&goal)
                                                            as &dyn ::tracing::field::Value))])
                            })
                } else {
                    let span =
                        ::tracing::__macro_support::__disabled_span(__CALLSITE.metadata());
                    {};
                    span
                }
            };
        __tracing_attr_guard = __tracing_attr_span.enter();
    }

    #[warn(clippy :: suspicious_else_formatting)]
    {

        #[allow(unknown_lints, unreachable_code, clippy ::
        diverging_sub_expression, clippy :: empty_loop, clippy ::
        let_unit_value, clippy :: let_with_type_underscore, clippy ::
        needless_return, clippy :: unreachable)]
        if false {
            let __tracing_attr_fake_return: QueryResultOrRerunNonErased<I> =
                loop {};
            return __tracing_attr_fake_return;
        }
        {
            match self.well_formed_goals(goal.param_env, goal.predicate) {
                Some(goals) => {
                    self.add_goals(GoalSource::Misc, goals)?;
                    self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
                }
                None =>
                    self.evaluate_added_goals_and_make_canonical_response(Certainty::AMBIGUOUS),
            }
        }
    }
}#[instrument(level = "trace", skip(self))]
180    fn compute_well_formed_goal(
181        &mut self,
182        goal: Goal<I, I::Term>,
183    ) -> QueryResultOrRerunNonErased<I> {
184        match self.well_formed_goals(goal.param_env, goal.predicate) {
185            Some(goals) => {
186                self.add_goals(GoalSource::Misc, goals)?;
187                self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
188            }
189            None => self.evaluate_added_goals_and_make_canonical_response(Certainty::AMBIGUOUS),
190        }
191    }
192
193    fn compute_unstable_feature_goal(
194        &mut self,
195        param_env: <I as Interner>::ParamEnv,
196        symbol: <I as Interner>::Symbol,
197    ) -> QueryResultOrRerunNonErased<I> {
198        if self.may_use_unstable_feature(param_env, symbol)? {
199            self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
200        } else {
201            self.evaluate_added_goals_and_make_canonical_response(Certainty::AMBIGUOUS)
202        }
203    }
204
205    {}
#[allow(clippy :: suspicious_else_formatting)]
{
    let __tracing_attr_span;
    let __tracing_attr_guard;
    if ::tracing::Level::TRACE <= ::tracing::level_filters::STATIC_MAX_LEVEL
                &&
                ::tracing::Level::TRACE <=
                    ::tracing::level_filters::LevelFilter::current() ||
            { false } {
        __tracing_attr_span =
            {
                use ::tracing::__macro_support::Callsite as _;
                static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                    {
                        static META: ::tracing::Metadata<'static> =
                            {
                                ::tracing_core::metadata::Metadata::new("compute_const_evaluatable_goal",
                                    "rustc_next_trait_solver::solve", ::tracing::Level::TRACE,
                                    ::tracing_core::__macro_support::Option::Some("/rustc-dev/574ff7d98bd6d037e5236a8453029173b32631fd/compiler/rustc_next_trait_solver/src/solve/mod.rs"),
                                    ::tracing_core::__macro_support::Option::Some(205u32),
                                    ::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve"),
                                    ::tracing_core::field::FieldSet::new(&[{
                                                        const NAME:
                                                            ::tracing::__macro_support::FieldName<{
                                                                ::tracing::__macro_support::FieldName::len("param_env")
                                                            }> =
                                                            ::tracing::__macro_support::FieldName::new("param_env");
                                                        NAME.as_str()
                                                    },
                                                    {
                                                        const NAME:
                                                            ::tracing::__macro_support::FieldName<{
                                                                ::tracing::__macro_support::FieldName::len("ct")
                                                            }> =
                                                            ::tracing::__macro_support::FieldName::new("ct");
                                                        NAME.as_str()
                                                    }], ::tracing_core::callsite::Identifier(&__CALLSITE)),
                                    ::tracing::metadata::Kind::SPAN)
                            };
                        ::tracing::callsite::DefaultCallsite::new(&META)
                    };
                let mut interest = ::tracing::subscriber::Interest::never();
                if ::tracing::Level::TRACE <=
                                    ::tracing::level_filters::STATIC_MAX_LEVEL &&
                                ::tracing::Level::TRACE <=
                                    ::tracing::level_filters::LevelFilter::current() &&
                            { interest = __CALLSITE.interest(); !interest.is_never() }
                        &&
                        ::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
                            interest) {
                    let meta = __CALLSITE.metadata();
                    ::tracing::Span::new(meta,
                        &{
                                #[allow(unused_imports)]
                                use ::tracing::field::{debug, display, Value};
                                meta.fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&param_env)
                                                            as &dyn ::tracing::field::Value)),
                                                (::tracing::__macro_support::Option::Some(&::tracing::field::debug(&ct)
                                                            as &dyn ::tracing::field::Value))])
                            })
                } else {
                    let span =
                        ::tracing::__macro_support::__disabled_span(__CALLSITE.metadata());
                    {};
                    span
                }
            };
        __tracing_attr_guard = __tracing_attr_span.enter();
    }

    #[warn(clippy :: suspicious_else_formatting)]
    {

        #[allow(unknown_lints, unreachable_code, clippy ::
        diverging_sub_expression, clippy :: empty_loop, clippy ::
        let_unit_value, clippy :: let_with_type_underscore, clippy ::
        needless_return, clippy :: unreachable)]
        if false {
            let __tracing_attr_fake_return: QueryResultOrRerunNonErased<I> =
                loop {};
            return __tracing_attr_fake_return;
        }
        {
            match ct.kind() {
                ty::ConstKind::Alias(ty::IsRigid::Yes, _) |
                    ty::ConstKind::Placeholder(_) | ty::ConstKind::Value(_) |
                    ty::ConstKind::Error(_) => {
                    self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
                }
                ty::ConstKind::Infer(_) => {
                    self.evaluate_added_goals_and_make_canonical_response(Certainty::AMBIGUOUS)
                }
                ty::ConstKind::Alias(ty::IsRigid::No, alias_const) => {
                    if let Some(_normalized) =
                            self.evaluate_const(param_env, alias_const)? {
                        self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
                    } else {
                        self.evaluate_added_goals_and_make_canonical_response(Certainty::AMBIGUOUS)
                    }
                }
                ty::ConstKind::Param(_) | ty::ConstKind::Bound(_, _) |
                    ty::ConstKind::Expr(_) => {
                    {
                        ::core::panicking::panic_fmt(format_args!("unexpected const kind: {0:?}",
                                ct));
                    }
                }
            }
        }
    }
}#[instrument(level = "trace", skip(self))]
206    fn compute_const_evaluatable_goal(
207        &mut self,
208        Goal { param_env, predicate: ct }: Goal<I, I::Const>,
209    ) -> QueryResultOrRerunNonErased<I> {
210        match ct.kind() {
211            ty::ConstKind::Alias(ty::IsRigid::Yes, _)
212            | ty::ConstKind::Placeholder(_)
213            | ty::ConstKind::Value(_)
214            | ty::ConstKind::Error(_) => {
215                self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
216            }
217
218            ty::ConstKind::Infer(_) => {
219                self.evaluate_added_goals_and_make_canonical_response(Certainty::AMBIGUOUS)
220            }
221
222            ty::ConstKind::Alias(ty::IsRigid::No, alias_const) => {
223                // We never return `NoSolution` here as `evaluate_const` emits an
224                // error itself when failing to evaluate, so emitting an additional fulfillment
225                // error in that case is unnecessary noise. This may change in the future once
226                // evaluation failures are allowed to impact selection, e.g. generic const
227                // expressions in impl headers or `where`-clauses.
228
229                // FIXME(generic_const_exprs): Implement handling for generic
230                // const expressions here.
231                if let Some(_normalized) = self.evaluate_const(param_env, alias_const)? {
232                    self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
233                } else {
234                    self.evaluate_added_goals_and_make_canonical_response(Certainty::AMBIGUOUS)
235                }
236            }
237
238            // We can freely ICE here as:
239            // - `Param` gets replaced with a placeholder during canonicalization
240            // - `Bound` cannot exist as we don't have a binder around the self Type
241            // - `Expr` is part of `feature(generic_const_exprs)` and is not implemented yet
242            ty::ConstKind::Param(_) | ty::ConstKind::Bound(_, _) | ty::ConstKind::Expr(_) => {
243                panic!("unexpected const kind: {:?}", ct)
244            }
245        }
246    }
247
248    {}
let __tracing_attr_span;
let __tracing_attr_guard;
if ::tracing::Level::TRACE <= ::tracing::level_filters::STATIC_MAX_LEVEL &&
            ::tracing::Level::TRACE <=
                ::tracing::level_filters::LevelFilter::current() || { false }
    {
    __tracing_attr_span =
        {
            use ::tracing::__macro_support::Callsite as _;
            static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                {
                    static META: ::tracing::Metadata<'static> =
                        {
                            ::tracing_core::metadata::Metadata::new("compute_const_arg_has_type_goal",
                                "rustc_next_trait_solver::solve", ::tracing::Level::TRACE,
                                ::tracing_core::__macro_support::Option::Some("/rustc-dev/574ff7d98bd6d037e5236a8453029173b32631fd/compiler/rustc_next_trait_solver/src/solve/mod.rs"),
                                ::tracing_core::__macro_support::Option::Some(248u32),
                                ::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve"),
                                ::tracing_core::field::FieldSet::new(&[{
                                                    const NAME:
                                                        ::tracing::__macro_support::FieldName<{
                                                            ::tracing::__macro_support::FieldName::len("goal")
                                                        }> =
                                                        ::tracing::__macro_support::FieldName::new("goal");
                                                    NAME.as_str()
                                                }], ::tracing_core::callsite::Identifier(&__CALLSITE)),
                                ::tracing::metadata::Kind::SPAN)
                        };
                    ::tracing::callsite::DefaultCallsite::new(&META)
                };
            let mut interest = ::tracing::subscriber::Interest::never();
            if ::tracing::Level::TRACE <=
                                ::tracing::level_filters::STATIC_MAX_LEVEL &&
                            ::tracing::Level::TRACE <=
                                ::tracing::level_filters::LevelFilter::current() &&
                        { interest = __CALLSITE.interest(); !interest.is_never() }
                    &&
                    ::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
                        interest) {
                let meta = __CALLSITE.metadata();
                ::tracing::Span::new(meta,
                    &{
                            #[allow(unused_imports)]
                            use ::tracing::field::{debug, display, Value};
                            meta.fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&goal)
                                                        as &dyn ::tracing::field::Value))])
                        })
            } else {
                let span =
                    ::tracing::__macro_support::__disabled_span(__CALLSITE.metadata());
                {};
                span
            }
        };
    __tracing_attr_guard = __tracing_attr_span.enter();
}
#[allow(clippy :: redundant_closure_call)]
let x =
    (move ||
                {

                    #[allow(unknown_lints, unreachable_code, clippy ::
                    diverging_sub_expression, clippy :: empty_loop, clippy ::
                    let_unit_value, clippy :: let_with_type_underscore, clippy
                    :: needless_return, clippy :: unreachable)]
                    if false {
                        let __tracing_attr_fake_return:
                                QueryResultOrRerunNonErased<I> = loop {};
                        return __tracing_attr_fake_return;
                    }
                    {
                        let (ct, ty) = goal.predicate;
                        let ct =
                            self.structurally_normalize_const(goal.param_env, ct)?;
                        let ct_ty =
                            match ct.kind() {
                                ty::ConstKind::Infer(_) => {
                                    return self.evaluate_added_goals_and_make_canonical_response(Certainty::AMBIGUOUS).map_err(Into::into);
                                }
                                ty::ConstKind::Error(_) => {
                                    return self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes).map_err(Into::into);
                                }
                                ty::ConstKind::Alias(ty::IsRigid::Yes, alias_const) => {
                                    alias_const.type_of(self.cx()).skip_norm_wip()
                                }
                                ty::ConstKind::Alias(ty::IsRigid::No, _) => {
                                    ::core::panicking::panic_fmt(format_args!("not implemented: {0}",
                                            format_args!("non-rigid unevaluated constant for compute_const_arg_has_type_goal: {0:?}",
                                                ct)));
                                }
                                ty::ConstKind::Expr(_) => {
                                    ::core::panicking::panic_fmt(format_args!("not implemented: {0}",
                                            format_args!("`feature(generic_const_exprs)` is not supported in the new trait solver")));
                                }
                                ty::ConstKind::Param(_) => {
                                    {
                                        ::core::panicking::panic_fmt(format_args!("internal error: entered unreachable code: {0}",
                                                format_args!("`ConstKind::Param` should have been canonicalized to `Placeholder`")));
                                    }
                                }
                                ty::ConstKind::Bound(_, _) => {
                                    ::core::panicking::panic_fmt(format_args!("escaping bound vars in {0:?}",
                                            ct));
                                }
                                ty::ConstKind::Value(cv) => cv.ty(),
                                ty::ConstKind::Placeholder(placeholder) => {
                                    placeholder.find_const_ty_from_env(goal.param_env)
                                }
                            };
                        self.eq(goal.param_env, ct_ty, ty)?;
                        self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes).map_err(Into::into)
                    }
                })();
{
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/574ff7d98bd6d037e5236a8453029173b32631fd/compiler/rustc_next_trait_solver/src/solve/mod.rs:248",
                        "rustc_next_trait_solver::solve", ::tracing::Level::TRACE,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/574ff7d98bd6d037e5236a8453029173b32631fd/compiler/rustc_next_trait_solver/src/solve/mod.rs"),
                        ::tracing_core::__macro_support::Option::Some(248u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve"),
                        ::tracing_core::field::FieldSet::new(&[{
                                            const NAME:
                                                ::tracing::__macro_support::FieldName<{
                                                    ::tracing::__macro_support::FieldName::len("return")
                                                }> =
                                                ::tracing::__macro_support::FieldName::new("return");
                                            NAME.as_str()
                                        }], ::tracing_core::callsite::Identifier(&__CALLSITE)),
                        ::tracing::metadata::Kind::EVENT)
                };
            ::tracing::callsite::DefaultCallsite::new(&META)
        };
    let enabled =
        ::tracing::Level::TRACE <= ::tracing::level_filters::STATIC_MAX_LEVEL
                &&
                ::tracing::Level::TRACE <=
                    ::tracing::level_filters::LevelFilter::current() &&
            {
                let interest = __CALLSITE.interest();
                !interest.is_never() &&
                    ::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
                        interest)
            };
    if enabled {
        (|value_set: ::tracing::field::ValueSet|
                    {
                        let meta = __CALLSITE.metadata();
                        ::tracing::Event::dispatch(meta, &value_set);
                        ;
                    })({
                #[allow(unused_imports)]
                use ::tracing::field::{debug, display, Value};
                __CALLSITE.metadata().fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&x)
                                            as &dyn ::tracing::field::Value))])
            });
    } else { ; }
};
x;#[instrument(level = "trace", skip(self), ret)]
249    fn compute_const_arg_has_type_goal(
250        &mut self,
251        goal: Goal<I, (I::Const, I::Ty)>,
252    ) -> QueryResultOrRerunNonErased<I> {
253        let (ct, ty) = goal.predicate;
254        let ct = self.structurally_normalize_const(goal.param_env, ct)?;
255
256        let ct_ty = match ct.kind() {
257            ty::ConstKind::Infer(_) => {
258                return self
259                    .evaluate_added_goals_and_make_canonical_response(Certainty::AMBIGUOUS)
260                    .map_err(Into::into);
261            }
262            ty::ConstKind::Error(_) => {
263                return self
264                    .evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
265                    .map_err(Into::into);
266            }
267            ty::ConstKind::Alias(ty::IsRigid::Yes, alias_const) => {
268                alias_const.type_of(self.cx()).skip_norm_wip()
269            }
270            ty::ConstKind::Alias(ty::IsRigid::No, _) => unimplemented!(
271                "non-rigid unevaluated constant for compute_const_arg_has_type_goal: {ct:?}"
272            ),
273            ty::ConstKind::Expr(_) => unimplemented!(
274                "`feature(generic_const_exprs)` is not supported in the new trait solver"
275            ),
276            ty::ConstKind::Param(_) => {
277                unreachable!("`ConstKind::Param` should have been canonicalized to `Placeholder`")
278            }
279            ty::ConstKind::Bound(_, _) => panic!("escaping bound vars in {:?}", ct),
280            ty::ConstKind::Value(cv) => cv.ty(),
281            ty::ConstKind::Placeholder(placeholder) => {
282                placeholder.find_const_ty_from_env(goal.param_env)
283            }
284        };
285
286        self.eq(goal.param_env, ct_ty, ty)?;
287        self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes).map_err(Into::into)
288    }
289}
290
291#[derive(#[automatically_derived]
impl ::core::fmt::Debug for MergeCandidateInfo {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            MergeCandidateInfo::AlwaysApplicable(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "AlwaysApplicable", &__self_0),
            MergeCandidateInfo::EqualResponse =>
                ::core::fmt::Formatter::write_str(f, "EqualResponse"),
        }
    }
}Debug)]
292enum MergeCandidateInfo {
293    AlwaysApplicable(usize),
294    EqualResponse,
295}
296
297impl<D, I> EvalCtxt<'_, D>
298where
299    D: SolverDelegate<Interner = I>,
300    I: Interner,
301{
302    /// Try to merge multiple possible ways to prove a goal, if that is not possible returns `None`.
303    ///
304    /// In this case we tend to flounder and return ambiguity by calling `[EvalCtxt::flounder]`.
305    {}
let __tracing_attr_span;
let __tracing_attr_guard;
if ::tracing::Level::TRACE <= ::tracing::level_filters::STATIC_MAX_LEVEL &&
            ::tracing::Level::TRACE <=
                ::tracing::level_filters::LevelFilter::current() || { false }
    {
    __tracing_attr_span =
        {
            use ::tracing::__macro_support::Callsite as _;
            static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                {
                    static META: ::tracing::Metadata<'static> =
                        {
                            ::tracing_core::metadata::Metadata::new("try_merge_candidates",
                                "rustc_next_trait_solver::solve", ::tracing::Level::TRACE,
                                ::tracing_core::__macro_support::Option::Some("/rustc-dev/574ff7d98bd6d037e5236a8453029173b32631fd/compiler/rustc_next_trait_solver/src/solve/mod.rs"),
                                ::tracing_core::__macro_support::Option::Some(305u32),
                                ::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve"),
                                ::tracing_core::field::FieldSet::new(&[{
                                                    const NAME:
                                                        ::tracing::__macro_support::FieldName<{
                                                            ::tracing::__macro_support::FieldName::len("candidates")
                                                        }> =
                                                        ::tracing::__macro_support::FieldName::new("candidates");
                                                    NAME.as_str()
                                                }], ::tracing_core::callsite::Identifier(&__CALLSITE)),
                                ::tracing::metadata::Kind::SPAN)
                        };
                    ::tracing::callsite::DefaultCallsite::new(&META)
                };
            let mut interest = ::tracing::subscriber::Interest::never();
            if ::tracing::Level::TRACE <=
                                ::tracing::level_filters::STATIC_MAX_LEVEL &&
                            ::tracing::Level::TRACE <=
                                ::tracing::level_filters::LevelFilter::current() &&
                        { interest = __CALLSITE.interest(); !interest.is_never() }
                    &&
                    ::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
                        interest) {
                let meta = __CALLSITE.metadata();
                ::tracing::Span::new(meta,
                    &{
                            #[allow(unused_imports)]
                            use ::tracing::field::{debug, display, Value};
                            meta.fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&candidates)
                                                        as &dyn ::tracing::field::Value))])
                        })
            } else {
                let span =
                    ::tracing::__macro_support::__disabled_span(__CALLSITE.metadata());
                {};
                span
            }
        };
    __tracing_attr_guard = __tracing_attr_span.enter();
}
#[allow(clippy :: redundant_closure_call)]
let x =
    (move ||
                {

                    #[allow(unknown_lints, unreachable_code, clippy ::
                    diverging_sub_expression, clippy :: empty_loop, clippy ::
                    let_unit_value, clippy :: let_with_type_underscore, clippy
                    :: needless_return, clippy :: unreachable)]
                    if false {
                        let __tracing_attr_fake_return:
                                Option<(CanonicalResponse<I>, MergeCandidateInfo)> =
                            loop {};
                        return __tracing_attr_fake_return;
                    }
                    {
                        if candidates.is_empty() { return None; }
                        let always_applicable =
                            candidates.iter().enumerate().find(|(_, candidate)|
                                    {
                                        candidate.result.value.certainty == Certainty::Yes &&
                                            has_no_inference_or_external_constraints(candidate.result)
                                    });
                        if let Some((i, c)) = always_applicable {
                            return Some((c.result,
                                        MergeCandidateInfo::AlwaysApplicable(i)));
                        }
                        let one: CanonicalResponse<I> = candidates[0].result;
                        if candidates[1..].iter().all(|candidate|
                                    candidate.result == one) {
                            return Some((one, MergeCandidateInfo::EqualResponse));
                        }
                        None
                    }
                })();
{
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/574ff7d98bd6d037e5236a8453029173b32631fd/compiler/rustc_next_trait_solver/src/solve/mod.rs:305",
                        "rustc_next_trait_solver::solve", ::tracing::Level::TRACE,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/574ff7d98bd6d037e5236a8453029173b32631fd/compiler/rustc_next_trait_solver/src/solve/mod.rs"),
                        ::tracing_core::__macro_support::Option::Some(305u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve"),
                        ::tracing_core::field::FieldSet::new(&[{
                                            const NAME:
                                                ::tracing::__macro_support::FieldName<{
                                                    ::tracing::__macro_support::FieldName::len("return")
                                                }> =
                                                ::tracing::__macro_support::FieldName::new("return");
                                            NAME.as_str()
                                        }], ::tracing_core::callsite::Identifier(&__CALLSITE)),
                        ::tracing::metadata::Kind::EVENT)
                };
            ::tracing::callsite::DefaultCallsite::new(&META)
        };
    let enabled =
        ::tracing::Level::TRACE <= ::tracing::level_filters::STATIC_MAX_LEVEL
                &&
                ::tracing::Level::TRACE <=
                    ::tracing::level_filters::LevelFilter::current() &&
            {
                let interest = __CALLSITE.interest();
                !interest.is_never() &&
                    ::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
                        interest)
            };
    if enabled {
        (|value_set: ::tracing::field::ValueSet|
                    {
                        let meta = __CALLSITE.metadata();
                        ::tracing::Event::dispatch(meta, &value_set);
                        ;
                    })({
                #[allow(unused_imports)]
                use ::tracing::field::{debug, display, Value};
                __CALLSITE.metadata().fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&x)
                                            as &dyn ::tracing::field::Value))])
            });
    } else { ; }
};
x;#[instrument(level = "trace", skip(self), ret)]
306    fn try_merge_candidates(
307        &mut self,
308        candidates: &[Candidate<I>],
309    ) -> Option<(CanonicalResponse<I>, MergeCandidateInfo)> {
310        if candidates.is_empty() {
311            return None;
312        }
313
314        let always_applicable = candidates.iter().enumerate().find(|(_, candidate)| {
315            candidate.result.value.certainty == Certainty::Yes
316                && has_no_inference_or_external_constraints(candidate.result)
317        });
318        if let Some((i, c)) = always_applicable {
319            return Some((c.result, MergeCandidateInfo::AlwaysApplicable(i)));
320        }
321
322        let one: CanonicalResponse<I> = candidates[0].result;
323        if candidates[1..].iter().all(|candidate| candidate.result == one) {
324            return Some((one, MergeCandidateInfo::EqualResponse));
325        }
326
327        None
328    }
329
330    fn bail_with_ambiguity(&mut self, candidates: &[Candidate<I>]) -> CanonicalResponse<I> {
331        if true {
    if !(candidates.len() > 1) {
        ::core::panicking::panic("assertion failed: candidates.len() > 1")
    };
};debug_assert!(candidates.len() > 1);
332        let maybe = candidates.iter().fold(MaybeInfo::AMBIGUOUS, |maybe, candidate| {
333            // We pull down the certainty of `Certainty::Yes` to ambiguity when combining
334            // these responses, b/c we're combining more than one response and this we
335            // don't know which one applies.
336            match candidate.result.value.certainty {
337                Certainty::Yes => maybe,
338                Certainty::Maybe(cand_maybe) => maybe.or(cand_maybe),
339            }
340        });
341        self.make_ambiguous_response_no_constraints(maybe)
342    }
343
344    /// If we fail to merge responses we flounder and return overflow or ambiguity.
345    {}
let __tracing_attr_span;
let __tracing_attr_guard;
if ::tracing::Level::TRACE <= ::tracing::level_filters::STATIC_MAX_LEVEL &&
            ::tracing::Level::TRACE <=
                ::tracing::level_filters::LevelFilter::current() || { false }
    {
    __tracing_attr_span =
        {
            use ::tracing::__macro_support::Callsite as _;
            static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                {
                    static META: ::tracing::Metadata<'static> =
                        {
                            ::tracing_core::metadata::Metadata::new("flounder",
                                "rustc_next_trait_solver::solve", ::tracing::Level::TRACE,
                                ::tracing_core::__macro_support::Option::Some("/rustc-dev/574ff7d98bd6d037e5236a8453029173b32631fd/compiler/rustc_next_trait_solver/src/solve/mod.rs"),
                                ::tracing_core::__macro_support::Option::Some(345u32),
                                ::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve"),
                                ::tracing_core::field::FieldSet::new(&[{
                                                    const NAME:
                                                        ::tracing::__macro_support::FieldName<{
                                                            ::tracing::__macro_support::FieldName::len("candidates")
                                                        }> =
                                                        ::tracing::__macro_support::FieldName::new("candidates");
                                                    NAME.as_str()
                                                }], ::tracing_core::callsite::Identifier(&__CALLSITE)),
                                ::tracing::metadata::Kind::SPAN)
                        };
                    ::tracing::callsite::DefaultCallsite::new(&META)
                };
            let mut interest = ::tracing::subscriber::Interest::never();
            if ::tracing::Level::TRACE <=
                                ::tracing::level_filters::STATIC_MAX_LEVEL &&
                            ::tracing::Level::TRACE <=
                                ::tracing::level_filters::LevelFilter::current() &&
                        { interest = __CALLSITE.interest(); !interest.is_never() }
                    &&
                    ::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
                        interest) {
                let meta = __CALLSITE.metadata();
                ::tracing::Span::new(meta,
                    &{
                            #[allow(unused_imports)]
                            use ::tracing::field::{debug, display, Value};
                            meta.fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&candidates)
                                                        as &dyn ::tracing::field::Value))])
                        })
            } else {
                let span =
                    ::tracing::__macro_support::__disabled_span(__CALLSITE.metadata());
                {};
                span
            }
        };
    __tracing_attr_guard = __tracing_attr_span.enter();
}
#[allow(clippy :: redundant_closure_call)]
let x =
    (move ||
                {

                    #[allow(unknown_lints, unreachable_code, clippy ::
                    diverging_sub_expression, clippy :: empty_loop, clippy ::
                    let_unit_value, clippy :: let_with_type_underscore, clippy
                    :: needless_return, clippy :: unreachable)]
                    if false {
                        let __tracing_attr_fake_return: QueryResult<I> = loop {};
                        return __tracing_attr_fake_return;
                    }
                    {
                        if candidates.is_empty() {
                            return Err(NoSolution);
                        } else { Ok(self.bail_with_ambiguity(candidates)) }
                    }
                })();
{
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/574ff7d98bd6d037e5236a8453029173b32631fd/compiler/rustc_next_trait_solver/src/solve/mod.rs:345",
                        "rustc_next_trait_solver::solve", ::tracing::Level::TRACE,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/574ff7d98bd6d037e5236a8453029173b32631fd/compiler/rustc_next_trait_solver/src/solve/mod.rs"),
                        ::tracing_core::__macro_support::Option::Some(345u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve"),
                        ::tracing_core::field::FieldSet::new(&[{
                                            const NAME:
                                                ::tracing::__macro_support::FieldName<{
                                                    ::tracing::__macro_support::FieldName::len("return")
                                                }> =
                                                ::tracing::__macro_support::FieldName::new("return");
                                            NAME.as_str()
                                        }], ::tracing_core::callsite::Identifier(&__CALLSITE)),
                        ::tracing::metadata::Kind::EVENT)
                };
            ::tracing::callsite::DefaultCallsite::new(&META)
        };
    let enabled =
        ::tracing::Level::TRACE <= ::tracing::level_filters::STATIC_MAX_LEVEL
                &&
                ::tracing::Level::TRACE <=
                    ::tracing::level_filters::LevelFilter::current() &&
            {
                let interest = __CALLSITE.interest();
                !interest.is_never() &&
                    ::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
                        interest)
            };
    if enabled {
        (|value_set: ::tracing::field::ValueSet|
                    {
                        let meta = __CALLSITE.metadata();
                        ::tracing::Event::dispatch(meta, &value_set);
                        ;
                    })({
                #[allow(unused_imports)]
                use ::tracing::field::{debug, display, Value};
                __CALLSITE.metadata().fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&x)
                                            as &dyn ::tracing::field::Value))])
            });
    } else { ; }
};
x;#[instrument(level = "trace", skip(self), ret)]
346    fn flounder(&mut self, candidates: &[Candidate<I>]) -> QueryResult<I> {
347        if candidates.is_empty() {
348            return Err(NoSolution);
349        } else {
350            Ok(self.bail_with_ambiguity(candidates))
351        }
352    }
353
354    /// Normalize a type for when it is structurally matched on.
355    ///
356    /// This function is necessary in nearly all cases before matching on a type.
357    /// Not doing so is likely to be incomplete and therefore unsound during
358    /// coherence.
359    {}
let __tracing_attr_span;
let __tracing_attr_guard;
if ::tracing::Level::TRACE <= ::tracing::level_filters::STATIC_MAX_LEVEL &&
            ::tracing::Level::TRACE <=
                ::tracing::level_filters::LevelFilter::current() || { false }
    {
    __tracing_attr_span =
        {
            use ::tracing::__macro_support::Callsite as _;
            static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                {
                    static META: ::tracing::Metadata<'static> =
                        {
                            ::tracing_core::metadata::Metadata::new("structurally_normalize_ty",
                                "rustc_next_trait_solver::solve", ::tracing::Level::TRACE,
                                ::tracing_core::__macro_support::Option::Some("/rustc-dev/574ff7d98bd6d037e5236a8453029173b32631fd/compiler/rustc_next_trait_solver/src/solve/mod.rs"),
                                ::tracing_core::__macro_support::Option::Some(359u32),
                                ::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve"),
                                ::tracing_core::field::FieldSet::new(&[{
                                                    const NAME:
                                                        ::tracing::__macro_support::FieldName<{
                                                            ::tracing::__macro_support::FieldName::len("ty")
                                                        }> =
                                                        ::tracing::__macro_support::FieldName::new("ty");
                                                    NAME.as_str()
                                                }], ::tracing_core::callsite::Identifier(&__CALLSITE)),
                                ::tracing::metadata::Kind::SPAN)
                        };
                    ::tracing::callsite::DefaultCallsite::new(&META)
                };
            let mut interest = ::tracing::subscriber::Interest::never();
            if ::tracing::Level::TRACE <=
                                ::tracing::level_filters::STATIC_MAX_LEVEL &&
                            ::tracing::Level::TRACE <=
                                ::tracing::level_filters::LevelFilter::current() &&
                        { interest = __CALLSITE.interest(); !interest.is_never() }
                    &&
                    ::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
                        interest) {
                let meta = __CALLSITE.metadata();
                ::tracing::Span::new(meta,
                    &{
                            #[allow(unused_imports)]
                            use ::tracing::field::{debug, display, Value};
                            meta.fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&ty)
                                                        as &dyn ::tracing::field::Value))])
                        })
            } else {
                let span =
                    ::tracing::__macro_support::__disabled_span(__CALLSITE.metadata());
                {};
                span
            }
        };
    __tracing_attr_guard = __tracing_attr_span.enter();
}
#[allow(clippy :: redundant_closure_call)]
let x =
    (move ||
                {

                    #[allow(unknown_lints, unreachable_code, clippy ::
                    diverging_sub_expression, clippy :: empty_loop, clippy ::
                    let_unit_value, clippy :: let_with_type_underscore, clippy
                    :: needless_return, clippy :: unreachable)]
                    if false {
                        let __tracing_attr_fake_return:
                                Result<I::Ty, NoSolutionOrRerunNonErased> = loop {};
                        return __tracing_attr_fake_return;
                    }
                    {
                        self.structurally_normalize_term(param_env,
                                ty.into()).map(|term| term.expect_ty())
                    }
                })();
{
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/574ff7d98bd6d037e5236a8453029173b32631fd/compiler/rustc_next_trait_solver/src/solve/mod.rs:359",
                        "rustc_next_trait_solver::solve", ::tracing::Level::TRACE,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/574ff7d98bd6d037e5236a8453029173b32631fd/compiler/rustc_next_trait_solver/src/solve/mod.rs"),
                        ::tracing_core::__macro_support::Option::Some(359u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve"),
                        ::tracing_core::field::FieldSet::new(&[{
                                            const NAME:
                                                ::tracing::__macro_support::FieldName<{
                                                    ::tracing::__macro_support::FieldName::len("return")
                                                }> =
                                                ::tracing::__macro_support::FieldName::new("return");
                                            NAME.as_str()
                                        }], ::tracing_core::callsite::Identifier(&__CALLSITE)),
                        ::tracing::metadata::Kind::EVENT)
                };
            ::tracing::callsite::DefaultCallsite::new(&META)
        };
    let enabled =
        ::tracing::Level::TRACE <= ::tracing::level_filters::STATIC_MAX_LEVEL
                &&
                ::tracing::Level::TRACE <=
                    ::tracing::level_filters::LevelFilter::current() &&
            {
                let interest = __CALLSITE.interest();
                !interest.is_never() &&
                    ::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
                        interest)
            };
    if enabled {
        (|value_set: ::tracing::field::ValueSet|
                    {
                        let meta = __CALLSITE.metadata();
                        ::tracing::Event::dispatch(meta, &value_set);
                        ;
                    })({
                #[allow(unused_imports)]
                use ::tracing::field::{debug, display, Value};
                __CALLSITE.metadata().fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&x)
                                            as &dyn ::tracing::field::Value))])
            });
    } else { ; }
};
x;#[instrument(level = "trace", skip(self, param_env), ret)]
360    fn structurally_normalize_ty(
361        &mut self,
362        param_env: I::ParamEnv,
363        ty: I::Ty,
364    ) -> Result<I::Ty, NoSolutionOrRerunNonErased> {
365        self.structurally_normalize_term(param_env, ty.into()).map(|term| term.expect_ty())
366    }
367
368    /// Normalize a const for when it is structurally matched on, or more likely
369    /// when it needs `.try_to_*` called on it (e.g. to turn it into a usize).
370    ///
371    /// This function is necessary in nearly all cases before matching on a const.
372    /// Not doing so is likely to be incomplete and therefore unsound during
373    /// coherence.
374    {}
let __tracing_attr_span;
let __tracing_attr_guard;
if ::tracing::Level::TRACE <= ::tracing::level_filters::STATIC_MAX_LEVEL &&
            ::tracing::Level::TRACE <=
                ::tracing::level_filters::LevelFilter::current() || { false }
    {
    __tracing_attr_span =
        {
            use ::tracing::__macro_support::Callsite as _;
            static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                {
                    static META: ::tracing::Metadata<'static> =
                        {
                            ::tracing_core::metadata::Metadata::new("structurally_normalize_const",
                                "rustc_next_trait_solver::solve", ::tracing::Level::TRACE,
                                ::tracing_core::__macro_support::Option::Some("/rustc-dev/574ff7d98bd6d037e5236a8453029173b32631fd/compiler/rustc_next_trait_solver/src/solve/mod.rs"),
                                ::tracing_core::__macro_support::Option::Some(374u32),
                                ::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve"),
                                ::tracing_core::field::FieldSet::new(&[{
                                                    const NAME:
                                                        ::tracing::__macro_support::FieldName<{
                                                            ::tracing::__macro_support::FieldName::len("ct")
                                                        }> =
                                                        ::tracing::__macro_support::FieldName::new("ct");
                                                    NAME.as_str()
                                                }], ::tracing_core::callsite::Identifier(&__CALLSITE)),
                                ::tracing::metadata::Kind::SPAN)
                        };
                    ::tracing::callsite::DefaultCallsite::new(&META)
                };
            let mut interest = ::tracing::subscriber::Interest::never();
            if ::tracing::Level::TRACE <=
                                ::tracing::level_filters::STATIC_MAX_LEVEL &&
                            ::tracing::Level::TRACE <=
                                ::tracing::level_filters::LevelFilter::current() &&
                        { interest = __CALLSITE.interest(); !interest.is_never() }
                    &&
                    ::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
                        interest) {
                let meta = __CALLSITE.metadata();
                ::tracing::Span::new(meta,
                    &{
                            #[allow(unused_imports)]
                            use ::tracing::field::{debug, display, Value};
                            meta.fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&ct)
                                                        as &dyn ::tracing::field::Value))])
                        })
            } else {
                let span =
                    ::tracing::__macro_support::__disabled_span(__CALLSITE.metadata());
                {};
                span
            }
        };
    __tracing_attr_guard = __tracing_attr_span.enter();
}
#[allow(clippy :: redundant_closure_call)]
let x =
    (move ||
                {

                    #[allow(unknown_lints, unreachable_code, clippy ::
                    diverging_sub_expression, clippy :: empty_loop, clippy ::
                    let_unit_value, clippy :: let_with_type_underscore, clippy
                    :: needless_return, clippy :: unreachable)]
                    if false {
                        let __tracing_attr_fake_return:
                                Result<I::Const, NoSolutionOrRerunNonErased> = loop {};
                        return __tracing_attr_fake_return;
                    }
                    {
                        self.structurally_normalize_term(param_env,
                                ct.into()).map(|term| term.expect_const())
                    }
                })();
{
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/574ff7d98bd6d037e5236a8453029173b32631fd/compiler/rustc_next_trait_solver/src/solve/mod.rs:374",
                        "rustc_next_trait_solver::solve", ::tracing::Level::TRACE,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/574ff7d98bd6d037e5236a8453029173b32631fd/compiler/rustc_next_trait_solver/src/solve/mod.rs"),
                        ::tracing_core::__macro_support::Option::Some(374u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve"),
                        ::tracing_core::field::FieldSet::new(&[{
                                            const NAME:
                                                ::tracing::__macro_support::FieldName<{
                                                    ::tracing::__macro_support::FieldName::len("return")
                                                }> =
                                                ::tracing::__macro_support::FieldName::new("return");
                                            NAME.as_str()
                                        }], ::tracing_core::callsite::Identifier(&__CALLSITE)),
                        ::tracing::metadata::Kind::EVENT)
                };
            ::tracing::callsite::DefaultCallsite::new(&META)
        };
    let enabled =
        ::tracing::Level::TRACE <= ::tracing::level_filters::STATIC_MAX_LEVEL
                &&
                ::tracing::Level::TRACE <=
                    ::tracing::level_filters::LevelFilter::current() &&
            {
                let interest = __CALLSITE.interest();
                !interest.is_never() &&
                    ::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
                        interest)
            };
    if enabled {
        (|value_set: ::tracing::field::ValueSet|
                    {
                        let meta = __CALLSITE.metadata();
                        ::tracing::Event::dispatch(meta, &value_set);
                        ;
                    })({
                #[allow(unused_imports)]
                use ::tracing::field::{debug, display, Value};
                __CALLSITE.metadata().fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&x)
                                            as &dyn ::tracing::field::Value))])
            });
    } else { ; }
};
x;#[instrument(level = "trace", skip(self, param_env), ret)]
375    fn structurally_normalize_const(
376        &mut self,
377        param_env: I::ParamEnv,
378        ct: I::Const,
379    ) -> Result<I::Const, NoSolutionOrRerunNonErased> {
380        self.structurally_normalize_term(param_env, ct.into()).map(|term| term.expect_const())
381    }
382
383    /// Normalize a term for when it is structurally matched on.
384    ///
385    /// This function is necessary in nearly all cases before matching on a ty/const.
386    /// Not doing so is likely to be incomplete and therefore unsound during coherence.
387    fn structurally_normalize_term(
388        &mut self,
389        param_env: I::ParamEnv,
390        term: I::Term,
391    ) -> Result<I::Term, NoSolutionOrRerunNonErased> {
392        if !self.cx().renormalize_rigid_aliases() && !term.is_non_rigid_alias() {
393            return Ok(term);
394        }
395
396        if let Some(alias) = term.to_alias_term() {
397            let normalized_term = self.next_term_infer_of_alias_kind(alias);
398            let projection_goal = Goal::new(
399                self.cx(),
400                param_env,
401                ty::ProjectionClause { projection_term: alias, term: normalized_term },
402            );
403            // We normalize the self type to be able to relate it with
404            // types from candidates.
405            self.add_goal(GoalSource::TypeRelating, projection_goal)?;
406            self.try_evaluate_added_goals()?;
407            Ok(self.deeply_resolve_ignoring_regions(normalized_term))
408        } else {
409            Ok(term)
410        }
411    }
412}
413
414/// The result of evaluating a goal.
415#[automatically_derived]
impl<I: Interner> ::core::fmt::Debug for GoalEvaluation<I> where I: Interner {
    fn fmt(&self, __f: &mut ::core::fmt::Formatter<'_>)
        -> ::core::fmt::Result {
        match self {
            GoalEvaluation {
                goal: ref __field_goal,
                certainty: ref __field_certainty,
                has_changed: ref __field_has_changed,
                stalled_on: ref __field_stalled_on } => {
                let mut __builder =
                    ::core::fmt::Formatter::debug_struct(__f, "GoalEvaluation");
                ::core::fmt::DebugStruct::field(&mut __builder, "goal",
                    __field_goal);
                ::core::fmt::DebugStruct::field(&mut __builder, "certainty",
                    __field_certainty);
                ::core::fmt::DebugStruct::field(&mut __builder, "has_changed",
                    __field_has_changed);
                ::core::fmt::DebugStruct::field(&mut __builder, "stalled_on",
                    __field_stalled_on);
                ::core::fmt::DebugStruct::finish(&mut __builder)
            }
        }
    }
}#[derive_where(Debug; I: Interner)]
416pub struct GoalEvaluation<I: Interner> {
417    /// The goal we've evaluated. This is the input goal, but potentially with its
418    /// inference variables resolved. This never applies any inference constraints
419    /// from evaluating the goal.
420    ///
421    /// We rely on this to check whether root goals in HIR typeck had an unresolved
422    /// type inference variable in the input. We must not resolve this after evaluating
423    /// the goal as even if the inference variable has been resolved by evaluating the
424    /// goal itself, this goal may still end up failing due to region uniquification
425    /// later on.
426    ///
427    /// This is used as a minor optimization to avoid re-resolving inference variables
428    /// when reevaluating ambiguous goals. E.g. if we've got a goal `?x: Trait` with `?x`
429    /// already being constrained to `Vec<?y>`, then the first evaluation resolves it to
430    /// `Vec<?y>: Trait`. If this goal is still ambiguous and we later resolve `?y` to `u32`,
431    /// then reevaluating this goal now only needs to resolve `?y` while it would otherwise
432    /// have to resolve both `?x` and `?y`,
433    pub goal: Goal<I, I::Predicate>,
434    pub certainty: Certainty,
435    pub has_changed: HasChanged,
436    /// If the [`Certainty`] was `Maybe`, then keep track of whether the goal has changed
437    /// before rerunning it.
438    pub stalled_on: Option<GoalStalledOn<I>>,
439}