Skip to main content

rustc_next_trait_solver/solve/eval_ctxt/
solver_region_constraints.rs

1//! Logic for `-Zassumptions-on-binders` stuff
2
3#[cfg(feature = "nightly")]
4use rustc_data_structures::transitive_relation::TransitiveRelationBuilder;
5use rustc_type_ir::inherent::*;
6use rustc_type_ir::outlives::{Component, push_outlives_components};
7#[cfg(not(feature = "nightly"))]
8use rustc_type_ir::region_constraint::TransitiveRelationBuilder;
9use rustc_type_ir::region_constraint::{
10    And, Assumptions, LeafRegionConstraint, Or, eagerly_handle_placeholders_in_universe,
11    propagate_ambiguity,
12};
13use rustc_type_ir::{
14    AliasTy, Binder, ClauseKind, InferCtxtLike, Interner, Region, TypeVisitable, TypeVisitableExt,
15    TypeVisitor, UniverseIndex,
16};
17use tracing::{debug, instrument};
18
19use crate::delegate::SolverDelegate;
20use crate::solve::{Certainty, EvalCtxt, Goal, NoSolution};
21
22/// Logic for `-Zassumptions-on-binders` stuff
23impl<'a, D, I> EvalCtxt<'a, D>
24where
25    D: SolverDelegate<Interner = I>,
26    I: Interner,
27{
28    /// Computes the assumptions associated with a binder for use in eagerly handling placeholders when
29    /// exiting the binder. Though, right now we do not actually handle placeholders when exiting binders,
30    /// instead we handle placeholders when computing the final response for the goal being computed.
31    {}
let __tracing_attr_span;
let __tracing_attr_guard;
if ::tracing::Level::DEBUG <= ::tracing::level_filters::STATIC_MAX_LEVEL &&
            ::tracing::Level::DEBUG <=
                ::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("region_assumptions_for_placeholders_in_universe",
                                "rustc_next_trait_solver::solve::eval_ctxt::solver_region_constraints",
                                ::tracing::Level::DEBUG,
                                ::tracing_core::__macro_support::Option::Some("/rustc-dev/809936eac66c547a5127ce1da805f0d3a6789b98/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/solver_region_constraints.rs"),
                                ::tracing_core::__macro_support::Option::Some(31u32),
                                ::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt::solver_region_constraints"),
                                ::tracing_core::field::FieldSet::new(&[{
                                                    const NAME:
                                                        ::tracing::__macro_support::FieldName<{
                                                            ::tracing::__macro_support::FieldName::len("t")
                                                        }> =
                                                        ::tracing::__macro_support::FieldName::new("t");
                                                    NAME.as_str()
                                                },
                                                {
                                                    const NAME:
                                                        ::tracing::__macro_support::FieldName<{
                                                            ::tracing::__macro_support::FieldName::len("u")
                                                        }> =
                                                        ::tracing::__macro_support::FieldName::new("u");
                                                    NAME.as_str()
                                                },
                                                {
                                                    const NAME:
                                                        ::tracing::__macro_support::FieldName<{
                                                            ::tracing::__macro_support::FieldName::len("param_env")
                                                        }> =
                                                        ::tracing::__macro_support::FieldName::new("param_env");
                                                    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::DEBUG <=
                                ::tracing::level_filters::STATIC_MAX_LEVEL &&
                            ::tracing::Level::DEBUG <=
                                ::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(&t)
                                                        as &dyn ::tracing::field::Value)),
                                            (::tracing::__macro_support::Option::Some(&::tracing::field::debug(&u)
                                                        as &dyn ::tracing::field::Value)),
                                            (::tracing::__macro_support::Option::Some(&::tracing::field::debug(&param_env)
                                                        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<Assumptions<I>> =
                            loop {};
                        return __tracing_attr_fake_return;
                    }
                    {
                        if !self.cx().assumptions_on_binders() {
                            ::core::panicking::panic("assertion failed: self.cx().assumptions_on_binders()")
                        };
                        struct RawAssumptions<'a, 'b,
                            D: SolverDelegate<Interner = I>, I: Interner> {
                            ecx: &'a mut EvalCtxt<'b, D, I>,
                            param_env: I::ParamEnv,
                            out: Vec<Goal<I, I::Predicate>>,
                        }
                        impl<D, I> TypeVisitor<I> for RawAssumptions<'_, '_, D, I>
                            where I: Interner, D: SolverDelegate<Interner = I> {
                            type Result = ();
                            fn visit_ty(&mut self, t: I::Ty) {
                                self.out.extend(self.ecx.well_formed_goals(self.param_env,
                                                t.into()).unwrap_or(::alloc::boxed::box_assume_init_into_vec_unsafe(::alloc::intrinsics::write_box_via_move(::alloc::boxed::Box::new_uninit(),
                                                    [Goal::new(self.ecx.cx(), self.param_env,
                                                                ClauseKind::WellFormed(t.into()))]))).into_iter());
                            }
                            fn visit_const(&mut self, c: I::Const) {
                                self.out.extend(self.ecx.well_formed_goals(self.param_env,
                                                c.into()).unwrap_or(::alloc::boxed::box_assume_init_into_vec_unsafe(::alloc::intrinsics::write_box_via_move(::alloc::boxed::Box::new_uninit(),
                                                    [Goal::new(self.ecx.cx(), self.param_env,
                                                                ClauseKind::WellFormed(c.into()))]))).into_iter());
                            }
                        }
                        let mut reqs_builder =
                            RawAssumptions {
                                ecx: self,
                                param_env,
                                out: ::alloc::vec::Vec::new(),
                            };
                        t.visit_with(&mut reqs_builder);
                        let reqs = reqs_builder.out;
                        if reqs.iter().any(|goal|
                                    { goal.predicate.has_non_region_infer() }) {
                            return None;
                        }
                        let clauses =
                            reqs.into_iter().filter_map(|goal|
                                    goal.predicate.as_clause());
                        Some(Assumptions::new(&**self.delegate, clauses,
                                TransitiveRelationBuilder::default().freeze(), u))
                    }
                })();
{
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/809936eac66c547a5127ce1da805f0d3a6789b98/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/solver_region_constraints.rs:31",
                        "rustc_next_trait_solver::solve::eval_ctxt::solver_region_constraints",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/809936eac66c547a5127ce1da805f0d3a6789b98/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/solver_region_constraints.rs"),
                        ::tracing_core::__macro_support::Option::Some(31u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt::solver_region_constraints"),
                        ::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::DEBUG <= ::tracing::level_filters::STATIC_MAX_LEVEL
                &&
                ::tracing::Level::DEBUG <=
                    ::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 = "debug", skip(self), ret)]
32    pub(super) fn region_assumptions_for_placeholders_in_universe(
33        &mut self,
34        t: impl TypeVisitable<I>,
35        u: UniverseIndex,
36        param_env: I::ParamEnv,
37    ) -> Option<Assumptions<I>> {
38        assert!(self.cx().assumptions_on_binders());
39
40        struct RawAssumptions<'a, 'b, D: SolverDelegate<Interner = I>, I: Interner> {
41            ecx: &'a mut EvalCtxt<'b, D, I>,
42            param_env: I::ParamEnv,
43            out: Vec<Goal<I, I::Predicate>>,
44        }
45
46        impl<D, I> TypeVisitor<I> for RawAssumptions<'_, '_, D, I>
47        where
48            I: Interner,
49            D: SolverDelegate<Interner = I>,
50        {
51            type Result = ();
52
53            fn visit_ty(&mut self, t: I::Ty) {
54                self.out.extend(
55                    self.ecx
56                        .well_formed_goals(self.param_env, t.into())
57                        .unwrap_or(vec![Goal::new(
58                            self.ecx.cx(),
59                            self.param_env,
60                            ClauseKind::WellFormed(t.into()),
61                        )])
62                        .into_iter(),
63                );
64            }
65
66            fn visit_const(&mut self, c: I::Const) {
67                self.out.extend(
68                    self.ecx
69                        .well_formed_goals(self.param_env, c.into())
70                        .unwrap_or(vec![Goal::new(
71                            self.ecx.cx(),
72                            self.param_env,
73                            ClauseKind::WellFormed(c.into()),
74                        )])
75                        .into_iter(),
76                );
77            }
78        }
79
80        let mut reqs_builder = RawAssumptions { ecx: self, param_env, out: vec![] };
81        t.visit_with(&mut reqs_builder);
82        let reqs = reqs_builder.out;
83
84        // If there are inference variables in type outlives then we may not be able
85        // to elaborate to the full set of implied bounds right now. To avoid incorrectly
86        // NoSolution'ing when lifting constraints to a lower universe due to no usable
87        // assumptions, we just bail here.
88        //
89        // This is somewhat imprecise as if both the infer var and the outlived region are
90        // in a lower universe than the binder we're computing assumptions for then it doesn't
91        // really matter as we wouldn't use those outlives as assumptions anyway.
92        if reqs.iter().any(|goal| {
93            // We don't care about region infers as they can't be further destructured
94            goal.predicate.has_non_region_infer()
95        }) {
96            return None;
97        }
98
99        // FIXME(-Zassumptions-on-binders): we need to normalize here/somewhere
100        // as we assume the type outlives assumptions only have rigid types :>
101        //
102        // `Assumptions::new` elaborates, restricts the clauses to `u` and picks out the
103        // outlives ones for us, so we just hand over everything the requirements gave us.
104        let clauses = reqs.into_iter().filter_map(|goal| goal.predicate.as_clause());
105
106        Some(Assumptions::new(
107            &**self.delegate,
108            clauses,
109            TransitiveRelationBuilder::default().freeze(),
110            u,
111        ))
112    }
113
114    {}
let __tracing_attr_span;
let __tracing_attr_guard;
if ::tracing::Level::DEBUG <= ::tracing::level_filters::STATIC_MAX_LEVEL &&
            ::tracing::Level::DEBUG <=
                ::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("eagerly_handle_placeholders",
                                "rustc_next_trait_solver::solve::eval_ctxt::solver_region_constraints",
                                ::tracing::Level::DEBUG,
                                ::tracing_core::__macro_support::Option::Some("/rustc-dev/809936eac66c547a5127ce1da805f0d3a6789b98/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/solver_region_constraints.rs"),
                                ::tracing_core::__macro_support::Option::Some(114u32),
                                ::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt::solver_region_constraints"),
                                ::tracing_core::field::FieldSet::new(&[],
                                    ::tracing_core::callsite::Identifier(&__CALLSITE)),
                                ::tracing::metadata::Kind::SPAN)
                        };
                    ::tracing::callsite::DefaultCallsite::new(&META)
                };
            let mut interest = ::tracing::subscriber::Interest::never();
            if ::tracing::Level::DEBUG <=
                                ::tracing::level_filters::STATIC_MAX_LEVEL &&
                            ::tracing::Level::DEBUG <=
                                ::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,
                    &{ meta.fields().value_set_all(&[]) })
            } 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<Certainty, NoSolution> = loop {};
                        return __tracing_attr_fake_return;
                    }
                    {
                        let constraint =
                            self.delegate.get_solver_region_constraint();
                        let smallest_universe = self.max_input_universe.index();
                        let largest_universe = self.delegate.universe().index();
                        {
                            use ::tracing::__macro_support::Callsite as _;
                            static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                                {
                                    static META: ::tracing::Metadata<'static> =
                                        {
                                            ::tracing_core::metadata::Metadata::new("event /rustc-dev/809936eac66c547a5127ce1da805f0d3a6789b98/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/solver_region_constraints.rs:120",
                                                "rustc_next_trait_solver::solve::eval_ctxt::solver_region_constraints",
                                                ::tracing::Level::DEBUG,
                                                ::tracing_core::__macro_support::Option::Some("/rustc-dev/809936eac66c547a5127ce1da805f0d3a6789b98/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/solver_region_constraints.rs"),
                                                ::tracing_core::__macro_support::Option::Some(120u32),
                                                ::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt::solver_region_constraints"),
                                                ::tracing_core::field::FieldSet::new(&[{
                                                                    const NAME:
                                                                        ::tracing::__macro_support::FieldName<{
                                                                            ::tracing::__macro_support::FieldName::len("smallest_universe")
                                                                        }> =
                                                                        ::tracing::__macro_support::FieldName::new("smallest_universe");
                                                                    NAME.as_str()
                                                                },
                                                                {
                                                                    const NAME:
                                                                        ::tracing::__macro_support::FieldName<{
                                                                            ::tracing::__macro_support::FieldName::len("largest_universe")
                                                                        }> =
                                                                        ::tracing::__macro_support::FieldName::new("largest_universe");
                                                                    NAME.as_str()
                                                                }], ::tracing_core::callsite::Identifier(&__CALLSITE)),
                                                ::tracing::metadata::Kind::EVENT)
                                        };
                                    ::tracing::callsite::DefaultCallsite::new(&META)
                                };
                            let enabled =
                                ::tracing::Level::DEBUG <=
                                            ::tracing::level_filters::STATIC_MAX_LEVEL &&
                                        ::tracing::Level::DEBUG <=
                                            ::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(&smallest_universe)
                                                                    as &dyn ::tracing::field::Value)),
                                                        (::tracing::__macro_support::Option::Some(&largest_universe
                                                                    as &dyn ::tracing::field::Value))])
                                    });
                            } else { ; }
                        };
                        let constraint =
                            ((smallest_universe +
                                                        1)..=largest_universe).map(|u|
                                            UniverseIndex::from_usize(u)).rev().fold(constraint,
                                |constraint, u|
                                    {
                                        eagerly_handle_placeholders_in_universe(&**self.delegate,
                                            constraint, u)
                                    });
                        let constraint = propagate_ambiguity(constraint);
                        {
                            use ::tracing::__macro_support::Callsite as _;
                            static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                                {
                                    static META: ::tracing::Metadata<'static> =
                                        {
                                            ::tracing_core::metadata::Metadata::new("event /rustc-dev/809936eac66c547a5127ce1da805f0d3a6789b98/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/solver_region_constraints.rs:130",
                                                "rustc_next_trait_solver::solve::eval_ctxt::solver_region_constraints",
                                                ::tracing::Level::DEBUG,
                                                ::tracing_core::__macro_support::Option::Some("/rustc-dev/809936eac66c547a5127ce1da805f0d3a6789b98/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/solver_region_constraints.rs"),
                                                ::tracing_core::__macro_support::Option::Some(130u32),
                                                ::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt::solver_region_constraints"),
                                                ::tracing_core::field::FieldSet::new(&["message"],
                                                    ::tracing_core::callsite::Identifier(&__CALLSITE)),
                                                ::tracing::metadata::Kind::EVENT)
                                        };
                                    ::tracing::callsite::DefaultCallsite::new(&META)
                                };
                            let enabled =
                                ::tracing::Level::DEBUG <=
                                            ::tracing::level_filters::STATIC_MAX_LEVEL &&
                                        ::tracing::Level::DEBUG <=
                                            ::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(&format_args!("final constraint={0:?}",
                                                                            constraint) as &dyn ::tracing::field::Value))])
                                    });
                            } else { ; }
                        };
                        self.delegate.overwrite_solver_region_constraint(constraint.clone(),
                            self.origin_span);
                        if constraint.is_false() {
                            Err(NoSolution)
                        } else if constraint.is_ambig() {
                            Ok(Certainty::AMBIGUOUS)
                        } else { Ok(Certainty::Yes) }
                    }
                })();
{
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/809936eac66c547a5127ce1da805f0d3a6789b98/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/solver_region_constraints.rs:114",
                        "rustc_next_trait_solver::solve::eval_ctxt::solver_region_constraints",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/809936eac66c547a5127ce1da805f0d3a6789b98/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/solver_region_constraints.rs"),
                        ::tracing_core::__macro_support::Option::Some(114u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt::solver_region_constraints"),
                        ::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::DEBUG <= ::tracing::level_filters::STATIC_MAX_LEVEL
                &&
                ::tracing::Level::DEBUG <=
                    ::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 = "debug", skip(self), ret)]
115    pub(super) fn eagerly_handle_placeholders(&mut self) -> Result<Certainty, NoSolution> {
116        let constraint = self.delegate.get_solver_region_constraint();
117
118        let smallest_universe = self.max_input_universe.index();
119        let largest_universe = self.delegate.universe().index();
120        debug!(?smallest_universe, largest_universe);
121
122        let constraint = ((smallest_universe + 1)..=largest_universe)
123            .map(|u| UniverseIndex::from_usize(u))
124            .rev()
125            .fold(constraint, |constraint, u| {
126                eagerly_handle_placeholders_in_universe(&**self.delegate, constraint, u)
127            });
128        let constraint = propagate_ambiguity(constraint);
129
130        debug!("final constraint={:?}", constraint);
131        self.delegate.overwrite_solver_region_constraint(constraint.clone(), self.origin_span);
132
133        if constraint.is_false() {
134            Err(NoSolution)
135        } else if constraint.is_ambig() {
136            Ok(Certainty::AMBIGUOUS)
137        } else {
138            Ok(Certainty::Yes)
139        }
140    }
141
142    /// Convert a type outlives constraint into a set of region outlives constraints and
143    /// type outlives constraints between the "components" of the type. E.g. `Foo<T, 'a>: 'b`
144    /// will be turned into `T: 'b, 'a: 'b`
145    {}
let __tracing_attr_span;
let __tracing_attr_guard;
if ::tracing::Level::DEBUG <= ::tracing::level_filters::STATIC_MAX_LEVEL &&
            ::tracing::Level::DEBUG <=
                ::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("destructure_type_outlives",
                                "rustc_next_trait_solver::solve::eval_ctxt::solver_region_constraints",
                                ::tracing::Level::DEBUG,
                                ::tracing_core::__macro_support::Option::Some("/rustc-dev/809936eac66c547a5127ce1da805f0d3a6789b98/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/solver_region_constraints.rs"),
                                ::tracing_core::__macro_support::Option::Some(145u32),
                                ::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt::solver_region_constraints"),
                                ::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()
                                                },
                                                {
                                                    const NAME:
                                                        ::tracing::__macro_support::FieldName<{
                                                            ::tracing::__macro_support::FieldName::len("r")
                                                        }> =
                                                        ::tracing::__macro_support::FieldName::new("r");
                                                    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::DEBUG <=
                                ::tracing::level_filters::STATIC_MAX_LEVEL &&
                            ::tracing::Level::DEBUG <=
                                ::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)),
                                            (::tracing::__macro_support::Option::Some(&::tracing::field::debug(&r)
                                                        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: Or<I> = loop {};
                        return __tracing_attr_fake_return;
                    }
                    {
                        let mut components = Default::default();
                        push_outlives_components(self.cx(), ty, &mut components);
                        self.destructure_components(&components, r)
                    }
                })();
{
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/809936eac66c547a5127ce1da805f0d3a6789b98/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/solver_region_constraints.rs:145",
                        "rustc_next_trait_solver::solve::eval_ctxt::solver_region_constraints",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/809936eac66c547a5127ce1da805f0d3a6789b98/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/solver_region_constraints.rs"),
                        ::tracing_core::__macro_support::Option::Some(145u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt::solver_region_constraints"),
                        ::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::DEBUG <= ::tracing::level_filters::STATIC_MAX_LEVEL
                &&
                ::tracing::Level::DEBUG <=
                    ::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 = "debug", skip(self), ret)]
146    pub(in crate::solve) fn destructure_type_outlives(&mut self, ty: I::Ty, r: Region<I>) -> Or<I> {
147        let mut components = Default::default();
148        push_outlives_components(self.cx(), ty, &mut components);
149        self.destructure_components(&components, r)
150    }
151
152    fn destructure_components(&mut self, components: &[Component<I>], r: Region<I>) -> Or<I> {
153        components
154            .into_iter()
155            .fold(Or::new_true(), |acc, c| Or::build_and(acc, self.destructure_component(c, r)))
156    }
157
158    fn destructure_component(&mut self, c: &Component<I>, r: Region<I>) -> Or<I> {
159        use Component::*;
160        use LeafRegionConstraint::*;
161        match c {
162            Region(c_r) => Or::new_leaf(RegionOutlives(*c_r, r, ())),
163            Placeholder(p) => {
164                Or::new_leaf(PlaceholderTyOutlives(Ty::new_placeholder(self.cx(), *p), r, ()))
165            }
166            Alias(_, alias) => self.destructure_alias_outlives(*alias, r),
167            UnresolvedInferenceVariable(_) => Or::new_ambig(()),
168            Param(_) => {
    ::core::panicking::panic_fmt(format_args!("Params should have been canonicalized to placeholders"));
}panic!("Params should have been canonicalized to placeholders"),
169            EscapingAlias(components) => self.destructure_components(components, r),
170        }
171    }
172
173    /// Convert an alias outlives constraint into an OR constraint of any number of three
174    /// separate classes of candidates:
175    /// 1. component outlives. we turn `Alias<T, 'a>: 'b` into `T: 'b, 'a: 'b`.
176    /// 2. item bounds. we turn `Alias<T, 'a>: 'b` into `'c: 'b` if `Alias` is
177    ///     defined as `type Alias<T, 'a>: 'c`
178    /// 3. env assumptions. we defer handling `Alias<T, 'a>: 'b` via where clauses until
179    ///     when exiting the current binder. See [`LeafRegionConstraint::AliasTyOutlivesViaEnv`].
180    {}
let __tracing_attr_span;
let __tracing_attr_guard;
if ::tracing::Level::DEBUG <= ::tracing::level_filters::STATIC_MAX_LEVEL &&
            ::tracing::Level::DEBUG <=
                ::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("destructure_alias_outlives",
                                "rustc_next_trait_solver::solve::eval_ctxt::solver_region_constraints",
                                ::tracing::Level::DEBUG,
                                ::tracing_core::__macro_support::Option::Some("/rustc-dev/809936eac66c547a5127ce1da805f0d3a6789b98/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/solver_region_constraints.rs"),
                                ::tracing_core::__macro_support::Option::Some(180u32),
                                ::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt::solver_region_constraints"),
                                ::tracing_core::field::FieldSet::new(&[{
                                                    const NAME:
                                                        ::tracing::__macro_support::FieldName<{
                                                            ::tracing::__macro_support::FieldName::len("alias")
                                                        }> =
                                                        ::tracing::__macro_support::FieldName::new("alias");
                                                    NAME.as_str()
                                                },
                                                {
                                                    const NAME:
                                                        ::tracing::__macro_support::FieldName<{
                                                            ::tracing::__macro_support::FieldName::len("r")
                                                        }> =
                                                        ::tracing::__macro_support::FieldName::new("r");
                                                    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::DEBUG <=
                                ::tracing::level_filters::STATIC_MAX_LEVEL &&
                            ::tracing::Level::DEBUG <=
                                ::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(&alias)
                                                        as &dyn ::tracing::field::Value)),
                                            (::tracing::__macro_support::Option::Some(&::tracing::field::debug(&r)
                                                        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: Or<I> = loop {};
                        return __tracing_attr_fake_return;
                    }
                    {
                        use LeafRegionConstraint::*;
                        let item_bounds =
                            rustc_type_ir::outlives::declared_bounds_from_definition(self.cx(),
                                    alias).map(|bound|
                                    And::new([RegionOutlives(bound, r, ())]));
                        let item_bound_outlives = Or::new(item_bounds);
                        let where_clause_outlives =
                            Or::new_leaf(AliasTyOutlivesViaEnv(Binder::dummy((alias,
                                            r)), ()));
                        let mut components = Default::default();
                        rustc_type_ir::outlives::compute_alias_components_recursive(self.cx(),
                            alias, &mut components);
                        let components_outlives =
                            self.destructure_components(&components, r);
                        let assumption_outlives =
                            Or::build_or(item_bound_outlives, where_clause_outlives);
                        Or::build_or(assumption_outlives, components_outlives)
                    }
                })();
{
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/809936eac66c547a5127ce1da805f0d3a6789b98/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/solver_region_constraints.rs:180",
                        "rustc_next_trait_solver::solve::eval_ctxt::solver_region_constraints",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/809936eac66c547a5127ce1da805f0d3a6789b98/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/solver_region_constraints.rs"),
                        ::tracing_core::__macro_support::Option::Some(180u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt::solver_region_constraints"),
                        ::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::DEBUG <= ::tracing::level_filters::STATIC_MAX_LEVEL
                &&
                ::tracing::Level::DEBUG <=
                    ::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 = "debug", skip(self), ret)]
181    fn destructure_alias_outlives(&mut self, alias: AliasTy<I>, r: Region<I>) -> Or<I> {
182        use LeafRegionConstraint::*;
183
184        let item_bounds =
185            rustc_type_ir::outlives::declared_bounds_from_definition(self.cx(), alias)
186                .map(|bound| And::new([RegionOutlives(bound, r, ())]));
187        let item_bound_outlives = Or::new(item_bounds);
188
189        let where_clause_outlives =
190            Or::new_leaf(AliasTyOutlivesViaEnv(Binder::dummy((alias, r)), ()));
191
192        let mut components = Default::default();
193        rustc_type_ir::outlives::compute_alias_components_recursive(
194            self.cx(),
195            alias,
196            &mut components,
197        );
198        let components_outlives = self.destructure_components(&components, r);
199
200        let assumption_outlives = Or::build_or(item_bound_outlives, where_clause_outlives);
201        Or::build_or(assumption_outlives, components_outlives)
202    }
203}