Skip to main content

rustc_borrowck/region_infer/
region_context.rs

1use std::collections::VecDeque;
2use std::ops::{Deref, DerefMut};
3use std::rc::Rc;
4
5use rustc_data_structures::frozen::Frozen;
6use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
7use rustc_errors::Diag;
8use rustc_index::IndexVec;
9use rustc_infer::infer::outlives::test_type_match;
10use rustc_infer::infer::region_constraints::{VerifyBound, VerifyIfEq};
11use rustc_infer::infer::{InferCtxt, NllRegionVariableOrigin};
12use rustc_middle::mir::{
13    AnnotationSource, BasicBlock, Body, ConstraintCategory, Location, ReturnConstraint,
14    TerminatorKind,
15};
16use rustc_middle::ty::{self, RegionVid, Ty, TyCtxt, TypeFoldable, UniverseIndex, fold_regions};
17use rustc_mir_dataflow::points::DenseLocationMap;
18use rustc_span::hygiene::DesugaringKind;
19use rustc_span::{DUMMY_SP, bug};
20use tracing::{debug, instrument, trace};
21
22use crate::constraints::graph::NormalConstraintGraph;
23use crate::constraints::{ConstraintSccIndex, OutlivesConstraint, OutlivesConstraintSet};
24use crate::consumers::PoloniusOutput;
25use crate::dataflow::BorrowIndex;
26use crate::diagnostics::{RegionErrorKind, RegionErrors, UniverseInfo};
27use crate::handle_placeholders::{LoweredConstraints, RegionTracker};
28use crate::region_infer::values::{LivenessValues, RegionElement, RegionValues};
29use crate::region_infer::{
30    BestBlame, ConstraintSccs, RegionDefinition, RegionRelationCheckResult, Trace, TypeTest,
31    sccs_info,
32};
33use crate::type_check::Locations;
34use crate::type_check::free_region_relations::UniversalRegionRelations;
35use crate::universal_regions::UniversalRegions;
36use crate::{
37    BorrowckInferCtxt, ClosureOutlivesRequirement, ClosureOutlivesSubject,
38    ClosureOutlivesSubjectTy, ClosureRegionRequirements,
39};
40
41/// Contains the data for `RegionInferenceContext` and `UnsolvedRegionInferenceContext`.
42pub struct RegionInferenceContextInner<'tcx> {
43    /// Contains the definition for every region variable. Region
44    /// variables are identified by their index (`RegionVid`). The
45    /// definition contains information about where the region came
46    /// from as well as its final inferred value.
47    pub(crate) definitions: Frozen<IndexVec<RegionVid, RegionDefinition<'tcx>>>,
48
49    /// The liveness constraints added to each region. For most
50    /// regions, these start out empty and steadily grow, though for
51    /// each universally quantified region R they start out containing
52    /// the entire CFG and `end(R)`.
53    pub(super) liveness_constraints: LivenessValues,
54
55    /// The outlives constraints computed by the type-check.
56    pub(super) constraints: Frozen<OutlivesConstraintSet<'tcx>>,
57
58    /// The constraint-set, but in graph form, making it easy to traverse
59    /// the constraints adjacent to a particular region. Used to construct
60    /// the SCC (see `constraint_sccs`) and for error reporting.
61    pub(super) constraint_graph: Frozen<NormalConstraintGraph>,
62
63    /// The SCC computed from `constraints` and the constraint
64    /// graph. We have an edge from SCC A to SCC B if `A: B`. Used to
65    /// compute the values of each region.
66    pub(super) constraint_sccs: ConstraintSccs,
67
68    pub(super) scc_annotations: IndexVec<ConstraintSccIndex, RegionTracker>,
69
70    /// Map universe indexes to information on why we created it.
71    pub(super) universe_causes: FxIndexMap<ty::UniverseIndex, UniverseInfo<'tcx>>,
72
73    /// The final inferred values of the region variables; we compute
74    /// one value per SCC. To get the value for any given *region*,
75    /// you first find which scc it is a part of.
76    pub(super) scc_values: RegionValues<'tcx, ConstraintSccIndex>,
77
78    /// Information about how the universally quantified regions in
79    /// scope on this function relate to one another.
80    pub(super) universal_region_relations: Frozen<UniversalRegionRelations<'tcx>>,
81}
82
83/// This contains data around region constraints and liveness, up to and after solving.
84/// All data is immutable.
85pub struct RegionInferenceContext<'tcx> {
86    data: Frozen<RegionInferenceContextInner<'tcx>>,
87}
88
89impl<'tcx> Deref for RegionInferenceContext<'tcx> {
90    type Target = RegionInferenceContextInner<'tcx>;
91
92    fn deref(&self) -> &Self::Target {
93        &self.data
94    }
95}
96
97/// This contains data around region constraints and liveness, up to solving.
98/// Calling `solve` returns a new immutable `RegionInferenceContext`.
99pub(crate) struct UnsolvedRegionInferenceContext<'tcx> {
100    pub(super) data: RegionInferenceContextInner<'tcx>,
101
102    /// Type constraints that we check after solving.
103    pub(super) type_tests: Vec<TypeTest<'tcx>>,
104}
105
106impl<'tcx> Deref for UnsolvedRegionInferenceContext<'tcx> {
107    type Target = RegionInferenceContextInner<'tcx>;
108
109    fn deref(&self) -> &Self::Target {
110        &self.data
111    }
112}
113
114impl<'tcx> DerefMut for UnsolvedRegionInferenceContext<'tcx> {
115    fn deref_mut(&mut self) -> &mut Self::Target {
116        &mut self.data
117    }
118}
119
120impl<'tcx> RegionInferenceContextInner<'tcx> {
121    /// Returns an iterator over all the region indices.
122    pub(crate) fn regions(&self) -> impl Iterator<Item = RegionVid> + 'tcx {
123        self.definitions.indices()
124    }
125
126    /// Given a universal region in scope on the MIR, returns the
127    /// corresponding index.
128    ///
129    /// Panics if `r` is not a registered universal region, most notably
130    /// if it is a placeholder. Handling placeholders requires access to the
131    /// `MirTypeckRegionConstraints`.
132    pub(crate) fn to_region_vid(&self, r: ty::Region<'tcx>) -> RegionVid {
133        self.universal_regions().to_region_vid(r)
134    }
135
136    /// Returns an iterator over all the outlives constraints.
137    pub(crate) fn outlives_constraints(&self) -> impl Iterator<Item = OutlivesConstraint<'tcx>> {
138        self.constraints.outlives().iter().copied()
139    }
140
141    /// Adds annotations for `#[rustc_regions]`; see `UniversalRegions::annotate`.
142    pub(crate) fn annotate(&self, tcx: TyCtxt<'tcx>, err: &mut Diag<'_>) {
143        self.universal_regions().annotate(tcx, err)
144    }
145
146    /// Returns `true` if the region `r` contains the point `p`.
147    ///
148    /// Panics if called before `solve()` executes,
149    pub(crate) fn region_contains_point(&self, r: RegionVid, p: Location) -> bool {
150        let scc = self.constraint_sccs.scc(r);
151        self.scc_values.contains_point(scc, p)
152    }
153
154    /// Returns the lowest statement index in `start..=end` which is not contained by `r`.
155    ///
156    /// Panics if called before `solve()` executes.
157    pub(crate) fn first_non_contained_inclusive(
158        &self,
159        r: RegionVid,
160        block: BasicBlock,
161        start: usize,
162        end: usize,
163    ) -> Option<usize> {
164        let scc = self.constraint_sccs.scc(r);
165        self.scc_values.first_non_contained_inclusive(scc, block, start, end)
166    }
167
168    /// Returns access to the value of `r` for debugging purposes.
169    pub(crate) fn region_value_str(&self, r: RegionVid) -> String {
170        let scc = self.constraint_sccs.scc(r);
171        self.scc_values.region_value_str(scc)
172    }
173
174    pub(crate) fn placeholders_contained_in(
175        &self,
176        r: RegionVid,
177    ) -> impl Iterator<Item = ty::PlaceholderRegion<'tcx>> {
178        let scc = self.constraint_sccs.scc(r);
179        self.scc_values.placeholders_contained_in(scc)
180    }
181
182    /// Like `universal_upper_bound`, but returns an approximation more suitable
183    /// for diagnostics. If `r` contains multiple disjoint universal regions
184    /// (e.g. 'a and 'b in `fn foo<'a, 'b> { ... }`, we pick the lower-numbered region.
185    /// This corresponds to picking named regions over unnamed regions
186    /// (e.g. picking early-bound regions over a closure late-bound region).
187    ///
188    /// This means that the returned value may not be a true upper bound, since
189    /// only 'static is known to outlive disjoint universal regions.
190    /// Therefore, this method should only be used in diagnostic code,
191    /// where displaying *some* named universal region is better than
192    /// falling back to 'static.
193    {}
#[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("approx_universal_upper_bound",
                                    "rustc_borrowck::region_infer::region_context",
                                    ::tracing::Level::DEBUG,
                                    ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                    ::tracing_core::__macro_support::Option::Some(193u32),
                                    ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                                    ::tracing_core::field::FieldSet::new(&[{
                                                        const NAME:
                                                            ::tracing::__macro_support::FieldName<{
                                                                ::tracing::__macro_support::FieldName::len("r")
                                                            }> =
                                                            ::tracing::__macro_support::FieldName::new("r");
                                                        NAME.as_str()
                                                    }], ::tracing_core::callsite::Identifier(&__CALLSITE)),
                                    ::tracing::metadata::Kind::SPAN)
                            };
                        ::tracing::callsite::DefaultCallsite::new(&META)
                    };
                let mut interest = ::tracing::subscriber::Interest::never();
                if ::tracing::Level::DEBUG <=
                                    ::tracing::level_filters::STATIC_MAX_LEVEL &&
                                ::tracing::Level::DEBUG <=
                                    ::tracing::level_filters::LevelFilter::current() &&
                            { interest = __CALLSITE.interest(); !interest.is_never() }
                        &&
                        ::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
                            interest) {
                    let meta = __CALLSITE.metadata();
                    ::tracing::Span::new(meta,
                        &{
                                #[allow(unused_imports)]
                                use ::tracing::field::{debug, display, Value};
                                meta.fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&r)
                                                            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: RegionVid = loop {};
            return __tracing_attr_fake_return;
        }
        {
            {
                use ::tracing::__macro_support::Callsite as _;
                static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                    {
                        static META: ::tracing::Metadata<'static> =
                            {
                                ::tracing_core::metadata::Metadata::new("event /rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs:195",
                                    "rustc_borrowck::region_infer::region_context",
                                    ::tracing::Level::DEBUG,
                                    ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                    ::tracing_core::__macro_support::Option::Some(195u32),
                                    ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                                    ::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!("{0}",
                                                                self.region_value_str(r)) as
                                                        &dyn ::tracing::field::Value))])
                        });
                } else { ; }
            };
            let mut lub = self.universal_regions().fr_fn_body;
            let r_scc = self.constraint_sccs.scc(r);
            let static_r = self.universal_regions().fr_static;
            for ur in self.scc_values.universal_regions_outlived_by(r_scc) {
                let new_lub =
                    self.universal_region_relations.postdom_upper_bound(lub,
                        ur);
                {
                    use ::tracing::__macro_support::Callsite as _;
                    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                        {
                            static META: ::tracing::Metadata<'static> =
                                {
                                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs:204",
                                        "rustc_borrowck::region_infer::region_context",
                                        ::tracing::Level::DEBUG,
                                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                        ::tracing_core::__macro_support::Option::Some(204u32),
                                        ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                                        ::tracing_core::field::FieldSet::new(&[{
                                                            const NAME:
                                                                ::tracing::__macro_support::FieldName<{
                                                                    ::tracing::__macro_support::FieldName::len("ur")
                                                                }> =
                                                                ::tracing::__macro_support::FieldName::new("ur");
                                                            NAME.as_str()
                                                        },
                                                        {
                                                            const NAME:
                                                                ::tracing::__macro_support::FieldName<{
                                                                    ::tracing::__macro_support::FieldName::len("lub")
                                                                }> =
                                                                ::tracing::__macro_support::FieldName::new("lub");
                                                            NAME.as_str()
                                                        },
                                                        {
                                                            const NAME:
                                                                ::tracing::__macro_support::FieldName<{
                                                                    ::tracing::__macro_support::FieldName::len("new_lub")
                                                                }> =
                                                                ::tracing::__macro_support::FieldName::new("new_lub");
                                                            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(&ur)
                                                            as &dyn ::tracing::field::Value)),
                                                (::tracing::__macro_support::Option::Some(&::tracing::field::debug(&lub)
                                                            as &dyn ::tracing::field::Value)),
                                                (::tracing::__macro_support::Option::Some(&::tracing::field::debug(&new_lub)
                                                            as &dyn ::tracing::field::Value))])
                            });
                    } else { ; }
                };
                if ur != static_r && lub != static_r && new_lub == static_r {
                    if self.region_definition(ur).external_name.is_some() {
                        lub = ur;
                    } else if self.region_definition(lub).external_name.is_some()
                        {} else { lub = std::cmp::min(ur, lub); }
                } else { lub = new_lub; }
            }
            {
                use ::tracing::__macro_support::Callsite as _;
                static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                    {
                        static META: ::tracing::Metadata<'static> =
                            {
                                ::tracing_core::metadata::Metadata::new("event /rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs:228",
                                    "rustc_borrowck::region_infer::region_context",
                                    ::tracing::Level::DEBUG,
                                    ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                    ::tracing_core::__macro_support::Option::Some(228u32),
                                    ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                                    ::tracing_core::field::FieldSet::new(&[{
                                                        const NAME:
                                                            ::tracing::__macro_support::FieldName<{
                                                                ::tracing::__macro_support::FieldName::len("r")
                                                            }> =
                                                            ::tracing::__macro_support::FieldName::new("r");
                                                        NAME.as_str()
                                                    },
                                                    {
                                                        const NAME:
                                                            ::tracing::__macro_support::FieldName<{
                                                                ::tracing::__macro_support::FieldName::len("lub")
                                                            }> =
                                                            ::tracing::__macro_support::FieldName::new("lub");
                                                        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(&r)
                                                        as &dyn ::tracing::field::Value)),
                                            (::tracing::__macro_support::Option::Some(&::tracing::field::debug(&lub)
                                                        as &dyn ::tracing::field::Value))])
                        });
                } else { ; }
            };
            lub
        }
    }
}#[instrument(level = "debug", skip(self))]
194    pub(crate) fn approx_universal_upper_bound(&self, r: RegionVid) -> RegionVid {
195        debug!("{}", self.region_value_str(r));
196
197        // Find the smallest universal region that contains all other
198        // universal regions within `region`.
199        let mut lub = self.universal_regions().fr_fn_body;
200        let r_scc = self.constraint_sccs.scc(r);
201        let static_r = self.universal_regions().fr_static;
202        for ur in self.scc_values.universal_regions_outlived_by(r_scc) {
203            let new_lub = self.universal_region_relations.postdom_upper_bound(lub, ur);
204            debug!(?ur, ?lub, ?new_lub);
205            // The upper bound of two non-static regions is static: this
206            // means we know nothing about the relationship between these
207            // two regions. Pick a 'better' one to use when constructing
208            // a diagnostic
209            if ur != static_r && lub != static_r && new_lub == static_r {
210                // Prefer the region with an `external_name` - this
211                // indicates that the region is early-bound, so working with
212                // it can produce a nicer error.
213                if self.region_definition(ur).external_name.is_some() {
214                    lub = ur;
215                } else if self.region_definition(lub).external_name.is_some() {
216                    // Leave lub unchanged
217                } else {
218                    // If we get here, we don't have any reason to prefer
219                    // one region over the other. Just pick the
220                    // one with the lower index for now.
221                    lub = std::cmp::min(ur, lub);
222                }
223            } else {
224                lub = new_lub;
225            }
226        }
227
228        debug!(?r, ?lub);
229
230        lub
231    }
232
233    /// The largest universe of any region nameable from this SCC.
234    pub(super) fn max_nameable_universe(&self, scc: ConstraintSccIndex) -> UniverseIndex {
235        self.scc_annotations[scc].max_nameable_universe()
236    }
237
238    pub(crate) fn constraint_path_between_regions(
239        &self,
240        from_region: RegionVid,
241        to_region: RegionVid,
242    ) -> Option<Vec<OutlivesConstraint<'tcx>>> {
243        if from_region == to_region {
244            ::rustc_span::macros::bug_impl(None,
    format_args!("Tried to find a path between {0:?} and itself!",
        from_region), Location::caller());bug!("Tried to find a path between {from_region:?} and itself!");
245        }
246        self.constraint_path_to(from_region, |to| to == to_region, true).map(|o| o.0)
247    }
248
249    /// Walks the graph of constraints (where `'a: 'b` is considered
250    /// an edge `'a -> 'b`) to find a path from `from_region` to
251    /// `to_region`.
252    ///
253    /// Returns: a series of constraints as well as the region `R`
254    /// that passed the target test.
255    /// If `include_static_outlives_all` is `true`, then the synthetic
256    /// outlives constraints `'static -> a` for every region `a` are
257    /// considered in the search, otherwise they are ignored.
258    {}
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("constraint_path_to",
                                "rustc_borrowck::region_infer::region_context",
                                ::tracing::Level::INFO,
                                ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                ::tracing_core::__macro_support::Option::Some(258u32),
                                ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                                ::tracing_core::field::FieldSet::new(&[{
                                                    const NAME:
                                                        ::tracing::__macro_support::FieldName<{
                                                            ::tracing::__macro_support::FieldName::len("from_region")
                                                        }> =
                                                        ::tracing::__macro_support::FieldName::new("from_region");
                                                    NAME.as_str()
                                                },
                                                {
                                                    const NAME:
                                                        ::tracing::__macro_support::FieldName<{
                                                            ::tracing::__macro_support::FieldName::len("include_placeholder_static")
                                                        }> =
                                                        ::tracing::__macro_support::FieldName::new("include_placeholder_static");
                                                    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::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,
                    &{
                            #[allow(unused_imports)]
                            use ::tracing::field::{debug, display, Value};
                            meta.fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&from_region)
                                                        as &dyn ::tracing::field::Value)),
                                            (::tracing::__macro_support::Option::Some(&include_placeholder_static
                                                        as &dyn ::tracing::field::Value))])
                        })
            } else {
                let span =
                    ::tracing::__macro_support::__disabled_span(__CALLSITE.metadata());
                {};
                span
            }
        };
    __tracing_attr_guard = __tracing_attr_span.enter();
}
#[allow(clippy :: redundant_closure_call)]
let x =
    (move ||
                {

                    #[allow(unknown_lints, unreachable_code, clippy ::
                    diverging_sub_expression, clippy :: empty_loop, clippy ::
                    let_unit_value, clippy :: let_with_type_underscore, clippy
                    :: needless_return, clippy :: unreachable)]
                    if false {
                        let __tracing_attr_fake_return:
                                Option<(Vec<OutlivesConstraint<'tcx>>, RegionVid)> =
                            loop {};
                        return __tracing_attr_fake_return;
                    }
                    {
                        self.find_constraint_path_between_regions_inner(true,
                                from_region, &target_test,
                                include_placeholder_static).or_else(||
                                {
                                    self.find_constraint_path_between_regions_inner(false,
                                        from_region, &target_test, include_placeholder_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/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs:258",
                        "rustc_borrowck::region_infer::region_context",
                        ::tracing::Level::INFO,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                        ::tracing_core::__macro_support::Option::Some(258u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                        ::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::INFO <= ::tracing::level_filters::STATIC_MAX_LEVEL
                &&
                ::tracing::Level::INFO <=
                    ::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(skip(self, target_test), ret)]
259    pub(crate) fn constraint_path_to(
260        &self,
261        from_region: RegionVid,
262        target_test: impl Fn(RegionVid) -> bool,
263        include_placeholder_static: bool,
264    ) -> Option<(Vec<OutlivesConstraint<'tcx>>, RegionVid)> {
265        self.find_constraint_path_between_regions_inner(
266            true,
267            from_region,
268            &target_test,
269            include_placeholder_static,
270        )
271        .or_else(|| {
272            self.find_constraint_path_between_regions_inner(
273                false,
274                from_region,
275                &target_test,
276                include_placeholder_static,
277            )
278        })
279    }
280
281    /// The constraints we get from equating the hidden type of each use of an opaque
282    /// with its final hidden type may end up getting preferred over other, potentially
283    /// longer constraint paths.
284    ///
285    /// Given that we compute the final hidden type by relying on this existing constraint
286    /// path, this can easily end up hiding the actual reason for why we require these regions
287    /// to be equal.
288    ///
289    /// To handle this, we first look at the path while ignoring these constraints and then
290    /// retry while considering them. This is not perfect, as the `from_region` may have already
291    /// been partially related to its argument region, so while we rely on a member constraint
292    /// to get a complete path, the most relevant step of that path already existed before then.
293    fn find_constraint_path_between_regions_inner(
294        &self,
295        ignore_opaque_type_constraints: bool,
296        from_region: RegionVid,
297        target_test: impl Fn(RegionVid) -> bool,
298        include_placeholder_static: bool,
299    ) -> Option<(Vec<OutlivesConstraint<'tcx>>, RegionVid)> {
300        let mut context = IndexVec::from_elem(Trace::NotVisited, &self.definitions);
301        context[from_region] = Trace::StartRegion;
302
303        let fr_static = self.universal_regions().fr_static;
304
305        // Use a deque so that we do a breadth-first search. We will
306        // stop at the first match, which ought to be the shortest
307        // path (fewest constraints).
308        let mut deque = VecDeque::new();
309        deque.push_back(from_region);
310
311        while let Some(r) = deque.pop_front() {
312            {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs:312",
                        "rustc_borrowck::region_infer::region_context",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                        ::tracing_core::__macro_support::Option::Some(312u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                        ::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_path_to: from_region={0:?} r={1:?} value={2}",
                                                    from_region, r, self.region_value_str(r)) as
                                            &dyn ::tracing::field::Value))])
            });
    } else { ; }
};debug!(
313                "constraint_path_to: from_region={:?} r={:?} value={}",
314                from_region,
315                r,
316                self.region_value_str(r),
317            );
318
319            // Check if we reached the region we were looking for. If so,
320            // we can reconstruct the path that led to it and return it.
321            if target_test(r) {
322                let mut result = ::alloc::vec::Vec::new()vec![];
323                let mut p = r;
324                // This loop is cold and runs at the end, which is why we delay
325                // `OutlivesConstraint` construction until now.
326                loop {
327                    match context[p] {
328                        Trace::FromGraph(c) => {
329                            p = c.sup;
330                            result.push(*c);
331                        }
332
333                        Trace::FromStatic(sub) => {
334                            let c = OutlivesConstraint {
335                                sup: fr_static,
336                                sub,
337                                locations: Locations::All(DUMMY_SP),
338                                span: DUMMY_SP,
339                                category: ConstraintCategory::Internal,
340                                variance_info: ty::VarianceDiagInfo::default(),
341                                from_closure: false,
342                            };
343                            p = c.sup;
344                            result.push(c);
345                        }
346
347                        Trace::StartRegion => {
348                            result.reverse();
349                            return Some((result, r));
350                        }
351
352                        Trace::NotVisited => {
353                            ::rustc_span::macros::bug_impl(None,
    format_args!("found unvisited region {0:?} on path to {1:?}", p, r),
    Location::caller())bug!("found unvisited region {:?} on path to {:?}", p, r)
354                        }
355                    }
356                }
357            }
358
359            // Otherwise, walk over the outgoing constraints and
360            // enqueue any regions we find, keeping track of how we
361            // reached them.
362
363            // A constraint like `'r: 'x` can come from our constraint
364            // graph.
365
366            // Always inline this closure because it can be hot.
367            let mut handle_trace = #[inline(always)]
368            |sub, trace| {
369                if let Trace::NotVisited = context[sub] {
370                    context[sub] = trace;
371                    deque.push_back(sub);
372                }
373            };
374
375            // If this is the `'static` region and the graph's direction is normal, then set up the
376            // Edges iterator to return all regions (#53178).
377            if r == fr_static && self.constraint_graph.is_normal() {
378                for sub in self.constraint_graph.outgoing_edges_from_static() {
379                    handle_trace(sub, Trace::FromStatic(sub));
380                }
381            } else {
382                let edges = self.constraint_graph.outgoing_edges_from_graph(r, &self.constraints);
383                // This loop can be hot.
384                for constraint in edges {
385                    match constraint.category {
386                        ConstraintCategory::OutlivesUnnameablePlaceholder(_)
387                            if !include_placeholder_static =>
388                        {
389                            {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs:389",
                        "rustc_borrowck::region_infer::region_context",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                        ::tracing_core::__macro_support::Option::Some(389u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                        ::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!("Ignoring illegal placeholder constraint: {0:?}",
                                                    constraint) as &dyn ::tracing::field::Value))])
            });
    } else { ; }
};debug!("Ignoring illegal placeholder constraint: {constraint:?}");
390                            continue;
391                        }
392                        ConstraintCategory::OpaqueType if ignore_opaque_type_constraints => {
393                            {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs:393",
                        "rustc_borrowck::region_infer::region_context",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                        ::tracing_core::__macro_support::Option::Some(393u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                        ::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!("Ignoring member constraint: {0:?}",
                                                    constraint) as &dyn ::tracing::field::Value))])
            });
    } else { ; }
};debug!("Ignoring member constraint: {constraint:?}");
394                            continue;
395                        }
396                        _ => {}
397                    }
398
399                    if true {
    {
        match (&constraint.sup, &r) {
            (left_val, right_val) => {
                if !(*left_val == *right_val) {
                    let kind = ::core::panicking::AssertKind::Eq;
                    ::core::panicking::assert_failed(kind, &*left_val,
                        &*right_val, ::core::option::Option::None);
                }
            }
        }
    };
};debug_assert_eq!(constraint.sup, r);
400                    handle_trace(constraint.sub, Trace::FromGraph(constraint));
401                }
402            }
403        }
404
405        None
406    }
407
408    /// Finds some region R such that `fr1: R` and `R` is live at `location`.
409    {}
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("find_sub_region_live_at",
                                "rustc_borrowck::region_infer::region_context",
                                ::tracing::Level::TRACE,
                                ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                ::tracing_core::__macro_support::Option::Some(409u32),
                                ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                                ::tracing_core::field::FieldSet::new(&[{
                                                    const NAME:
                                                        ::tracing::__macro_support::FieldName<{
                                                            ::tracing::__macro_support::FieldName::len("fr1")
                                                        }> =
                                                        ::tracing::__macro_support::FieldName::new("fr1");
                                                    NAME.as_str()
                                                },
                                                {
                                                    const NAME:
                                                        ::tracing::__macro_support::FieldName<{
                                                            ::tracing::__macro_support::FieldName::len("location")
                                                        }> =
                                                        ::tracing::__macro_support::FieldName::new("location");
                                                    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(&fr1)
                                                        as &dyn ::tracing::field::Value)),
                                            (::tracing::__macro_support::Option::Some(&::tracing::field::debug(&location)
                                                        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: RegionVid = loop {};
                        return __tracing_attr_fake_return;
                    }
                    {
                        {
                            use ::tracing::__macro_support::Callsite as _;
                            static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                                {
                                    static META: ::tracing::Metadata<'static> =
                                        {
                                            ::tracing_core::metadata::Metadata::new("event /rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs:411",
                                                "rustc_borrowck::region_infer::region_context",
                                                ::tracing::Level::TRACE,
                                                ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                                ::tracing_core::__macro_support::Option::Some(411u32),
                                                ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                                                ::tracing_core::field::FieldSet::new(&[{
                                                                    const NAME:
                                                                        ::tracing::__macro_support::FieldName<{
                                                                            ::tracing::__macro_support::FieldName::len("scc")
                                                                        }> =
                                                                        ::tracing::__macro_support::FieldName::new("scc");
                                                                    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(&self.constraint_sccs.scc(fr1))
                                                                    as &dyn ::tracing::field::Value))])
                                    });
                            } else { ; }
                        };
                        {
                            use ::tracing::__macro_support::Callsite as _;
                            static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                                {
                                    static META: ::tracing::Metadata<'static> =
                                        {
                                            ::tracing_core::metadata::Metadata::new("event /rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs:412",
                                                "rustc_borrowck::region_infer::region_context",
                                                ::tracing::Level::TRACE,
                                                ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                                ::tracing_core::__macro_support::Option::Some(412u32),
                                                ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                                                ::tracing_core::field::FieldSet::new(&[{
                                                                    const NAME:
                                                                        ::tracing::__macro_support::FieldName<{
                                                                            ::tracing::__macro_support::FieldName::len("universe")
                                                                        }> =
                                                                        ::tracing::__macro_support::FieldName::new("universe");
                                                                    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(&self.max_nameable_universe(self.constraint_sccs.scc(fr1)))
                                                                    as &dyn ::tracing::field::Value))])
                                    });
                            } else { ; }
                        };
                        self.constraint_path_to(fr1,
                                    |r|
                                        {
                                            {
                                                use ::tracing::__macro_support::Callsite as _;
                                                static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                                                    {
                                                        static META: ::tracing::Metadata<'static> =
                                                            {
                                                                ::tracing_core::metadata::Metadata::new("event /rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs:414",
                                                                    "rustc_borrowck::region_infer::region_context",
                                                                    ::tracing::Level::TRACE,
                                                                    ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                                                    ::tracing_core::__macro_support::Option::Some(414u32),
                                                                    ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                                                                    ::tracing_core::field::FieldSet::new(&[{
                                                                                        const NAME:
                                                                                            ::tracing::__macro_support::FieldName<{
                                                                                                ::tracing::__macro_support::FieldName::len("r")
                                                                                            }> =
                                                                                            ::tracing::__macro_support::FieldName::new("r");
                                                                                        NAME.as_str()
                                                                                    },
                                                                                    {
                                                                                        const NAME:
                                                                                            ::tracing::__macro_support::FieldName<{
                                                                                                ::tracing::__macro_support::FieldName::len("liveness_constraints")
                                                                                            }> =
                                                                                            ::tracing::__macro_support::FieldName::new("liveness_constraints");
                                                                                        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(&r)
                                                                                        as &dyn ::tracing::field::Value)),
                                                                            (::tracing::__macro_support::Option::Some(&::tracing::field::debug(&self.liveness_constraints.pretty_print_live_points(r))
                                                                                        as &dyn ::tracing::field::Value))])
                                                        });
                                                } else { ; }
                                            };
                                            self.liveness_constraints.is_live_at(r, location)
                                        }, true).unwrap().1
                    }
                })();
{
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs:409",
                        "rustc_borrowck::region_infer::region_context",
                        ::tracing::Level::TRACE,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                        ::tracing_core::__macro_support::Option::Some(409u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                        ::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(skip(self), level = "trace", ret)]
410    pub(crate) fn find_sub_region_live_at(&self, fr1: RegionVid, location: Location) -> RegionVid {
411        trace!(scc = ?self.constraint_sccs.scc(fr1));
412        trace!(universe = ?self.max_nameable_universe(self.constraint_sccs.scc(fr1)));
413        self.constraint_path_to(fr1, |r| {
414            trace!(?r, liveness_constraints=?self.liveness_constraints.pretty_print_live_points(r));
415            self.liveness_constraints.is_live_at(r, location)
416        }, true).unwrap().1
417    }
418
419    /// Get the region definition of `r`.
420    pub(crate) fn region_definition(&self, r: RegionVid) -> &RegionDefinition<'tcx> {
421        &self.definitions[r]
422    }
423
424    /// Check if the SCC of `r` contains `upper`, a free region.
425    pub(crate) fn upper_bound_in_region_scc(&self, r: RegionVid, upper: RegionVid) -> bool {
426        let r_scc = self.constraint_sccs.scc(r);
427        self.scc_values.contains_free_region(r_scc, upper)
428    }
429
430    pub(crate) fn universal_regions(&self) -> &UniversalRegions<'tcx> {
431        &self.universal_region_relations.universal_regions
432    }
433
434    /// Tries to find the best constraint to blame for the fact that
435    /// `R: from_region`, where `R` is some region that meets
436    /// `target_test`. This works by following the constraint graph,
437    /// creating a constraint path that forces `R` to outlive
438    /// `from_region`, and then finding the best choices within that
439    /// path to blame.
440    {}
#[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("best_blame_constraint",
                                    "rustc_borrowck::region_infer::region_context",
                                    ::tracing::Level::DEBUG,
                                    ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                    ::tracing_core::__macro_support::Option::Some(440u32),
                                    ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                                    ::tracing_core::field::FieldSet::new(&[{
                                                        const NAME:
                                                            ::tracing::__macro_support::FieldName<{
                                                                ::tracing::__macro_support::FieldName::len("from_region")
                                                            }> =
                                                            ::tracing::__macro_support::FieldName::new("from_region");
                                                        NAME.as_str()
                                                    },
                                                    {
                                                        const NAME:
                                                            ::tracing::__macro_support::FieldName<{
                                                                ::tracing::__macro_support::FieldName::len("from_region_origin")
                                                            }> =
                                                            ::tracing::__macro_support::FieldName::new("from_region_origin");
                                                        NAME.as_str()
                                                    },
                                                    {
                                                        const NAME:
                                                            ::tracing::__macro_support::FieldName<{
                                                                ::tracing::__macro_support::FieldName::len("to_region")
                                                            }> =
                                                            ::tracing::__macro_support::FieldName::new("to_region");
                                                        NAME.as_str()
                                                    }], ::tracing_core::callsite::Identifier(&__CALLSITE)),
                                    ::tracing::metadata::Kind::SPAN)
                            };
                        ::tracing::callsite::DefaultCallsite::new(&META)
                    };
                let mut interest = ::tracing::subscriber::Interest::never();
                if ::tracing::Level::DEBUG <=
                                    ::tracing::level_filters::STATIC_MAX_LEVEL &&
                                ::tracing::Level::DEBUG <=
                                    ::tracing::level_filters::LevelFilter::current() &&
                            { interest = __CALLSITE.interest(); !interest.is_never() }
                        &&
                        ::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
                            interest) {
                    let meta = __CALLSITE.metadata();
                    ::tracing::Span::new(meta,
                        &{
                                #[allow(unused_imports)]
                                use ::tracing::field::{debug, display, Value};
                                meta.fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&from_region)
                                                            as &dyn ::tracing::field::Value)),
                                                (::tracing::__macro_support::Option::Some(&::tracing::field::debug(&from_region_origin)
                                                            as &dyn ::tracing::field::Value)),
                                                (::tracing::__macro_support::Option::Some(&::tracing::field::debug(&to_region)
                                                            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: BestBlame<'tcx> = loop {};
            return __tracing_attr_fake_return;
        }
        {
            if !(from_region != to_region) {
                {
                    ::core::panicking::panic_fmt(format_args!("Trying to blame a region for itself!"));
                }
            };
            let path =
                self.constraint_path_between_regions(from_region,
                        to_region).unwrap();
            let due_to_placeholder_outlives =
                path.iter().find_map(|c|
                        {
                            if let ConstraintCategory::OutlivesUnnameablePlaceholder(unnameable)
                                    = c.category {
                                Some(unnameable)
                            } else { None }
                        });
            let mut path =
                if let Some(unnameable) = due_to_placeholder_outlives &&
                        unnameable != from_region {
                    self.constraint_path_to(from_region, |r| r == unnameable,
                                false).unwrap().0
                } else { path };
            {
                use ::tracing::__macro_support::Callsite as _;
                static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                    {
                        static META: ::tracing::Metadata<'static> =
                            {
                                ::tracing_core::metadata::Metadata::new("event /rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs:472",
                                    "rustc_borrowck::region_infer::region_context",
                                    ::tracing::Level::DEBUG,
                                    ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                    ::tracing_core::__macro_support::Option::Some(472u32),
                                    ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                                    ::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!("path={0:#?}",
                                                                path.iter().map(|c|
                                                                            ::alloc::__export::must_use({
                                                                                    ::alloc::fmt::format(format_args!("{0:?} ({1:?}: {2:?})", c,
                                                                                            self.constraint_sccs.scc(c.sup),
                                                                                            self.constraint_sccs.scc(c.sub)))
                                                                                })).collect::<Vec<_>>()) as &dyn ::tracing::field::Value))])
                        });
                } else { ; }
            };
            let blame_source =
                match from_region_origin {
                    NllRegionVariableOrigin::FreeRegion => true,
                    NllRegionVariableOrigin::Placeholder(_) => false,
                    NllRegionVariableOrigin::Existential { name: _ } => {
                        {
                            ::core::panicking::panic_fmt(format_args!("internal error: entered unreachable code: {0}",
                                    format_args!("existentials can outlive everything")));
                        }
                    }
                };
            let constraint_interest =
                |constraint: &OutlivesConstraint<'tcx>|
                    {
                        let category =
                            if let Some(kind) = constraint.span.desugaring_kind() &&
                                    (kind != DesugaringKind::QuestionMark ||
                                            !#[allow(non_exhaustive_omitted_patterns)] match constraint.category
                                                    {
                                                    ConstraintCategory::Return(_) => true,
                                                    _ => false,
                                                }) {
                                ConstraintCategory::Boring
                            } else { constraint.category };
                        let interest =
                            match category {
                                ConstraintCategory::Return(_) => 0,
                                ConstraintCategory::Cast {
                                    is_raw_ptr_dyn_type_cast: _,
                                    unsize_to: Some(unsize_ty),
                                    is_implicit_coercion: true } if
                                    to_region == self.universal_regions().fr_static &&
                                                let ty::Adt(_, args) = unsize_ty.kind() &&
                                            args.iter().any(|arg|
                                                    arg.as_type().is_some_and(|ty| ty.is_trait())) &&
                                        !path.iter().any(|c|
                                                    #[allow(non_exhaustive_omitted_patterns)] match c.category {
                                                        ConstraintCategory::TypeAnnotation(_) => true,
                                                        _ => false,
                                                    }) => {
                                    1
                                }
                                ConstraintCategory::Yield | ConstraintCategory::UseAsConst |
                                    ConstraintCategory::UseAsStatic |
                                    ConstraintCategory::TypeAnnotation(AnnotationSource::Ascription
                                    | AnnotationSource::Declaration |
                                    AnnotationSource::OpaqueCast) | ConstraintCategory::Cast {
                                    .. } | ConstraintCategory::CallArgument(_) |
                                    ConstraintCategory::CopyBound |
                                    ConstraintCategory::SizedBound |
                                    ConstraintCategory::Assignment | ConstraintCategory::Usage |
                                    ConstraintCategory::ClosureUpvar(_) => 2,
                                ConstraintCategory::TypeAnnotation(AnnotationSource::GenericArg)
                                    => 3,
                                ConstraintCategory::Predicate(_) |
                                    ConstraintCategory::OpaqueType => 4,
                                ConstraintCategory::Boring => 5,
                                ConstraintCategory::BoringNoLocation => 6,
                                ConstraintCategory::Internal => 7,
                                ConstraintCategory::OutlivesUnnameablePlaceholder(_) => 8,
                                ConstraintCategory::SolverRegionConstraint(_) => 9,
                            };
                        {
                            use ::tracing::__macro_support::Callsite as _;
                            static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                                {
                                    static META: ::tracing::Metadata<'static> =
                                        {
                                            ::tracing_core::metadata::Metadata::new("event /rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs:606",
                                                "rustc_borrowck::region_infer::region_context",
                                                ::tracing::Level::DEBUG,
                                                ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                                ::tracing_core::__macro_support::Option::Some(606u32),
                                                ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                                                ::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:?} category: {1:?}, interest: {2:?}",
                                                                            constraint, category, interest) as
                                                                    &dyn ::tracing::field::Value))])
                                    });
                            } else { ; }
                        };
                        interest
                    };
            let best_choice =
                if blame_source {
                    path.iter().enumerate().rev().min_by_key(|(_, c)|
                                    constraint_interest(c)).unwrap().0
                } else {
                    path.iter().enumerate().min_by_key(|(_, c)|
                                    constraint_interest(c)).unwrap().0
                };
            {
                use ::tracing::__macro_support::Callsite as _;
                static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                    {
                        static META: ::tracing::Metadata<'static> =
                            {
                                ::tracing_core::metadata::Metadata::new("event /rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs:617",
                                    "rustc_borrowck::region_infer::region_context",
                                    ::tracing::Level::DEBUG,
                                    ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                    ::tracing_core::__macro_support::Option::Some(617u32),
                                    ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                                    ::tracing_core::field::FieldSet::new(&[{
                                                        const NAME:
                                                            ::tracing::__macro_support::FieldName<{
                                                                ::tracing::__macro_support::FieldName::len("best_choice")
                                                            }> =
                                                            ::tracing::__macro_support::FieldName::new("best_choice");
                                                        NAME.as_str()
                                                    },
                                                    {
                                                        const NAME:
                                                            ::tracing::__macro_support::FieldName<{
                                                                ::tracing::__macro_support::FieldName::len("blame_source")
                                                            }> =
                                                            ::tracing::__macro_support::FieldName::new("blame_source");
                                                        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(&best_choice)
                                                        as &dyn ::tracing::field::Value)),
                                            (::tracing::__macro_support::Option::Some(&::tracing::field::debug(&blame_source)
                                                        as &dyn ::tracing::field::Value))])
                        });
                } else { ; }
            };
            let best_blame_idx =
                if let Some(next) = path.get(best_choice + 1) &&
                            #[allow(non_exhaustive_omitted_patterns)] match path[best_choice].category
                                {
                                ConstraintCategory::Return(_) => true,
                                _ => false,
                            } && next.category == ConstraintCategory::OpaqueType {
                    best_choice + 1
                } else if path[best_choice].category ==
                            ConstraintCategory::Return(ReturnConstraint::Normal) &&
                        let Some(field) =
                            path.iter().find_map(|p|
                                    {
                                        if let ConstraintCategory::ClosureUpvar(f) = p.category {
                                            Some(f)
                                        } else { None }
                                    }) {
                    path[best_choice].category =
                        ConstraintCategory::Return(ReturnConstraint::ClosureUpvar(field));
                    best_choice
                } else { best_choice };
            if !!#[allow(non_exhaustive_omitted_patterns)] match path[best_blame_idx].category
                            {
                            ConstraintCategory::OutlivesUnnameablePlaceholder(_) =>
                                true,
                            _ => false,
                        } {
                {
                    ::core::panicking::panic_fmt(format_args!("Illegal placeholder constraint blamed; should have redirected to other region relation"));
                }
            };
            BestBlame { path, idx: best_blame_idx }
        }
    }
}#[instrument(level = "debug", skip(self))]
441    pub(crate) fn best_blame_constraint(
442        &self,
443        from_region: RegionVid,
444        from_region_origin: NllRegionVariableOrigin<'tcx>,
445        to_region: RegionVid,
446    ) -> BestBlame<'tcx> {
447        assert!(from_region != to_region, "Trying to blame a region for itself!");
448
449        let path = self.constraint_path_between_regions(from_region, to_region).unwrap();
450
451        // If we are passing through a constraint added because we reached an unnameable placeholder `'unnameable`,
452        // redirect search towards `'unnameable`.
453        let due_to_placeholder_outlives = path.iter().find_map(|c| {
454            if let ConstraintCategory::OutlivesUnnameablePlaceholder(unnameable) = c.category {
455                Some(unnameable)
456            } else {
457                None
458            }
459        });
460
461        // Edge case: it's possible that `'from_region` is an unnameable placeholder.
462        let mut path = if let Some(unnameable) = due_to_placeholder_outlives
463            && unnameable != from_region
464        {
465            // We ignore the extra edges due to unnameable placeholders to get
466            // an explanation that was present in the original constraint graph.
467            self.constraint_path_to(from_region, |r| r == unnameable, false).unwrap().0
468        } else {
469            path
470        };
471
472        debug!(
473            "path={:#?}",
474            path.iter()
475                .map(|c| format!(
476                    "{:?} ({:?}: {:?})",
477                    c,
478                    self.constraint_sccs.scc(c.sup),
479                    self.constraint_sccs.scc(c.sub),
480                ))
481                .collect::<Vec<_>>()
482        );
483
484        // When reporting an error, there is typically a chain of constraints leading from some
485        // "source" region which must outlive some "target" region.
486        // In most cases, we prefer to "blame" the constraints closer to the target --
487        // but there is one exception. When constraints arise from higher-ranked subtyping,
488        // we generally prefer to blame the source value,
489        // as the "target" in this case tends to be some type annotation that the user gave.
490        // Therefore, if we find that the region origin is some instantiation
491        // of a higher-ranked region, we start our search from the "source" point
492        // rather than the "target", and we also tweak a few other things.
493        //
494        // An example might be this bit of Rust code:
495        //
496        // ```rust
497        // let x: fn(&'static ()) = |_| {};
498        // let y: for<'a> fn(&'a ()) = x;
499        // ```
500        //
501        // In MIR, this will be converted into a combination of assignments and type ascriptions.
502        // In particular, the 'static is imposed through a type ascription:
503        //
504        // ```rust
505        // x = ...;
506        // AscribeUserType(x, fn(&'static ())
507        // y = x;
508        // ```
509        //
510        // We wind up ultimately with constraints like
511        //
512        // ```rust
513        // !a: 'temp1 // from the `y = x` statement
514        // 'temp1: 'temp2
515        // 'temp2: 'static // from the AscribeUserType
516        // ```
517        //
518        // and here we prefer to blame the source (the y = x statement).
519        let blame_source = match from_region_origin {
520            NllRegionVariableOrigin::FreeRegion => true,
521            NllRegionVariableOrigin::Placeholder(_) => false,
522            // `'existential: 'whatever` never results in a region error by itself.
523            // We may always infer it to `'static` afterall. This means while an error
524            // path may go through an existential, these existentials are never the
525            // `from_region`.
526            NllRegionVariableOrigin::Existential { name: _ } => {
527                unreachable!("existentials can outlive everything")
528            }
529        };
530
531        // To pick a constraint to blame, we organize constraints by how interesting we expect them
532        // to be in diagnostics, then pick the most interesting one closest to either the source or
533        // the target on our constraint path.
534        let constraint_interest = |constraint: &OutlivesConstraint<'tcx>| {
535            // Try to avoid blaming constraints from desugarings, since they may not clearly match
536            // match what users have written. As an exception, allow blaming returns generated by
537            // `?` desugaring, since the correspondence is fairly clear.
538            let category = if let Some(kind) = constraint.span.desugaring_kind()
539                && (kind != DesugaringKind::QuestionMark
540                    || !matches!(constraint.category, ConstraintCategory::Return(_)))
541            {
542                ConstraintCategory::Boring
543            } else {
544                constraint.category
545            };
546
547            let interest = match category {
548                // Returns usually provide a type to blame and have specially written diagnostics,
549                // so prioritize them.
550                ConstraintCategory::Return(_) => 0,
551                // Unsizing coercions are interesting, since we have a note for that:
552                // `BorrowExplanation::add_object_lifetime_default_note`.
553                // FIXME(dianne): That note shouldn't depend on a coercion being blamed; see issue
554                // #131008 for an example of where we currently don't emit it but should.
555                // Once the note is handled properly, this case should be removed. Until then, it
556                // should be as limited as possible; the note is prone to false positives and this
557                // constraint usually isn't best to blame.
558                ConstraintCategory::Cast {
559                    is_raw_ptr_dyn_type_cast: _,
560                    unsize_to: Some(unsize_ty),
561                    is_implicit_coercion: true,
562                } if to_region == self.universal_regions().fr_static
563                    // Mirror the note's condition, to minimize how often this diverts blame.
564                    && let ty::Adt(_, args) = unsize_ty.kind()
565                    && args.iter().any(|arg| arg.as_type().is_some_and(|ty| ty.is_trait()))
566                    // Mimic old logic for this, to minimize false positives in tests.
567                    && !path
568                        .iter()
569                        .any(|c| matches!(c.category, ConstraintCategory::TypeAnnotation(_))) =>
570                {
571                    1
572                }
573                // Between other interesting constraints, order by their position on the `path`.
574                ConstraintCategory::Yield
575                | ConstraintCategory::UseAsConst
576                | ConstraintCategory::UseAsStatic
577                | ConstraintCategory::TypeAnnotation(
578                    AnnotationSource::Ascription
579                    | AnnotationSource::Declaration
580                    | AnnotationSource::OpaqueCast,
581                )
582                | ConstraintCategory::Cast { .. }
583                | ConstraintCategory::CallArgument(_)
584                | ConstraintCategory::CopyBound
585                | ConstraintCategory::SizedBound
586                | ConstraintCategory::Assignment
587                | ConstraintCategory::Usage
588                | ConstraintCategory::ClosureUpvar(_) => 2,
589                // Generic arguments are unlikely to be what relates regions together
590                ConstraintCategory::TypeAnnotation(AnnotationSource::GenericArg) => 3,
591                // We handle predicates and opaque types specially; don't prioritize them here.
592                ConstraintCategory::Predicate(_) | ConstraintCategory::OpaqueType => 4,
593                // `Boring` constraints can correspond to user-written code and have useful spans,
594                // but don't provide any other useful information for diagnostics.
595                ConstraintCategory::Boring => 5,
596                // `BoringNoLocation` constraints can point to user-written code, but are less
597                // specific, and are not used for relations that would make sense to blame.
598                ConstraintCategory::BoringNoLocation => 6,
599                // Do not blame internal constraints if we can avoid it. Never blame
600                // the `'region: 'static` constraints introduced by placeholder outlives.
601                ConstraintCategory::Internal => 7,
602                ConstraintCategory::OutlivesUnnameablePlaceholder(_) => 8,
603                ConstraintCategory::SolverRegionConstraint(_) => 9,
604            };
605
606            debug!("constraint {constraint:?} category: {category:?}, interest: {interest:?}");
607
608            interest
609        };
610
611        let best_choice = if blame_source {
612            path.iter().enumerate().rev().min_by_key(|(_, c)| constraint_interest(c)).unwrap().0
613        } else {
614            path.iter().enumerate().min_by_key(|(_, c)| constraint_interest(c)).unwrap().0
615        };
616
617        debug!(?best_choice, ?blame_source);
618
619        let best_blame_idx = if let Some(next) = path.get(best_choice + 1)
620            && matches!(path[best_choice].category, ConstraintCategory::Return(_))
621            && next.category == ConstraintCategory::OpaqueType
622        {
623            // The return expression is being influenced by the return type being
624            // impl Trait, point at the return type and not the return expr.
625            best_choice + 1
626        } else if path[best_choice].category == ConstraintCategory::Return(ReturnConstraint::Normal)
627            && let Some(field) = path.iter().find_map(|p| {
628                if let ConstraintCategory::ClosureUpvar(f) = p.category { Some(f) } else { None }
629            })
630        {
631            path[best_choice].category =
632                ConstraintCategory::Return(ReturnConstraint::ClosureUpvar(field));
633            best_choice
634        } else {
635            best_choice
636        };
637
638        assert!(
639            !matches!(
640                path[best_blame_idx].category,
641                ConstraintCategory::OutlivesUnnameablePlaceholder(_)
642            ),
643            "Illegal placeholder constraint blamed; should have redirected to other region relation"
644        );
645
646        BestBlame { path, idx: best_blame_idx }
647    }
648
649    pub(crate) fn universe_info(&self, universe: ty::UniverseIndex) -> UniverseInfo<'tcx> {
650        // Query canonicalization can create local superuniverses (for example in
651        // `InferCtx::query_response_instantiation_guess`), but they don't have an associated
652        // `UniverseInfo` explaining why they were created.
653        // This can cause ICEs if these causes are accessed in diagnostics, for example in issue
654        // #114907 where this happens via liveness and dropck outlives results.
655        // Therefore, we return a default value in case that happens, which should at worst emit a
656        // suboptimal error, instead of the ICE.
657        self.universe_causes.get(&universe).cloned().unwrap_or_else(UniverseInfo::other)
658    }
659
660    /// Tries to find the terminator of the loop in which the region 'r' resides.
661    /// Returns the location of the terminator if found.
662    pub(crate) fn find_loop_terminator_location(
663        &self,
664        r: RegionVid,
665        body: &Body<'_>,
666    ) -> Option<Location> {
667        let scc = self.constraint_sccs.scc(r);
668        let locations = self.scc_values.locations_outlived_by(scc);
669        for location in locations {
670            let bb = &body[location.block];
671            if let Some(terminator) = &bb.terminator
672                // terminator of a loop should be TerminatorKind::FalseUnwind
673                && let TerminatorKind::FalseUnwind { .. } = terminator.kind
674            {
675                return Some(location);
676            }
677        }
678        None
679    }
680
681    /// Access to the SCC constraint graph.
682    /// This can be used to quickly under-approximate the regions which are equal to each other
683    /// and their relative orderings.
684    // This is `pub` because it's used by unstable external borrowck data users, see `consumers.rs`.
685    pub(crate) fn constraint_sccs(&self) -> &ConstraintSccs {
686        &self.constraint_sccs
687    }
688
689    pub(crate) fn liveness_constraints(&self) -> &LivenessValues {
690        &self.liveness_constraints
691    }
692
693    /// Returns whether the `loan_idx` is live at the given `location`: whether its issuing
694    /// region is contained within the type of a variable that is live at this point.
695    /// Note: for now, the sets of live loans is only available when using `-Zpolonius=next`.
696    pub(crate) fn is_loan_live_at(&self, loan_idx: BorrowIndex, location: Location) -> bool {
697        let point = self.liveness_constraints.point_from_location(location);
698        self.liveness_constraints.is_loan_live_at(loan_idx, point)
699    }
700}
701
702impl<'tcx> UnsolvedRegionInferenceContext<'tcx> {
703    /// Creates a new region inference context with a total of
704    /// `num_region_variables` valid inference variables; the first N
705    /// of those will be constant regions representing the free
706    /// regions defined in `universal_regions`.
707    ///
708    /// The `outlives_constraints` and `type_tests` are an initial set
709    /// of constraints produced by the MIR type check.
710    pub(crate) fn new(
711        infcx: &BorrowckInferCtxt<'tcx>,
712        lowered_constraints: LoweredConstraints<'tcx>,
713        universal_region_relations: Frozen<UniversalRegionRelations<'tcx>>,
714        location_map: Rc<DenseLocationMap>,
715    ) -> Self {
716        let universal_regions = &universal_region_relations.universal_regions;
717
718        let LoweredConstraints {
719            constraint_sccs,
720            definitions,
721            outlives_constraints,
722            scc_annotations,
723            type_tests,
724            liveness_constraints,
725            universe_causes,
726            placeholder_indices,
727        } = lowered_constraints;
728
729        {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs:729",
                        "rustc_borrowck::region_infer::region_context",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                        ::tracing_core::__macro_support::Option::Some(729u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                        ::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!("universal_regions: {0:#?}",
                                                    universal_region_relations.universal_regions) as
                                            &dyn ::tracing::field::Value))])
            });
    } else { ; }
};debug!("universal_regions: {:#?}", universal_region_relations.universal_regions);
730        {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs:730",
                        "rustc_borrowck::region_infer::region_context",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                        ::tracing_core::__macro_support::Option::Some(730u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                        ::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!("outlives constraints: {0:#?}",
                                                    outlives_constraints) as &dyn ::tracing::field::Value))])
            });
    } else { ; }
};debug!("outlives constraints: {:#?}", outlives_constraints);
731        {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs:731",
                        "rustc_borrowck::region_infer::region_context",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                        ::tracing_core::__macro_support::Option::Some(731u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                        ::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!("placeholder_indices: {0:#?}",
                                                    placeholder_indices) as &dyn ::tracing::field::Value))])
            });
    } else { ; }
};debug!("placeholder_indices: {:#?}", placeholder_indices);
732        {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs:732",
                        "rustc_borrowck::region_infer::region_context",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                        ::tracing_core::__macro_support::Option::Some(732u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                        ::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!("type tests: {0:#?}",
                                                    type_tests) as &dyn ::tracing::field::Value))])
            });
    } else { ; }
};debug!("type tests: {:#?}", type_tests);
733
734        let constraint_graph = Frozen::freeze(outlives_constraints.graph(definitions.len()));
735
736        if truecfg!(debug_assertions) {
737            sccs_info(infcx, &constraint_sccs);
738        }
739
740        let mut scc_values =
741            RegionValues::new(location_map, universal_regions.len(), placeholder_indices);
742
743        // Initializes the region variables with their initial live points.
744        for (region, definition) in definitions.iter_enumerated() {
745            let scc = constraint_sccs.scc(region);
746
747            // For each universally quantified region (lifetime parameter). The
748            // first N variables always correspond to the regions appearing in the
749            // function signature (both named and anonymous) and in where-clauses.
750            match definition.origin {
751                // For each free, universally quantified region X:
752                NllRegionVariableOrigin::FreeRegion => {
753                    // Add `end(X)` into the set for X.
754                    scc_values.add_free_region(scc, region);
755                }
756
757                NllRegionVariableOrigin::Placeholder(placeholder) => {
758                    scc_values.add_placeholder(scc, placeholder);
759                }
760
761                NllRegionVariableOrigin::Existential { .. } => {
762                    // For existential, regions, nothing to do.
763                }
764            }
765
766            // Initially copy the liveness constraints of any region that
767            // has them, setting `scc_values[scc(region)] |= liveness_constraints[region]`.
768            //
769            // These values will later be propagated during [`Self::propagate_constraints()`].
770            // The values include any live-at-all-points constraints added previously in `liveness::generate`.
771            if let Some(liveness) = liveness_constraints.point_liveness(region) {
772                scc_values.merge_liveness(scc, liveness)
773            }
774        }
775
776        Self {
777            data: RegionInferenceContextInner {
778                definitions,
779                liveness_constraints,
780                constraints: outlives_constraints,
781                constraint_graph,
782                constraint_sccs,
783                scc_annotations,
784                universe_causes,
785                universal_region_relations,
786                scc_values,
787            },
788            type_tests,
789        }
790    }
791
792    /// Performs region inference and report errors if we see any
793    /// unsatisfiable constraints. If this is a closure, returns the
794    /// region requirements to propagate to our creator, if any.
795    {}
#[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("solve",
                                    "rustc_borrowck::region_infer::region_context",
                                    ::tracing::Level::DEBUG,
                                    ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                    ::tracing_core::__macro_support::Option::Some(795u32),
                                    ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                                    ::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:
                    (RegionInferenceContext<'tcx>,
                    Option<ClosureRegionRequirements<'tcx>>,
                    RegionErrors<'tcx>) = loop {};
            return __tracing_attr_fake_return;
        }
        {
            let mir_def_id = body.source.def_id();
            self.propagate_constraints();
            let mut errors_buffer = RegionErrors::new(infcx.tcx);
            let mut propagated_outlives_requirements =
                infcx.tcx.is_typeck_child(mir_def_id).then(Vec::new);
            self.check_type_tests(infcx,
                propagated_outlives_requirements.as_mut(),
                &mut errors_buffer);
            {
                use ::tracing::__macro_support::Callsite as _;
                static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                    {
                        static META: ::tracing::Metadata<'static> =
                            {
                                ::tracing_core::metadata::Metadata::new("event /rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs:816",
                                    "rustc_borrowck::region_infer::region_context",
                                    ::tracing::Level::DEBUG,
                                    ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                    ::tracing_core::__macro_support::Option::Some(816u32),
                                    ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                                    ::tracing_core::field::FieldSet::new(&[{
                                                        const NAME:
                                                            ::tracing::__macro_support::FieldName<{
                                                                ::tracing::__macro_support::FieldName::len("errors_buffer")
                                                            }> =
                                                            ::tracing::__macro_support::FieldName::new("errors_buffer");
                                                        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(&errors_buffer)
                                                        as &dyn ::tracing::field::Value))])
                        });
                } else { ; }
            };
            {
                use ::tracing::__macro_support::Callsite as _;
                static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                    {
                        static META: ::tracing::Metadata<'static> =
                            {
                                ::tracing_core::metadata::Metadata::new("event /rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs:817",
                                    "rustc_borrowck::region_infer::region_context",
                                    ::tracing::Level::DEBUG,
                                    ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                    ::tracing_core::__macro_support::Option::Some(817u32),
                                    ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                                    ::tracing_core::field::FieldSet::new(&[{
                                                        const NAME:
                                                            ::tracing::__macro_support::FieldName<{
                                                                ::tracing::__macro_support::FieldName::len("propagated_outlives_requirements")
                                                            }> =
                                                            ::tracing::__macro_support::FieldName::new("propagated_outlives_requirements");
                                                        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(&propagated_outlives_requirements)
                                                        as &dyn ::tracing::field::Value))])
                        });
                } else { ; }
            };
            if infcx.tcx.sess.opts.unstable_opts.polonius.is_legacy_enabled()
                {
                self.check_polonius_subset_errors(propagated_outlives_requirements.as_mut(),
                    &mut errors_buffer,
                    polonius_output.as_ref().expect("Polonius output is unavailable despite `-Z polonius`"));
            } else {
                self.check_universal_regions(propagated_outlives_requirements.as_mut(),
                    &mut errors_buffer);
            }
            {
                use ::tracing::__macro_support::Callsite as _;
                static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                    {
                        static META: ::tracing::Metadata<'static> =
                            {
                                ::tracing_core::metadata::Metadata::new("event /rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs:837",
                                    "rustc_borrowck::region_infer::region_context",
                                    ::tracing::Level::DEBUG,
                                    ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                    ::tracing_core::__macro_support::Option::Some(837u32),
                                    ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                                    ::tracing_core::field::FieldSet::new(&[{
                                                        const NAME:
                                                            ::tracing::__macro_support::FieldName<{
                                                                ::tracing::__macro_support::FieldName::len("errors_buffer")
                                                            }> =
                                                            ::tracing::__macro_support::FieldName::new("errors_buffer");
                                                        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(&errors_buffer)
                                                        as &dyn ::tracing::field::Value))])
                        });
                } else { ; }
            };
            let propagated_outlives_requirements =
                propagated_outlives_requirements.unwrap_or_default();
            if propagated_outlives_requirements.is_empty() {
                (RegionInferenceContext { data: Frozen::freeze(self.data) },
                    None, errors_buffer)
            } else {
                let num_external_vids =
                    self.universal_regions().num_global_and_external_regions();
                (RegionInferenceContext { data: Frozen::freeze(self.data) },
                    Some(ClosureRegionRequirements {
                            num_external_vids,
                            outlives_requirements: propagated_outlives_requirements,
                        }), errors_buffer)
            }
        }
    }
}#[instrument(skip(self, infcx, body, polonius_output), level = "debug")]
796    pub(crate) fn solve(
797        mut self,
798        infcx: &InferCtxt<'tcx>,
799        body: &Body<'tcx>,
800        polonius_output: Option<Box<PoloniusOutput>>,
801    ) -> (RegionInferenceContext<'tcx>, Option<ClosureRegionRequirements<'tcx>>, RegionErrors<'tcx>)
802    {
803        let mir_def_id = body.source.def_id();
804        self.propagate_constraints();
805
806        let mut errors_buffer = RegionErrors::new(infcx.tcx);
807
808        // If this is a nested body, we propagate unsatisfied
809        // outlives constraints to the parent body instead of
810        // eagerly erroing.
811        let mut propagated_outlives_requirements =
812            infcx.tcx.is_typeck_child(mir_def_id).then(Vec::new);
813
814        self.check_type_tests(infcx, propagated_outlives_requirements.as_mut(), &mut errors_buffer);
815
816        debug!(?errors_buffer);
817        debug!(?propagated_outlives_requirements);
818
819        // In Polonius mode, the errors about missing universal region relations are in the output
820        // and need to be emitted or propagated. Otherwise, we need to check whether the
821        // constraints were too strong, and if so, emit or propagate those errors.
822        if infcx.tcx.sess.opts.unstable_opts.polonius.is_legacy_enabled() {
823            self.check_polonius_subset_errors(
824                propagated_outlives_requirements.as_mut(),
825                &mut errors_buffer,
826                polonius_output
827                    .as_ref()
828                    .expect("Polonius output is unavailable despite `-Z polonius`"),
829            );
830        } else {
831            self.check_universal_regions(
832                propagated_outlives_requirements.as_mut(),
833                &mut errors_buffer,
834            );
835        }
836
837        debug!(?errors_buffer);
838
839        let propagated_outlives_requirements = propagated_outlives_requirements.unwrap_or_default();
840        if propagated_outlives_requirements.is_empty() {
841            (RegionInferenceContext { data: Frozen::freeze(self.data) }, None, errors_buffer)
842        } else {
843            let num_external_vids = self.universal_regions().num_global_and_external_regions();
844            (
845                RegionInferenceContext { data: Frozen::freeze(self.data) },
846                Some(ClosureRegionRequirements {
847                    num_external_vids,
848                    outlives_requirements: propagated_outlives_requirements,
849                }),
850                errors_buffer,
851            )
852        }
853    }
854
855    /// Propagate the region constraints: this will grow the values
856    /// for each region variable until all the constraints are
857    /// satisfied. Note that some values may grow **too** large to be
858    /// feasible, but we check this later.
859    {}
#[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("propagate_constraints",
                                    "rustc_borrowck::region_infer::region_context",
                                    ::tracing::Level::DEBUG,
                                    ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                    ::tracing_core::__macro_support::Option::Some(859u32),
                                    ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                                    ::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;
        }
        {
            {
                use ::tracing::__macro_support::Callsite as _;
                static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                    {
                        static META: ::tracing::Metadata<'static> =
                            {
                                ::tracing_core::metadata::Metadata::new("event /rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs:861",
                                    "rustc_borrowck::region_infer::region_context",
                                    ::tracing::Level::DEBUG,
                                    ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                    ::tracing_core::__macro_support::Option::Some(861u32),
                                    ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                                    ::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!("constraints={0:#?}",
                                                                {
                                                                    let mut constraints: Vec<_> =
                                                                        self.outlives_constraints().collect();
                                                                    constraints.sort_by_key(|c| (c.sup, c.sub));
                                                                    constraints.into_iter().map(|c|
                                                                                (c, self.constraint_sccs.scc(c.sup),
                                                                                    self.constraint_sccs.scc(c.sub))).collect::<Vec<_>>()
                                                                }) as &dyn ::tracing::field::Value))])
                        });
                } else { ; }
            };
            for scc_a in self.constraint_sccs.all_sccs() {
                for &scc_b in self.data.constraint_sccs.successors(scc_a) {
                    {
                        use ::tracing::__macro_support::Callsite as _;
                        static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                            {
                                static META: ::tracing::Metadata<'static> =
                                    {
                                        ::tracing_core::metadata::Metadata::new("event /rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs:878",
                                            "rustc_borrowck::region_infer::region_context",
                                            ::tracing::Level::DEBUG,
                                            ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                            ::tracing_core::__macro_support::Option::Some(878u32),
                                            ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                                            ::tracing_core::field::FieldSet::new(&[{
                                                                const NAME:
                                                                    ::tracing::__macro_support::FieldName<{
                                                                        ::tracing::__macro_support::FieldName::len("scc_b")
                                                                    }> =
                                                                    ::tracing::__macro_support::FieldName::new("scc_b");
                                                                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(&scc_b)
                                                                as &dyn ::tracing::field::Value))])
                                });
                        } else { ; }
                    };
                    self.data.scc_values.add_region(scc_a, scc_b);
                }
            }
        }
    }
}#[instrument(skip(self), level = "debug")]
860    fn propagate_constraints(&mut self) {
861        debug!("constraints={:#?}", {
862            let mut constraints: Vec<_> = self.outlives_constraints().collect();
863            constraints.sort_by_key(|c| (c.sup, c.sub));
864            constraints
865                .into_iter()
866                .map(|c| (c, self.constraint_sccs.scc(c.sup), self.constraint_sccs.scc(c.sub)))
867                .collect::<Vec<_>>()
868        });
869
870        // To propagate constraints, we walk the DAG induced by the
871        // SCC. For each SCC `A`, we visit its successors and compute
872        // their values, then we union all those values to get our
873        // own. This one-shot approach works because iteration is in
874        // dependency order. I.e. a chain A: B: C will visit C, B, A.
875        for scc_a in self.constraint_sccs.all_sccs() {
876            // Walk each SCC `B` such that `A: B`...
877            for &scc_b in self.data.constraint_sccs.successors(scc_a) {
878                debug!(?scc_b);
879                self.data.scc_values.add_region(scc_a, scc_b);
880            }
881        }
882    }
883
884    /// Returns `true` if all the placeholders in the value of `scc_b` are nameable
885    /// in `scc_a`. Used during constraint propagation, and only once
886    /// the value of `scc_b` has been computed.
887    fn can_name_all_placeholders(
888        &self,
889        scc_a: ConstraintSccIndex,
890        scc_b: ConstraintSccIndex,
891    ) -> bool {
892        self.scc_annotations[scc_a].can_name_all_placeholders(self.scc_annotations[scc_b])
893    }
894
895    /// Once regions have been propagated, this method is used to see
896    /// whether the "type tests" produced by typeck were satisfied;
897    /// type tests encode type-outlives relationships like `T:
898    /// 'a`. See `TypeTest` for more details.
899    fn check_type_tests(
900        &self,
901        infcx: &InferCtxt<'tcx>,
902        mut propagated_outlives_requirements: Option<&mut Vec<ClosureOutlivesRequirement<'tcx>>>,
903        errors_buffer: &mut RegionErrors<'tcx>,
904    ) {
905        let tcx = infcx.tcx;
906
907        // Sometimes we register equivalent type-tests that would
908        // result in basically the exact same error being reported to
909        // the user. Avoid that.
910        let mut deduplicate_errors = FxIndexSet::default();
911        let mut failed_type_tests = Vec::new();
912
913        for type_test in &self.type_tests {
914            {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs:914",
                        "rustc_borrowck::region_infer::region_context",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                        ::tracing_core::__macro_support::Option::Some(914u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                        ::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!("check_type_test: {0:?}",
                                                    type_test) as &dyn ::tracing::field::Value))])
            });
    } else { ; }
};debug!("check_type_test: {:?}", type_test);
915
916            let generic_ty = type_test.generic_kind.to_ty(tcx);
917            if self.eval_verify_bound(
918                infcx,
919                generic_ty,
920                type_test.lower_bound,
921                &type_test.verify_bound,
922            ) {
923                continue;
924            }
925
926            if let Some(propagated_outlives_requirements) = &mut propagated_outlives_requirements
927                && self.try_promote_type_test(infcx, type_test, propagated_outlives_requirements)
928            {
929                continue;
930            }
931
932            // Type-test failed. Collect it so we can suppress redundant errors below.
933            let erased_generic_kind = infcx.tcx.erase_and_anonymize_regions(type_test.generic_kind);
934            failed_type_tests.push((erased_generic_kind, type_test));
935        }
936
937        // An async body can produce both `G: 'static` and `G: 'a` type-test failures at
938        // the same span, as in `tests/ui/async-await/spurious-static-bound-issue-115376.rs`.
939        // Reporting the weaker bound adds a redundant diagnostic and suggests a lifetime
940        // bound that cannot fix the missing `G: 'static` requirement. Keep the `'static`
941        // error and suppress weaker failures for the same erased generic kind and span.
942        // This is a diagnostic heuristic, using the same erasure as deduplication below.
943        //
944        // Collect all failed `'static` bounds before reporting errors so suppression does
945        // not depend on the order of the type tests. Compare SCCs because a lower-bound
946        // region can be equivalent to `'static` without being `fr_static` itself.
947        let static_scc = self.constraint_sccs.scc(self.universal_regions().fr_static);
948        let static_bound_errors: FxIndexSet<_> = failed_type_tests
949            .iter()
950            .filter_map(|&(erased_generic_kind, type_test)| {
951                if self.constraint_sccs.scc(type_test.lower_bound) == static_scc {
952                    Some((erased_generic_kind, type_test.span))
953                } else {
954                    None
955                }
956            })
957            .collect();
958
959        // If `G: 'static` failed at this span, then same-span `G: 'a` failures are weaker.
960        for (erased_generic_kind, type_test) in failed_type_tests {
961            if self.constraint_sccs.scc(type_test.lower_bound) != static_scc
962                && static_bound_errors.contains(&(erased_generic_kind, type_test.span))
963            {
964                continue;
965            }
966
967            // Skip duplicate-ish errors.
968            if deduplicate_errors.insert((
969                erased_generic_kind,
970                type_test.lower_bound,
971                type_test.span,
972            )) {
973                {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs:973",
                        "rustc_borrowck::region_infer::region_context",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                        ::tracing_core::__macro_support::Option::Some(973u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                        ::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!("check_type_test: reporting error for erased_generic_kind={0:?}, lower_bound_region={1:?}, type_test.span={2:?}",
                                                    erased_generic_kind, type_test.lower_bound, type_test.span)
                                            as &dyn ::tracing::field::Value))])
            });
    } else { ; }
};debug!(
974                    "check_type_test: reporting error for erased_generic_kind={:?}, \
975                     lower_bound_region={:?}, \
976                     type_test.span={:?}",
977                    erased_generic_kind, type_test.lower_bound, type_test.span,
978                );
979
980                errors_buffer.push(RegionErrorKind::TypeTestError { type_test: type_test.clone() });
981            }
982        }
983    }
984
985    /// Invoked when we have some type-test (e.g., `T: 'X`) that we cannot
986    /// prove to be satisfied. If this is a closure, we will attempt to
987    /// "promote" this type-test into our `ClosureRegionRequirements` and
988    /// hence pass it up the creator. To do this, we have to phrase the
989    /// type-test in terms of external free regions, as local free
990    /// regions are not nameable by the closure's creator.
991    ///
992    /// Promotion works as follows: we first check that the type `T`
993    /// contains only regions that the creator knows about. If this is
994    /// true, then -- as a consequence -- we know that all regions in
995    /// the type `T` are free regions that outlive the closure body. If
996    /// false, then promotion fails.
997    ///
998    /// Once we've promoted T, we have to "promote" `'X` to some region
999    /// that is "external" to the closure. Generally speaking, a region
1000    /// may be the union of some points in the closure body as well as
1001    /// various free lifetimes. We can ignore the points in the closure
1002    /// body: if the type T can be expressed in terms of external regions,
1003    /// we know it outlives the points in the closure body. That
1004    /// just leaves the free regions.
1005    ///
1006    /// The idea then is to lower the `T: 'X` constraint into multiple
1007    /// bounds -- e.g., if `'X` is the union of two free lifetimes,
1008    /// `'1` and `'2`, then we would create `T: '1` and `T: '2`.
1009    {}
#[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("try_promote_type_test",
                                    "rustc_borrowck::region_infer::region_context",
                                    ::tracing::Level::DEBUG,
                                    ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                    ::tracing_core::__macro_support::Option::Some(1009u32),
                                    ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                                    ::tracing_core::field::FieldSet::new(&[{
                                                        const NAME:
                                                            ::tracing::__macro_support::FieldName<{
                                                                ::tracing::__macro_support::FieldName::len("type_test")
                                                            }> =
                                                            ::tracing::__macro_support::FieldName::new("type_test");
                                                        NAME.as_str()
                                                    }], ::tracing_core::callsite::Identifier(&__CALLSITE)),
                                    ::tracing::metadata::Kind::SPAN)
                            };
                        ::tracing::callsite::DefaultCallsite::new(&META)
                    };
                let mut interest = ::tracing::subscriber::Interest::never();
                if ::tracing::Level::DEBUG <=
                                    ::tracing::level_filters::STATIC_MAX_LEVEL &&
                                ::tracing::Level::DEBUG <=
                                    ::tracing::level_filters::LevelFilter::current() &&
                            { interest = __CALLSITE.interest(); !interest.is_never() }
                        &&
                        ::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
                            interest) {
                    let meta = __CALLSITE.metadata();
                    ::tracing::Span::new(meta,
                        &{
                                #[allow(unused_imports)]
                                use ::tracing::field::{debug, display, Value};
                                meta.fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&type_test)
                                                            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 = infcx.tcx;
            let TypeTest {
                    generic_kind, lower_bound, span: blame_span, verify_bound: _
                    } = *type_test;
            let generic_ty = generic_kind.to_ty(tcx);
            let Some(subject) =
                self.try_promote_type_test_subject(infcx,
                    generic_ty) else { return false; };
            let r_scc = self.constraint_sccs.scc(lower_bound);
            {
                use ::tracing::__macro_support::Callsite as _;
                static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                    {
                        static META: ::tracing::Metadata<'static> =
                            {
                                ::tracing_core::metadata::Metadata::new("event /rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs:1025",
                                    "rustc_borrowck::region_infer::region_context",
                                    ::tracing::Level::DEBUG,
                                    ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                    ::tracing_core::__macro_support::Option::Some(1025u32),
                                    ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                                    ::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!("lower_bound = {0:?} r_scc={1:?} universe={2:?}",
                                                                lower_bound, r_scc, self.max_nameable_universe(r_scc)) as
                                                        &dyn ::tracing::field::Value))])
                        });
                } else { ; }
            };
            if let Some(p) =
                    self.scc_values.placeholders_contained_in(r_scc).next() {
                {
                    use ::tracing::__macro_support::Callsite as _;
                    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                        {
                            static META: ::tracing::Metadata<'static> =
                                {
                                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs:1038",
                                        "rustc_borrowck::region_infer::region_context",
                                        ::tracing::Level::DEBUG,
                                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                        ::tracing_core::__macro_support::Option::Some(1038u32),
                                        ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                                        ::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!("encountered placeholder in higher universe: {0:?}, requiring \'static",
                                                                    p) as &dyn ::tracing::field::Value))])
                            });
                    } else { ; }
                };
                let static_r = self.universal_regions().fr_static;
                propagated_outlives_requirements.push(ClosureOutlivesRequirement {
                        subject,
                        outlived_free_region: static_r,
                        blame_span,
                        category: ConstraintCategory::Boring,
                    });
                return true;
            }
            let mut found_outlived_universal_region = false;
            for ur in self.scc_values.universal_regions_outlived_by(r_scc) {
                found_outlived_universal_region = true;
                {
                    use ::tracing::__macro_support::Callsite as _;
                    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                        {
                            static META: ::tracing::Metadata<'static> =
                                {
                                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs:1058",
                                        "rustc_borrowck::region_infer::region_context",
                                        ::tracing::Level::DEBUG,
                                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                        ::tracing_core::__macro_support::Option::Some(1058u32),
                                        ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                                        ::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!("universal_region_outlived_by ur={0:?}",
                                                                    ur) as &dyn ::tracing::field::Value))])
                            });
                    } else { ; }
                };
                let non_local_ub =
                    self.universal_region_relations.non_local_upper_bounds(ur);
                {
                    use ::tracing::__macro_support::Callsite as _;
                    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                        {
                            static META: ::tracing::Metadata<'static> =
                                {
                                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs:1060",
                                        "rustc_borrowck::region_infer::region_context",
                                        ::tracing::Level::DEBUG,
                                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                        ::tracing_core::__macro_support::Option::Some(1060u32),
                                        ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                                        ::tracing_core::field::FieldSet::new(&[{
                                                            const NAME:
                                                                ::tracing::__macro_support::FieldName<{
                                                                    ::tracing::__macro_support::FieldName::len("non_local_ub")
                                                                }> =
                                                                ::tracing::__macro_support::FieldName::new("non_local_ub");
                                                            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(&non_local_ub)
                                                            as &dyn ::tracing::field::Value))])
                            });
                    } else { ; }
                };
                for upper_bound in non_local_ub {
                    if true {
                        if !self.universal_regions().is_universal_region(upper_bound)
                            {
                            ::core::panicking::panic("assertion failed: self.universal_regions().is_universal_region(upper_bound)")
                        };
                    };
                    if true {
                        if !!self.universal_regions().is_local_free_region(upper_bound)
                            {
                            ::core::panicking::panic("assertion failed: !self.universal_regions().is_local_free_region(upper_bound)")
                        };
                    };
                    let requirement =
                        ClosureOutlivesRequirement {
                            subject,
                            outlived_free_region: upper_bound,
                            blame_span,
                            category: ConstraintCategory::Boring,
                        };
                    {
                        use ::tracing::__macro_support::Callsite as _;
                        static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                            {
                                static META: ::tracing::Metadata<'static> =
                                    {
                                        ::tracing_core::metadata::Metadata::new("event /rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs:1076",
                                            "rustc_borrowck::region_infer::region_context",
                                            ::tracing::Level::DEBUG,
                                            ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                            ::tracing_core::__macro_support::Option::Some(1076u32),
                                            ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                                            ::tracing_core::field::FieldSet::new(&["message",
                                                            {
                                                                const NAME:
                                                                    ::tracing::__macro_support::FieldName<{
                                                                        ::tracing::__macro_support::FieldName::len("requirement")
                                                                    }> =
                                                                    ::tracing::__macro_support::FieldName::new("requirement");
                                                                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(&format_args!("adding closure requirement")
                                                                as &dyn ::tracing::field::Value)),
                                                    (::tracing::__macro_support::Option::Some(&::tracing::field::debug(&requirement)
                                                                as &dyn ::tracing::field::Value))])
                                });
                        } else { ; }
                    };
                    propagated_outlives_requirements.push(requirement);
                }
            }
            if !found_outlived_universal_region {
                ::core::panicking::panic("assertion failed: found_outlived_universal_region")
            };
            true
        }
    }
}#[instrument(level = "debug", skip(self, infcx, propagated_outlives_requirements))]
1010    fn try_promote_type_test(
1011        &self,
1012        infcx: &InferCtxt<'tcx>,
1013        type_test: &TypeTest<'tcx>,
1014        propagated_outlives_requirements: &mut Vec<ClosureOutlivesRequirement<'tcx>>,
1015    ) -> bool {
1016        let tcx = infcx.tcx;
1017        let TypeTest { generic_kind, lower_bound, span: blame_span, verify_bound: _ } = *type_test;
1018
1019        let generic_ty = generic_kind.to_ty(tcx);
1020        let Some(subject) = self.try_promote_type_test_subject(infcx, generic_ty) else {
1021            return false;
1022        };
1023
1024        let r_scc = self.constraint_sccs.scc(lower_bound);
1025        debug!(
1026            "lower_bound = {:?} r_scc={:?} universe={:?}",
1027            lower_bound,
1028            r_scc,
1029            self.max_nameable_universe(r_scc)
1030        );
1031        // If the type test requires that `T: 'a` where `'a` is a
1032        // placeholder from another universe, that effectively requires
1033        // `T: 'static`, so we have to propagate that requirement.
1034        //
1035        // It doesn't matter *what* universe because the promoted `T` will
1036        // always be in the root universe.
1037        if let Some(p) = self.scc_values.placeholders_contained_in(r_scc).next() {
1038            debug!("encountered placeholder in higher universe: {:?}, requiring 'static", p);
1039            let static_r = self.universal_regions().fr_static;
1040            propagated_outlives_requirements.push(ClosureOutlivesRequirement {
1041                subject,
1042                outlived_free_region: static_r,
1043                blame_span,
1044                category: ConstraintCategory::Boring,
1045            });
1046
1047            // we can return here -- the code below might push add'l constraints
1048            // but they would all be weaker than this one.
1049            return true;
1050        }
1051
1052        // For each region outlived by lower_bound find a non-local,
1053        // universal region (it may be the same region) and add it to
1054        // `ClosureOutlivesRequirement`.
1055        let mut found_outlived_universal_region = false;
1056        for ur in self.scc_values.universal_regions_outlived_by(r_scc) {
1057            found_outlived_universal_region = true;
1058            debug!("universal_region_outlived_by ur={:?}", ur);
1059            let non_local_ub = self.universal_region_relations.non_local_upper_bounds(ur);
1060            debug!(?non_local_ub);
1061
1062            // This is slightly too conservative. To show T: '1, given `'2: '1`
1063            // and `'3: '1` we only need to prove that T: '2 *or* T: '3, but to
1064            // avoid potential non-determinism we approximate this by requiring
1065            // T: '1 and T: '2.
1066            for upper_bound in non_local_ub {
1067                debug_assert!(self.universal_regions().is_universal_region(upper_bound));
1068                debug_assert!(!self.universal_regions().is_local_free_region(upper_bound));
1069
1070                let requirement = ClosureOutlivesRequirement {
1071                    subject,
1072                    outlived_free_region: upper_bound,
1073                    blame_span,
1074                    category: ConstraintCategory::Boring,
1075                };
1076                debug!(?requirement, "adding closure requirement");
1077                propagated_outlives_requirements.push(requirement);
1078            }
1079        }
1080        // If we succeed to promote the subject, i.e. it only contains non-local regions,
1081        // and fail to prove the type test inside of the closure, the `lower_bound` has to
1082        // also be at least as large as some universal region, as the type test is otherwise
1083        // trivial.
1084        assert!(found_outlived_universal_region);
1085        true
1086    }
1087
1088    /// When we promote a type test `T: 'r`, we have to replace all region
1089    /// variables in the type `T` with an equal universal region from the
1090    /// closure signature.
1091    /// This is not always possible, so this is a fallible process.
1092    {}
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("try_promote_type_test_subject",
                                "rustc_borrowck::region_infer::region_context",
                                ::tracing::Level::DEBUG,
                                ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                ::tracing_core::__macro_support::Option::Some(1092u32),
                                ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                                ::tracing_core::field::FieldSet::new(&[{
                                                    const NAME:
                                                        ::tracing::__macro_support::FieldName<{
                                                            ::tracing::__macro_support::FieldName::len("ty")
                                                        }> =
                                                        ::tracing::__macro_support::FieldName::new("ty");
                                                    NAME.as_str()
                                                }], ::tracing_core::callsite::Identifier(&__CALLSITE)),
                                ::tracing::metadata::Kind::SPAN)
                        };
                    ::tracing::callsite::DefaultCallsite::new(&META)
                };
            let mut interest = ::tracing::subscriber::Interest::never();
            if ::tracing::Level::DEBUG <=
                                ::tracing::level_filters::STATIC_MAX_LEVEL &&
                            ::tracing::Level::DEBUG <=
                                ::tracing::level_filters::LevelFilter::current() &&
                        { interest = __CALLSITE.interest(); !interest.is_never() }
                    &&
                    ::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
                        interest) {
                let meta = __CALLSITE.metadata();
                ::tracing::Span::new(meta,
                    &{
                            #[allow(unused_imports)]
                            use ::tracing::field::{debug, display, Value};
                            meta.fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&ty)
                                                        as &dyn ::tracing::field::Value))])
                        })
            } else {
                let span =
                    ::tracing::__macro_support::__disabled_span(__CALLSITE.metadata());
                {};
                span
            }
        };
    __tracing_attr_guard = __tracing_attr_span.enter();
}
#[allow(clippy :: redundant_closure_call)]
let x =
    (move ||
                {

                    #[allow(unknown_lints, unreachable_code, clippy ::
                    diverging_sub_expression, clippy :: empty_loop, clippy ::
                    let_unit_value, clippy :: let_with_type_underscore, clippy
                    :: needless_return, clippy :: unreachable)]
                    if false {
                        let __tracing_attr_fake_return:
                                Option<ClosureOutlivesSubject<'tcx>> = loop {};
                        return __tracing_attr_fake_return;
                    }
                    {
                        let tcx = infcx.tcx;
                        let mut failed = false;
                        let ty =
                            fold_regions(tcx, ty,
                                |r, _depth|
                                    {
                                        let r_vid = self.to_region_vid(r);
                                        let r_scc = self.constraint_sccs.scc(r_vid);
                                        self.scc_values.universal_regions_outlived_by(r_scc).filter(|&u_r|
                                                            !self.universal_regions().is_local_free_region(u_r)).find(|&u_r|
                                                        self.eval_equal(u_r,
                                                            r_vid)).map(|u_r|
                                                    ty::Region::new_var(tcx,
                                                        u_r)).unwrap_or_else(|| { failed = true; r })
                                    });
                        {
                            use ::tracing::__macro_support::Callsite as _;
                            static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                                {
                                    static META: ::tracing::Metadata<'static> =
                                        {
                                            ::tracing_core::metadata::Metadata::new("event /rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs:1122",
                                                "rustc_borrowck::region_infer::region_context",
                                                ::tracing::Level::DEBUG,
                                                ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                                ::tracing_core::__macro_support::Option::Some(1122u32),
                                                ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                                                ::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!("try_promote_type_test_subject: folded ty = {0:?}",
                                                                            ty) as &dyn ::tracing::field::Value))])
                                    });
                            } else { ; }
                        };
                        if failed { return None; }
                        Some(ClosureOutlivesSubject::Ty(ClosureOutlivesSubjectTy::bind(tcx,
                                    ty)))
                    }
                })();
{
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs:1092",
                        "rustc_borrowck::region_infer::region_context",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                        ::tracing_core::__macro_support::Option::Some(1092u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                        ::tracing_core::field::FieldSet::new(&[{
                                            const NAME:
                                                ::tracing::__macro_support::FieldName<{
                                                    ::tracing::__macro_support::FieldName::len("return")
                                                }> =
                                                ::tracing::__macro_support::FieldName::new("return");
                                            NAME.as_str()
                                        }], ::tracing_core::callsite::Identifier(&__CALLSITE)),
                        ::tracing::metadata::Kind::EVENT)
                };
            ::tracing::callsite::DefaultCallsite::new(&META)
        };
    let enabled =
        ::tracing::Level::DEBUG <= ::tracing::level_filters::STATIC_MAX_LEVEL
                &&
                ::tracing::Level::DEBUG <=
                    ::tracing::level_filters::LevelFilter::current() &&
            {
                let interest = __CALLSITE.interest();
                !interest.is_never() &&
                    ::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
                        interest)
            };
    if enabled {
        (|value_set: ::tracing::field::ValueSet|
                    {
                        let meta = __CALLSITE.metadata();
                        ::tracing::Event::dispatch(meta, &value_set);
                        ;
                    })({
                #[allow(unused_imports)]
                use ::tracing::field::{debug, display, Value};
                __CALLSITE.metadata().fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&x)
                                            as &dyn ::tracing::field::Value))])
            });
    } else { ; }
};
x;#[instrument(level = "debug", skip(self, infcx), ret)]
1093    fn try_promote_type_test_subject(
1094        &self,
1095        infcx: &InferCtxt<'tcx>,
1096        ty: Ty<'tcx>,
1097    ) -> Option<ClosureOutlivesSubject<'tcx>> {
1098        let tcx = infcx.tcx;
1099        let mut failed = false;
1100        let ty = fold_regions(tcx, ty, |r, _depth| {
1101            let r_vid = self.to_region_vid(r);
1102            let r_scc = self.constraint_sccs.scc(r_vid);
1103
1104            // The challenge is this. We have some region variable `r`
1105            // whose value is a set of CFG points and universal
1106            // regions. We want to find if that set is *equivalent* to
1107            // any of the named regions found in the closure.
1108            // To do so, we simply check every candidate `u_r` for equality.
1109            self.scc_values
1110                .universal_regions_outlived_by(r_scc)
1111                .filter(|&u_r| !self.universal_regions().is_local_free_region(u_r))
1112                .find(|&u_r| self.eval_equal(u_r, r_vid))
1113                .map(|u_r| ty::Region::new_var(tcx, u_r))
1114                // In case we could not find a named region to map to,
1115                // we will return `None` below.
1116                .unwrap_or_else(|| {
1117                    failed = true;
1118                    r
1119                })
1120        });
1121
1122        debug!("try_promote_type_test_subject: folded ty = {:?}", ty);
1123
1124        // This will be true if we failed to promote some region.
1125        if failed {
1126            return None;
1127        }
1128
1129        Some(ClosureOutlivesSubject::Ty(ClosureOutlivesSubjectTy::bind(tcx, ty)))
1130    }
1131
1132    /// Tests if `test` is true when applied to `lower_bound` at
1133    /// `point`.
1134    fn eval_verify_bound(
1135        &self,
1136        infcx: &InferCtxt<'tcx>,
1137        generic_ty: Ty<'tcx>,
1138        lower_bound: RegionVid,
1139        verify_bound: &VerifyBound<'tcx>,
1140    ) -> bool {
1141        {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs:1141",
                        "rustc_borrowck::region_infer::region_context",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                        ::tracing_core::__macro_support::Option::Some(1141u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                        ::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!("eval_verify_bound(lower_bound={0:?}, verify_bound={1:?})",
                                                    lower_bound, verify_bound) as
                                            &dyn ::tracing::field::Value))])
            });
    } else { ; }
};debug!("eval_verify_bound(lower_bound={:?}, verify_bound={:?})", lower_bound, verify_bound);
1142
1143        match verify_bound {
1144            VerifyBound::IfEq(verify_if_eq_b) => {
1145                self.eval_if_eq(infcx, generic_ty, lower_bound, *verify_if_eq_b)
1146            }
1147
1148            VerifyBound::IsEmpty => {
1149                let lower_bound_scc = self.constraint_sccs.scc(lower_bound);
1150                self.scc_values.elements_contained_in(lower_bound_scc).next().is_none()
1151            }
1152
1153            VerifyBound::OutlivedBy(r) => {
1154                let r_vid = self.to_region_vid(*r);
1155                self.eval_outlives(r_vid, lower_bound)
1156            }
1157
1158            VerifyBound::AnyBound(verify_bounds) => verify_bounds.iter().any(|verify_bound| {
1159                self.eval_verify_bound(infcx, generic_ty, lower_bound, verify_bound)
1160            }),
1161
1162            VerifyBound::AllBounds(verify_bounds) => verify_bounds.iter().all(|verify_bound| {
1163                self.eval_verify_bound(infcx, generic_ty, lower_bound, verify_bound)
1164            }),
1165        }
1166    }
1167
1168    fn eval_if_eq(
1169        &self,
1170        infcx: &InferCtxt<'tcx>,
1171        generic_ty: Ty<'tcx>,
1172        lower_bound: RegionVid,
1173        verify_if_eq_b: ty::Binder<'tcx, VerifyIfEq<'tcx>>,
1174    ) -> bool {
1175        let generic_ty = self.normalize_to_scc_representatives(infcx.tcx, generic_ty);
1176        let verify_if_eq_b = self.normalize_to_scc_representatives(infcx.tcx, verify_if_eq_b);
1177        match test_type_match::extract_verify_if_eq(infcx.tcx, &verify_if_eq_b, generic_ty) {
1178            Some(r) => {
1179                let r_vid = self.to_region_vid(r);
1180                self.eval_outlives(r_vid, lower_bound)
1181            }
1182            None => false,
1183        }
1184    }
1185
1186    /// This is a conservative normalization procedure. It takes every
1187    /// free region in `value` and replaces it with the
1188    /// "representative" of its SCC (see `scc_representatives` field).
1189    /// We are guaranteed that if two values normalize to the same
1190    /// thing, then they are equal; this is a conservative check in
1191    /// that they could still be equal even if they normalize to
1192    /// different results. (For example, there might be two regions
1193    /// with the same value that are not in the same SCC).
1194    ///
1195    /// N.B., this is not an ideal approach and I would like to revisit
1196    /// it. However, it works pretty well in practice. In particular,
1197    /// this is needed to deal with projection outlives bounds like
1198    ///
1199    /// ```text
1200    /// <T as Foo<'0>>::Item: '1
1201    /// ```
1202    ///
1203    /// In particular, this routine winds up being important when
1204    /// there are bounds like `where <T as Foo<'a>>::Item: 'b` in the
1205    /// environment. In this case, if we can show that `'0 == 'a`,
1206    /// and that `'b: '1`, then we know that the clause is
1207    /// satisfied. In such cases, particularly due to limitations of
1208    /// the trait solver =), we usually wind up with a where-clause like
1209    /// `T: Foo<'a>` in scope, which thus forces `'0 == 'a` to be added as
1210    /// a constraint, and thus ensures that they are in the same SCC.
1211    ///
1212    /// So why can't we do a more correct routine? Well, we could
1213    /// *almost* use the `relate_tys` code, but the way it is
1214    /// currently setup it creates inference variables to deal with
1215    /// higher-ranked things and so forth, and right now the inference
1216    /// context is not permitted to make more inference variables. So
1217    /// we use this kind of hacky solution.
1218    fn normalize_to_scc_representatives<T>(&self, tcx: TyCtxt<'tcx>, value: T) -> T
1219    where
1220        T: TypeFoldable<TyCtxt<'tcx>>,
1221    {
1222        fold_regions(tcx, value, |r, _db| {
1223            let vid = self.to_region_vid(r);
1224            let scc = self.constraint_sccs.scc(vid);
1225            let repr = self.scc_representative(scc);
1226            ty::Region::new_var(tcx, repr)
1227        })
1228    }
1229
1230    /// Evaluate whether `sup_region == sub_region`.
1231    ///
1232    /// Panics if called before `solve()` executes,
1233    // This is `pub` because it's used by unstable external borrowck data users, see `consumers.rs`.
1234    pub(crate) fn eval_equal(&self, r1: RegionVid, r2: RegionVid) -> bool {
1235        self.eval_outlives(r1, r2) && self.eval_outlives(r2, r1)
1236    }
1237
1238    /// Evaluate whether `sup_region: sub_region`.
1239    ///
1240    /// Panics if called before `solve()` executes,
1241    // This is `pub` because it's used by unstable external borrowck data users, see `consumers.rs`.
1242    {}
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("eval_outlives",
                                "rustc_borrowck::region_infer::region_context",
                                ::tracing::Level::DEBUG,
                                ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                ::tracing_core::__macro_support::Option::Some(1242u32),
                                ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                                ::tracing_core::field::FieldSet::new(&[{
                                                    const NAME:
                                                        ::tracing::__macro_support::FieldName<{
                                                            ::tracing::__macro_support::FieldName::len("sup_region")
                                                        }> =
                                                        ::tracing::__macro_support::FieldName::new("sup_region");
                                                    NAME.as_str()
                                                },
                                                {
                                                    const NAME:
                                                        ::tracing::__macro_support::FieldName<{
                                                            ::tracing::__macro_support::FieldName::len("sub_region")
                                                        }> =
                                                        ::tracing::__macro_support::FieldName::new("sub_region");
                                                    NAME.as_str()
                                                }], ::tracing_core::callsite::Identifier(&__CALLSITE)),
                                ::tracing::metadata::Kind::SPAN)
                        };
                    ::tracing::callsite::DefaultCallsite::new(&META)
                };
            let mut interest = ::tracing::subscriber::Interest::never();
            if ::tracing::Level::DEBUG <=
                                ::tracing::level_filters::STATIC_MAX_LEVEL &&
                            ::tracing::Level::DEBUG <=
                                ::tracing::level_filters::LevelFilter::current() &&
                        { interest = __CALLSITE.interest(); !interest.is_never() }
                    &&
                    ::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
                        interest) {
                let meta = __CALLSITE.metadata();
                ::tracing::Span::new(meta,
                    &{
                            #[allow(unused_imports)]
                            use ::tracing::field::{debug, display, Value};
                            meta.fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&sup_region)
                                                        as &dyn ::tracing::field::Value)),
                                            (::tracing::__macro_support::Option::Some(&::tracing::field::debug(&sub_region)
                                                        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: bool = loop {};
                        return __tracing_attr_fake_return;
                    }
                    {
                        {
                            use ::tracing::__macro_support::Callsite as _;
                            static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                                {
                                    static META: ::tracing::Metadata<'static> =
                                        {
                                            ::tracing_core::metadata::Metadata::new("event /rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs:1244",
                                                "rustc_borrowck::region_infer::region_context",
                                                ::tracing::Level::DEBUG,
                                                ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                                ::tracing_core::__macro_support::Option::Some(1244u32),
                                                ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                                                ::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!("sup_region\'s value = {0:?} universal={1:?}",
                                                                            self.region_value_str(sup_region),
                                                                            self.universal_regions().is_universal_region(sup_region)) as
                                                                    &dyn ::tracing::field::Value))])
                                    });
                            } else { ; }
                        };
                        {
                            use ::tracing::__macro_support::Callsite as _;
                            static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                                {
                                    static META: ::tracing::Metadata<'static> =
                                        {
                                            ::tracing_core::metadata::Metadata::new("event /rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs:1249",
                                                "rustc_borrowck::region_infer::region_context",
                                                ::tracing::Level::DEBUG,
                                                ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                                ::tracing_core::__macro_support::Option::Some(1249u32),
                                                ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                                                ::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!("sub_region\'s value = {0:?} universal={1:?}",
                                                                            self.region_value_str(sub_region),
                                                                            self.universal_regions().is_universal_region(sub_region)) as
                                                                    &dyn ::tracing::field::Value))])
                                    });
                            } else { ; }
                        };
                        let sub_region_scc = self.constraint_sccs.scc(sub_region);
                        let sup_region_scc = self.constraint_sccs.scc(sup_region);
                        if sub_region_scc == sup_region_scc {
                            {
                                use ::tracing::__macro_support::Callsite as _;
                                static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                                    {
                                        static META: ::tracing::Metadata<'static> =
                                            {
                                                ::tracing_core::metadata::Metadata::new("event /rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs:1259",
                                                    "rustc_borrowck::region_infer::region_context",
                                                    ::tracing::Level::DEBUG,
                                                    ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                                    ::tracing_core::__macro_support::Option::Some(1259u32),
                                                    ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                                                    ::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!("{0:?}: {1:?} holds trivially; they are in the same SCC",
                                                                                sup_region, sub_region) as &dyn ::tracing::field::Value))])
                                        });
                                } else { ; }
                            };
                            return true;
                        }
                        let fr_static = self.universal_regions().fr_static;
                        if sub_region != fr_static &&
                                !self.can_name_all_placeholders(sup_region_scc,
                                        sub_region_scc) {
                            {
                                use ::tracing::__macro_support::Callsite as _;
                                static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                                    {
                                        static META: ::tracing::Metadata<'static> =
                                            {
                                                ::tracing_core::metadata::Metadata::new("event /rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs:1273",
                                                    "rustc_borrowck::region_infer::region_context",
                                                    ::tracing::Level::DEBUG,
                                                    ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                                    ::tracing_core::__macro_support::Option::Some(1273u32),
                                                    ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                                                    ::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!("sub universe `{0:?}` is not nameable by super `{1:?}`, promoting to static",
                                                                                sub_region_scc, sup_region_scc) as
                                                                        &dyn ::tracing::field::Value))])
                                        });
                                } else { ; }
                            };
                            return self.eval_outlives(sup_region, fr_static);
                        }
                        let universal_outlives =
                            self.scc_values.universal_regions_outlived_by(sub_region_scc).all(|r1|
                                    {
                                        self.scc_values.universal_regions_outlived_by(sup_region_scc).any(|r2|
                                                self.universal_region_relations.outlives(r2, r1))
                                    });
                        if !universal_outlives {
                            {
                                use ::tracing::__macro_support::Callsite as _;
                                static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                                    {
                                        static META: ::tracing::Metadata<'static> =
                                            {
                                                ::tracing_core::metadata::Metadata::new("event /rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs:1295",
                                                    "rustc_borrowck::region_infer::region_context",
                                                    ::tracing::Level::DEBUG,
                                                    ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                                    ::tracing_core::__macro_support::Option::Some(1295u32),
                                                    ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                                                    ::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!("sub region contains a universal region not present in super")
                                                                        as &dyn ::tracing::field::Value))])
                                        });
                                } else { ; }
                            };
                            return false;
                        }
                        if self.universal_regions().is_universal_region(sup_region)
                            {
                            {
                                use ::tracing::__macro_support::Callsite as _;
                                static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                                    {
                                        static META: ::tracing::Metadata<'static> =
                                            {
                                                ::tracing_core::metadata::Metadata::new("event /rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs:1304",
                                                    "rustc_borrowck::region_infer::region_context",
                                                    ::tracing::Level::DEBUG,
                                                    ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                                    ::tracing_core::__macro_support::Option::Some(1304u32),
                                                    ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                                                    ::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!("super is universal and hence contains all points")
                                                                        as &dyn ::tracing::field::Value))])
                                        });
                                } else { ; }
                            };
                            return true;
                        }
                        {
                            use ::tracing::__macro_support::Callsite as _;
                            static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                                {
                                    static META: ::tracing::Metadata<'static> =
                                        {
                                            ::tracing_core::metadata::Metadata::new("event /rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs:1308",
                                                "rustc_borrowck::region_infer::region_context",
                                                ::tracing::Level::DEBUG,
                                                ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                                ::tracing_core::__macro_support::Option::Some(1308u32),
                                                ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                                                ::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!("comparison between points in sup/sub")
                                                                    as &dyn ::tracing::field::Value))])
                                    });
                            } else { ; }
                        };
                        self.scc_values.contains_points(sup_region_scc,
                            sub_region_scc)
                    }
                })();
{
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs:1242",
                        "rustc_borrowck::region_infer::region_context",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                        ::tracing_core::__macro_support::Option::Some(1242u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                        ::tracing_core::field::FieldSet::new(&[{
                                            const NAME:
                                                ::tracing::__macro_support::FieldName<{
                                                    ::tracing::__macro_support::FieldName::len("return")
                                                }> =
                                                ::tracing::__macro_support::FieldName::new("return");
                                            NAME.as_str()
                                        }], ::tracing_core::callsite::Identifier(&__CALLSITE)),
                        ::tracing::metadata::Kind::EVENT)
                };
            ::tracing::callsite::DefaultCallsite::new(&META)
        };
    let enabled =
        ::tracing::Level::DEBUG <= ::tracing::level_filters::STATIC_MAX_LEVEL
                &&
                ::tracing::Level::DEBUG <=
                    ::tracing::level_filters::LevelFilter::current() &&
            {
                let interest = __CALLSITE.interest();
                !interest.is_never() &&
                    ::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
                        interest)
            };
    if enabled {
        (|value_set: ::tracing::field::ValueSet|
                    {
                        let meta = __CALLSITE.metadata();
                        ::tracing::Event::dispatch(meta, &value_set);
                        ;
                    })({
                #[allow(unused_imports)]
                use ::tracing::field::{debug, display, Value};
                __CALLSITE.metadata().fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&x)
                                            as &dyn ::tracing::field::Value))])
            });
    } else { ; }
};
x;#[instrument(skip(self), level = "debug", ret)]
1243    pub(crate) fn eval_outlives(&self, sup_region: RegionVid, sub_region: RegionVid) -> bool {
1244        debug!(
1245            "sup_region's value = {:?} universal={:?}",
1246            self.region_value_str(sup_region),
1247            self.universal_regions().is_universal_region(sup_region),
1248        );
1249        debug!(
1250            "sub_region's value = {:?} universal={:?}",
1251            self.region_value_str(sub_region),
1252            self.universal_regions().is_universal_region(sub_region),
1253        );
1254
1255        let sub_region_scc = self.constraint_sccs.scc(sub_region);
1256        let sup_region_scc = self.constraint_sccs.scc(sup_region);
1257
1258        if sub_region_scc == sup_region_scc {
1259            debug!("{sup_region:?}: {sub_region:?} holds trivially; they are in the same SCC");
1260            return true;
1261        }
1262
1263        let fr_static = self.universal_regions().fr_static;
1264
1265        // If we are checking that `'sup: 'sub`, and `'sub` contains
1266        // some placeholder that `'sup` cannot name, then this is only
1267        // true if `'sup` outlives static.
1268        //
1269        // Avoid infinite recursion if `sub_region` is already `'static`
1270        if sub_region != fr_static
1271            && !self.can_name_all_placeholders(sup_region_scc, sub_region_scc)
1272        {
1273            debug!(
1274                "sub universe `{sub_region_scc:?}` is not nameable \
1275                by super `{sup_region_scc:?}`, promoting to static",
1276            );
1277
1278            return self.eval_outlives(sup_region, fr_static);
1279        }
1280
1281        // Both the `sub_region` and `sup_region` consist of the union
1282        // of some number of universal regions (along with the union
1283        // of various points in the CFG; ignore those points for
1284        // now). Therefore, the sup-region outlives the sub-region if,
1285        // for each universal region R1 in the sub-region, there
1286        // exists some region R2 in the sup-region that outlives R1.
1287        let universal_outlives =
1288            self.scc_values.universal_regions_outlived_by(sub_region_scc).all(|r1| {
1289                self.scc_values
1290                    .universal_regions_outlived_by(sup_region_scc)
1291                    .any(|r2| self.universal_region_relations.outlives(r2, r1))
1292            });
1293
1294        if !universal_outlives {
1295            debug!("sub region contains a universal region not present in super");
1296            return false;
1297        }
1298
1299        // Now we have to compare all the points in the sub region and make
1300        // sure they exist in the sup region.
1301
1302        if self.universal_regions().is_universal_region(sup_region) {
1303            // Micro-opt: universal regions contain all points.
1304            debug!("super is universal and hence contains all points");
1305            return true;
1306        }
1307
1308        debug!("comparison between points in sup/sub");
1309
1310        self.scc_values.contains_points(sup_region_scc, sub_region_scc)
1311    }
1312
1313    /// Once regions have been propagated, this method is used to see
1314    /// whether any of the constraints were too strong. In particular,
1315    /// we want to check for a case where a universally quantified
1316    /// region exceeded its bounds. Consider:
1317    /// ```compile_fail
1318    /// fn foo<'a, 'b>(x: &'a u32) -> &'b u32 { x }
1319    /// ```
1320    /// In this case, returning `x` requires `&'a u32 <: &'b u32`
1321    /// and hence we establish (transitively) a constraint that
1322    /// `'a: 'b`. The `propagate_constraints` code above will
1323    /// therefore add `end('a)` into the region for `'b` -- but we
1324    /// have no evidence that `'b` outlives `'a`, so we want to report
1325    /// an error.
1326    ///
1327    /// If `propagated_outlives_requirements` is `Some`, then we will
1328    /// push unsatisfied obligations into there. Otherwise, we'll
1329    /// report them as errors.
1330    fn check_universal_regions(
1331        &self,
1332        mut propagated_outlives_requirements: Option<&mut Vec<ClosureOutlivesRequirement<'tcx>>>,
1333        errors_buffer: &mut RegionErrors<'tcx>,
1334    ) {
1335        for (fr, fr_definition) in self.definitions.iter_enumerated() {
1336            {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs:1336",
                        "rustc_borrowck::region_infer::region_context",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                        ::tracing_core::__macro_support::Option::Some(1336u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                        ::tracing_core::field::FieldSet::new(&[{
                                            const NAME:
                                                ::tracing::__macro_support::FieldName<{
                                                    ::tracing::__macro_support::FieldName::len("fr")
                                                }> =
                                                ::tracing::__macro_support::FieldName::new("fr");
                                            NAME.as_str()
                                        },
                                        {
                                            const NAME:
                                                ::tracing::__macro_support::FieldName<{
                                                    ::tracing::__macro_support::FieldName::len("fr_definition")
                                                }> =
                                                ::tracing::__macro_support::FieldName::new("fr_definition");
                                            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(&fr)
                                            as &dyn ::tracing::field::Value)),
                                (::tracing::__macro_support::Option::Some(&::tracing::field::debug(&fr_definition)
                                            as &dyn ::tracing::field::Value))])
            });
    } else { ; }
};debug!(?fr, ?fr_definition);
1337            match fr_definition.origin {
1338                NllRegionVariableOrigin::FreeRegion => {
1339                    // Go through each of the universal regions `fr` and check that
1340                    // they did not grow too large, accumulating any requirements
1341                    // for our caller into the `outlives_requirements` vector.
1342                    self.check_universal_region(
1343                        fr,
1344                        &mut propagated_outlives_requirements,
1345                        errors_buffer,
1346                    );
1347                }
1348
1349                NllRegionVariableOrigin::Placeholder(placeholder) => {
1350                    self.check_bound_universal_region(fr, placeholder, errors_buffer);
1351                }
1352
1353                NllRegionVariableOrigin::Existential { .. } => {
1354                    // nothing to check here
1355                }
1356            }
1357        }
1358    }
1359
1360    /// Checks if Polonius has found any unexpected free region relations.
1361    ///
1362    /// In Polonius terms, a "subset error" (or "illegal subset relation error") is the equivalent
1363    /// of NLL's "checking if any region constraints were too strong": a placeholder origin `'a`
1364    /// was unexpectedly found to be a subset of another placeholder origin `'b`, and means in NLL
1365    /// terms that the "longer free region" `'a` outlived the "shorter free region" `'b`.
1366    ///
1367    /// More details can be found in this blog post by Niko:
1368    /// <https://smallcultfollowing.com/babysteps/blog/2019/01/17/polonius-and-region-errors/>
1369    ///
1370    /// In the canonical example
1371    /// ```compile_fail
1372    /// fn foo<'a, 'b>(x: &'a u32) -> &'b u32 { x }
1373    /// ```
1374    /// returning `x` requires `&'a u32 <: &'b u32` and hence we establish (transitively) a
1375    /// constraint that `'a: 'b`. It is an error that we have no evidence that this
1376    /// constraint holds.
1377    ///
1378    /// If `propagated_outlives_requirements` is `Some`, then we will
1379    /// push unsatisfied obligations into there. Otherwise, we'll
1380    /// report them as errors.
1381    fn check_polonius_subset_errors(
1382        &self,
1383        mut propagated_outlives_requirements: Option<&mut Vec<ClosureOutlivesRequirement<'tcx>>>,
1384        errors_buffer: &mut RegionErrors<'tcx>,
1385        polonius_output: &PoloniusOutput,
1386    ) {
1387        {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs:1387",
                        "rustc_borrowck::region_infer::region_context",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                        ::tracing_core::__macro_support::Option::Some(1387u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                        ::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!("check_polonius_subset_errors: {0} subset_errors",
                                                    polonius_output.subset_errors.len()) as
                                            &dyn ::tracing::field::Value))])
            });
    } else { ; }
};debug!(
1388            "check_polonius_subset_errors: {} subset_errors",
1389            polonius_output.subset_errors.len()
1390        );
1391
1392        // Similarly to `check_universal_regions`: a free region relation, which was not explicitly
1393        // declared ("known") was found by Polonius, so emit an error, or propagate the
1394        // requirements for our caller into the `propagated_outlives_requirements` vector.
1395        //
1396        // Polonius doesn't model regions ("origins") as CFG-subsets or durations, but the
1397        // `longer_fr` and `shorter_fr` terminology will still be used here, for consistency with
1398        // the rest of the NLL infrastructure. The "subset origin" is the "longer free region",
1399        // and the "superset origin" is the outlived "shorter free region".
1400        //
1401        // Note: Polonius will produce a subset error at every point where the unexpected
1402        // `longer_fr`'s "placeholder loan" is contained in the `shorter_fr`. This can be helpful
1403        // for diagnostics in the future, e.g. to point more precisely at the key locations
1404        // requiring this constraint to hold. However, the error and diagnostics code downstream
1405        // expects that these errors are not duplicated (and that they are in a certain order).
1406        // Otherwise, diagnostics messages such as the ones giving names like `'1` to elided or
1407        // anonymous lifetimes for example, could give these names differently, while others like
1408        // the outlives suggestions or the debug output from `#[rustc_regions]` would be
1409        // duplicated. The polonius subset errors are deduplicated here, while keeping the
1410        // CFG-location ordering.
1411        // We can iterate the HashMap here because the result is sorted afterwards.
1412        #[allow(rustc::potential_query_instability)]
1413        let mut subset_errors: Vec<_> = polonius_output
1414            .subset_errors
1415            .iter()
1416            .flat_map(|(_location, subset_errors)| subset_errors.iter())
1417            .collect();
1418        subset_errors.sort();
1419        subset_errors.dedup();
1420
1421        for &(longer_fr, shorter_fr) in subset_errors.into_iter() {
1422            {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs:1422",
                        "rustc_borrowck::region_infer::region_context",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                        ::tracing_core::__macro_support::Option::Some(1422u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                        ::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!("check_polonius_subset_errors: subset_error longer_fr={0:?},shorter_fr={1:?}",
                                                    longer_fr, shorter_fr) as &dyn ::tracing::field::Value))])
            });
    } else { ; }
};debug!(
1423                "check_polonius_subset_errors: subset_error longer_fr={:?},\
1424                 shorter_fr={:?}",
1425                longer_fr, shorter_fr
1426            );
1427
1428            let propagated = self.try_propagate_universal_region_error(
1429                longer_fr.into(),
1430                shorter_fr.into(),
1431                &mut propagated_outlives_requirements,
1432            );
1433            if propagated == RegionRelationCheckResult::Error {
1434                errors_buffer.push(RegionErrorKind::RegionError {
1435                    longer_fr: longer_fr.into(),
1436                    shorter_fr: shorter_fr.into(),
1437                    fr_origin: NllRegionVariableOrigin::FreeRegion,
1438                    is_reported: true,
1439                });
1440            }
1441        }
1442
1443        // Handle the placeholder errors as usual, until the chalk-rustc-polonius triumvirate has
1444        // a more complete picture on how to separate this responsibility.
1445        for (fr, fr_definition) in self.definitions.iter_enumerated() {
1446            match fr_definition.origin {
1447                NllRegionVariableOrigin::FreeRegion => {
1448                    // handled by polonius above
1449                }
1450
1451                NllRegionVariableOrigin::Placeholder(placeholder) => {
1452                    self.check_bound_universal_region(fr, placeholder, errors_buffer);
1453                }
1454
1455                NllRegionVariableOrigin::Existential { .. } => {
1456                    // nothing to check here
1457                }
1458            }
1459        }
1460    }
1461
1462    /// Checks the final value for the free region `fr` to see if it
1463    /// grew too large. In particular, examine what `end(X)` points
1464    /// wound up in `fr`'s final value; for each `end(X)` where `X !=
1465    /// fr`, we want to check that `fr: X`. If not, that's either an
1466    /// error, or something we have to propagate to our creator.
1467    ///
1468    /// Things that are to be propagated are accumulated into the
1469    /// `outlives_requirements` vector.
1470    {}
#[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("check_universal_region",
                                    "rustc_borrowck::region_infer::region_context",
                                    ::tracing::Level::DEBUG,
                                    ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                    ::tracing_core::__macro_support::Option::Some(1470u32),
                                    ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                                    ::tracing_core::field::FieldSet::new(&[{
                                                        const NAME:
                                                            ::tracing::__macro_support::FieldName<{
                                                                ::tracing::__macro_support::FieldName::len("longer_fr")
                                                            }> =
                                                            ::tracing::__macro_support::FieldName::new("longer_fr");
                                                        NAME.as_str()
                                                    }], ::tracing_core::callsite::Identifier(&__CALLSITE)),
                                    ::tracing::metadata::Kind::SPAN)
                            };
                        ::tracing::callsite::DefaultCallsite::new(&META)
                    };
                let mut interest = ::tracing::subscriber::Interest::never();
                if ::tracing::Level::DEBUG <=
                                    ::tracing::level_filters::STATIC_MAX_LEVEL &&
                                ::tracing::Level::DEBUG <=
                                    ::tracing::level_filters::LevelFilter::current() &&
                            { interest = __CALLSITE.interest(); !interest.is_never() }
                        &&
                        ::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
                            interest) {
                    let meta = __CALLSITE.metadata();
                    ::tracing::Span::new(meta,
                        &{
                                #[allow(unused_imports)]
                                use ::tracing::field::{debug, display, Value};
                                meta.fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&longer_fr)
                                                            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: () = loop {};
            return __tracing_attr_fake_return;
        }
        {
            let longer_fr_scc = self.constraint_sccs.scc(longer_fr);
            if !self.max_nameable_universe(longer_fr_scc).is_root() {
                ::core::panicking::panic("assertion failed: self.max_nameable_universe(longer_fr_scc).is_root()")
            };
            let representative = self.scc_representative(longer_fr_scc);
            if representative != longer_fr {
                if let RegionRelationCheckResult::Error =
                        self.check_universal_region_relation(longer_fr,
                            representative, propagated_outlives_requirements) {
                    errors_buffer.push(RegionErrorKind::RegionError {
                            longer_fr,
                            shorter_fr: representative,
                            fr_origin: NllRegionVariableOrigin::FreeRegion,
                            is_reported: true,
                        });
                }
                return;
            }
            let mut error_reported = false;
            for shorter_fr in
                self.scc_values.universal_regions_outlived_by(longer_fr_scc) {
                if let RegionRelationCheckResult::Error =
                        self.check_universal_region_relation(longer_fr, shorter_fr,
                            propagated_outlives_requirements) {
                    errors_buffer.push(RegionErrorKind::RegionError {
                            longer_fr,
                            shorter_fr,
                            fr_origin: NllRegionVariableOrigin::FreeRegion,
                            is_reported: !error_reported,
                        });
                    error_reported = true;
                }
            }
        }
    }
}#[instrument(skip(self, propagated_outlives_requirements, errors_buffer), level = "debug")]
1471    fn check_universal_region(
1472        &self,
1473        longer_fr: RegionVid,
1474        propagated_outlives_requirements: &mut Option<&mut Vec<ClosureOutlivesRequirement<'tcx>>>,
1475        errors_buffer: &mut RegionErrors<'tcx>,
1476    ) {
1477        let longer_fr_scc = self.constraint_sccs.scc(longer_fr);
1478
1479        // Because this free region must be in the ROOT universe, we
1480        // know it cannot contain any bound universes.
1481        assert!(self.max_nameable_universe(longer_fr_scc).is_root());
1482
1483        // Only check all of the relations for the main representative of each
1484        // SCC, otherwise just check that we outlive said representative. This
1485        // reduces the number of redundant relations propagated out of
1486        // closures.
1487        // Note that the representative will be a universal region if there is
1488        // one in this SCC, so we will always check the representative here.
1489        let representative = self.scc_representative(longer_fr_scc);
1490        if representative != longer_fr {
1491            if let RegionRelationCheckResult::Error = self.check_universal_region_relation(
1492                longer_fr,
1493                representative,
1494                propagated_outlives_requirements,
1495            ) {
1496                errors_buffer.push(RegionErrorKind::RegionError {
1497                    longer_fr,
1498                    shorter_fr: representative,
1499                    fr_origin: NllRegionVariableOrigin::FreeRegion,
1500                    is_reported: true,
1501                });
1502            }
1503            return;
1504        }
1505
1506        // Find every region `o` such that `fr: o`
1507        // (because `fr` includes `end(o)`).
1508        let mut error_reported = false;
1509        for shorter_fr in self.scc_values.universal_regions_outlived_by(longer_fr_scc) {
1510            if let RegionRelationCheckResult::Error = self.check_universal_region_relation(
1511                longer_fr,
1512                shorter_fr,
1513                propagated_outlives_requirements,
1514            ) {
1515                // We only report the first region error. Subsequent errors are hidden so as
1516                // not to overwhelm the user, but we do record them so as to potentially print
1517                // better diagnostics elsewhere...
1518                errors_buffer.push(RegionErrorKind::RegionError {
1519                    longer_fr,
1520                    shorter_fr,
1521                    fr_origin: NllRegionVariableOrigin::FreeRegion,
1522                    is_reported: !error_reported,
1523                });
1524
1525                error_reported = true;
1526            }
1527        }
1528    }
1529
1530    /// Checks that we can prove that `longer_fr: shorter_fr`. If we can't we attempt to propagate
1531    /// the constraint outward (e.g. to a closure environment), but if that fails, there is an
1532    /// error.
1533    fn check_universal_region_relation(
1534        &self,
1535        longer_fr: RegionVid,
1536        shorter_fr: RegionVid,
1537        propagated_outlives_requirements: &mut Option<&mut Vec<ClosureOutlivesRequirement<'tcx>>>,
1538    ) -> RegionRelationCheckResult {
1539        // If it is known that `fr: o`, carry on.
1540        if self.universal_region_relations.outlives(longer_fr, shorter_fr) {
1541            RegionRelationCheckResult::Ok
1542        } else {
1543            // If we are not in a context where we can't propagate errors, or we
1544            // could not shrink `fr` to something smaller, then just report an
1545            // error.
1546            //
1547            // Note: in this case, we use the unapproximated regions to report the
1548            // error. This gives better error messages in some cases.
1549            self.try_propagate_universal_region_error(
1550                longer_fr,
1551                shorter_fr,
1552                propagated_outlives_requirements,
1553            )
1554        }
1555    }
1556
1557    /// Attempt to propagate a region error (e.g. `'a: 'b`) that is not met to a closure's
1558    /// creator. If we cannot, then the caller should report an error to the user.
1559    fn try_propagate_universal_region_error(
1560        &self,
1561        longer_fr: RegionVid,
1562        shorter_fr: RegionVid,
1563        propagated_outlives_requirements: &mut Option<&mut Vec<ClosureOutlivesRequirement<'tcx>>>,
1564    ) -> RegionRelationCheckResult {
1565        if let Some(propagated_outlives_requirements) = propagated_outlives_requirements {
1566            // Shrink `longer_fr` until we find some non-local regions.
1567            // We'll call them `longer_fr-` -- they are ever so slightly smaller than
1568            // `longer_fr`.
1569            let longer_fr_minus = self.universal_region_relations.non_local_lower_bounds(longer_fr);
1570
1571            {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs:1571",
                        "rustc_borrowck::region_infer::region_context",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                        ::tracing_core::__macro_support::Option::Some(1571u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                        ::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!("try_propagate_universal_region_error: fr_minus={0:?}",
                                                    longer_fr_minus) as &dyn ::tracing::field::Value))])
            });
    } else { ; }
};debug!("try_propagate_universal_region_error: fr_minus={:?}", longer_fr_minus);
1572
1573            // If we don't find a any non-local regions, we should error out as there is nothing
1574            // to propagate.
1575            if longer_fr_minus.is_empty() {
1576                return RegionRelationCheckResult::Error;
1577            }
1578
1579            let best_blame = self.best_blame_constraint(
1580                longer_fr,
1581                NllRegionVariableOrigin::FreeRegion,
1582                shorter_fr,
1583            );
1584            let OutlivesConstraint { category, span, .. } = best_blame.constraint();
1585
1586            // Grow `shorter_fr` until we find some non-local regions.
1587            // We will always find at least one: `'static`. We'll call
1588            // them `shorter_fr+` -- they're ever so slightly larger
1589            // than `shorter_fr`.
1590            let shorter_fr_plus =
1591                self.universal_region_relations.non_local_upper_bounds(shorter_fr);
1592            {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs:1592",
                        "rustc_borrowck::region_infer::region_context",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                        ::tracing_core::__macro_support::Option::Some(1592u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                        ::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!("try_propagate_universal_region_error: shorter_fr_plus={0:?}",
                                                    shorter_fr_plus) as &dyn ::tracing::field::Value))])
            });
    } else { ; }
};debug!("try_propagate_universal_region_error: shorter_fr_plus={:?}", shorter_fr_plus);
1593
1594            // We then create constraints `longer_fr-: shorter_fr+` that may or may not
1595            // be propagated (see below).
1596            let mut constraints = ::alloc::vec::Vec::new()vec![];
1597            for fr_minus in longer_fr_minus {
1598                for shorter_fr_plus in &shorter_fr_plus {
1599                    constraints.push((fr_minus, *shorter_fr_plus));
1600                }
1601            }
1602
1603            // We only need to propagate at least one of the constraints for
1604            // soundness. However, we want to avoid arbitrary choices here
1605            // and currently don't support returning OR constraints.
1606            //
1607            // If any of the `shorter_fr+` regions are already outlived by `longer_fr-`,
1608            // we propagate only those.
1609            //
1610            // Consider this example (`'b: 'a` == `a -> b`), where we try to propagate `'d: 'a`:
1611            // a --> b --> d
1612            //  \
1613            //   \-> c
1614            // Here, `shorter_fr+` of `'a` == `['b, 'c]`.
1615            // Propagating `'d: 'b` is correct and should occur; `'d: 'c` is redundant because of
1616            // `'d: 'b` and could reject valid code.
1617            //
1618            // So we filter the constraints to regions already outlived by `longer_fr-`, but if
1619            // the filter yields an empty set, we fall back to the original one.
1620            let subset: Vec<_> = constraints
1621                .iter()
1622                .filter(|&&(fr_minus, shorter_fr_plus)| {
1623                    self.eval_outlives(fr_minus, shorter_fr_plus)
1624                })
1625                .copied()
1626                .collect();
1627            let propagated_constraints = if subset.is_empty() { constraints } else { subset };
1628            {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs:1628",
                        "rustc_borrowck::region_infer::region_context",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                        ::tracing_core::__macro_support::Option::Some(1628u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                        ::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!("try_propagate_universal_region_error: constraints={0:?}",
                                                    propagated_constraints) as &dyn ::tracing::field::Value))])
            });
    } else { ; }
};debug!(
1629                "try_propagate_universal_region_error: constraints={:?}",
1630                propagated_constraints
1631            );
1632
1633            if !!propagated_constraints.is_empty() {
    {
        ::core::panicking::panic_fmt(format_args!("Expected at least one constraint to propagate here"));
    }
};assert!(
1634                !propagated_constraints.is_empty(),
1635                "Expected at least one constraint to propagate here"
1636            );
1637
1638            for (fr_minus, fr_plus) in propagated_constraints {
1639                // Push the constraint `long_fr-: shorter_fr+`
1640                propagated_outlives_requirements.push(ClosureOutlivesRequirement {
1641                    subject: ClosureOutlivesSubject::Region(fr_minus),
1642                    outlived_free_region: fr_plus,
1643                    blame_span: *span,
1644                    category: *category,
1645                });
1646            }
1647            return RegionRelationCheckResult::Propagated;
1648        }
1649
1650        RegionRelationCheckResult::Error
1651    }
1652
1653    fn check_bound_universal_region(
1654        &self,
1655        longer_fr: RegionVid,
1656        placeholder: ty::PlaceholderRegion<'tcx>,
1657        errors_buffer: &mut RegionErrors<'tcx>,
1658    ) {
1659        {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs:1659",
                        "rustc_borrowck::region_infer::region_context",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                        ::tracing_core::__macro_support::Option::Some(1659u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                        ::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!("check_bound_universal_region(fr={0:?}, placeholder={1:?})",
                                                    longer_fr, placeholder) as &dyn ::tracing::field::Value))])
            });
    } else { ; }
};debug!("check_bound_universal_region(fr={:?}, placeholder={:?})", longer_fr, placeholder,);
1660
1661        let longer_fr_scc = self.constraint_sccs.scc(longer_fr);
1662        {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs:1662",
                        "rustc_borrowck::region_infer::region_context",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                        ::tracing_core::__macro_support::Option::Some(1662u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                        ::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!("check_bound_universal_region: longer_fr_scc={0:?}",
                                                    longer_fr_scc) as &dyn ::tracing::field::Value))])
            });
    } else { ; }
};debug!("check_bound_universal_region: longer_fr_scc={:?}", longer_fr_scc,);
1663
1664        // If we have some bound universal region `'a`, then the only
1665        // elements it can contain is itself -- we don't know anything
1666        // else about it!
1667        if let Some(error_element) = self
1668            .scc_values
1669            .elements_contained_in(longer_fr_scc)
1670            .find(|e| *e != RegionElement::PlaceholderRegion(placeholder))
1671        {
1672            let illegally_outlived_r = self.region_from_element(longer_fr, &error_element);
1673            // Stop after the first error, it gets too noisy otherwise, and does not provide more information.
1674            errors_buffer.push(RegionErrorKind::PlaceholderOutlivesIllegalRegion {
1675                longer_fr,
1676                illegally_outlived_r,
1677            });
1678        } else {
1679            {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs:1679",
                        "rustc_borrowck::region_infer::region_context",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/5ceaf6608eb354c2f5bbb3b8d974caa367dac81c/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                        ::tracing_core::__macro_support::Option::Some(1679u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_borrowck::region_infer::region_context"),
                        ::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!("check_bound_universal_region: all bounds satisfied")
                                            as &dyn ::tracing::field::Value))])
            });
    } else { ; }
};debug!("check_bound_universal_region: all bounds satisfied");
1680        }
1681    }
1682
1683    /// Get the region outlived by `longer_fr` and live at `element`.
1684    fn region_from_element(
1685        &self,
1686        longer_fr: RegionVid,
1687        element: &RegionElement<'tcx>,
1688    ) -> RegionVid {
1689        match *element {
1690            RegionElement::Location(l) => self.find_sub_region_live_at(longer_fr, l),
1691            RegionElement::RootUniversalRegion(r) => r,
1692            RegionElement::PlaceholderRegion(error_placeholder) => self
1693                .definitions
1694                .iter_enumerated()
1695                .find_map(|(r, definition)| match definition.origin {
1696                    NllRegionVariableOrigin::Placeholder(p) if p == error_placeholder => Some(r),
1697                    _ => None,
1698                })
1699                .unwrap(),
1700        }
1701    }
1702
1703    /// Returns the representative `RegionVid` for a given SCC.
1704    /// See `RegionTracker` for how a region variable ID is chosen.
1705    ///
1706    /// It is a hacky way to manage checking regions for equality,
1707    /// since we can 'canonicalize' each region to the representative
1708    /// of its SCC and be sure that -- if they have the same repr --
1709    /// they *must* be equal (though not having the same repr does not
1710    /// mean they are unequal).
1711    fn scc_representative(&self, scc: ConstraintSccIndex) -> RegionVid {
1712        self.scc_annotations[scc].representative.rvid()
1713    }
1714}