Skip to main content

rustc_infer/infer/lexical_region_resolve/
mod.rs

1//! Lexical region resolution.
2
3use std::fmt;
4
5use rustc_data_structures::fx::FxHashSet;
6use rustc_data_structures::intern::Interned;
7use rustc_data_structures::unord::UnordSet;
8use rustc_index::{IndexSlice, IndexVec};
9use rustc_middle::ty::{
10    self, ReBound, ReEarlyParam, ReErased, ReError, ReLateParam, RePlaceholder, ReStatic, ReVar,
11    Region, RegionVid, Ty, TyCtxt, TypeFoldable, fold_regions,
12};
13use rustc_span::{Span, bug, span_bug};
14use tracing::{debug, instrument};
15
16use super::outlives::test_type_match;
17use crate::infer::lexical_region_resolve::indexed_edges::{EdgeDirection, IndexedConstraintEdges};
18use crate::infer::region_constraints::{
19    ConstraintKind, GenericKind, RegionConstraintData, VarInfos, VerifyBound,
20};
21use crate::infer::{RegionRelations, RegionVariableOrigin, SubregionOrigin};
22
23mod indexed_edges;
24
25/// This function performs lexical region resolution given a complete
26/// set of constraints and variable origins. It performs a fixed-point
27/// iteration to find region values which satisfy all constraints,
28/// assuming such values can be found. It returns the final values of
29/// all the variables as well as a set of errors that must be reported.
30{}
#[allow(clippy :: suspicious_else_formatting)]
{
    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("resolve",
                                    "rustc_infer::infer::lexical_region_resolve",
                                    ::tracing::Level::DEBUG,
                                    ::tracing_core::__macro_support::Option::Some("/rustc-dev/d080e7dff1b0fc54541545252818f8cccf995d05/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs"),
                                    ::tracing_core::__macro_support::Option::Some(30u32),
                                    ::tracing_core::__macro_support::Option::Some("rustc_infer::infer::lexical_region_resolve"),
                                    ::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();
    }

    #[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:
                    (LexicalRegionResolutions<'tcx>,
                    Vec<RegionResolutionError<'tcx>>) = loop {};
            return __tracing_attr_fake_return;
        }
        {
            if !data.constraints.iter().all(|(c, _)|
                            match c.kind {
                                ConstraintKind::VarSubVar | ConstraintKind::RegSubVar |
                                    ConstraintKind::VarSubReg | ConstraintKind::RegSubReg =>
                                    true,
                                ConstraintKind::VarEqVar | ConstraintKind::VarEqReg |
                                    ConstraintKind::RegEqReg => false,
                            }) {
                {
                    ::core::panicking::panic_fmt(format_args!("Every constraint should be decomposed into outlives here"));
                }
            };
            let mut errors = ::alloc::vec::Vec::new();
            let mut resolver =
                LexicalResolver { region_rels, var_infos, data };
            let values = resolver.infer_variable_values(&mut errors);
            (values, errors)
        }
    }
}#[instrument(level = "debug", skip(region_rels, var_infos, data))]
31pub(crate) fn resolve<'tcx>(
32    region_rels: &RegionRelations<'_, 'tcx>,
33    var_infos: VarInfos<'tcx>,
34    data: RegionConstraintData<'tcx>,
35) -> (LexicalRegionResolutions<'tcx>, Vec<RegionResolutionError<'tcx>>) {
36    assert!(
37        data.constraints.iter().all(|(c, _)| match c.kind {
38            ConstraintKind::VarSubVar
39            | ConstraintKind::RegSubVar
40            | ConstraintKind::VarSubReg
41            | ConstraintKind::RegSubReg => true,
42
43            ConstraintKind::VarEqVar | ConstraintKind::VarEqReg | ConstraintKind::RegEqReg => false,
44        }),
45        "Every constraint should be decomposed into outlives here"
46    );
47
48    let mut errors = vec![];
49    let mut resolver = LexicalResolver { region_rels, var_infos, data };
50    let values = resolver.infer_variable_values(&mut errors);
51    (values, errors)
52}
53
54/// Contains the result of lexical region resolution. Offers methods
55/// to lookup up the final value of a region variable.
56#[derive(#[automatically_derived]
impl<'tcx> ::core::clone::Clone for LexicalRegionResolutions<'tcx> {
    #[inline]
    fn clone(&self) -> Self {
        Self { values: ::core::clone::Clone::clone(&self.values) }
    }
}Clone)]
57pub(crate) struct LexicalRegionResolutions<'tcx> {
58    pub(crate) values: IndexVec<RegionVid, VarValue<'tcx>>,
59}
60
61#[derive(#[automatically_derived]
impl<'tcx> ::core::marker::Copy for VarValue<'tcx> { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl<'tcx> ::core::clone::TrivialClone for VarValue<'tcx> { }
#[automatically_derived]
impl<'tcx> ::core::clone::Clone for VarValue<'tcx> {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<ty::UniverseIndex>;
        let _: ::core::clone::AssertParamIsClone<Region<'tcx>>;
        *self
    }
}Clone, #[automatically_derived]
impl<'tcx> ::core::fmt::Debug for VarValue<'tcx> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            Self::Empty(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Empty",
                    &__self_0),
            Self::Value(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Value",
                    &__self_0),
            Self::ErrorValue =>
                ::core::fmt::Formatter::write_str(f, "ErrorValue"),
        }
    }
}Debug)]
62pub(crate) enum VarValue<'tcx> {
63    /// Empty lifetime is for data that is never accessed. We tag the
64    /// empty lifetime with a universe -- the idea is that we don't
65    /// want `exists<'a> { forall<'b> { 'b: 'a } }` to be satisfiable.
66    /// Therefore, the `'empty` in a universe `U` is less than all
67    /// regions visible from `U`, but not less than regions not visible
68    /// from `U`.
69    Empty(ty::UniverseIndex),
70    Value(Region<'tcx>),
71    ErrorValue,
72}
73
74#[derive(#[automatically_derived]
impl<'tcx> ::core::clone::Clone for RegionResolutionError<'tcx> {
    #[inline]
    fn clone(&self) -> Self {
        match self {
            Self::ConcreteFailure(__self_0, __self_1, __self_2) =>
                Self::ConcreteFailure(::core::clone::Clone::clone(__self_0),
                    ::core::clone::Clone::clone(__self_1),
                    ::core::clone::Clone::clone(__self_2)),
            Self::GenericBoundFailure(__self_0, __self_1, __self_2) =>
                Self::GenericBoundFailure(::core::clone::Clone::clone(__self_0),
                    ::core::clone::Clone::clone(__self_1),
                    ::core::clone::Clone::clone(__self_2)),
            Self::SubSupConflict(__self_0, __self_1, __self_2, __self_3,
                __self_4, __self_5, __self_6) =>
                Self::SubSupConflict(::core::clone::Clone::clone(__self_0),
                    ::core::clone::Clone::clone(__self_1),
                    ::core::clone::Clone::clone(__self_2),
                    ::core::clone::Clone::clone(__self_3),
                    ::core::clone::Clone::clone(__self_4),
                    ::core::clone::Clone::clone(__self_5),
                    ::core::clone::Clone::clone(__self_6)),
            Self::UpperBoundUniverseConflict(__self_0, __self_1, __self_2,
                __self_3, __self_4) =>
                Self::UpperBoundUniverseConflict(::core::clone::Clone::clone(__self_0),
                    ::core::clone::Clone::clone(__self_1),
                    ::core::clone::Clone::clone(__self_2),
                    ::core::clone::Clone::clone(__self_3),
                    ::core::clone::Clone::clone(__self_4)),
            Self::CannotNormalize(__self_0, __self_1) =>
                Self::CannotNormalize(::core::clone::Clone::clone(__self_0),
                    ::core::clone::Clone::clone(__self_1)),
        }
    }
}Clone, #[automatically_derived]
impl<'tcx> ::core::fmt::Debug for RegionResolutionError<'tcx> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            Self::ConcreteFailure(__self_0, __self_1, __self_2) =>
                ::core::fmt::Formatter::debug_tuple_field3_finish(f,
                    "ConcreteFailure", __self_0, __self_1, &__self_2),
            Self::GenericBoundFailure(__self_0, __self_1, __self_2) =>
                ::core::fmt::Formatter::debug_tuple_field3_finish(f,
                    "GenericBoundFailure", __self_0, __self_1, &__self_2),
            Self::SubSupConflict(__self_0, __self_1, __self_2, __self_3,
                __self_4, __self_5, __self_6) => {
                let values: &[&dyn ::core::fmt::Debug] =
                    &[__self_0, __self_1, __self_2, __self_3, __self_4,
                                __self_5, &__self_6];
                ::core::fmt::Formatter::debug_tuple_fields_finish(f,
                    "SubSupConflict", values)
            }
            Self::UpperBoundUniverseConflict(__self_0, __self_1, __self_2,
                __self_3, __self_4) =>
                ::core::fmt::Formatter::debug_tuple_field5_finish(f,
                    "UpperBoundUniverseConflict", __self_0, __self_1, __self_2,
                    __self_3, &__self_4),
            Self::CannotNormalize(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f,
                    "CannotNormalize", __self_0, &__self_1),
        }
    }
}Debug)]
75pub enum RegionResolutionError<'tcx> {
76    /// `ConcreteFailure(o, a, b)`:
77    ///
78    /// `o` requires that `a <= b`, but this does not hold
79    ConcreteFailure(SubregionOrigin<'tcx>, Region<'tcx>, Region<'tcx>),
80
81    /// `GenericBoundFailure(p, s, a)`:
82    ///
83    /// The parameter/associated-type `p` must be known to outlive the lifetime
84    /// `a` (but none of the known bounds are sufficient).
85    GenericBoundFailure(SubregionOrigin<'tcx>, GenericKind<'tcx>, Region<'tcx>),
86
87    /// `SubSupConflict(v, v_origin, sub_origin, sub_r, sup_origin, sup_r)`:
88    ///
89    /// Could not infer a value for `v` (which has origin `v_origin`)
90    /// because `sub_r <= v` (due to `sub_origin`) but `v <= sup_r` (due to `sup_origin`) and
91    /// `sub_r <= sup_r` does not hold.
92    SubSupConflict(
93        RegionVid,
94        RegionVariableOrigin<'tcx>,
95        SubregionOrigin<'tcx>,
96        Region<'tcx>,
97        SubregionOrigin<'tcx>,
98        Region<'tcx>,
99        Vec<Span>, // All the influences on a given value that didn't meet its constraints.
100    ),
101
102    /// Indicates a `'b: 'a` constraint where `'a` is in a universe that
103    /// cannot name the placeholder `'b`.
104    UpperBoundUniverseConflict(
105        RegionVid,
106        RegionVariableOrigin<'tcx>,
107        ty::UniverseIndex,     // the universe index of the region variable
108        SubregionOrigin<'tcx>, // cause of the constraint
109        Region<'tcx>,          // the placeholder `'b`
110    ),
111
112    CannotNormalize(ty::PolyTypeOutlivesClause<'tcx>, SubregionOrigin<'tcx>),
113}
114
115impl<'tcx> RegionResolutionError<'tcx> {
116    pub fn origin(&self) -> &SubregionOrigin<'tcx> {
117        match self {
118            RegionResolutionError::ConcreteFailure(origin, _, _)
119            | RegionResolutionError::GenericBoundFailure(origin, _, _)
120            | RegionResolutionError::SubSupConflict(_, _, origin, _, _, _, _)
121            | RegionResolutionError::UpperBoundUniverseConflict(_, _, _, origin, _)
122            | RegionResolutionError::CannotNormalize(_, origin) => origin,
123        }
124    }
125}
126
127struct RegionAndOrigin<'tcx> {
128    region: Region<'tcx>,
129    origin: SubregionOrigin<'tcx>,
130}
131
132struct LexicalResolver<'cx, 'tcx> {
133    region_rels: &'cx RegionRelations<'cx, 'tcx>,
134    var_infos: VarInfos<'tcx>,
135    data: RegionConstraintData<'tcx>,
136}
137
138impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
139    fn tcx(&self) -> TyCtxt<'tcx> {
140        self.region_rels.tcx
141    }
142
143    fn infer_variable_values(
144        &mut self,
145        errors: &mut Vec<RegionResolutionError<'tcx>>,
146    ) -> LexicalRegionResolutions<'tcx> {
147        let mut var_data = self.construct_var_data();
148
149        // Deduplicating constraints is shown to have a positive perf impact.
150        let mut seen = UnordSet::default();
151        self.data.constraints.retain_mut(|(constraint, _)| {
152            // We don't want to discern constraints by leak check visibility here
153            constraint.visible_for_leak_check = ty::VisibleForLeakCheck::Unreachable;
154            seen.insert(*constraint)
155        });
156
157        if truecfg!(debug_assertions) {
158            self.dump_constraints();
159        }
160
161        self.expansion(&mut var_data);
162        self.collect_errors(&mut var_data, errors);
163        self.collect_var_errors(&var_data, errors);
164        var_data
165    }
166
167    fn num_vars(&self) -> usize {
168        self.var_infos.len()
169    }
170
171    /// Initially, the value for all variables is set to `'empty`, the
172    /// empty region. The `expansion` phase will grow this larger.
173    fn construct_var_data(&self) -> LexicalRegionResolutions<'tcx> {
174        LexicalRegionResolutions {
175            values: IndexVec::<RegionVid, _>::from_fn_n(
176                |vid| {
177                    let vid_universe = self.var_infos[vid].universe;
178                    VarValue::Empty(vid_universe)
179                },
180                self.num_vars(),
181            ),
182        }
183    }
184
185    {}
#[allow(clippy :: suspicious_else_formatting)]
{
    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("dump_constraints",
                                    "rustc_infer::infer::lexical_region_resolve",
                                    ::tracing::Level::DEBUG,
                                    ::tracing_core::__macro_support::Option::Some("/rustc-dev/d080e7dff1b0fc54541545252818f8cccf995d05/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs"),
                                    ::tracing_core::__macro_support::Option::Some(185u32),
                                    ::tracing_core::__macro_support::Option::Some("rustc_infer::infer::lexical_region_resolve"),
                                    ::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();
    }

    #[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: () = loop {};
            return __tracing_attr_fake_return;
        }
        {
            for (idx, (constraint, _)) in
                self.data.constraints.iter().enumerate() {
                {
                    use ::tracing::__macro_support::Callsite as _;
                    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                        {
                            static META: ::tracing::Metadata<'static> =
                                {
                                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/d080e7dff1b0fc54541545252818f8cccf995d05/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs:188",
                                        "rustc_infer::infer::lexical_region_resolve",
                                        ::tracing::Level::DEBUG,
                                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/d080e7dff1b0fc54541545252818f8cccf995d05/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs"),
                                        ::tracing_core::__macro_support::Option::Some(188u32),
                                        ::tracing_core::__macro_support::Option::Some("rustc_infer::infer::lexical_region_resolve"),
                                        ::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!("Constraint {0} => {1:?}",
                                                                    idx, constraint) as &dyn ::tracing::field::Value))])
                            });
                    } else { ; }
                };
            }
        }
    }
}#[instrument(level = "debug", skip(self))]
186    fn dump_constraints(&self) {
187        for (idx, (constraint, _)) in self.data.constraints.iter().enumerate() {
188            debug!("Constraint {} => {:?}", idx, constraint);
189        }
190    }
191
192    fn expansion(&self, var_values: &mut LexicalRegionResolutions<'tcx>) {
193        // In the first pass, we expand region vids according to constraints we
194        // have previously found. In the second pass, we loop through the region
195        // vids we expanded and expand *across* region vids (effectively
196        // "expanding" new `RegSubVar` constraints).
197
198        // Tracks the `VarSubVar` constraints generated for each region vid. We
199        // later use this to expand across vids.
200        let mut constraints = IndexVec::from_elem(Vec::new(), &var_values.values);
201        // Tracks the changed region vids.
202        let mut changes = Vec::new();
203        for (c, _) in &self.data.constraints {
204            match c.kind {
205                ConstraintKind::RegSubVar => {
206                    let sup_vid = c.sup.as_var();
207                    let sup_data = var_values.value_mut(sup_vid);
208
209                    if self.expand_node(c.sub, sup_vid, sup_data) {
210                        changes.push(sup_vid);
211                    }
212                }
213                ConstraintKind::VarSubVar => {
214                    let sub_vid = c.sub.as_var();
215                    let sup_vid = c.sup.as_var();
216                    match *var_values.value(sub_vid) {
217                        VarValue::ErrorValue => continue,
218                        VarValue::Empty(sub_universe) => {
219                            let sup_data = var_values.value_mut(sup_vid);
220
221                            let changed = match *sup_data {
222                                VarValue::Empty(sup_universe) => {
223                                    // Empty regions are ordered according to the universe
224                                    // they are associated with.
225                                    let ui = sub_universe.min(sup_universe);
226
227                                    {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/d080e7dff1b0fc54541545252818f8cccf995d05/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs:227",
                        "rustc_infer::infer::lexical_region_resolve",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/d080e7dff1b0fc54541545252818f8cccf995d05/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs"),
                        ::tracing_core::__macro_support::Option::Some(227u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_infer::infer::lexical_region_resolve"),
                        ::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!("Expanding value of {0:?} from empty lifetime with universe {1:?} to empty lifetime with universe {2:?}",
                                                    sup_vid, sup_universe, ui) as
                                            &dyn ::tracing::field::Value))])
            });
    } else { ; }
};debug!(
228                                        "Expanding value of {:?} \
229                                    from empty lifetime with universe {:?} \
230                                    to empty lifetime with universe {:?}",
231                                        sup_vid, sup_universe, ui
232                                    );
233
234                                    *sup_data = VarValue::Empty(ui);
235                                    true
236                                }
237                                VarValue::Value(cur_region) => {
238                                    match cur_region.kind() {
239                                        // If this empty region is from a universe that can name
240                                        // the placeholder universe, then the LUB is the
241                                        // Placeholder region (which is the cur_region). Otherwise,
242                                        // the LUB is the Static lifetime.
243                                        RePlaceholder(placeholder)
244                                            if !sub_universe.can_name(placeholder.universe) =>
245                                        {
246                                            let lub = self.tcx().lifetimes.re_static;
247                                            {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/d080e7dff1b0fc54541545252818f8cccf995d05/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs:247",
                        "rustc_infer::infer::lexical_region_resolve",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/d080e7dff1b0fc54541545252818f8cccf995d05/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs"),
                        ::tracing_core::__macro_support::Option::Some(247u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_infer::infer::lexical_region_resolve"),
                        ::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!("Expanding value of {0:?} from {1:?} to {2:?}",
                                                    sup_vid, cur_region, lub) as
                                            &dyn ::tracing::field::Value))])
            });
    } else { ; }
};debug!(
248                                                "Expanding value of {:?} from {:?} to {:?}",
249                                                sup_vid, cur_region, lub
250                                            );
251
252                                            *sup_data = VarValue::Value(lub);
253                                            true
254                                        }
255
256                                        _ => false,
257                                    }
258                                }
259
260                                VarValue::ErrorValue => false,
261                            };
262
263                            if changed {
264                                changes.push(sup_vid);
265                            }
266                            match sup_data {
267                                VarValue::Value(Region(Interned(ReStatic, _)))
268                                | VarValue::ErrorValue => (),
269                                _ => {
270                                    constraints[sub_vid].push((sub_vid, sup_vid));
271                                    constraints[sup_vid].push((sub_vid, sup_vid));
272                                }
273                            }
274                        }
275                        VarValue::Value(sub_region) => {
276                            let sup_data = var_values.value_mut(sup_vid);
277
278                            if self.expand_node(sub_region, sup_vid, sup_data) {
279                                changes.push(sup_vid);
280                            }
281                            match sup_data {
282                                VarValue::Value(Region(Interned(ReStatic, _)))
283                                | VarValue::ErrorValue => (),
284                                _ => {
285                                    constraints[sub_vid].push((sub_vid, sup_vid));
286                                    constraints[sup_vid].push((sub_vid, sup_vid));
287                                }
288                            }
289                        }
290                    }
291                }
292                ConstraintKind::RegSubReg | ConstraintKind::VarSubReg => {
293                    // These constraints are checked after expansion
294                    // is done, in `collect_errors`.
295                    continue;
296                }
297
298                ConstraintKind::VarEqVar | ConstraintKind::VarEqReg | ConstraintKind::RegEqReg => {
299                    ::core::panicking::panic("internal error: entered unreachable code")unreachable!()
300                }
301            }
302        }
303
304        while let Some(vid) = changes.pop() {
305            constraints[vid].retain(|&(a_vid, b_vid)| {
306                let VarValue::Value(a_region) = *var_values.value(a_vid) else {
307                    return false;
308                };
309                let b_data = var_values.value_mut(b_vid);
310                if self.expand_node(a_region, b_vid, b_data) {
311                    changes.push(b_vid);
312                }
313                !#[allow(non_exhaustive_omitted_patterns)] match b_data {
    VarValue::Value(Region(Interned(ReStatic, _))) | VarValue::ErrorValue =>
        true,
    _ => false,
}matches!(
314                    b_data,
315                    VarValue::Value(Region(Interned(ReStatic, _))) | VarValue::ErrorValue
316                )
317            });
318        }
319    }
320
321    /// Expands the value of the region represented with `b_vid` with current
322    /// value `b_data` to the lub of `b_data` and `a_region`. The corresponds
323    /// with the constraint `'?b: 'a` (`'a <: '?b`), where `'a` is some known
324    /// region and `'?b` is some region variable.
325    fn expand_node(
326        &self,
327        a_region: Region<'tcx>,
328        b_vid: RegionVid,
329        b_data: &mut VarValue<'tcx>,
330    ) -> bool {
331        {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/d080e7dff1b0fc54541545252818f8cccf995d05/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs:331",
                        "rustc_infer::infer::lexical_region_resolve",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/d080e7dff1b0fc54541545252818f8cccf995d05/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs"),
                        ::tracing_core::__macro_support::Option::Some(331u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_infer::infer::lexical_region_resolve"),
                        ::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!("expand_node({0:?}, {1:?} == {2:?})",
                                                    a_region, b_vid, b_data) as &dyn ::tracing::field::Value))])
            });
    } else { ; }
};debug!("expand_node({:?}, {:?} == {:?})", a_region, b_vid, b_data);
332
333        match *b_data {
334            VarValue::Empty(empty_ui) => {
335                let lub = match a_region.kind() {
336                    RePlaceholder(placeholder) => {
337                        // If this empty region is from a universe that can
338                        // name the placeholder, then the placeholder is
339                        // larger; otherwise, the only ancestor is `'static`.
340                        if empty_ui.can_name(placeholder.universe) {
341                            ty::Region::new_placeholder(self.tcx(), placeholder)
342                        } else {
343                            self.tcx().lifetimes.re_static
344                        }
345                    }
346
347                    _ => a_region,
348                };
349
350                {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/d080e7dff1b0fc54541545252818f8cccf995d05/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs:350",
                        "rustc_infer::infer::lexical_region_resolve",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/d080e7dff1b0fc54541545252818f8cccf995d05/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs"),
                        ::tracing_core::__macro_support::Option::Some(350u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_infer::infer::lexical_region_resolve"),
                        ::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!("Expanding value of {0:?} from empty lifetime to {1:?}",
                                                    b_vid, lub) as &dyn ::tracing::field::Value))])
            });
    } else { ; }
};debug!("Expanding value of {:?} from empty lifetime to {:?}", b_vid, lub);
351
352                *b_data = VarValue::Value(lub);
353                true
354            }
355            VarValue::Value(cur_region) => {
356                // This is a specialized version of the `lub_concrete_regions`
357                // check below for a common case, here purely as an
358                // optimization.
359                let b_universe = self.var_infos[b_vid].universe;
360
361                let mut lub = self.lub_concrete_regions(a_region, cur_region);
362                if lub == cur_region {
363                    return false;
364                }
365
366                // Watch out for `'b: !1` relationships, where the
367                // universe of `'b` can't name the placeholder `!1`. In
368                // that case, we have to grow `'b` to be `'static` for the
369                // relationship to hold. This is obviously a kind of sub-optimal
370                // choice -- in the future, when we incorporate a knowledge
371                // of the parameter environment, we might be able to find a
372                // tighter bound than `'static`.
373                //
374                // (This might e.g. arise from being asked to prove `for<'a> { 'b: 'a }`.)
375                if let ty::RePlaceholder(p) = lub.kind()
376                    && b_universe.cannot_name(p.universe)
377                {
378                    lub = self.tcx().lifetimes.re_static;
379                }
380
381                {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/d080e7dff1b0fc54541545252818f8cccf995d05/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs:381",
                        "rustc_infer::infer::lexical_region_resolve",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/d080e7dff1b0fc54541545252818f8cccf995d05/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs"),
                        ::tracing_core::__macro_support::Option::Some(381u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_infer::infer::lexical_region_resolve"),
                        ::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!("Expanding value of {0:?} from {1:?} to {2:?}",
                                                    b_vid, cur_region, lub) as &dyn ::tracing::field::Value))])
            });
    } else { ; }
};debug!("Expanding value of {:?} from {:?} to {:?}", b_vid, cur_region, lub);
382
383                *b_data = VarValue::Value(lub);
384                true
385            }
386
387            VarValue::ErrorValue => false,
388        }
389    }
390
391    /// True if `a <= b`.
392    fn sub_region_values(&self, a: VarValue<'tcx>, b: VarValue<'tcx>) -> bool {
393        match (a, b) {
394            // Error region is `'static`
395            (VarValue::ErrorValue, _) | (_, VarValue::ErrorValue) => return true,
396            (VarValue::Empty(a_ui), VarValue::Empty(b_ui)) => {
397                // Empty regions are ordered according to the universe
398                // they are associated with.
399                a_ui.min(b_ui) == b_ui
400            }
401            (VarValue::Value(a), VarValue::Empty(_)) => {
402                match a.kind() {
403                    // this is always on an error path,
404                    // so it doesn't really matter if it's shorter or longer than an empty region
405                    ReError(_) => false,
406
407                    ReBound(..) | ReErased => {
408                        ::rustc_span::macros::bug_impl(None,
    format_args!("cannot relate region: {0:?}", a), Location::caller());bug!("cannot relate region: {:?}", a);
409                    }
410
411                    ReVar(v_id) => {
412                        ::rustc_span::macros::bug_impl(Some(self.var_infos[v_id].origin.span()),
    format_args!("lub_concrete_regions invoked with non-concrete region: {0:?}",
        a), Location::caller());span_bug!(
413                            self.var_infos[v_id].origin.span(),
414                            "lub_concrete_regions invoked with non-concrete region: {:?}",
415                            a
416                        );
417                    }
418
419                    ReStatic | ReEarlyParam(_) | ReLateParam(_) => {
420                        // nothing lives longer than `'static`
421
422                        // All empty regions are less than early-bound, free,
423                        // and scope regions.
424
425                        false
426                    }
427
428                    RePlaceholder(_) => {
429                        // The LUB is either `a` or `'static`
430                        false
431                    }
432                }
433            }
434            (VarValue::Empty(a_ui), VarValue::Value(b)) => {
435                match b.kind() {
436                    // this is always on an error path,
437                    // so it doesn't really matter if it's shorter or longer than an empty region
438                    ReError(_) => false,
439
440                    ReBound(..) | ReErased => {
441                        ::rustc_span::macros::bug_impl(None,
    format_args!("cannot relate region: {0:?}", b), Location::caller());bug!("cannot relate region: {:?}", b);
442                    }
443
444                    ReVar(v_id) => {
445                        ::rustc_span::macros::bug_impl(Some(self.var_infos[v_id].origin.span()),
    format_args!("lub_concrete_regions invoked with non-concrete regions: {0:?}",
        b), Location::caller());span_bug!(
446                            self.var_infos[v_id].origin.span(),
447                            "lub_concrete_regions invoked with non-concrete regions: {:?}",
448                            b
449                        );
450                    }
451
452                    ReStatic | ReEarlyParam(_) | ReLateParam(_) => {
453                        // nothing lives longer than `'static`
454                        // All empty regions are less than early-bound, late-bound,
455                        // and scope regions.
456                        true
457                    }
458
459                    RePlaceholder(placeholder) => {
460                        // If this empty region is from a universe that can
461                        // name the placeholder, then the placeholder is
462                        // larger; otherwise, the only ancestor is `'static`.
463                        return a_ui.can_name(placeholder.universe);
464                    }
465                }
466            }
467            (VarValue::Value(a), VarValue::Value(b)) => self.sub_concrete_regions(a, b),
468        }
469    }
470
471    /// True if `a <= b`, but not defined over inference variables.
472    {}
#[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("sub_concrete_regions",
                                    "rustc_infer::infer::lexical_region_resolve",
                                    ::tracing::Level::TRACE,
                                    ::tracing_core::__macro_support::Option::Some("/rustc-dev/d080e7dff1b0fc54541545252818f8cccf995d05/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs"),
                                    ::tracing_core::__macro_support::Option::Some(472u32),
                                    ::tracing_core::__macro_support::Option::Some("rustc_infer::infer::lexical_region_resolve"),
                                    ::tracing_core::field::FieldSet::new(&[{
                                                        const NAME:
                                                            ::tracing::__macro_support::FieldName<{
                                                                ::tracing::__macro_support::FieldName::len("a")
                                                            }> =
                                                            ::tracing::__macro_support::FieldName::new("a");
                                                        NAME.as_str()
                                                    },
                                                    {
                                                        const NAME:
                                                            ::tracing::__macro_support::FieldName<{
                                                                ::tracing::__macro_support::FieldName::len("b")
                                                            }> =
                                                            ::tracing::__macro_support::FieldName::new("b");
                                                        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(&a)
                                                            as &dyn ::tracing::field::Value)),
                                                (::tracing::__macro_support::Option::Some(&::tracing::field::debug(&b)
                                                            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: bool = loop {};
            return __tracing_attr_fake_return;
        }
        {
            let tcx = self.tcx();
            let sub_free_regions =
                |r1, r2|
                    self.region_rels.free_regions.sub_free_regions(tcx, r1, r2);
            if b.is_free() && sub_free_regions(tcx.lifetimes.re_static, b) {
                return true;
            }
            if a.is_free() && b.is_free() { return sub_free_regions(a, b); }
            self.lub_concrete_regions(a, b) == b
        }
    }
}#[instrument(level = "trace", skip(self))]
473    fn sub_concrete_regions(&self, a: Region<'tcx>, b: Region<'tcx>) -> bool {
474        let tcx = self.tcx();
475        let sub_free_regions = |r1, r2| self.region_rels.free_regions.sub_free_regions(tcx, r1, r2);
476
477        // Check for the case where we know that `'b: 'static` -- in that case,
478        // `a <= b` for all `a`.
479        if b.is_free() && sub_free_regions(tcx.lifetimes.re_static, b) {
480            return true;
481        }
482
483        // If both `a` and `b` are free, consult the declared
484        // relationships. Note that this can be more precise than the
485        // `lub` relationship defined below, since sometimes the "lub"
486        // is actually the `postdom_upper_bound` (see
487        // `TransitiveRelation` for more details).
488        if a.is_free() && b.is_free() {
489            return sub_free_regions(a, b);
490        }
491
492        // For other cases, leverage the LUB code to find the LUB and
493        // check if it is equal to `b`.
494        self.lub_concrete_regions(a, b) == b
495    }
496
497    /// Returns the least-upper-bound of `a` and `b`; i.e., the
498    /// smallest region `c` such that `a <= c` and `b <= c`.
499    ///
500    /// Neither `a` nor `b` may be an inference variable (hence the
501    /// term "concrete regions").
502    {}
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("lub_concrete_regions",
                                "rustc_infer::infer::lexical_region_resolve",
                                ::tracing::Level::TRACE,
                                ::tracing_core::__macro_support::Option::Some("/rustc-dev/d080e7dff1b0fc54541545252818f8cccf995d05/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs"),
                                ::tracing_core::__macro_support::Option::Some(502u32),
                                ::tracing_core::__macro_support::Option::Some("rustc_infer::infer::lexical_region_resolve"),
                                ::tracing_core::field::FieldSet::new(&[{
                                                    const NAME:
                                                        ::tracing::__macro_support::FieldName<{
                                                            ::tracing::__macro_support::FieldName::len("a")
                                                        }> =
                                                        ::tracing::__macro_support::FieldName::new("a");
                                                    NAME.as_str()
                                                },
                                                {
                                                    const NAME:
                                                        ::tracing::__macro_support::FieldName<{
                                                            ::tracing::__macro_support::FieldName::len("b")
                                                        }> =
                                                        ::tracing::__macro_support::FieldName::new("b");
                                                    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(&a)
                                                        as &dyn ::tracing::field::Value)),
                                            (::tracing::__macro_support::Option::Some(&::tracing::field::debug(&b)
                                                        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: Region<'tcx> = loop {};
                        return __tracing_attr_fake_return;
                    }
                    {
                        match (a.kind(), b.kind()) {
                            (ReBound(..), _) | (_, ReBound(..)) | (ReErased, _) |
                                (_, ReErased) => {
                                ::rustc_span::macros::bug_impl(None,
                                    format_args!("cannot relate region: LUB({0:?}, {1:?})", a,
                                        b), Location::caller());
                            }
                            (ReVar(v_id), _) | (_, ReVar(v_id)) => {
                                ::rustc_span::macros::bug_impl(Some(self.var_infos[v_id].origin.span()),
                                    format_args!("lub_concrete_regions invoked with non-concrete regions: {0:?}, {1:?}",
                                        a, b), Location::caller());
                            }
                            (ReError(_), _) => a,
                            (_, ReError(_)) => b,
                            (ReStatic, _) | (_, ReStatic) => {
                                self.tcx().lifetimes.re_static
                            }
                            (ReEarlyParam(_) | ReLateParam(_),
                                ReEarlyParam(_) | ReLateParam(_)) => {
                                self.region_rels.lub_param_regions(a, b)
                            }
                            (RePlaceholder(..), _) | (_, RePlaceholder(..)) => {
                                if a == b { a } else { self.tcx().lifetimes.re_static }
                            }
                        }
                    }
                })();
{
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/d080e7dff1b0fc54541545252818f8cccf995d05/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs:502",
                        "rustc_infer::infer::lexical_region_resolve",
                        ::tracing::Level::TRACE,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/d080e7dff1b0fc54541545252818f8cccf995d05/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs"),
                        ::tracing_core::__macro_support::Option::Some(502u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_infer::infer::lexical_region_resolve"),
                        ::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)]
503    fn lub_concrete_regions(&self, a: Region<'tcx>, b: Region<'tcx>) -> Region<'tcx> {
504        match (a.kind(), b.kind()) {
505            (ReBound(..), _) | (_, ReBound(..)) | (ReErased, _) | (_, ReErased) => {
506                bug!("cannot relate region: LUB({:?}, {:?})", a, b);
507            }
508
509            (ReVar(v_id), _) | (_, ReVar(v_id)) => {
510                span_bug!(
511                    self.var_infos[v_id].origin.span(),
512                    "lub_concrete_regions invoked with non-concrete \
513                     regions: {:?}, {:?}",
514                    a,
515                    b
516                );
517            }
518
519            (ReError(_), _) => a,
520
521            (_, ReError(_)) => b,
522
523            (ReStatic, _) | (_, ReStatic) => {
524                // nothing lives longer than `'static`
525                self.tcx().lifetimes.re_static
526            }
527
528            (ReEarlyParam(_) | ReLateParam(_), ReEarlyParam(_) | ReLateParam(_)) => {
529                self.region_rels.lub_param_regions(a, b)
530            }
531
532            // For these types, we cannot define any additional
533            // relationship:
534            (RePlaceholder(..), _) | (_, RePlaceholder(..)) => {
535                if a == b {
536                    a
537                } else {
538                    self.tcx().lifetimes.re_static
539                }
540            }
541        }
542    }
543
544    /// After expansion is complete, go and check upper bounds (i.e.,
545    /// cases where the region cannot grow larger than a fixed point)
546    /// and check that they are satisfied.
547    {}
#[allow(clippy :: suspicious_else_formatting)]
{
    let __tracing_attr_span;
    let __tracing_attr_guard;
    if ::tracing::Level::INFO <= ::tracing::level_filters::STATIC_MAX_LEVEL &&
                ::tracing::Level::INFO <=
                    ::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("collect_errors",
                                    "rustc_infer::infer::lexical_region_resolve",
                                    ::tracing::Level::INFO,
                                    ::tracing_core::__macro_support::Option::Some("/rustc-dev/d080e7dff1b0fc54541545252818f8cccf995d05/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs"),
                                    ::tracing_core::__macro_support::Option::Some(547u32),
                                    ::tracing_core::__macro_support::Option::Some("rustc_infer::infer::lexical_region_resolve"),
                                    ::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::INFO <=
                                    ::tracing::level_filters::STATIC_MAX_LEVEL &&
                                ::tracing::Level::INFO <=
                                    ::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();
    }

    #[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: () = loop {};
            return __tracing_attr_fake_return;
        }
        {
            for (c, origin) in &self.data.constraints {
                {
                    use ::tracing::__macro_support::Callsite as _;
                    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                        {
                            static META: ::tracing::Metadata<'static> =
                                {
                                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/d080e7dff1b0fc54541545252818f8cccf995d05/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs:554",
                                        "rustc_infer::infer::lexical_region_resolve",
                                        ::tracing::Level::DEBUG,
                                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/d080e7dff1b0fc54541545252818f8cccf995d05/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs"),
                                        ::tracing_core::__macro_support::Option::Some(554u32),
                                        ::tracing_core::__macro_support::Option::Some("rustc_infer::infer::lexical_region_resolve"),
                                        ::tracing_core::field::FieldSet::new(&[{
                                                            const NAME:
                                                                ::tracing::__macro_support::FieldName<{
                                                                    ::tracing::__macro_support::FieldName::len("c")
                                                                }> =
                                                                ::tracing::__macro_support::FieldName::new("c");
                                                            NAME.as_str()
                                                        },
                                                        {
                                                            const NAME:
                                                                ::tracing::__macro_support::FieldName<{
                                                                    ::tracing::__macro_support::FieldName::len("origin")
                                                                }> =
                                                                ::tracing::__macro_support::FieldName::new("origin");
                                                            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(&c)
                                                            as &dyn ::tracing::field::Value)),
                                                (::tracing::__macro_support::Option::Some(&::tracing::field::debug(&origin)
                                                            as &dyn ::tracing::field::Value))])
                            });
                    } else { ; }
                };
                match c.kind {
                    ConstraintKind::RegSubVar | ConstraintKind::VarSubVar => {}
                    ConstraintKind::RegSubReg => {
                        if self.sub_concrete_regions(c.sub, c.sup) { continue; }
                        {
                            use ::tracing::__macro_support::Callsite as _;
                            static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                                {
                                    static META: ::tracing::Metadata<'static> =
                                        {
                                            ::tracing_core::metadata::Metadata::new("event /rustc-dev/d080e7dff1b0fc54541545252818f8cccf995d05/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs:565",
                                                "rustc_infer::infer::lexical_region_resolve",
                                                ::tracing::Level::DEBUG,
                                                ::tracing_core::__macro_support::Option::Some("/rustc-dev/d080e7dff1b0fc54541545252818f8cccf995d05/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs"),
                                                ::tracing_core::__macro_support::Option::Some(565u32),
                                                ::tracing_core::__macro_support::Option::Some("rustc_infer::infer::lexical_region_resolve"),
                                                ::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!("region error at {0:?}: cannot verify that {1:?} <= {2:?}",
                                                                            origin, c.sub, c.sup) as &dyn ::tracing::field::Value))])
                                    });
                            } else { ; }
                        };
                        errors.push(RegionResolutionError::ConcreteFailure((*origin).clone(),
                                c.sub, c.sup));
                    }
                    ConstraintKind::VarSubReg => {
                        let sub_vid = c.sub.as_var();
                        let sub_data = var_data.value_mut(sub_vid);
                        {
                            use ::tracing::__macro_support::Callsite as _;
                            static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                                {
                                    static META: ::tracing::Metadata<'static> =
                                        {
                                            ::tracing_core::metadata::Metadata::new("event /rustc-dev/d080e7dff1b0fc54541545252818f8cccf995d05/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs:580",
                                                "rustc_infer::infer::lexical_region_resolve",
                                                ::tracing::Level::DEBUG,
                                                ::tracing_core::__macro_support::Option::Some("/rustc-dev/d080e7dff1b0fc54541545252818f8cccf995d05/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs"),
                                                ::tracing_core::__macro_support::Option::Some(580u32),
                                                ::tracing_core::__macro_support::Option::Some("rustc_infer::infer::lexical_region_resolve"),
                                                ::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!("contraction: {0:?} == {1:?}, {2:?}",
                                                                            sub_vid, sub_data, c.sup) as
                                                                    &dyn ::tracing::field::Value))])
                                    });
                            } else { ; }
                        };
                        let VarValue::Value(sub_region) =
                            *sub_data else { continue; };
                        if !self.sub_concrete_regions(sub_region, c.sup) {
                            {
                                use ::tracing::__macro_support::Callsite as _;
                                static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                                    {
                                        static META: ::tracing::Metadata<'static> =
                                            {
                                                ::tracing_core::metadata::Metadata::new("event /rustc-dev/d080e7dff1b0fc54541545252818f8cccf995d05/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs:590",
                                                    "rustc_infer::infer::lexical_region_resolve",
                                                    ::tracing::Level::DEBUG,
                                                    ::tracing_core::__macro_support::Option::Some("/rustc-dev/d080e7dff1b0fc54541545252818f8cccf995d05/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs"),
                                                    ::tracing_core::__macro_support::Option::Some(590u32),
                                                    ::tracing_core::__macro_support::Option::Some("rustc_infer::infer::lexical_region_resolve"),
                                                    ::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!("region error at {0:?}: cannot verify that {1:?}={2:?} <= {3:?}",
                                                                                origin, sub_vid, sub_region, c.sup) as
                                                                        &dyn ::tracing::field::Value))])
                                        });
                                } else { ; }
                            };
                            *sub_data = VarValue::ErrorValue;
                        }
                    }
                    ConstraintKind::VarEqVar | ConstraintKind::VarEqReg |
                        ConstraintKind::RegEqReg => {
                        ::core::panicking::panic("internal error: entered unreachable code")
                    }
                }
            }
            for verify in &self.data.verifys {
                {
                    use ::tracing::__macro_support::Callsite as _;
                    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                        {
                            static META: ::tracing::Metadata<'static> =
                                {
                                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/d080e7dff1b0fc54541545252818f8cccf995d05/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs:605",
                                        "rustc_infer::infer::lexical_region_resolve",
                                        ::tracing::Level::DEBUG,
                                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/d080e7dff1b0fc54541545252818f8cccf995d05/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs"),
                                        ::tracing_core::__macro_support::Option::Some(605u32),
                                        ::tracing_core::__macro_support::Option::Some("rustc_infer::infer::lexical_region_resolve"),
                                        ::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!("collect_errors: verify={0:?}",
                                                                    verify) as &dyn ::tracing::field::Value))])
                            });
                    } else { ; }
                };
                let sub = var_data.normalize(self.tcx(), verify.region);
                let verify_kind_ty = verify.kind.to_ty(self.tcx());
                let verify_kind_ty =
                    var_data.normalize(self.tcx(), verify_kind_ty);
                if self.bound_is_met(&verify.bound, var_data, verify_kind_ty,
                        sub) {
                    continue;
                }
                {
                    use ::tracing::__macro_support::Callsite as _;
                    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                        {
                            static META: ::tracing::Metadata<'static> =
                                {
                                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/d080e7dff1b0fc54541545252818f8cccf995d05/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs:614",
                                        "rustc_infer::infer::lexical_region_resolve",
                                        ::tracing::Level::DEBUG,
                                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/d080e7dff1b0fc54541545252818f8cccf995d05/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs"),
                                        ::tracing_core::__macro_support::Option::Some(614u32),
                                        ::tracing_core::__macro_support::Option::Some("rustc_infer::infer::lexical_region_resolve"),
                                        ::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!("collect_errors: region error at {0:?}: cannot verify that {1:?} <= {2:?}",
                                                                    verify.origin, verify.region, verify.bound) as
                                                            &dyn ::tracing::field::Value))])
                            });
                    } else { ; }
                };
                errors.push(RegionResolutionError::GenericBoundFailure(verify.origin.clone(),
                        verify.kind, sub));
            }
        }
    }
}#[instrument(skip(self, var_data, errors))]
548    fn collect_errors(
549        &self,
550        var_data: &mut LexicalRegionResolutions<'tcx>,
551        errors: &mut Vec<RegionResolutionError<'tcx>>,
552    ) {
553        for (c, origin) in &self.data.constraints {
554            debug!(?c, ?origin);
555            match c.kind {
556                ConstraintKind::RegSubVar | ConstraintKind::VarSubVar => {
557                    // Expansion will ensure that these constraints hold. Ignore.
558                }
559
560                ConstraintKind::RegSubReg => {
561                    if self.sub_concrete_regions(c.sub, c.sup) {
562                        continue;
563                    }
564
565                    debug!(
566                        "region error at {:?}: cannot verify that {:?} <= {:?}",
567                        origin, c.sub, c.sup
568                    );
569
570                    errors.push(RegionResolutionError::ConcreteFailure(
571                        (*origin).clone(),
572                        c.sub,
573                        c.sup,
574                    ));
575                }
576
577                ConstraintKind::VarSubReg => {
578                    let sub_vid = c.sub.as_var();
579                    let sub_data = var_data.value_mut(sub_vid);
580                    debug!("contraction: {:?} == {:?}, {:?}", sub_vid, sub_data, c.sup);
581
582                    let VarValue::Value(sub_region) = *sub_data else {
583                        continue;
584                    };
585
586                    // Do not report these errors immediately:
587                    // instead, set the variable value to error and
588                    // collect them later.
589                    if !self.sub_concrete_regions(sub_region, c.sup) {
590                        debug!(
591                            "region error at {:?}: cannot verify that {:?}={:?} <= {:?}",
592                            origin, sub_vid, sub_region, c.sup
593                        );
594                        *sub_data = VarValue::ErrorValue;
595                    }
596                }
597
598                ConstraintKind::VarEqVar | ConstraintKind::VarEqReg | ConstraintKind::RegEqReg => {
599                    unreachable!()
600                }
601            }
602        }
603
604        for verify in &self.data.verifys {
605            debug!("collect_errors: verify={:?}", verify);
606            let sub = var_data.normalize(self.tcx(), verify.region);
607
608            let verify_kind_ty = verify.kind.to_ty(self.tcx());
609            let verify_kind_ty = var_data.normalize(self.tcx(), verify_kind_ty);
610            if self.bound_is_met(&verify.bound, var_data, verify_kind_ty, sub) {
611                continue;
612            }
613
614            debug!(
615                "collect_errors: region error at {:?}: \
616                 cannot verify that {:?} <= {:?}",
617                verify.origin, verify.region, verify.bound
618            );
619
620            errors.push(RegionResolutionError::GenericBoundFailure(
621                verify.origin.clone(),
622                verify.kind,
623                sub,
624            ));
625        }
626    }
627
628    /// Go over the variables that were declared to be error variables
629    /// and create a `RegionResolutionError` for each of them.
630    fn collect_var_errors(
631        &self,
632        var_data: &LexicalRegionResolutions<'tcx>,
633        errors: &mut Vec<RegionResolutionError<'tcx>>,
634    ) {
635        {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/d080e7dff1b0fc54541545252818f8cccf995d05/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs:635",
                        "rustc_infer::infer::lexical_region_resolve",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/d080e7dff1b0fc54541545252818f8cccf995d05/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs"),
                        ::tracing_core::__macro_support::Option::Some(635u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_infer::infer::lexical_region_resolve"),
                        ::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!("collect_var_errors, var_data = {0:#?}",
                                                    var_data.values) as &dyn ::tracing::field::Value))])
            });
    } else { ; }
};debug!("collect_var_errors, var_data = {:#?}", var_data.values);
636
637        // This is the best way that I have found to suppress
638        // duplicate and related errors. Basically we keep a set of
639        // flags for every node. Whenever an error occurs, we will
640        // walk some portion of the graph looking to find pairs of
641        // conflicting regions to report to the user. As we walk, we
642        // trip the flags from false to true, and if we find that
643        // we've already reported an error involving any particular
644        // node we just stop and don't report the current error. The
645        // idea is to report errors that derive from independent
646        // regions of the graph, but not those that derive from
647        // overlapping locations.
648        let mut dup_vec = IndexVec::from_elem_n(None, self.num_vars());
649
650        // Only construct the edge index when necessary, because it's moderately expensive.
651        let mut edges: Option<IndexedConstraintEdges<'_, 'tcx>> = None;
652
653        for (node_vid, value) in var_data.values.iter_enumerated() {
654            match *value {
655                VarValue::Empty(_) | VarValue::Value(_) => { /* Inference successful */ }
656                VarValue::ErrorValue => {
657                    // Inference impossible: this value contains
658                    // inconsistent constraints.
659                    //
660                    // I think that in this case we should report an
661                    // error now -- unlike the case above, we can't
662                    // wait to see whether the user needs the result
663                    // of this variable. The reason is that the mere
664                    // existence of this variable implies that the
665                    // region graph is inconsistent, whether or not it
666                    // is used.
667                    //
668                    // For example, we may have created a region
669                    // variable that is the GLB of two other regions
670                    // which do not have a GLB. Even if that variable
671                    // is not used, it implies that those two regions
672                    // *should* have a GLB.
673                    //
674                    // At least I think this is true. It may be that
675                    // the mere existence of a conflict in a region
676                    // variable that is not used is not a problem, so
677                    // if this rule starts to create problems we'll
678                    // have to revisit this portion of the code and
679                    // think hard about it. =) -- nikomatsakis
680
681                    // Obtain the spans for all the places that can
682                    // influence the constraints on this value for
683                    // richer diagnostics in `static_impl_trait`.
684
685                    let e = edges.get_or_insert_with(|| {
686                        IndexedConstraintEdges::build_index(self.num_vars(), &self.data)
687                    });
688                    self.collect_error_for_expanding_node(e, &mut dup_vec, node_vid, errors);
689                }
690            }
691        }
692    }
693
694    fn collect_error_for_expanding_node(
695        &self,
696        edges: &IndexedConstraintEdges<'_, 'tcx>,
697        dup_vec: &mut IndexSlice<RegionVid, Option<RegionVid>>,
698        node_idx: RegionVid,
699        errors: &mut Vec<RegionResolutionError<'tcx>>,
700    ) {
701        // Errors in expanding nodes result from a lower-bound that is
702        // not contained by an upper-bound.
703        let (mut lower_bounds, lower_vid_bounds, lower_dup) =
704            self.collect_bounding_regions(edges, node_idx, EdgeDirection::In, Some(dup_vec));
705        let (mut upper_bounds, _, upper_dup) =
706            self.collect_bounding_regions(edges, node_idx, EdgeDirection::Out, Some(dup_vec));
707
708        if lower_dup || upper_dup {
709            return;
710        }
711
712        // We place late-bound regions first because we are special casing
713        // SubSupConflict(ReLateParam, ReLateParam) when reporting error, and so
714        // the user will more likely get a specific suggestion.
715        fn region_order_key(x: &RegionAndOrigin<'_>) -> u8 {
716            match x.region.kind() {
717                ReEarlyParam(_) => 0,
718                ReLateParam(_) => 1,
719                _ => 2,
720            }
721        }
722        lower_bounds.sort_by_key(region_order_key);
723        upper_bounds.sort_by_key(region_order_key);
724
725        let node_universe = self.var_infos[node_idx].universe;
726
727        for lower_bound in &lower_bounds {
728            let effective_lower_bound = if let ty::RePlaceholder(p) = lower_bound.region.kind() {
729                if node_universe.cannot_name(p.universe) {
730                    self.tcx().lifetimes.re_static
731                } else {
732                    lower_bound.region
733                }
734            } else {
735                lower_bound.region
736            };
737
738            for upper_bound in &upper_bounds {
739                if !self.sub_concrete_regions(effective_lower_bound, upper_bound.region) {
740                    let origin = self.var_infos[node_idx].origin;
741                    {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/d080e7dff1b0fc54541545252818f8cccf995d05/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs:741",
                        "rustc_infer::infer::lexical_region_resolve",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/d080e7dff1b0fc54541545252818f8cccf995d05/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs"),
                        ::tracing_core::__macro_support::Option::Some(741u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_infer::infer::lexical_region_resolve"),
                        ::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!("region inference error at {0:?} for {1:?}: SubSupConflict sub: {2:?} sup: {3:?}",
                                                    origin, node_idx, lower_bound.region, upper_bound.region) as
                                            &dyn ::tracing::field::Value))])
            });
    } else { ; }
};debug!(
742                        "region inference error at {:?} for {:?}: SubSupConflict sub: {:?} \
743                         sup: {:?}",
744                        origin, node_idx, lower_bound.region, upper_bound.region
745                    );
746
747                    errors.push(RegionResolutionError::SubSupConflict(
748                        node_idx,
749                        origin,
750                        lower_bound.origin.clone(),
751                        lower_bound.region,
752                        upper_bound.origin.clone(),
753                        upper_bound.region,
754                        ::alloc::vec::Vec::new()vec![],
755                    ));
756                    return;
757                }
758            }
759        }
760
761        // If we have a scenario like `exists<'a> { forall<'b> { 'b:
762        // 'a } }`, we wind up without any lower-bound -- all we have
763        // are placeholders as upper bounds, but the universe of the
764        // variable `'a`, or some variable that `'a` has to outlive, doesn't
765        // permit those placeholders.
766        //
767        // We only iterate to find the min, which means it doesn't cause reproducibility issues
768        #[allow(rustc::potential_query_instability)]
769        let min_universe = lower_vid_bounds
770            .into_iter()
771            .map(|vid| self.var_infos[vid].universe)
772            .min()
773            .expect("lower_vid_bounds should at least include `node_idx`");
774
775        for upper_bound in &upper_bounds {
776            if let ty::RePlaceholder(p) = upper_bound.region.kind() {
777                if min_universe.cannot_name(p.universe) {
778                    let origin = self.var_infos[node_idx].origin;
779                    errors.push(RegionResolutionError::UpperBoundUniverseConflict(
780                        node_idx,
781                        origin,
782                        min_universe,
783                        upper_bound.origin.clone(),
784                        upper_bound.region,
785                    ));
786                    return;
787                }
788            }
789        }
790
791        // Errors in earlier passes can yield error variables without
792        // resolution errors here; ICE if no errors have been emitted yet.
793        if !self.tcx().dcx().has_errors().is_some() {
    {
        ::core::panicking::panic_fmt(format_args!("collect_error_for_expanding_node() could not find error for var {0:?} in universe {1:?}, lower_bounds={2:#?}, upper_bounds={3:#?}",
                node_idx, node_universe, lower_bounds, upper_bounds));
    }
};assert!(
794            self.tcx().dcx().has_errors().is_some(),
795            "collect_error_for_expanding_node() could not find error for var {node_idx:?} in \
796            universe {node_universe:?}, lower_bounds={lower_bounds:#?}, \
797            upper_bounds={upper_bounds:#?}",
798        );
799    }
800
801    /// Collects all regions that "bound" the variable `orig_node_idx` in the
802    /// given direction.
803    ///
804    /// If `dup_vec` is `Some` it's used to track duplicates between successive
805    /// calls of this function.
806    ///
807    /// The return tuple fields are:
808    /// - a list of all concrete regions bounding the given region.
809    /// - the set of all region variables bounding the given region.
810    /// - a `bool` that's true if the returned region variables overlap with
811    ///   those returned by a previous call for another region.
812    fn collect_bounding_regions(
813        &self,
814        edges: &IndexedConstraintEdges<'_, 'tcx>,
815        orig_node_idx: RegionVid,
816        dir: EdgeDirection,
817        mut dup_vec: Option<&mut IndexSlice<RegionVid, Option<RegionVid>>>,
818    ) -> (Vec<RegionAndOrigin<'tcx>>, FxHashSet<RegionVid>, bool) {
819        struct WalkState<'tcx> {
820            set: FxHashSet<RegionVid>,
821            stack: Vec<RegionVid>,
822            result: Vec<RegionAndOrigin<'tcx>>,
823            dup_found: bool,
824        }
825        let mut state = WalkState {
826            set: Default::default(),
827            stack: ::alloc::boxed::box_assume_init_into_vec_unsafe(::alloc::intrinsics::write_box_via_move(::alloc::boxed::Box::new_uninit(),
        [orig_node_idx]))vec![orig_node_idx],
828            result: Vec::new(),
829            dup_found: false,
830        };
831        state.set.insert(orig_node_idx);
832
833        // to start off the process, walk the source node in the
834        // direction specified
835        process_edges(&mut state, edges, orig_node_idx, dir);
836
837        while let Some(node_idx) = state.stack.pop() {
838            // check whether we've visited this node on some previous walk
839            if let Some(dup_vec) = &mut dup_vec {
840                if dup_vec[node_idx].is_none() {
841                    dup_vec[node_idx] = Some(orig_node_idx);
842                } else if dup_vec[node_idx] != Some(orig_node_idx) {
843                    state.dup_found = true;
844                }
845
846                {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/d080e7dff1b0fc54541545252818f8cccf995d05/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs:846",
                        "rustc_infer::infer::lexical_region_resolve",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/d080e7dff1b0fc54541545252818f8cccf995d05/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs"),
                        ::tracing_core::__macro_support::Option::Some(846u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_infer::infer::lexical_region_resolve"),
                        ::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!("collect_concrete_regions(orig_node_idx={0:?}, node_idx={1:?})",
                                                    orig_node_idx, node_idx) as &dyn ::tracing::field::Value))])
            });
    } else { ; }
};debug!(
847                    "collect_concrete_regions(orig_node_idx={:?}, node_idx={:?})",
848                    orig_node_idx, node_idx
849                );
850            }
851
852            process_edges(&mut state, edges, node_idx, dir);
853        }
854
855        let WalkState { result, dup_found, set, .. } = state;
856        return (result, set, dup_found);
857
858        fn process_edges<'tcx>(
859            state: &mut WalkState<'tcx>,
860            edges: &IndexedConstraintEdges<'_, 'tcx>,
861            source_vid: RegionVid,
862            dir: EdgeDirection,
863        ) {
864            {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/d080e7dff1b0fc54541545252818f8cccf995d05/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs:864",
                        "rustc_infer::infer::lexical_region_resolve",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/d080e7dff1b0fc54541545252818f8cccf995d05/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs"),
                        ::tracing_core::__macro_support::Option::Some(864u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_infer::infer::lexical_region_resolve"),
                        ::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!("process_edges(source_vid={0:?}, dir={1:?})",
                                                    source_vid, dir) as &dyn ::tracing::field::Value))])
            });
    } else { ; }
};debug!("process_edges(source_vid={:?}, dir={:?})", source_vid, dir);
865
866            for (c, origin) in edges.adjacent_edges(source_vid, dir) {
867                match c.kind {
868                    ConstraintKind::VarSubVar => {
869                        let from_vid = c.sub.as_var();
870                        let to_vid = c.sup.as_var();
871                        let opp_vid = if from_vid == source_vid { to_vid } else { from_vid };
872                        if state.set.insert(opp_vid) {
873                            state.stack.push(opp_vid);
874                        }
875                    }
876
877                    ConstraintKind::RegSubVar => {
878                        let origin = (*origin).clone();
879                        state.result.push(RegionAndOrigin { region: c.sub, origin });
880                    }
881
882                    ConstraintKind::VarSubReg => {
883                        let origin = (*origin).clone();
884                        state.result.push(RegionAndOrigin { region: c.sup, origin });
885                    }
886
887                    ConstraintKind::RegSubReg => {
    ::core::panicking::panic_fmt(format_args!("cannot reach reg-sub-reg edge in region inference post-processing"));
}panic!(
888                        "cannot reach reg-sub-reg edge in region inference \
889                         post-processing"
890                    ),
891
892                    ConstraintKind::VarEqVar
893                    | ConstraintKind::VarEqReg
894                    | ConstraintKind::RegEqReg => ::core::panicking::panic("internal error: entered unreachable code")unreachable!(),
895                }
896            }
897        }
898    }
899
900    fn bound_is_met(
901        &self,
902        bound: &VerifyBound<'tcx>,
903        var_values: &LexicalRegionResolutions<'tcx>,
904        generic_ty: Ty<'tcx>,
905        min: ty::Region<'tcx>,
906    ) -> bool {
907        if let ty::ReError(_) = min.kind() {
908            return true;
909        }
910
911        match bound {
912            VerifyBound::IfEq(verify_if_eq_b) => {
913                let verify_if_eq_b = var_values.normalize(self.region_rels.tcx, *verify_if_eq_b);
914                match test_type_match::extract_verify_if_eq(self.tcx(), &verify_if_eq_b, generic_ty)
915                {
916                    Some(r) => {
917                        self.bound_is_met(&VerifyBound::OutlivedBy(r), var_values, generic_ty, min)
918                    }
919
920                    None => false,
921                }
922            }
923
924            VerifyBound::OutlivedBy(r) => {
925                let a = match min.kind() {
926                    ty::ReVar(rid) => var_values.values[rid],
927                    _ => VarValue::Value(min),
928                };
929                let b = match r.kind() {
930                    ty::ReVar(rid) => var_values.values[rid],
931                    _ => VarValue::Value(*r),
932                };
933                self.sub_region_values(a, b)
934            }
935
936            VerifyBound::IsEmpty => match min.kind() {
937                ty::ReVar(rid) => match var_values.values[rid] {
938                    VarValue::ErrorValue => false,
939                    VarValue::Empty(_) => true,
940                    VarValue::Value(_) => false,
941                },
942                _ => false,
943            },
944
945            VerifyBound::AnyBound(bs) => {
946                bs.iter().any(|b| self.bound_is_met(b, var_values, generic_ty, min))
947            }
948
949            VerifyBound::AllBounds(bs) => {
950                bs.iter().all(|b| self.bound_is_met(b, var_values, generic_ty, min))
951            }
952        }
953    }
954}
955
956impl<'tcx> fmt::Debug for RegionAndOrigin<'tcx> {
957    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
958        f.write_fmt(format_args!("RegionAndOrigin({0:?},{1:?})", self.region,
        self.origin))write!(f, "RegionAndOrigin({:?},{:?})", self.region, self.origin)
959    }
960}
961
962impl<'tcx> LexicalRegionResolutions<'tcx> {
963    fn normalize<T>(&self, tcx: TyCtxt<'tcx>, value: T) -> T
964    where
965        T: TypeFoldable<TyCtxt<'tcx>>,
966    {
967        fold_regions(tcx, value, |r, _db| self.resolve_region(tcx, r))
968    }
969
970    fn value(&self, rid: RegionVid) -> &VarValue<'tcx> {
971        &self.values[rid]
972    }
973
974    fn value_mut(&mut self, rid: RegionVid) -> &mut VarValue<'tcx> {
975        &mut self.values[rid]
976    }
977
978    pub(crate) fn resolve_region(
979        &self,
980        tcx: TyCtxt<'tcx>,
981        r: ty::Region<'tcx>,
982    ) -> ty::Region<'tcx> {
983        let result = match r.kind() {
984            ty::ReVar(rid) => match self.values[rid] {
985                VarValue::Empty(_) => r,
986                VarValue::Value(r) => r,
987                VarValue::ErrorValue => tcx.lifetimes.re_static,
988            },
989            _ => r,
990        };
991        {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/d080e7dff1b0fc54541545252818f8cccf995d05/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs:991",
                        "rustc_infer::infer::lexical_region_resolve",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/d080e7dff1b0fc54541545252818f8cccf995d05/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs"),
                        ::tracing_core::__macro_support::Option::Some(991u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_infer::infer::lexical_region_resolve"),
                        ::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!("resolve_region({0:?}) = {1:?}",
                                                    r, result) as &dyn ::tracing::field::Value))])
            });
    } else { ; }
};debug!("resolve_region({:?}) = {:?}", r, result);
992        result
993    }
994}