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    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    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    scc_annotations: IndexVec<ConstraintSccIndex, RegionTracker>,
69
70    /// Map universe indexes to information on why we created it.
71    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    inner: 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.inner
94    }
95}
96
97impl<'tcx> RegionInferenceContext<'tcx> {
98    /// Performs region inference and report errors if we see any
99    /// unsatisfiable constraints. If this is a closure, returns the
100    /// region requirements to propagate to our creator, if any.
101    {}
#[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/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                    ::tracing_core::__macro_support::Option::Some(101u32),
                                    ::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("universal_region_relations")
                                                            }> =
                                                            ::tracing::__macro_support::FieldName::new("universal_region_relations");
                                                        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(&universal_region_relations)
                                                            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:
                    (RegionInferenceContext<'tcx>,
                    Option<ClosureRegionRequirements<'tcx>>,
                    RegionErrors<'tcx>) = loop {};
            return __tracing_attr_fake_return;
        }
        {
            let universal_regions =
                &universal_region_relations.universal_regions;
            let LoweredConstraints {
                    constraint_sccs,
                    definitions,
                    outlives_constraints,
                    scc_annotations,
                    type_tests,
                    liveness_constraints,
                    universe_causes,
                    placeholder_indices } = lowered_constraints;
            {
                use ::tracing::__macro_support::Callsite as _;
                static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                    {
                        static META: ::tracing::Metadata<'static> =
                            {
                                ::tracing_core::metadata::Metadata::new("event /rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs:129",
                                    "rustc_borrowck::region_infer::region_context",
                                    ::tracing::Level::DEBUG,
                                    ::tracing_core::__macro_support::Option::Some("/rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                    ::tracing_core::__macro_support::Option::Some(129u32),
                                    ::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 { ; }
            };
            {
                use ::tracing::__macro_support::Callsite as _;
                static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                    {
                        static META: ::tracing::Metadata<'static> =
                            {
                                ::tracing_core::metadata::Metadata::new("event /rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs:130",
                                    "rustc_borrowck::region_infer::region_context",
                                    ::tracing::Level::DEBUG,
                                    ::tracing_core::__macro_support::Option::Some("/rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                    ::tracing_core::__macro_support::Option::Some(130u32),
                                    ::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 { ; }
            };
            {
                use ::tracing::__macro_support::Callsite as _;
                static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                    {
                        static META: ::tracing::Metadata<'static> =
                            {
                                ::tracing_core::metadata::Metadata::new("event /rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs:131",
                                    "rustc_borrowck::region_infer::region_context",
                                    ::tracing::Level::DEBUG,
                                    ::tracing_core::__macro_support::Option::Some("/rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                    ::tracing_core::__macro_support::Option::Some(131u32),
                                    ::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 { ; }
            };
            {
                use ::tracing::__macro_support::Callsite as _;
                static __CALLSITE: ::tracing::callsite::DefaultCallsite =
                    {
                        static META: ::tracing::Metadata<'static> =
                            {
                                ::tracing_core::metadata::Metadata::new("event /rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs:132",
                                    "rustc_borrowck::region_infer::region_context",
                                    ::tracing::Level::DEBUG,
                                    ::tracing_core::__macro_support::Option::Some("/rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                    ::tracing_core::__macro_support::Option::Some(132u32),
                                    ::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 { ; }
            };
            let constraint_graph =
                Frozen::freeze(outlives_constraints.graph(definitions.len()));
            if true { sccs_info(infcx, &constraint_sccs); }
            let mut scc_values =
                RegionValues::new(location_map, universal_regions.len(),
                    placeholder_indices);
            for (region, definition) in definitions.iter_enumerated() {
                let scc = constraint_sccs.scc(region);
                match definition.origin {
                    NllRegionVariableOrigin::FreeRegion => {
                        scc_values.add_free_region(scc, region);
                    }
                    NllRegionVariableOrigin::Placeholder(placeholder) => {
                        scc_values.add_placeholder(scc, placeholder);
                    }
                    NllRegionVariableOrigin::Existential { .. } => {}
                }
                if let Some(liveness) =
                        liveness_constraints.point_liveness(region) {
                    scc_values.merge_liveness(scc, liveness)
                }
            }
            let mut unsolved_regioncx =
                UnsolvedRegionInferenceContext {
                    inner: RegionInferenceContextInner {
                        definitions,
                        liveness_constraints,
                        constraints: outlives_constraints,
                        constraint_graph,
                        constraint_sccs,
                        scc_annotations,
                        universe_causes,
                        universal_region_relations,
                        scc_values,
                    },
                    type_tests,
                };
            let mir_def_id = body.source.def_id();
            unsolved_regioncx.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);
            unsolved_regioncx.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/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs:210",
                                    "rustc_borrowck::region_infer::region_context",
                                    ::tracing::Level::DEBUG,
                                    ::tracing_core::__macro_support::Option::Some("/rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                    ::tracing_core::__macro_support::Option::Some(210u32),
                                    ::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/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs:211",
                                    "rustc_borrowck::region_infer::region_context",
                                    ::tracing::Level::DEBUG,
                                    ::tracing_core::__macro_support::Option::Some("/rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                    ::tracing_core::__macro_support::Option::Some(211u32),
                                    ::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()
                {
                unsolved_regioncx.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 {
                unsolved_regioncx.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/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs:231",
                                    "rustc_borrowck::region_infer::region_context",
                                    ::tracing::Level::DEBUG,
                                    ::tracing_core::__macro_support::Option::Some("/rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                    ::tracing_core::__macro_support::Option::Some(231u32),
                                    ::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 {
                        inner: Frozen::freeze(unsolved_regioncx.inner),
                    }, None, errors_buffer)
            } else {
                let num_external_vids =
                    unsolved_regioncx.universal_regions().num_global_and_external_regions();
                (RegionInferenceContext {
                        inner: Frozen::freeze(unsolved_regioncx.inner),
                    },
                    Some(ClosureRegionRequirements {
                            num_external_vids,
                            outlives_requirements: propagated_outlives_requirements,
                        }), errors_buffer)
            }
        }
    }
}#[instrument(
102        skip(infcx, lowered_constraints, location_map, body, polonius_output),
103        level = "debug"
104    )]
105    pub(crate) fn solve(
106        infcx: &BorrowckInferCtxt<'tcx>,
107        lowered_constraints: LoweredConstraints<'tcx>,
108        universal_region_relations: Frozen<UniversalRegionRelations<'tcx>>,
109        location_map: Rc<DenseLocationMap>,
110        body: &Body<'tcx>,
111        polonius_output: Option<Box<PoloniusOutput>>,
112    ) -> (RegionInferenceContext<'tcx>, Option<ClosureRegionRequirements<'tcx>>, RegionErrors<'tcx>)
113    {
114        // 1. We first prepare the data needed for the `UnsolvedRegionInferenceContext` to do the
115        //    solving work.
116        let universal_regions = &universal_region_relations.universal_regions;
117
118        let LoweredConstraints {
119            constraint_sccs,
120            definitions,
121            outlives_constraints,
122            scc_annotations,
123            type_tests,
124            liveness_constraints,
125            universe_causes,
126            placeholder_indices,
127        } = lowered_constraints;
128
129        debug!("universal_regions: {:#?}", universal_region_relations.universal_regions);
130        debug!("outlives constraints: {:#?}", outlives_constraints);
131        debug!("placeholder_indices: {:#?}", placeholder_indices);
132        debug!("type tests: {:#?}", type_tests);
133
134        let constraint_graph = Frozen::freeze(outlives_constraints.graph(definitions.len()));
135
136        if cfg!(debug_assertions) {
137            sccs_info(infcx, &constraint_sccs);
138        }
139
140        let mut scc_values =
141            RegionValues::new(location_map, universal_regions.len(), placeholder_indices);
142
143        // Initializes the region variables with their initial live points.
144        for (region, definition) in definitions.iter_enumerated() {
145            let scc = constraint_sccs.scc(region);
146
147            // For each universally quantified region (lifetime parameter). The
148            // first N variables always correspond to the regions appearing in the
149            // function signature (both named and anonymous) and in where-clauses.
150            match definition.origin {
151                // For each free, universally quantified region X:
152                NllRegionVariableOrigin::FreeRegion => {
153                    // Add `end(X)` into the set for X.
154                    scc_values.add_free_region(scc, region);
155                }
156
157                NllRegionVariableOrigin::Placeholder(placeholder) => {
158                    scc_values.add_placeholder(scc, placeholder);
159                }
160
161                NllRegionVariableOrigin::Existential { .. } => {
162                    // For existential, regions, nothing to do.
163                }
164            }
165
166            // Initially copy the liveness constraints of any region that
167            // has them, setting `scc_values[scc(region)] |= liveness_constraints[region]`.
168            //
169            // These values will later be propagated during
170            // [`UnsolvedRegionInferenceContext::propagate_constraints()`].
171            // The values include any live-at-all-points constraints added previously in `liveness::generate`.
172            if let Some(liveness) = liveness_constraints.point_liveness(region) {
173                scc_values.merge_liveness(scc, liveness)
174            }
175        }
176
177        let mut unsolved_regioncx = UnsolvedRegionInferenceContext {
178            inner: RegionInferenceContextInner {
179                definitions,
180                liveness_constraints,
181                constraints: outlives_constraints,
182                constraint_graph,
183                constraint_sccs,
184                scc_annotations,
185                universe_causes,
186                universal_region_relations,
187                scc_values,
188            },
189            type_tests,
190        };
191
192        // 2. And now we can do the actual solving, the region inference.
193        let mir_def_id = body.source.def_id();
194        unsolved_regioncx.propagate_constraints();
195
196        let mut errors_buffer = RegionErrors::new(infcx.tcx);
197
198        // If this is a nested body, we propagate unsatisfied
199        // outlives constraints to the parent body instead of
200        // eagerly erroing.
201        let mut propagated_outlives_requirements =
202            infcx.tcx.is_typeck_child(mir_def_id).then(Vec::new);
203
204        unsolved_regioncx.check_type_tests(
205            infcx,
206            propagated_outlives_requirements.as_mut(),
207            &mut errors_buffer,
208        );
209
210        debug!(?errors_buffer);
211        debug!(?propagated_outlives_requirements);
212
213        // In Polonius mode, the errors about missing universal region relations are in the output
214        // and need to be emitted or propagated. Otherwise, we need to check whether the
215        // constraints were too strong, and if so, emit or propagate those errors.
216        if infcx.tcx.sess.opts.unstable_opts.polonius.is_legacy_enabled() {
217            unsolved_regioncx.check_polonius_subset_errors(
218                propagated_outlives_requirements.as_mut(),
219                &mut errors_buffer,
220                polonius_output
221                    .as_ref()
222                    .expect("Polonius output is unavailable despite `-Z polonius`"),
223            );
224        } else {
225            unsolved_regioncx.check_universal_regions(
226                propagated_outlives_requirements.as_mut(),
227                &mut errors_buffer,
228            );
229        }
230
231        debug!(?errors_buffer);
232
233        let propagated_outlives_requirements = propagated_outlives_requirements.unwrap_or_default();
234        if propagated_outlives_requirements.is_empty() {
235            (
236                RegionInferenceContext { inner: Frozen::freeze(unsolved_regioncx.inner) },
237                None,
238                errors_buffer,
239            )
240        } else {
241            let num_external_vids =
242                unsolved_regioncx.universal_regions().num_global_and_external_regions();
243            (
244                RegionInferenceContext { inner: Frozen::freeze(unsolved_regioncx.inner) },
245                Some(ClosureRegionRequirements {
246                    num_external_vids,
247                    outlives_requirements: propagated_outlives_requirements,
248                }),
249                errors_buffer,
250            )
251        }
252    }
253
254    /// Returns `true` if the region `r` contains the point `p`.
255    pub(crate) fn region_contains_point(&self, r: RegionVid, p: Location) -> bool {
256        let scc = self.constraint_sccs.scc(r);
257        self.scc_values.contains_point(scc, p)
258    }
259
260    /// Returns the lowest statement index in `start..=end` which is not contained by `r`.
261    pub(crate) fn first_non_contained_inclusive(
262        &self,
263        r: RegionVid,
264        block: BasicBlock,
265        start: usize,
266        end: usize,
267    ) -> Option<usize> {
268        let scc = self.constraint_sccs.scc(r);
269        self.scc_values.first_non_contained_inclusive(scc, block, start, end)
270    }
271}
272
273/// This contains data around region constraints and liveness, up to solving.
274struct UnsolvedRegionInferenceContext<'tcx> {
275    inner: RegionInferenceContextInner<'tcx>,
276
277    /// Type constraints that we check after solving.
278    type_tests: Vec<TypeTest<'tcx>>,
279}
280
281impl<'tcx> Deref for UnsolvedRegionInferenceContext<'tcx> {
282    type Target = RegionInferenceContextInner<'tcx>;
283
284    fn deref(&self) -> &Self::Target {
285        &self.inner
286    }
287}
288
289impl<'tcx> DerefMut for UnsolvedRegionInferenceContext<'tcx> {
290    fn deref_mut(&mut self) -> &mut Self::Target {
291        &mut self.inner
292    }
293}
294
295impl<'tcx> RegionInferenceContextInner<'tcx> {
296    /// Returns an iterator over all the region indices.
297    pub(crate) fn regions(&self) -> impl Iterator<Item = RegionVid> + 'tcx {
298        self.definitions.indices()
299    }
300
301    /// Given a universal region in scope on the MIR, returns the
302    /// corresponding index.
303    ///
304    /// Panics if `r` is not a registered universal region, most notably
305    /// if it is a placeholder. Handling placeholders requires access to the
306    /// `MirTypeckRegionConstraints`.
307    pub(crate) fn to_region_vid(&self, r: ty::Region<'tcx>) -> RegionVid {
308        self.universal_regions().to_region_vid(r)
309    }
310
311    /// Returns an iterator over all the outlives constraints.
312    pub(crate) fn outlives_constraints(&self) -> impl Iterator<Item = OutlivesConstraint<'tcx>> {
313        self.constraints.outlives().iter().copied()
314    }
315
316    /// Adds annotations for `#[rustc_regions]`; see `UniversalRegions::annotate`.
317    pub(crate) fn annotate(&self, tcx: TyCtxt<'tcx>, err: &mut Diag<'_>) {
318        self.universal_regions().annotate(tcx, err)
319    }
320
321    /// Returns access to the value of `r` for debugging purposes.
322    pub(crate) fn region_value_str(&self, r: RegionVid) -> String {
323        let scc = self.constraint_sccs.scc(r);
324        self.scc_values.region_value_str(scc)
325    }
326
327    pub(crate) fn placeholders_contained_in(
328        &self,
329        r: RegionVid,
330    ) -> impl Iterator<Item = ty::PlaceholderRegion<'tcx>> {
331        let scc = self.constraint_sccs.scc(r);
332        self.scc_values.placeholders_contained_in(scc)
333    }
334
335    /// Like `universal_upper_bound`, but returns an approximation more suitable
336    /// for diagnostics. If `r` contains multiple disjoint universal regions
337    /// (e.g. 'a and 'b in `fn foo<'a, 'b> { ... }`, we pick the lower-numbered region.
338    /// This corresponds to picking named regions over unnamed regions
339    /// (e.g. picking early-bound regions over a closure late-bound region).
340    ///
341    /// This means that the returned value may not be a true upper bound, since
342    /// only 'static is known to outlive disjoint universal regions.
343    /// Therefore, this method should only be used in diagnostic code,
344    /// where displaying *some* named universal region is better than
345    /// falling back to 'static.
346    {}
#[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/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                    ::tracing_core::__macro_support::Option::Some(346u32),
                                    ::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/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs:348",
                                    "rustc_borrowck::region_infer::region_context",
                                    ::tracing::Level::DEBUG,
                                    ::tracing_core::__macro_support::Option::Some("/rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                    ::tracing_core::__macro_support::Option::Some(348u32),
                                    ::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/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs:357",
                                        "rustc_borrowck::region_infer::region_context",
                                        ::tracing::Level::DEBUG,
                                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                        ::tracing_core::__macro_support::Option::Some(357u32),
                                        ::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/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs:381",
                                    "rustc_borrowck::region_infer::region_context",
                                    ::tracing::Level::DEBUG,
                                    ::tracing_core::__macro_support::Option::Some("/rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                    ::tracing_core::__macro_support::Option::Some(381u32),
                                    ::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))]
347    pub(crate) fn approx_universal_upper_bound(&self, r: RegionVid) -> RegionVid {
348        debug!("{}", self.region_value_str(r));
349
350        // Find the smallest universal region that contains all other
351        // universal regions within `region`.
352        let mut lub = self.universal_regions().fr_fn_body;
353        let r_scc = self.constraint_sccs.scc(r);
354        let static_r = self.universal_regions().fr_static;
355        for ur in self.scc_values.universal_regions_outlived_by(r_scc) {
356            let new_lub = self.universal_region_relations.postdom_upper_bound(lub, ur);
357            debug!(?ur, ?lub, ?new_lub);
358            // The upper bound of two non-static regions is static: this
359            // means we know nothing about the relationship between these
360            // two regions. Pick a 'better' one to use when constructing
361            // a diagnostic
362            if ur != static_r && lub != static_r && new_lub == static_r {
363                // Prefer the region with an `external_name` - this
364                // indicates that the region is early-bound, so working with
365                // it can produce a nicer error.
366                if self.region_definition(ur).external_name.is_some() {
367                    lub = ur;
368                } else if self.region_definition(lub).external_name.is_some() {
369                    // Leave lub unchanged
370                } else {
371                    // If we get here, we don't have any reason to prefer
372                    // one region over the other. Just pick the
373                    // one with the lower index for now.
374                    lub = std::cmp::min(ur, lub);
375                }
376            } else {
377                lub = new_lub;
378            }
379        }
380
381        debug!(?r, ?lub);
382
383        lub
384    }
385
386    /// The largest universe of any region nameable from this SCC.
387    pub(super) fn max_nameable_universe(&self, scc: ConstraintSccIndex) -> UniverseIndex {
388        self.scc_annotations[scc].max_nameable_universe()
389    }
390
391    pub(crate) fn constraint_path_between_regions(
392        &self,
393        from_region: RegionVid,
394        to_region: RegionVid,
395    ) -> Option<Vec<OutlivesConstraint<'tcx>>> {
396        if from_region == to_region {
397            ::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!");
398        }
399        self.constraint_path_to(from_region, |to| to == to_region, true).map(|o| o.0)
400    }
401
402    /// Walks the graph of constraints (where `'a: 'b` is considered
403    /// an edge `'a -> 'b`) to find a path from `from_region` to
404    /// `to_region`.
405    ///
406    /// Returns: a series of constraints as well as the region `R`
407    /// that passed the target test.
408    /// If `include_static_outlives_all` is `true`, then the synthetic
409    /// outlives constraints `'static -> a` for every region `a` are
410    /// considered in the search, otherwise they are ignored.
411    {}
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/4ebd258257737d5b7635c116fa7d281627a7e937/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("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/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs:411",
                        "rustc_borrowck::region_infer::region_context",
                        ::tracing::Level::INFO,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/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("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)]
412    pub(crate) fn constraint_path_to(
413        &self,
414        from_region: RegionVid,
415        target_test: impl Fn(RegionVid) -> bool,
416        include_placeholder_static: bool,
417    ) -> Option<(Vec<OutlivesConstraint<'tcx>>, RegionVid)> {
418        self.find_constraint_path_between_regions_inner(
419            true,
420            from_region,
421            &target_test,
422            include_placeholder_static,
423        )
424        .or_else(|| {
425            self.find_constraint_path_between_regions_inner(
426                false,
427                from_region,
428                &target_test,
429                include_placeholder_static,
430            )
431        })
432    }
433
434    /// The constraints we get from equating the hidden type of each use of an opaque
435    /// with its final hidden type may end up getting preferred over other, potentially
436    /// longer constraint paths.
437    ///
438    /// Given that we compute the final hidden type by relying on this existing constraint
439    /// path, this can easily end up hiding the actual reason for why we require these regions
440    /// to be equal.
441    ///
442    /// To handle this, we first look at the path while ignoring these constraints and then
443    /// retry while considering them. This is not perfect, as the `from_region` may have already
444    /// been partially related to its argument region, so while we rely on a member constraint
445    /// to get a complete path, the most relevant step of that path already existed before then.
446    fn find_constraint_path_between_regions_inner(
447        &self,
448        ignore_opaque_type_constraints: bool,
449        from_region: RegionVid,
450        target_test: impl Fn(RegionVid) -> bool,
451        include_placeholder_static: bool,
452    ) -> Option<(Vec<OutlivesConstraint<'tcx>>, RegionVid)> {
453        let mut context = IndexVec::from_elem(Trace::NotVisited, &self.definitions);
454        context[from_region] = Trace::StartRegion;
455
456        let fr_static = self.universal_regions().fr_static;
457
458        // Use a deque so that we do a breadth-first search. We will
459        // stop at the first match, which ought to be the shortest
460        // path (fewest constraints).
461        let mut deque = VecDeque::new();
462        deque.push_back(from_region);
463
464        while let Some(r) = deque.pop_front() {
465            {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs:465",
                        "rustc_borrowck::region_infer::region_context",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                        ::tracing_core::__macro_support::Option::Some(465u32),
                        ::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!(
466                "constraint_path_to: from_region={:?} r={:?} value={}",
467                from_region,
468                r,
469                self.region_value_str(r),
470            );
471
472            // Check if we reached the region we were looking for. If so,
473            // we can reconstruct the path that led to it and return it.
474            if target_test(r) {
475                let mut result = ::alloc::vec::Vec::new()vec![];
476                let mut p = r;
477                // This loop is cold and runs at the end, which is why we delay
478                // `OutlivesConstraint` construction until now.
479                loop {
480                    match context[p] {
481                        Trace::FromGraph(c) => {
482                            p = c.sup;
483                            result.push(*c);
484                        }
485
486                        Trace::FromStatic(sub) => {
487                            let c = OutlivesConstraint {
488                                sup: fr_static,
489                                sub,
490                                locations: Locations::All(DUMMY_SP),
491                                span: DUMMY_SP,
492                                category: ConstraintCategory::Internal,
493                                variance_info: ty::VarianceDiagInfo::default(),
494                                from_closure: false,
495                            };
496                            p = c.sup;
497                            result.push(c);
498                        }
499
500                        Trace::StartRegion => {
501                            result.reverse();
502                            return Some((result, r));
503                        }
504
505                        Trace::NotVisited => {
506                            ::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)
507                        }
508                    }
509                }
510            }
511
512            // Otherwise, walk over the outgoing constraints and
513            // enqueue any regions we find, keeping track of how we
514            // reached them.
515
516            // A constraint like `'r: 'x` can come from our constraint
517            // graph.
518
519            // Always inline this closure because it can be hot.
520            let mut handle_trace = #[inline(always)]
521            |sub, trace| {
522                if let Trace::NotVisited = context[sub] {
523                    context[sub] = trace;
524                    deque.push_back(sub);
525                }
526            };
527
528            // If this is the `'static` region and the graph's direction is normal, then set up the
529            // Edges iterator to return all regions (#53178).
530            if r == fr_static && self.constraint_graph.is_normal() {
531                for sub in self.constraint_graph.outgoing_edges_from_static() {
532                    handle_trace(sub, Trace::FromStatic(sub));
533                }
534            } else {
535                let edges = self.constraint_graph.outgoing_edges_from_graph(r, &self.constraints);
536                // This loop can be hot.
537                for constraint in edges {
538                    match constraint.category {
539                        ConstraintCategory::OutlivesUnnameablePlaceholder(_)
540                            if !include_placeholder_static =>
541                        {
542                            {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs:542",
                        "rustc_borrowck::region_infer::region_context",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                        ::tracing_core::__macro_support::Option::Some(542u32),
                        ::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:?}");
543                            continue;
544                        }
545                        ConstraintCategory::OpaqueType if ignore_opaque_type_constraints => {
546                            {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs:546",
                        "rustc_borrowck::region_infer::region_context",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                        ::tracing_core::__macro_support::Option::Some(546u32),
                        ::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:?}");
547                            continue;
548                        }
549                        _ => {}
550                    }
551
552                    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);
553                    handle_trace(constraint.sub, Trace::FromGraph(constraint));
554                }
555            }
556        }
557
558        None
559    }
560
561    /// Finds some region R such that `fr1: R` and `R` is live at `location`.
562    {}
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/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                ::tracing_core::__macro_support::Option::Some(562u32),
                                ::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/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs:564",
                                                "rustc_borrowck::region_infer::region_context",
                                                ::tracing::Level::TRACE,
                                                ::tracing_core::__macro_support::Option::Some("/rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                                ::tracing_core::__macro_support::Option::Some(564u32),
                                                ::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/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs:565",
                                                "rustc_borrowck::region_infer::region_context",
                                                ::tracing::Level::TRACE,
                                                ::tracing_core::__macro_support::Option::Some("/rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                                ::tracing_core::__macro_support::Option::Some(565u32),
                                                ::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/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs:567",
                                                                    "rustc_borrowck::region_infer::region_context",
                                                                    ::tracing::Level::TRACE,
                                                                    ::tracing_core::__macro_support::Option::Some("/rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                                                    ::tracing_core::__macro_support::Option::Some(567u32),
                                                                    ::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/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs:562",
                        "rustc_borrowck::region_infer::region_context",
                        ::tracing::Level::TRACE,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                        ::tracing_core::__macro_support::Option::Some(562u32),
                        ::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)]
563    pub(crate) fn find_sub_region_live_at(&self, fr1: RegionVid, location: Location) -> RegionVid {
564        trace!(scc = ?self.constraint_sccs.scc(fr1));
565        trace!(universe = ?self.max_nameable_universe(self.constraint_sccs.scc(fr1)));
566        self.constraint_path_to(fr1, |r| {
567            trace!(?r, liveness_constraints=?self.liveness_constraints.pretty_print_live_points(r));
568            self.liveness_constraints.is_live_at(r, location)
569        }, true).unwrap().1
570    }
571
572    /// Get the region definition of `r`.
573    pub(crate) fn region_definition(&self, r: RegionVid) -> &RegionDefinition<'tcx> {
574        &self.definitions[r]
575    }
576
577    /// Check if the SCC of `r` contains `upper`, a free region.
578    pub(crate) fn upper_bound_in_region_scc(&self, r: RegionVid, upper: RegionVid) -> bool {
579        let r_scc = self.constraint_sccs.scc(r);
580        self.scc_values.contains_free_region(r_scc, upper)
581    }
582
583    pub(crate) fn universal_regions(&self) -> &UniversalRegions<'tcx> {
584        &self.universal_region_relations.universal_regions
585    }
586
587    /// Tries to find the best constraint to blame for the fact that
588    /// `R: from_region`, where `R` is some region that meets
589    /// `target_test`. This works by following the constraint graph,
590    /// creating a constraint path that forces `R` to outlive
591    /// `from_region`, and then finding the best choices within that
592    /// path to blame.
593    {}
#[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/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                    ::tracing_core::__macro_support::Option::Some(593u32),
                                    ::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/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs:625",
                                    "rustc_borrowck::region_infer::region_context",
                                    ::tracing::Level::DEBUG,
                                    ::tracing_core::__macro_support::Option::Some("/rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                    ::tracing_core::__macro_support::Option::Some(625u32),
                                    ::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/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs:759",
                                                "rustc_borrowck::region_infer::region_context",
                                                ::tracing::Level::DEBUG,
                                                ::tracing_core::__macro_support::Option::Some("/rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                                ::tracing_core::__macro_support::Option::Some(759u32),
                                                ::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/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs:770",
                                    "rustc_borrowck::region_infer::region_context",
                                    ::tracing::Level::DEBUG,
                                    ::tracing_core::__macro_support::Option::Some("/rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                    ::tracing_core::__macro_support::Option::Some(770u32),
                                    ::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))]
594    pub(crate) fn best_blame_constraint(
595        &self,
596        from_region: RegionVid,
597        from_region_origin: NllRegionVariableOrigin<'tcx>,
598        to_region: RegionVid,
599    ) -> BestBlame<'tcx> {
600        assert!(from_region != to_region, "Trying to blame a region for itself!");
601
602        let path = self.constraint_path_between_regions(from_region, to_region).unwrap();
603
604        // If we are passing through a constraint added because we reached an unnameable placeholder `'unnameable`,
605        // redirect search towards `'unnameable`.
606        let due_to_placeholder_outlives = path.iter().find_map(|c| {
607            if let ConstraintCategory::OutlivesUnnameablePlaceholder(unnameable) = c.category {
608                Some(unnameable)
609            } else {
610                None
611            }
612        });
613
614        // Edge case: it's possible that `'from_region` is an unnameable placeholder.
615        let mut path = if let Some(unnameable) = due_to_placeholder_outlives
616            && unnameable != from_region
617        {
618            // We ignore the extra edges due to unnameable placeholders to get
619            // an explanation that was present in the original constraint graph.
620            self.constraint_path_to(from_region, |r| r == unnameable, false).unwrap().0
621        } else {
622            path
623        };
624
625        debug!(
626            "path={:#?}",
627            path.iter()
628                .map(|c| format!(
629                    "{:?} ({:?}: {:?})",
630                    c,
631                    self.constraint_sccs.scc(c.sup),
632                    self.constraint_sccs.scc(c.sub),
633                ))
634                .collect::<Vec<_>>()
635        );
636
637        // When reporting an error, there is typically a chain of constraints leading from some
638        // "source" region which must outlive some "target" region.
639        // In most cases, we prefer to "blame" the constraints closer to the target --
640        // but there is one exception. When constraints arise from higher-ranked subtyping,
641        // we generally prefer to blame the source value,
642        // as the "target" in this case tends to be some type annotation that the user gave.
643        // Therefore, if we find that the region origin is some instantiation
644        // of a higher-ranked region, we start our search from the "source" point
645        // rather than the "target", and we also tweak a few other things.
646        //
647        // An example might be this bit of Rust code:
648        //
649        // ```rust
650        // let x: fn(&'static ()) = |_| {};
651        // let y: for<'a> fn(&'a ()) = x;
652        // ```
653        //
654        // In MIR, this will be converted into a combination of assignments and type ascriptions.
655        // In particular, the 'static is imposed through a type ascription:
656        //
657        // ```rust
658        // x = ...;
659        // AscribeUserType(x, fn(&'static ())
660        // y = x;
661        // ```
662        //
663        // We wind up ultimately with constraints like
664        //
665        // ```rust
666        // !a: 'temp1 // from the `y = x` statement
667        // 'temp1: 'temp2
668        // 'temp2: 'static // from the AscribeUserType
669        // ```
670        //
671        // and here we prefer to blame the source (the y = x statement).
672        let blame_source = match from_region_origin {
673            NllRegionVariableOrigin::FreeRegion => true,
674            NllRegionVariableOrigin::Placeholder(_) => false,
675            // `'existential: 'whatever` never results in a region error by itself.
676            // We may always infer it to `'static` afterall. This means while an error
677            // path may go through an existential, these existentials are never the
678            // `from_region`.
679            NllRegionVariableOrigin::Existential { name: _ } => {
680                unreachable!("existentials can outlive everything")
681            }
682        };
683
684        // To pick a constraint to blame, we organize constraints by how interesting we expect them
685        // to be in diagnostics, then pick the most interesting one closest to either the source or
686        // the target on our constraint path.
687        let constraint_interest = |constraint: &OutlivesConstraint<'tcx>| {
688            // Try to avoid blaming constraints from desugarings, since they may not clearly match
689            // match what users have written. As an exception, allow blaming returns generated by
690            // `?` desugaring, since the correspondence is fairly clear.
691            let category = if let Some(kind) = constraint.span.desugaring_kind()
692                && (kind != DesugaringKind::QuestionMark
693                    || !matches!(constraint.category, ConstraintCategory::Return(_)))
694            {
695                ConstraintCategory::Boring
696            } else {
697                constraint.category
698            };
699
700            let interest = match category {
701                // Returns usually provide a type to blame and have specially written diagnostics,
702                // so prioritize them.
703                ConstraintCategory::Return(_) => 0,
704                // Unsizing coercions are interesting, since we have a note for that:
705                // `BorrowExplanation::add_object_lifetime_default_note`.
706                // FIXME(dianne): That note shouldn't depend on a coercion being blamed; see issue
707                // #131008 for an example of where we currently don't emit it but should.
708                // Once the note is handled properly, this case should be removed. Until then, it
709                // should be as limited as possible; the note is prone to false positives and this
710                // constraint usually isn't best to blame.
711                ConstraintCategory::Cast {
712                    is_raw_ptr_dyn_type_cast: _,
713                    unsize_to: Some(unsize_ty),
714                    is_implicit_coercion: true,
715                } if to_region == self.universal_regions().fr_static
716                    // Mirror the note's condition, to minimize how often this diverts blame.
717                    && let ty::Adt(_, args) = unsize_ty.kind()
718                    && args.iter().any(|arg| arg.as_type().is_some_and(|ty| ty.is_trait()))
719                    // Mimic old logic for this, to minimize false positives in tests.
720                    && !path
721                        .iter()
722                        .any(|c| matches!(c.category, ConstraintCategory::TypeAnnotation(_))) =>
723                {
724                    1
725                }
726                // Between other interesting constraints, order by their position on the `path`.
727                ConstraintCategory::Yield
728                | ConstraintCategory::UseAsConst
729                | ConstraintCategory::UseAsStatic
730                | ConstraintCategory::TypeAnnotation(
731                    AnnotationSource::Ascription
732                    | AnnotationSource::Declaration
733                    | AnnotationSource::OpaqueCast,
734                )
735                | ConstraintCategory::Cast { .. }
736                | ConstraintCategory::CallArgument(_)
737                | ConstraintCategory::CopyBound
738                | ConstraintCategory::SizedBound
739                | ConstraintCategory::Assignment
740                | ConstraintCategory::Usage
741                | ConstraintCategory::ClosureUpvar(_) => 2,
742                // Generic arguments are unlikely to be what relates regions together
743                ConstraintCategory::TypeAnnotation(AnnotationSource::GenericArg) => 3,
744                // We handle predicates and opaque types specially; don't prioritize them here.
745                ConstraintCategory::Predicate(_, _) | ConstraintCategory::OpaqueType => 4,
746                // `Boring` constraints can correspond to user-written code and have useful spans,
747                // but don't provide any other useful information for diagnostics.
748                ConstraintCategory::Boring => 5,
749                // `BoringNoLocation` constraints can point to user-written code, but are less
750                // specific, and are not used for relations that would make sense to blame.
751                ConstraintCategory::BoringNoLocation => 6,
752                // Do not blame internal constraints if we can avoid it. Never blame
753                // the `'region: 'static` constraints introduced by placeholder outlives.
754                ConstraintCategory::Internal => 7,
755                ConstraintCategory::OutlivesUnnameablePlaceholder(_) => 8,
756                ConstraintCategory::SolverRegionConstraint(_) => 9,
757            };
758
759            debug!("constraint {constraint:?} category: {category:?}, interest: {interest:?}");
760
761            interest
762        };
763
764        let best_choice = if blame_source {
765            path.iter().enumerate().rev().min_by_key(|(_, c)| constraint_interest(c)).unwrap().0
766        } else {
767            path.iter().enumerate().min_by_key(|(_, c)| constraint_interest(c)).unwrap().0
768        };
769
770        debug!(?best_choice, ?blame_source);
771
772        let best_blame_idx = if let Some(next) = path.get(best_choice + 1)
773            && matches!(path[best_choice].category, ConstraintCategory::Return(_))
774            && next.category == ConstraintCategory::OpaqueType
775        {
776            // The return expression is being influenced by the return type being
777            // impl Trait, point at the return type and not the return expr.
778            best_choice + 1
779        } else if path[best_choice].category == ConstraintCategory::Return(ReturnConstraint::Normal)
780            && let Some(field) = path.iter().find_map(|p| {
781                if let ConstraintCategory::ClosureUpvar(f) = p.category { Some(f) } else { None }
782            })
783        {
784            path[best_choice].category =
785                ConstraintCategory::Return(ReturnConstraint::ClosureUpvar(field));
786            best_choice
787        } else {
788            best_choice
789        };
790
791        assert!(
792            !matches!(
793                path[best_blame_idx].category,
794                ConstraintCategory::OutlivesUnnameablePlaceholder(_)
795            ),
796            "Illegal placeholder constraint blamed; should have redirected to other region relation"
797        );
798
799        BestBlame { path, idx: best_blame_idx }
800    }
801
802    pub(crate) fn universe_info(&self, universe: ty::UniverseIndex) -> UniverseInfo<'tcx> {
803        // Query canonicalization can create local superuniverses (for example in
804        // `InferCtx::query_response_instantiation_guess`), but they don't have an associated
805        // `UniverseInfo` explaining why they were created.
806        // This can cause ICEs if these causes are accessed in diagnostics, for example in issue
807        // #114907 where this happens via liveness and dropck outlives results.
808        // Therefore, we return a default value in case that happens, which should at worst emit a
809        // suboptimal error, instead of the ICE.
810        self.universe_causes.get(&universe).cloned().unwrap_or_else(UniverseInfo::other)
811    }
812
813    /// Tries to find the terminator of the loop in which the region 'r' resides.
814    /// Returns the location of the terminator if found.
815    pub(crate) fn find_loop_terminator_location(
816        &self,
817        r: RegionVid,
818        body: &Body<'_>,
819    ) -> Option<Location> {
820        let scc = self.constraint_sccs.scc(r);
821        let locations = self.scc_values.locations_outlived_by(scc);
822        for location in locations {
823            let bb = &body[location.block];
824            if let Some(terminator) = &bb.terminator
825                // terminator of a loop should be TerminatorKind::FalseUnwind
826                && let TerminatorKind::FalseUnwind { .. } = terminator.kind
827            {
828                return Some(location);
829            }
830        }
831        None
832    }
833
834    /// Access to the SCC constraint graph.
835    /// This can be used to quickly under-approximate the regions which are equal to each other
836    /// and their relative orderings.
837    // This is `pub` because it's used by unstable external borrowck data users, see `consumers.rs`.
838    pub(crate) fn constraint_sccs(&self) -> &ConstraintSccs {
839        &self.constraint_sccs
840    }
841
842    pub(crate) fn liveness_constraints(&self) -> &LivenessValues {
843        &self.liveness_constraints
844    }
845
846    /// Returns whether the `loan_idx` is live at the given `location`: whether its issuing
847    /// region is contained within the type of a variable that is live at this point.
848    /// Note: for now, the sets of live loans is only available when using `-Zpolonius=next`.
849    pub(crate) fn is_loan_live_at(&self, loan_idx: BorrowIndex, location: Location) -> bool {
850        let point = self.liveness_constraints.location_map().point_from_location(location);
851        self.liveness_constraints.is_loan_live_at(loan_idx, point)
852    }
853}
854
855impl<'tcx> UnsolvedRegionInferenceContext<'tcx> {
856    /// Propagate the region constraints: this will grow the values
857    /// for each region variable until all the constraints are
858    /// satisfied. Note that some values may grow **too** large to be
859    /// feasible, but we check this later.
860    {}
#[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/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                    ::tracing_core::__macro_support::Option::Some(860u32),
                                    ::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/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs:862",
                                    "rustc_borrowck::region_infer::region_context",
                                    ::tracing::Level::DEBUG,
                                    ::tracing_core::__macro_support::Option::Some("/rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                    ::tracing_core::__macro_support::Option::Some(862u32),
                                    ::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.inner.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/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs:879",
                                            "rustc_borrowck::region_infer::region_context",
                                            ::tracing::Level::DEBUG,
                                            ::tracing_core::__macro_support::Option::Some("/rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                            ::tracing_core::__macro_support::Option::Some(879u32),
                                            ::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.inner.scc_values.add_region(scc_a, scc_b);
                }
            }
        }
    }
}#[instrument(skip(self), level = "debug")]
861    fn propagate_constraints(&mut self) {
862        debug!("constraints={:#?}", {
863            let mut constraints: Vec<_> = self.outlives_constraints().collect();
864            constraints.sort_by_key(|c| (c.sup, c.sub));
865            constraints
866                .into_iter()
867                .map(|c| (c, self.constraint_sccs.scc(c.sup), self.constraint_sccs.scc(c.sub)))
868                .collect::<Vec<_>>()
869        });
870
871        // To propagate constraints, we walk the DAG induced by the
872        // SCC. For each SCC `A`, we visit its successors and compute
873        // their values, then we union all those values to get our
874        // own. This one-shot approach works because iteration is in
875        // dependency order. I.e. a chain A: B: C will visit C, B, A.
876        for scc_a in self.constraint_sccs.all_sccs() {
877            // Walk each SCC `B` such that `A: B`...
878            for &scc_b in self.inner.constraint_sccs.successors(scc_a) {
879                debug!(?scc_b);
880                self.inner.scc_values.add_region(scc_a, scc_b);
881            }
882        }
883    }
884
885    /// Returns `true` if all the placeholders in the value of `scc_b` are nameable
886    /// in `scc_a`. Used during constraint propagation, and only once
887    /// the value of `scc_b` has been computed.
888    fn can_name_all_placeholders(
889        &self,
890        scc_a: ConstraintSccIndex,
891        scc_b: ConstraintSccIndex,
892    ) -> bool {
893        self.scc_annotations[scc_a].can_name_all_placeholders(self.scc_annotations[scc_b])
894    }
895
896    /// Once regions have been propagated, this method is used to see
897    /// whether the "type tests" produced by typeck were satisfied;
898    /// type tests encode type-outlives relationships like `T:
899    /// 'a`. See `TypeTest` for more details.
900    fn check_type_tests(
901        &self,
902        infcx: &InferCtxt<'tcx>,
903        mut propagated_outlives_requirements: Option<&mut Vec<ClosureOutlivesRequirement<'tcx>>>,
904        errors_buffer: &mut RegionErrors<'tcx>,
905    ) {
906        let tcx = infcx.tcx;
907
908        // Sometimes we register equivalent type-tests that would
909        // result in basically the exact same error being reported to
910        // the user. Avoid that.
911        let mut deduplicate_errors = FxIndexSet::default();
912        let mut failed_type_tests = Vec::new();
913
914        for type_test in &self.type_tests {
915            {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs:915",
                        "rustc_borrowck::region_infer::region_context",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                        ::tracing_core::__macro_support::Option::Some(915u32),
                        ::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);
916
917            let generic_ty = type_test.generic_kind.to_ty(tcx);
918            if self.eval_verify_bound(
919                infcx,
920                generic_ty,
921                type_test.lower_bound,
922                &type_test.verify_bound,
923            ) {
924                continue;
925            }
926
927            if let Some(propagated_outlives_requirements) = &mut propagated_outlives_requirements
928                && self.try_promote_type_test(infcx, type_test, propagated_outlives_requirements)
929            {
930                continue;
931            }
932
933            // Type-test failed. Collect it so we can suppress redundant errors below.
934            let erased_generic_kind = infcx.tcx.erase_and_anonymize_regions(type_test.generic_kind);
935            failed_type_tests.push((erased_generic_kind, type_test));
936        }
937
938        // An async body can produce both `G: 'static` and `G: 'a` type-test failures at
939        // the same span, as in `tests/ui/async-await/spurious-static-bound-issue-115376.rs`.
940        // Reporting the weaker bound adds a redundant diagnostic and suggests a lifetime
941        // bound that cannot fix the missing `G: 'static` requirement. Keep the `'static`
942        // error and suppress weaker failures for the same erased generic kind and span.
943        // This is a diagnostic heuristic, using the same erasure as deduplication below.
944        //
945        // Collect all failed `'static` bounds before reporting errors so suppression does
946        // not depend on the order of the type tests. Compare SCCs because a lower-bound
947        // region can be equivalent to `'static` without being `fr_static` itself.
948        let static_scc = self.constraint_sccs.scc(self.universal_regions().fr_static);
949        let static_bound_errors: FxIndexSet<_> = failed_type_tests
950            .iter()
951            .filter_map(|&(erased_generic_kind, type_test)| {
952                if self.constraint_sccs.scc(type_test.lower_bound) == static_scc {
953                    Some((erased_generic_kind, type_test.span))
954                } else {
955                    None
956                }
957            })
958            .collect();
959
960        // If `G: 'static` failed at this span, then same-span `G: 'a` failures are weaker.
961        for (erased_generic_kind, type_test) in failed_type_tests {
962            if self.constraint_sccs.scc(type_test.lower_bound) != static_scc
963                && static_bound_errors.contains(&(erased_generic_kind, type_test.span))
964            {
965                continue;
966            }
967
968            // Skip duplicate-ish errors.
969            if deduplicate_errors.insert((
970                erased_generic_kind,
971                type_test.lower_bound,
972                type_test.span,
973            )) {
974                {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs:974",
                        "rustc_borrowck::region_infer::region_context",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                        ::tracing_core::__macro_support::Option::Some(974u32),
                        ::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!(
975                    "check_type_test: reporting error for erased_generic_kind={:?}, \
976                     lower_bound_region={:?}, \
977                     type_test.span={:?}",
978                    erased_generic_kind, type_test.lower_bound, type_test.span,
979                );
980
981                errors_buffer.push(RegionErrorKind::TypeTestError { type_test: type_test.clone() });
982            }
983        }
984    }
985
986    /// Invoked when we have some type-test (e.g., `T: 'X`) that we cannot
987    /// prove to be satisfied. If this is a closure, we will attempt to
988    /// "promote" this type-test into our `ClosureRegionRequirements` and
989    /// hence pass it up the creator. To do this, we have to phrase the
990    /// type-test in terms of external free regions, as local free
991    /// regions are not nameable by the closure's creator.
992    ///
993    /// Promotion works as follows: we first check that the type `T`
994    /// contains only regions that the creator knows about. If this is
995    /// true, then -- as a consequence -- we know that all regions in
996    /// the type `T` are free regions that outlive the closure body. If
997    /// false, then promotion fails.
998    ///
999    /// Once we've promoted T, we have to "promote" `'X` to some region
1000    /// that is "external" to the closure. Generally speaking, a region
1001    /// may be the union of some points in the closure body as well as
1002    /// various free lifetimes. We can ignore the points in the closure
1003    /// body: if the type T can be expressed in terms of external regions,
1004    /// we know it outlives the points in the closure body. That
1005    /// just leaves the free regions.
1006    ///
1007    /// The idea then is to lower the `T: 'X` constraint into multiple
1008    /// bounds -- e.g., if `'X` is the union of two free lifetimes,
1009    /// `'1` and `'2`, then we would create `T: '1` and `T: '2`.
1010    {}
#[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/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                    ::tracing_core::__macro_support::Option::Some(1010u32),
                                    ::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/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs:1026",
                                    "rustc_borrowck::region_infer::region_context",
                                    ::tracing::Level::DEBUG,
                                    ::tracing_core::__macro_support::Option::Some("/rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                    ::tracing_core::__macro_support::Option::Some(1026u32),
                                    ::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/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs:1039",
                                        "rustc_borrowck::region_infer::region_context",
                                        ::tracing::Level::DEBUG,
                                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                        ::tracing_core::__macro_support::Option::Some(1039u32),
                                        ::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/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs:1059",
                                        "rustc_borrowck::region_infer::region_context",
                                        ::tracing::Level::DEBUG,
                                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                        ::tracing_core::__macro_support::Option::Some(1059u32),
                                        ::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/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs:1061",
                                        "rustc_borrowck::region_infer::region_context",
                                        ::tracing::Level::DEBUG,
                                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                        ::tracing_core::__macro_support::Option::Some(1061u32),
                                        ::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/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs:1077",
                                            "rustc_borrowck::region_infer::region_context",
                                            ::tracing::Level::DEBUG,
                                            ::tracing_core::__macro_support::Option::Some("/rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                            ::tracing_core::__macro_support::Option::Some(1077u32),
                                            ::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))]
1011    fn try_promote_type_test(
1012        &self,
1013        infcx: &InferCtxt<'tcx>,
1014        type_test: &TypeTest<'tcx>,
1015        propagated_outlives_requirements: &mut Vec<ClosureOutlivesRequirement<'tcx>>,
1016    ) -> bool {
1017        let tcx = infcx.tcx;
1018        let TypeTest { generic_kind, lower_bound, span: blame_span, verify_bound: _ } = *type_test;
1019
1020        let generic_ty = generic_kind.to_ty(tcx);
1021        let Some(subject) = self.try_promote_type_test_subject(infcx, generic_ty) else {
1022            return false;
1023        };
1024
1025        let r_scc = self.constraint_sccs.scc(lower_bound);
1026        debug!(
1027            "lower_bound = {:?} r_scc={:?} universe={:?}",
1028            lower_bound,
1029            r_scc,
1030            self.max_nameable_universe(r_scc)
1031        );
1032        // If the type test requires that `T: 'a` where `'a` is a
1033        // placeholder from another universe, that effectively requires
1034        // `T: 'static`, so we have to propagate that requirement.
1035        //
1036        // It doesn't matter *what* universe because the promoted `T` will
1037        // always be in the root universe.
1038        if let Some(p) = self.scc_values.placeholders_contained_in(r_scc).next() {
1039            debug!("encountered placeholder in higher universe: {:?}, requiring 'static", p);
1040            let static_r = self.universal_regions().fr_static;
1041            propagated_outlives_requirements.push(ClosureOutlivesRequirement {
1042                subject,
1043                outlived_free_region: static_r,
1044                blame_span,
1045                category: ConstraintCategory::Boring,
1046            });
1047
1048            // we can return here -- the code below might push add'l constraints
1049            // but they would all be weaker than this one.
1050            return true;
1051        }
1052
1053        // For each region outlived by lower_bound find a non-local,
1054        // universal region (it may be the same region) and add it to
1055        // `ClosureOutlivesRequirement`.
1056        let mut found_outlived_universal_region = false;
1057        for ur in self.scc_values.universal_regions_outlived_by(r_scc) {
1058            found_outlived_universal_region = true;
1059            debug!("universal_region_outlived_by ur={:?}", ur);
1060            let non_local_ub = self.universal_region_relations.non_local_upper_bounds(ur);
1061            debug!(?non_local_ub);
1062
1063            // This is slightly too conservative. To show T: '1, given `'2: '1`
1064            // and `'3: '1` we only need to prove that T: '2 *or* T: '3, but to
1065            // avoid potential non-determinism we approximate this by requiring
1066            // T: '1 and T: '2.
1067            for upper_bound in non_local_ub {
1068                debug_assert!(self.universal_regions().is_universal_region(upper_bound));
1069                debug_assert!(!self.universal_regions().is_local_free_region(upper_bound));
1070
1071                let requirement = ClosureOutlivesRequirement {
1072                    subject,
1073                    outlived_free_region: upper_bound,
1074                    blame_span,
1075                    category: ConstraintCategory::Boring,
1076                };
1077                debug!(?requirement, "adding closure requirement");
1078                propagated_outlives_requirements.push(requirement);
1079            }
1080        }
1081        // If we succeed to promote the subject, i.e. it only contains non-local regions,
1082        // and fail to prove the type test inside of the closure, the `lower_bound` has to
1083        // also be at least as large as some universal region, as the type test is otherwise
1084        // trivial.
1085        assert!(found_outlived_universal_region);
1086        true
1087    }
1088
1089    /// When we promote a type test `T: 'r`, we have to replace all region
1090    /// variables in the type `T` with an equal universal region from the
1091    /// closure signature.
1092    /// This is not always possible, so this is a fallible process.
1093    {}
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/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                ::tracing_core::__macro_support::Option::Some(1093u32),
                                ::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/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs:1123",
                                                "rustc_borrowck::region_infer::region_context",
                                                ::tracing::Level::DEBUG,
                                                ::tracing_core::__macro_support::Option::Some("/rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                                ::tracing_core::__macro_support::Option::Some(1123u32),
                                                ::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/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs:1093",
                        "rustc_borrowck::region_infer::region_context",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                        ::tracing_core::__macro_support::Option::Some(1093u32),
                        ::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)]
1094    fn try_promote_type_test_subject(
1095        &self,
1096        infcx: &InferCtxt<'tcx>,
1097        ty: Ty<'tcx>,
1098    ) -> Option<ClosureOutlivesSubject<'tcx>> {
1099        let tcx = infcx.tcx;
1100        let mut failed = false;
1101        let ty = fold_regions(tcx, ty, |r, _depth| {
1102            let r_vid = self.to_region_vid(r);
1103            let r_scc = self.constraint_sccs.scc(r_vid);
1104
1105            // The challenge is this. We have some region variable `r`
1106            // whose value is a set of CFG points and universal
1107            // regions. We want to find if that set is *equivalent* to
1108            // any of the named regions found in the closure.
1109            // To do so, we simply check every candidate `u_r` for equality.
1110            self.scc_values
1111                .universal_regions_outlived_by(r_scc)
1112                .filter(|&u_r| !self.universal_regions().is_local_free_region(u_r))
1113                .find(|&u_r| self.eval_equal(u_r, r_vid))
1114                .map(|u_r| ty::Region::new_var(tcx, u_r))
1115                // In case we could not find a named region to map to,
1116                // we will return `None` below.
1117                .unwrap_or_else(|| {
1118                    failed = true;
1119                    r
1120                })
1121        });
1122
1123        debug!("try_promote_type_test_subject: folded ty = {:?}", ty);
1124
1125        // This will be true if we failed to promote some region.
1126        if failed {
1127            return None;
1128        }
1129
1130        Some(ClosureOutlivesSubject::Ty(ClosureOutlivesSubjectTy::bind(tcx, ty)))
1131    }
1132
1133    /// Tests if `test` is true when applied to `lower_bound` at
1134    /// `point`.
1135    fn eval_verify_bound(
1136        &self,
1137        infcx: &InferCtxt<'tcx>,
1138        generic_ty: Ty<'tcx>,
1139        lower_bound: RegionVid,
1140        verify_bound: &VerifyBound<'tcx>,
1141    ) -> bool {
1142        {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs:1142",
                        "rustc_borrowck::region_infer::region_context",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                        ::tracing_core::__macro_support::Option::Some(1142u32),
                        ::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);
1143
1144        match verify_bound {
1145            VerifyBound::IfEq(verify_if_eq_b) => {
1146                self.eval_if_eq(infcx, generic_ty, lower_bound, *verify_if_eq_b)
1147            }
1148
1149            VerifyBound::IsEmpty => {
1150                let lower_bound_scc = self.constraint_sccs.scc(lower_bound);
1151                self.scc_values.elements_contained_in(lower_bound_scc).next().is_none()
1152            }
1153
1154            VerifyBound::OutlivedBy(r) => {
1155                let r_vid = self.to_region_vid(*r);
1156                self.eval_outlives(r_vid, lower_bound)
1157            }
1158
1159            VerifyBound::AnyBound(verify_bounds) => verify_bounds.iter().any(|verify_bound| {
1160                self.eval_verify_bound(infcx, generic_ty, lower_bound, verify_bound)
1161            }),
1162
1163            VerifyBound::AllBounds(verify_bounds) => verify_bounds.iter().all(|verify_bound| {
1164                self.eval_verify_bound(infcx, generic_ty, lower_bound, verify_bound)
1165            }),
1166        }
1167    }
1168
1169    fn eval_if_eq(
1170        &self,
1171        infcx: &InferCtxt<'tcx>,
1172        generic_ty: Ty<'tcx>,
1173        lower_bound: RegionVid,
1174        verify_if_eq_b: ty::Binder<'tcx, VerifyIfEq<'tcx>>,
1175    ) -> bool {
1176        let generic_ty = self.normalize_to_scc_representatives(infcx.tcx, generic_ty);
1177        let verify_if_eq_b = self.normalize_to_scc_representatives(infcx.tcx, verify_if_eq_b);
1178        match test_type_match::extract_verify_if_eq(infcx.tcx, &verify_if_eq_b, generic_ty) {
1179            Some(r) => {
1180                let r_vid = self.to_region_vid(r);
1181                self.eval_outlives(r_vid, lower_bound)
1182            }
1183            None => false,
1184        }
1185    }
1186
1187    /// This is a conservative normalization procedure. It takes every
1188    /// free region in `value` and replaces it with the
1189    /// "representative" of its SCC (see `scc_representatives` field).
1190    /// We are guaranteed that if two values normalize to the same
1191    /// thing, then they are equal; this is a conservative check in
1192    /// that they could still be equal even if they normalize to
1193    /// different results. (For example, there might be two regions
1194    /// with the same value that are not in the same SCC).
1195    ///
1196    /// N.B., this is not an ideal approach and I would like to revisit
1197    /// it. However, it works pretty well in practice. In particular,
1198    /// this is needed to deal with projection outlives bounds like
1199    ///
1200    /// ```text
1201    /// <T as Foo<'0>>::Item: '1
1202    /// ```
1203    ///
1204    /// In particular, this routine winds up being important when
1205    /// there are bounds like `where <T as Foo<'a>>::Item: 'b` in the
1206    /// environment. In this case, if we can show that `'0 == 'a`,
1207    /// and that `'b: '1`, then we know that the clause is
1208    /// satisfied. In such cases, particularly due to limitations of
1209    /// the trait solver =), we usually wind up with a where-clause like
1210    /// `T: Foo<'a>` in scope, which thus forces `'0 == 'a` to be added as
1211    /// a constraint, and thus ensures that they are in the same SCC.
1212    ///
1213    /// So why can't we do a more correct routine? Well, we could
1214    /// *almost* use the `relate_tys` code, but the way it is
1215    /// currently setup it creates inference variables to deal with
1216    /// higher-ranked things and so forth, and right now the inference
1217    /// context is not permitted to make more inference variables. So
1218    /// we use this kind of hacky solution.
1219    fn normalize_to_scc_representatives<T>(&self, tcx: TyCtxt<'tcx>, value: T) -> T
1220    where
1221        T: TypeFoldable<TyCtxt<'tcx>>,
1222    {
1223        fold_regions(tcx, value, |r, _db| {
1224            let vid = self.to_region_vid(r);
1225            let scc = self.constraint_sccs.scc(vid);
1226            let repr = self.scc_representative(scc);
1227            ty::Region::new_var(tcx, repr)
1228        })
1229    }
1230
1231    /// Evaluate whether `sup_region == sub_region`.
1232    ///
1233    /// Panics if called before `solve()` executes,
1234    // This is `pub` because it's used by unstable external borrowck data users, see `consumers.rs`.
1235    pub(crate) fn eval_equal(&self, r1: RegionVid, r2: RegionVid) -> bool {
1236        self.eval_outlives(r1, r2) && self.eval_outlives(r2, r1)
1237    }
1238
1239    /// Evaluate whether `sup_region: sub_region`.
1240    ///
1241    /// Panics if called before `solve()` executes,
1242    // This is `pub` because it's used by unstable external borrowck data users, see `consumers.rs`.
1243    {}
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/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                ::tracing_core::__macro_support::Option::Some(1243u32),
                                ::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/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs:1245",
                                                "rustc_borrowck::region_infer::region_context",
                                                ::tracing::Level::DEBUG,
                                                ::tracing_core::__macro_support::Option::Some("/rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                                ::tracing_core::__macro_support::Option::Some(1245u32),
                                                ::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/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs:1250",
                                                "rustc_borrowck::region_infer::region_context",
                                                ::tracing::Level::DEBUG,
                                                ::tracing_core::__macro_support::Option::Some("/rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                                ::tracing_core::__macro_support::Option::Some(1250u32),
                                                ::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/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs:1260",
                                                    "rustc_borrowck::region_infer::region_context",
                                                    ::tracing::Level::DEBUG,
                                                    ::tracing_core::__macro_support::Option::Some("/rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                                    ::tracing_core::__macro_support::Option::Some(1260u32),
                                                    ::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/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs:1274",
                                                    "rustc_borrowck::region_infer::region_context",
                                                    ::tracing::Level::DEBUG,
                                                    ::tracing_core::__macro_support::Option::Some("/rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                                    ::tracing_core::__macro_support::Option::Some(1274u32),
                                                    ::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/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs:1296",
                                                    "rustc_borrowck::region_infer::region_context",
                                                    ::tracing::Level::DEBUG,
                                                    ::tracing_core::__macro_support::Option::Some("/rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                                    ::tracing_core::__macro_support::Option::Some(1296u32),
                                                    ::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/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs:1305",
                                                    "rustc_borrowck::region_infer::region_context",
                                                    ::tracing::Level::DEBUG,
                                                    ::tracing_core::__macro_support::Option::Some("/rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                                    ::tracing_core::__macro_support::Option::Some(1305u32),
                                                    ::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/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs:1309",
                                                "rustc_borrowck::region_infer::region_context",
                                                ::tracing::Level::DEBUG,
                                                ::tracing_core::__macro_support::Option::Some("/rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                                ::tracing_core::__macro_support::Option::Some(1309u32),
                                                ::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/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs:1243",
                        "rustc_borrowck::region_infer::region_context",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                        ::tracing_core::__macro_support::Option::Some(1243u32),
                        ::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)]
1244    pub(crate) fn eval_outlives(&self, sup_region: RegionVid, sub_region: RegionVid) -> bool {
1245        debug!(
1246            "sup_region's value = {:?} universal={:?}",
1247            self.region_value_str(sup_region),
1248            self.universal_regions().is_universal_region(sup_region),
1249        );
1250        debug!(
1251            "sub_region's value = {:?} universal={:?}",
1252            self.region_value_str(sub_region),
1253            self.universal_regions().is_universal_region(sub_region),
1254        );
1255
1256        let sub_region_scc = self.constraint_sccs.scc(sub_region);
1257        let sup_region_scc = self.constraint_sccs.scc(sup_region);
1258
1259        if sub_region_scc == sup_region_scc {
1260            debug!("{sup_region:?}: {sub_region:?} holds trivially; they are in the same SCC");
1261            return true;
1262        }
1263
1264        let fr_static = self.universal_regions().fr_static;
1265
1266        // If we are checking that `'sup: 'sub`, and `'sub` contains
1267        // some placeholder that `'sup` cannot name, then this is only
1268        // true if `'sup` outlives static.
1269        //
1270        // Avoid infinite recursion if `sub_region` is already `'static`
1271        if sub_region != fr_static
1272            && !self.can_name_all_placeholders(sup_region_scc, sub_region_scc)
1273        {
1274            debug!(
1275                "sub universe `{sub_region_scc:?}` is not nameable \
1276                by super `{sup_region_scc:?}`, promoting to static",
1277            );
1278
1279            return self.eval_outlives(sup_region, fr_static);
1280        }
1281
1282        // Both the `sub_region` and `sup_region` consist of the union
1283        // of some number of universal regions (along with the union
1284        // of various points in the CFG; ignore those points for
1285        // now). Therefore, the sup-region outlives the sub-region if,
1286        // for each universal region R1 in the sub-region, there
1287        // exists some region R2 in the sup-region that outlives R1.
1288        let universal_outlives =
1289            self.scc_values.universal_regions_outlived_by(sub_region_scc).all(|r1| {
1290                self.scc_values
1291                    .universal_regions_outlived_by(sup_region_scc)
1292                    .any(|r2| self.universal_region_relations.outlives(r2, r1))
1293            });
1294
1295        if !universal_outlives {
1296            debug!("sub region contains a universal region not present in super");
1297            return false;
1298        }
1299
1300        // Now we have to compare all the points in the sub region and make
1301        // sure they exist in the sup region.
1302
1303        if self.universal_regions().is_universal_region(sup_region) {
1304            // Micro-opt: universal regions contain all points.
1305            debug!("super is universal and hence contains all points");
1306            return true;
1307        }
1308
1309        debug!("comparison between points in sup/sub");
1310
1311        self.scc_values.contains_points(sup_region_scc, sub_region_scc)
1312    }
1313
1314    /// Once regions have been propagated, this method is used to see
1315    /// whether any of the constraints were too strong. In particular,
1316    /// we want to check for a case where a universally quantified
1317    /// region exceeded its bounds. Consider:
1318    /// ```compile_fail
1319    /// fn foo<'a, 'b>(x: &'a u32) -> &'b u32 { x }
1320    /// ```
1321    /// In this case, returning `x` requires `&'a u32 <: &'b u32`
1322    /// and hence we establish (transitively) a constraint that
1323    /// `'a: 'b`. The `propagate_constraints` code above will
1324    /// therefore add `end('a)` into the region for `'b` -- but we
1325    /// have no evidence that `'b` outlives `'a`, so we want to report
1326    /// an error.
1327    ///
1328    /// If `propagated_outlives_requirements` is `Some`, then we will
1329    /// push unsatisfied obligations into there. Otherwise, we'll
1330    /// report them as errors.
1331    fn check_universal_regions(
1332        &self,
1333        mut propagated_outlives_requirements: Option<&mut Vec<ClosureOutlivesRequirement<'tcx>>>,
1334        errors_buffer: &mut RegionErrors<'tcx>,
1335    ) {
1336        for (fr, fr_definition) in self.definitions.iter_enumerated() {
1337            {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs:1337",
                        "rustc_borrowck::region_infer::region_context",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                        ::tracing_core::__macro_support::Option::Some(1337u32),
                        ::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);
1338            match fr_definition.origin {
1339                NllRegionVariableOrigin::FreeRegion => {
1340                    // Go through each of the universal regions `fr` and check that
1341                    // they did not grow too large, accumulating any requirements
1342                    // for our caller into the `outlives_requirements` vector.
1343                    self.check_universal_region(
1344                        fr,
1345                        &mut propagated_outlives_requirements,
1346                        errors_buffer,
1347                    );
1348                }
1349
1350                NllRegionVariableOrigin::Placeholder(placeholder) => {
1351                    self.check_bound_universal_region(fr, placeholder, errors_buffer);
1352                }
1353
1354                NllRegionVariableOrigin::Existential { .. } => {
1355                    // nothing to check here
1356                }
1357            }
1358        }
1359    }
1360
1361    /// Checks if Polonius has found any unexpected free region relations.
1362    ///
1363    /// In Polonius terms, a "subset error" (or "illegal subset relation error") is the equivalent
1364    /// of NLL's "checking if any region constraints were too strong": a placeholder origin `'a`
1365    /// was unexpectedly found to be a subset of another placeholder origin `'b`, and means in NLL
1366    /// terms that the "longer free region" `'a` outlived the "shorter free region" `'b`.
1367    ///
1368    /// More details can be found in this blog post by Niko:
1369    /// <https://smallcultfollowing.com/babysteps/blog/2019/01/17/polonius-and-region-errors/>
1370    ///
1371    /// In the canonical example
1372    /// ```compile_fail
1373    /// fn foo<'a, 'b>(x: &'a u32) -> &'b u32 { x }
1374    /// ```
1375    /// returning `x` requires `&'a u32 <: &'b u32` and hence we establish (transitively) a
1376    /// constraint that `'a: 'b`. It is an error that we have no evidence that this
1377    /// constraint holds.
1378    ///
1379    /// If `propagated_outlives_requirements` is `Some`, then we will
1380    /// push unsatisfied obligations into there. Otherwise, we'll
1381    /// report them as errors.
1382    fn check_polonius_subset_errors(
1383        &self,
1384        mut propagated_outlives_requirements: Option<&mut Vec<ClosureOutlivesRequirement<'tcx>>>,
1385        errors_buffer: &mut RegionErrors<'tcx>,
1386        polonius_output: &PoloniusOutput,
1387    ) {
1388        {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs:1388",
                        "rustc_borrowck::region_infer::region_context",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                        ::tracing_core::__macro_support::Option::Some(1388u32),
                        ::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!(
1389            "check_polonius_subset_errors: {} subset_errors",
1390            polonius_output.subset_errors.len()
1391        );
1392
1393        // Similarly to `check_universal_regions`: a free region relation, which was not explicitly
1394        // declared ("known") was found by Polonius, so emit an error, or propagate the
1395        // requirements for our caller into the `propagated_outlives_requirements` vector.
1396        //
1397        // Polonius doesn't model regions ("origins") as CFG-subsets or durations, but the
1398        // `longer_fr` and `shorter_fr` terminology will still be used here, for consistency with
1399        // the rest of the NLL infrastructure. The "subset origin" is the "longer free region",
1400        // and the "superset origin" is the outlived "shorter free region".
1401        //
1402        // Note: Polonius will produce a subset error at every point where the unexpected
1403        // `longer_fr`'s "placeholder loan" is contained in the `shorter_fr`. This can be helpful
1404        // for diagnostics in the future, e.g. to point more precisely at the key locations
1405        // requiring this constraint to hold. However, the error and diagnostics code downstream
1406        // expects that these errors are not duplicated (and that they are in a certain order).
1407        // Otherwise, diagnostics messages such as the ones giving names like `'1` to elided or
1408        // anonymous lifetimes for example, could give these names differently, while others like
1409        // the outlives suggestions or the debug output from `#[rustc_regions]` would be
1410        // duplicated. The polonius subset errors are deduplicated here, while keeping the
1411        // CFG-location ordering.
1412        // We can iterate the HashMap here because the result is sorted afterwards.
1413        #[allow(rustc::potential_query_instability)]
1414        let mut subset_errors: Vec<_> = polonius_output
1415            .subset_errors
1416            .iter()
1417            .flat_map(|(_location, subset_errors)| subset_errors.iter())
1418            .collect();
1419        subset_errors.sort();
1420        subset_errors.dedup();
1421
1422        for &(longer_fr, shorter_fr) in subset_errors.into_iter() {
1423            {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs:1423",
                        "rustc_borrowck::region_infer::region_context",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                        ::tracing_core::__macro_support::Option::Some(1423u32),
                        ::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!(
1424                "check_polonius_subset_errors: subset_error longer_fr={:?},\
1425                 shorter_fr={:?}",
1426                longer_fr, shorter_fr
1427            );
1428
1429            let propagated = self.try_propagate_universal_region_error(
1430                longer_fr.into(),
1431                shorter_fr.into(),
1432                &mut propagated_outlives_requirements,
1433            );
1434            if propagated == RegionRelationCheckResult::Error {
1435                errors_buffer.push(RegionErrorKind::RegionError {
1436                    longer_fr: longer_fr.into(),
1437                    shorter_fr: shorter_fr.into(),
1438                    fr_origin: NllRegionVariableOrigin::FreeRegion,
1439                    is_reported: true,
1440                });
1441            }
1442        }
1443
1444        // Handle the placeholder errors as usual, until the chalk-rustc-polonius triumvirate has
1445        // a more complete picture on how to separate this responsibility.
1446        for (fr, fr_definition) in self.definitions.iter_enumerated() {
1447            match fr_definition.origin {
1448                NllRegionVariableOrigin::FreeRegion => {
1449                    // handled by polonius above
1450                }
1451
1452                NllRegionVariableOrigin::Placeholder(placeholder) => {
1453                    self.check_bound_universal_region(fr, placeholder, errors_buffer);
1454                }
1455
1456                NllRegionVariableOrigin::Existential { .. } => {
1457                    // nothing to check here
1458                }
1459            }
1460        }
1461    }
1462
1463    /// Checks the final value for the free region `fr` to see if it
1464    /// grew too large. In particular, examine what `end(X)` points
1465    /// wound up in `fr`'s final value; for each `end(X)` where `X !=
1466    /// fr`, we want to check that `fr: X`. If not, that's either an
1467    /// error, or something we have to propagate to our creator.
1468    ///
1469    /// Things that are to be propagated are accumulated into the
1470    /// `outlives_requirements` vector.
1471    {}
#[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/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                                    ::tracing_core::__macro_support::Option::Some(1471u32),
                                    ::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")]
1472    fn check_universal_region(
1473        &self,
1474        longer_fr: RegionVid,
1475        propagated_outlives_requirements: &mut Option<&mut Vec<ClosureOutlivesRequirement<'tcx>>>,
1476        errors_buffer: &mut RegionErrors<'tcx>,
1477    ) {
1478        let longer_fr_scc = self.constraint_sccs.scc(longer_fr);
1479
1480        // Because this free region must be in the ROOT universe, we
1481        // know it cannot contain any bound universes.
1482        assert!(self.max_nameable_universe(longer_fr_scc).is_root());
1483
1484        // Only check all of the relations for the main representative of each
1485        // SCC, otherwise just check that we outlive said representative. This
1486        // reduces the number of redundant relations propagated out of
1487        // closures.
1488        // Note that the representative will be a universal region if there is
1489        // one in this SCC, so we will always check the representative here.
1490        let representative = self.scc_representative(longer_fr_scc);
1491        if representative != longer_fr {
1492            if let RegionRelationCheckResult::Error = self.check_universal_region_relation(
1493                longer_fr,
1494                representative,
1495                propagated_outlives_requirements,
1496            ) {
1497                errors_buffer.push(RegionErrorKind::RegionError {
1498                    longer_fr,
1499                    shorter_fr: representative,
1500                    fr_origin: NllRegionVariableOrigin::FreeRegion,
1501                    is_reported: true,
1502                });
1503            }
1504            return;
1505        }
1506
1507        // Find every region `o` such that `fr: o`
1508        // (because `fr` includes `end(o)`).
1509        let mut error_reported = false;
1510        for shorter_fr in self.scc_values.universal_regions_outlived_by(longer_fr_scc) {
1511            if let RegionRelationCheckResult::Error = self.check_universal_region_relation(
1512                longer_fr,
1513                shorter_fr,
1514                propagated_outlives_requirements,
1515            ) {
1516                // We only report the first region error. Subsequent errors are hidden so as
1517                // not to overwhelm the user, but we do record them so as to potentially print
1518                // better diagnostics elsewhere...
1519                errors_buffer.push(RegionErrorKind::RegionError {
1520                    longer_fr,
1521                    shorter_fr,
1522                    fr_origin: NllRegionVariableOrigin::FreeRegion,
1523                    is_reported: !error_reported,
1524                });
1525
1526                error_reported = true;
1527            }
1528        }
1529    }
1530
1531    /// Checks that we can prove that `longer_fr: shorter_fr`. If we can't we attempt to propagate
1532    /// the constraint outward (e.g. to a closure environment), but if that fails, there is an
1533    /// error.
1534    fn check_universal_region_relation(
1535        &self,
1536        longer_fr: RegionVid,
1537        shorter_fr: RegionVid,
1538        propagated_outlives_requirements: &mut Option<&mut Vec<ClosureOutlivesRequirement<'tcx>>>,
1539    ) -> RegionRelationCheckResult {
1540        // If it is known that `fr: o`, carry on.
1541        if self.universal_region_relations.outlives(longer_fr, shorter_fr) {
1542            RegionRelationCheckResult::Ok
1543        } else {
1544            // If we are not in a context where we can't propagate errors, or we
1545            // could not shrink `fr` to something smaller, then just report an
1546            // error.
1547            //
1548            // Note: in this case, we use the unapproximated regions to report the
1549            // error. This gives better error messages in some cases.
1550            self.try_propagate_universal_region_error(
1551                longer_fr,
1552                shorter_fr,
1553                propagated_outlives_requirements,
1554            )
1555        }
1556    }
1557
1558    /// Attempt to propagate a region error (e.g. `'a: 'b`) that is not met to a closure's
1559    /// creator. If we cannot, then the caller should report an error to the user.
1560    fn try_propagate_universal_region_error(
1561        &self,
1562        longer_fr: RegionVid,
1563        shorter_fr: RegionVid,
1564        propagated_outlives_requirements: &mut Option<&mut Vec<ClosureOutlivesRequirement<'tcx>>>,
1565    ) -> RegionRelationCheckResult {
1566        if let Some(propagated_outlives_requirements) = propagated_outlives_requirements {
1567            // Shrink `longer_fr` until we find some non-local regions.
1568            // We'll call them `longer_fr-` -- they are ever so slightly smaller than
1569            // `longer_fr`.
1570            let longer_fr_minus = self.universal_region_relations.non_local_lower_bounds(longer_fr);
1571
1572            {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs:1572",
                        "rustc_borrowck::region_infer::region_context",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                        ::tracing_core::__macro_support::Option::Some(1572u32),
                        ::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);
1573
1574            // If we don't find a any non-local regions, we should error out as there is nothing
1575            // to propagate.
1576            if longer_fr_minus.is_empty() {
1577                return RegionRelationCheckResult::Error;
1578            }
1579
1580            let best_blame = self.best_blame_constraint(
1581                longer_fr,
1582                NllRegionVariableOrigin::FreeRegion,
1583                shorter_fr,
1584            );
1585            let OutlivesConstraint { category, span, .. } = best_blame.constraint();
1586
1587            // Grow `shorter_fr` until we find some non-local regions.
1588            // We will always find at least one: `'static`. We'll call
1589            // them `shorter_fr+` -- they're ever so slightly larger
1590            // than `shorter_fr`.
1591            let shorter_fr_plus =
1592                self.universal_region_relations.non_local_upper_bounds(shorter_fr);
1593            {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs:1593",
                        "rustc_borrowck::region_infer::region_context",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                        ::tracing_core::__macro_support::Option::Some(1593u32),
                        ::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);
1594
1595            // We then create constraints `longer_fr-: shorter_fr+` that may or may not
1596            // be propagated (see below).
1597            let mut constraints = ::alloc::vec::Vec::new()vec![];
1598            for fr_minus in longer_fr_minus {
1599                for shorter_fr_plus in &shorter_fr_plus {
1600                    constraints.push((fr_minus, *shorter_fr_plus));
1601                }
1602            }
1603
1604            // We only need to propagate at least one of the constraints for
1605            // soundness. However, we want to avoid arbitrary choices here
1606            // and currently don't support returning OR constraints.
1607            //
1608            // If any of the `shorter_fr+` regions are already outlived by `longer_fr-`,
1609            // we propagate only those.
1610            //
1611            // Consider this example (`'b: 'a` == `a -> b`), where we try to propagate `'d: 'a`:
1612            // a --> b --> d
1613            //  \
1614            //   \-> c
1615            // Here, `shorter_fr+` of `'a` == `['b, 'c]`.
1616            // Propagating `'d: 'b` is correct and should occur; `'d: 'c` is redundant because of
1617            // `'d: 'b` and could reject valid code.
1618            //
1619            // So we filter the constraints to regions already outlived by `longer_fr-`, but if
1620            // the filter yields an empty set, we fall back to the original one.
1621            let subset: Vec<_> = constraints
1622                .iter()
1623                .filter(|&&(fr_minus, shorter_fr_plus)| {
1624                    self.eval_outlives(fr_minus, shorter_fr_plus)
1625                })
1626                .copied()
1627                .collect();
1628            let propagated_constraints = if subset.is_empty() { constraints } else { subset };
1629            {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs:1629",
                        "rustc_borrowck::region_infer::region_context",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                        ::tracing_core::__macro_support::Option::Some(1629u32),
                        ::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!(
1630                "try_propagate_universal_region_error: constraints={:?}",
1631                propagated_constraints
1632            );
1633
1634            if !!propagated_constraints.is_empty() {
    {
        ::core::panicking::panic_fmt(format_args!("Expected at least one constraint to propagate here"));
    }
};assert!(
1635                !propagated_constraints.is_empty(),
1636                "Expected at least one constraint to propagate here"
1637            );
1638
1639            for (fr_minus, fr_plus) in propagated_constraints {
1640                // Push the constraint `long_fr-: shorter_fr+`
1641                propagated_outlives_requirements.push(ClosureOutlivesRequirement {
1642                    subject: ClosureOutlivesSubject::Region(fr_minus),
1643                    outlived_free_region: fr_plus,
1644                    blame_span: *span,
1645                    category: *category,
1646                });
1647            }
1648            return RegionRelationCheckResult::Propagated;
1649        }
1650
1651        RegionRelationCheckResult::Error
1652    }
1653
1654    fn check_bound_universal_region(
1655        &self,
1656        longer_fr: RegionVid,
1657        placeholder: ty::PlaceholderRegion<'tcx>,
1658        errors_buffer: &mut RegionErrors<'tcx>,
1659    ) {
1660        {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs:1660",
                        "rustc_borrowck::region_infer::region_context",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                        ::tracing_core::__macro_support::Option::Some(1660u32),
                        ::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,);
1661
1662        let longer_fr_scc = self.constraint_sccs.scc(longer_fr);
1663        {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs:1663",
                        "rustc_borrowck::region_infer::region_context",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                        ::tracing_core::__macro_support::Option::Some(1663u32),
                        ::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,);
1664
1665        // If we have some bound universal region `'a`, then the only
1666        // elements it can contain is itself -- we don't know anything
1667        // else about it!
1668        if let Some(error_element) = self
1669            .scc_values
1670            .elements_contained_in(longer_fr_scc)
1671            .find(|e| *e != RegionElement::PlaceholderRegion(placeholder))
1672        {
1673            let illegally_outlived_r = self.region_from_element(longer_fr, &error_element);
1674            // Stop after the first error, it gets too noisy otherwise, and does not provide more information.
1675            errors_buffer.push(RegionErrorKind::PlaceholderOutlivesIllegalRegion {
1676                longer_fr,
1677                illegally_outlived_r,
1678            });
1679        } else {
1680            {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event /rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs:1680",
                        "rustc_borrowck::region_infer::region_context",
                        ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("/rustc-dev/4ebd258257737d5b7635c116fa7d281627a7e937/compiler/rustc_borrowck/src/region_infer/region_context.rs"),
                        ::tracing_core::__macro_support::Option::Some(1680u32),
                        ::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");
1681        }
1682    }
1683
1684    /// Get the region outlived by `longer_fr` and live at `element`.
1685    fn region_from_element(
1686        &self,
1687        longer_fr: RegionVid,
1688        element: &RegionElement<'tcx>,
1689    ) -> RegionVid {
1690        match *element {
1691            RegionElement::Location(l) => self.find_sub_region_live_at(longer_fr, l),
1692            RegionElement::RootUniversalRegion(r) => r,
1693            RegionElement::PlaceholderRegion(error_placeholder) => self
1694                .definitions
1695                .iter_enumerated()
1696                .find_map(|(r, definition)| match definition.origin {
1697                    NllRegionVariableOrigin::Placeholder(p) if p == error_placeholder => Some(r),
1698                    _ => None,
1699                })
1700                .unwrap(),
1701        }
1702    }
1703
1704    /// Returns the representative `RegionVid` for a given SCC.
1705    /// See `RegionTracker` for how a region variable ID is chosen.
1706    ///
1707    /// It is a hacky way to manage checking regions for equality,
1708    /// since we can 'canonicalize' each region to the representative
1709    /// of its SCC and be sure that -- if they have the same repr --
1710    /// they *must* be equal (though not having the same repr does not
1711    /// mean they are unequal).
1712    fn scc_representative(&self, scc: ConstraintSccIndex) -> RegionVid {
1713        self.scc_annotations[scc].representative.rvid()
1714    }
1715}