[][src]Struct rustc_mir::borrow_check::nll::region_infer::RegionInferenceContext

pub struct RegionInferenceContext<'tcx> {
    definitions: IndexVec<RegionVid, RegionDefinition<'tcx>>,
    liveness_constraints: LivenessValues<RegionVid>,
    constraints: Rc<OutlivesConstraintSet>,
    constraint_graph: Rc<ConstraintGraph<Normal>>,
    constraint_sccs: Rc<Sccs<RegionVid, ConstraintSccIndex>>,
    rev_constraint_graph: Option<Rc<VecGraph<ConstraintSccIndex>>>,
    member_constraints: Rc<MemberConstraintSet<'tcx, ConstraintSccIndex>>,
    member_constraints_applied: Vec<AppliedMemberConstraint>,
    closure_bounds_mapping: FxHashMap<Location, FxHashMap<(RegionVid, RegionVid), (ConstraintCategory, Span)>>,
    scc_universes: IndexVec<ConstraintSccIndex, UniverseIndex>,
    scc_representatives: IndexVec<ConstraintSccIndex, RegionVid>,
    scc_values: RegionValues<ConstraintSccIndex>,
    type_tests: Vec<TypeTest<'tcx>>,
    universal_regions: Rc<UniversalRegions<'tcx>>,
    universal_region_relations: Rc<UniversalRegionRelations<'tcx>>,
}
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Fields

definitions: IndexVec<RegionVid, RegionDefinition<'tcx>>
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Contains the definition for every region variable. Region variables are identified by their index (RegionVid). The definition contains information about where the region came from as well as its final inferred value.

liveness_constraints: LivenessValues<RegionVid>
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

The liveness constraints added to each region. For most regions, these start out empty and steadily grow, though for each universally quantified region R they start out containing the entire CFG and end(R).

constraints: Rc<OutlivesConstraintSet>
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

The outlives constraints computed by the type-check.

constraint_graph: Rc<ConstraintGraph<Normal>>
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

The constraint-set, but in graph form, making it easy to traverse the constraints adjacent to a particular region. Used to construct the SCC (see constraint_sccs) and for error reporting.

constraint_sccs: Rc<Sccs<RegionVid, ConstraintSccIndex>>
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

The SCC computed from constraints and the constraint graph. We have an edge from SCC A to SCC B if A: B. Used to compute the values of each region.

rev_constraint_graph: Option<Rc<VecGraph<ConstraintSccIndex>>>
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Reverse of the SCC constraint graph -- i.e., an edge A -> B exists if B: A. Computed lazilly.

member_constraints: Rc<MemberConstraintSet<'tcx, ConstraintSccIndex>>
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

The "R0 member of [R1..Rn]" constraints, indexed by SCC.

member_constraints_applied: Vec<AppliedMemberConstraint>
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Records the member constraints that we applied to each scc. This is useful for error reporting. Once constraint propagation is done, this vector is sorted according to member_region_scc.

closure_bounds_mapping: FxHashMap<Location, FxHashMap<(RegionVid, RegionVid), (ConstraintCategory, Span)>>
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Map closure bounds to a Span that should be used for error reporting.

scc_universes: IndexVec<ConstraintSccIndex, UniverseIndex>
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Contains the minimum universe of any variable within the same SCC. We will ensure that no SCC contains values that are not visible from this index.

scc_representatives: IndexVec<ConstraintSccIndex, RegionVid>
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Contains a "representative" from each SCC. This will be the minimal RegionVid belonging to that universe. It is used as a kind of hacky way to manage checking outlives relationships, since we can 'canonicalize' each region to the representative of its SCC and be sure that -- if they have the same repr -- they must be equal (though not having the same repr does not mean they are unequal).

scc_values: RegionValues<ConstraintSccIndex>
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

The final inferred values of the region variables; we compute one value per SCC. To get the value for any given region, you first find which scc it is a part of.

type_tests: Vec<TypeTest<'tcx>>
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Type constraints that we check after solving.

universal_regions: Rc<UniversalRegions<'tcx>>
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Information about the universally quantified regions in scope on this function.

universal_region_relations: Rc<UniversalRegionRelations<'tcx>>
⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Information about how the universally quantified regions in scope on this function relate to one another.

Methods

impl<'tcx> RegionInferenceContext<'tcx>[src]

pub(crate) fn dump_mir(&self, out: &mut dyn Write) -> Result<()>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Write out our state into the .mir files.

fn for_each_constraint(
    &self,
    with_msg: &mut dyn FnMut(&str) -> Result<()>
) -> Result<()>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Debugging aid: Invokes the with_msg callback repeatedly with our internal region constraints. These are dumped into the -Zdump-mir file so that we can figure out why the region inference resulted in the values that it did when debugging.

impl<'tcx> RegionInferenceContext<'tcx>[src]

pub(crate) fn give_region_a_name(
    &self,
    errctx: &ErrorReportingCtx<'_, '_, 'tcx>,
    renctx: &mut RegionErrorNamingCtx,
    fr: RegionVid
) -> Option<RegionName>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Maps from an internal MIR region vid to something that we can report to the user. In some cases, the region vids will map directly to lifetimes that the user has a name for (e.g., 'static). But frequently they will not, in which case we have to find some way to identify the lifetime to the user. To that end, this function takes a "diagnostic" so that it can create auxiliary notes as needed.

Example (function arguments):

Suppose we are trying to give a name to the lifetime of the reference x:

fn foo(x: &u32) { .. }

This function would create a label like this:

 | fn foo(x: &u32) { .. }
          ------- fully elaborated type of `x` is `&'1 u32`

and then return the name '1 for us to use.

fn give_name_from_error_region(
    &self,
    tcx: TyCtxt<'tcx>,
    mir_def_id: DefId,
    fr: RegionVid,
    renctx: &mut RegionErrorNamingCtx
) -> Option<RegionName>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Checks for the case where fr maps to something that the user has a name for. In that case, we'll be able to map fr to a Region<'tcx>, and that region will be one of named variants.

fn get_named_span(
    &self,
    tcx: TyCtxt<'tcx>,
    error_region: &RegionKind,
    name: Symbol
) -> Span
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Gets a span of a named region to provide context for error messages that mention that span, for example:

 |
 | fn two_regions<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
 |                --  -- lifetime `'b` defined here
 |                |
 |                lifetime `'a` defined here
 |
 |     with_signature(cell, t, |cell, t| require(cell, t));
 |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'b` must
 |                                                         outlive `'a`

fn give_name_if_anonymous_region_appears_in_arguments(
    &self,
    infcx: &InferCtxt<'_, 'tcx>,
    body: &Body<'tcx>,
    mir_def_id: DefId,
    fr: RegionVid,
    renctx: &mut RegionErrorNamingCtx
) -> Option<RegionName>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Finds an argument that contains fr and label it with a fully elaborated type, returning something like '1. Result looks like:

 | fn foo(x: &u32) { .. }
          ------- fully elaborated type of `x` is `&'1 u32`

fn give_name_if_we_can_match_hir_ty_from_argument(
    &self,
    infcx: &InferCtxt<'_, 'tcx>,
    mir_def_id: DefId,
    needle_fr: RegionVid,
    argument_ty: Ty<'tcx>,
    argument_index: usize,
    renctx: &mut RegionErrorNamingCtx
) -> Option<RegionName>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn give_name_if_we_cannot_match_hir_ty(
    &self,
    infcx: &InferCtxt<'_, 'tcx>,
    body: &Body<'tcx>,
    needle_fr: RegionVid,
    argument_ty: Ty<'tcx>,
    renctx: &mut RegionErrorNamingCtx
) -> Option<RegionName>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Attempts to highlight the specific part of a type in an argument that has no type annotation. For example, we might produce an annotation like this:

 |     foo(|a, b| b)
 |          -  -
 |          |  |
 |          |  has type `&'1 u32`
 |          has type `&'2 u32`

fn give_name_if_we_can_match_hir_ty(
    &self,
    tcx: TyCtxt<'tcx>,
    needle_fr: RegionVid,
    argument_ty: Ty<'tcx>,
    argument_hir_ty: &Ty,
    renctx: &mut RegionErrorNamingCtx
) -> Option<RegionName>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Attempts to highlight the specific part of a type annotation that contains the anonymous reference we want to give a name to. For example, we might produce an annotation like this:

 | fn a(items: &[T]) -> Box> {
 |                - let's call the lifetime of this reference `'1`

the way this works is that we match up argument_ty, which is a Ty<'tcx> (the internal form of the type) with argument_hir_ty, a hir::Ty (the syntax of the type annotation). We are descending through the types stepwise, looking in to find the region needle_fr in the internal type. Once we find that, we can use the span of the hir::Ty to add the highlight.

This is a somewhat imperfect process, so along the way we also keep track of the closest type we've found. If we fail to find the exact & or '_ to highlight, then we may fall back to highlighting that closest type instead.

fn match_adt_and_segment<'hir>(
    &self,
    substs: SubstsRef<'tcx>,
    needle_fr: RegionVid,
    last_segment: &'hir PathSegment,
    renctx: &mut RegionErrorNamingCtx,
    search_stack: &mut Vec<(Ty<'tcx>, &'hir Ty)>
) -> Option<RegionName>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

We've found an enum/struct/union type with the substitutions substs and -- in the HIR -- a path type with the final segment last_segment. Try to find a '_ to highlight in the generic args (or, if not, to produce new zipped pairs of types+hir to search through).

fn try_match_adt_and_generic_args<'hir>(
    &self,
    substs: SubstsRef<'tcx>,
    needle_fr: RegionVid,
    args: &'hir GenericArgs,
    search_stack: &mut Vec<(Ty<'tcx>, &'hir Ty)>
) -> Option<&'hir Lifetime>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

We've found an enum/struct/union type with the substitutions substs and -- in the HIR -- a path with the generic arguments args. If needle_fr appears in the args, return the hir::Lifetime that corresponds to it. If not, push onto search_stack the types+hir to search through.

fn give_name_if_anonymous_region_appears_in_upvars(
    &self,
    tcx: TyCtxt<'tcx>,
    upvars: &[Upvar],
    fr: RegionVid,
    renctx: &mut RegionErrorNamingCtx
) -> Option<RegionName>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Finds a closure upvar that contains fr and label it with a fully elaborated type, returning something like '1. Result looks like:

 | let x = Some(&22);
       - fully elaborated type of `x` is `Option<&'1 u32>`

fn give_name_if_anonymous_region_appears_in_output(
    &self,
    infcx: &InferCtxt<'_, 'tcx>,
    body: &Body<'tcx>,
    mir_def_id: DefId,
    fr: RegionVid,
    renctx: &mut RegionErrorNamingCtx
) -> Option<RegionName>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Checks for arguments appearing in the (closure) return type. It must be a closure since, in a free fn, such an argument would have to either also appear in an argument (if using elision) or be early bound (named, not in argument).

fn give_name_if_anonymous_region_appears_in_yield_ty(
    &self,
    infcx: &InferCtxt<'_, 'tcx>,
    body: &Body<'tcx>,
    mir_def_id: DefId,
    fr: RegionVid,
    renctx: &mut RegionErrorNamingCtx
) -> Option<RegionName>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn synthesize_region_name(&self, renctx: &mut RegionErrorNamingCtx) -> Symbol[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Creates a synthetic region named '1, incrementing the counter.

impl<'tcx> RegionInferenceContext<'tcx>[src]

pub(crate) fn get_var_name_and_span_for_region(
    &self,
    tcx: TyCtxt<'tcx>,
    body: &Body<'tcx>,
    upvars: &[Upvar],
    fr: RegionVid
) -> Option<(Option<Symbol>, Span)>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub(crate) fn get_upvar_index_for_region(
    &self,
    tcx: TyCtxt<'tcx>,
    fr: RegionVid
) -> Option<usize>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Search the upvars (if any) to find one that references fr. Return its index.

pub(crate) fn get_upvar_name_and_span_for_region(
    &self,
    tcx: TyCtxt<'tcx>,
    upvars: &[Upvar],
    upvar_index: usize
) -> (Symbol, Span)
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Given the index of an upvar, finds its name and the span from where it was declared.

pub(crate) fn get_argument_index_for_region(
    &self,
    tcx: TyCtxt<'tcx>,
    fr: RegionVid
) -> Option<usize>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Search the argument types for one that references fr (which should be a free region). Returns Some(_) with the index of the input if one is found.

N.B., in the case of a closure, the index is indexing into the signature as seen by the user - in particular, index 0 is not the implicit self parameter.

pub(crate) fn get_argument_name_and_span_for_region(
    &self,
    body: &Body<'tcx>,
    argument_index: usize
) -> (Option<Symbol>, Span)
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Given the index of an argument, finds its name (if any) and the span from where it was declared.

impl<'tcx> RegionInferenceContext<'tcx>[src]

fn best_blame_constraint(
    &self,
    body: &Body<'tcx>,
    from_region: RegionVid,
    from_region_origin: NLLRegionVariableOrigin,
    target_test: impl Fn(RegionVid) -> bool
) -> (ConstraintCategory, bool, Span)
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Tries to find the best constraint to blame for the fact that R: from_region, where R is some region that meets target_test. This works by following the constraint graph, creating a constraint path that forces R to outlive from_region, and then finding the best choices within that path to blame.

fn find_constraint_paths_between_regions(
    &self,
    from_region: RegionVid,
    target_test: impl Fn(RegionVid) -> bool
) -> Option<(Vec<OutlivesConstraint>, RegionVid)>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Walks the graph of constraints (where 'a: 'b is considered an edge 'a -> 'b) to find all paths from from_region to to_region. The paths are accumulated into the vector results. The paths are stored as a series of ConstraintIndex values -- in other words, a list of edges.

Returns: a series of constraints as well as the region R that passed the target test.

pub(super) fn report_error<'a>(
    &'a self,
    body: &Body<'tcx>,
    upvars: &[Upvar],
    infcx: &'a InferCtxt<'a, 'tcx>,
    mir_def_id: DefId,
    fr: RegionVid,
    fr_origin: NLLRegionVariableOrigin,
    outlived_fr: RegionVid,
    outlives_suggestion: &mut OutlivesSuggestionBuilder,
    renctx: &mut RegionErrorNamingCtx
) -> DiagnosticBuilder<'a>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Report an error because the universal region fr was required to outlive outlived_fr but it is not known to do so. For example:

fn foo<'a, 'b>(x: &'a u32) -> &'b u32 { x }

Here we would be invoked with fr = 'a and outlived_fr = 'b`.

fn provides_universal_region(
    &self,
    r: RegionVid,
    fr1: RegionVid,
    fr2: RegionVid
) -> bool
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

We have a constraint fr1: fr2 that is not satisfied, where fr2 represents some universal region. Here, r is some region where we know that fr1: r and this function has the job of determining whether r is "to blame" for the fact that fr1: fr2 is required.

This is true under two conditions:

  • r == fr2
  • fr2 is 'static and r is some placeholder in a universe that cannot be named by fr1; in that case, we will require that fr1: 'static because it is the only way to fr1: r to be satisfied. (See add_incompatible_universe.)

fn report_fnmut_error(
    &self,
    errctx: &ErrorReportingCtx<'_, '_, 'tcx>,
    errci: &ErrorConstraintInfo,
    renctx: &mut RegionErrorNamingCtx
) -> DiagnosticBuilder
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Report a specialized error when FnMut closures return a reference to a captured variable. This function expects fr to be local and outlived_fr to not be local.

error: captured variable cannot escape `FnMut` closure body
  --> $DIR/issue-53040.rs:15:8
   |
LL |     || &mut v;
   |     -- ^^^^^^ creates a reference to a captured variable which escapes the closure body
   |     |
   |     inferred to be a `FnMut` closure
   |
   = note: `FnMut` closures only have access to their captured variables while they are
           executing...
   = note: ...therefore, returned references to captured variables will escape the closure

fn report_escaping_data_error(
    &self,
    errctx: &ErrorReportingCtx<'_, '_, 'tcx>,
    errci: &ErrorConstraintInfo,
    renctx: &mut RegionErrorNamingCtx
) -> DiagnosticBuilder
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Reports a error specifically for when data is escaping a closure.

error: borrowed data escapes outside of function
  --> $DIR/lifetime-bound-will-change-warning.rs:44:5
   |
LL | fn test2<'a>(x: &'a Box<Fn()+'a>) {
   |              - `x` is a reference that is only valid in the function body
LL |     // but ref_obj will not, so warn.
LL |     ref_obj(x)
   |     ^^^^^^^^^^ `x` escapes the function body here

fn report_general_error(
    &self,
    errctx: &ErrorReportingCtx<'_, '_, 'tcx>,
    errci: &ErrorConstraintInfo,
    renctx: &mut RegionErrorNamingCtx
) -> DiagnosticBuilder
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Reports a region inference error for the general case with named/synthesized lifetimes to explain what is happening.

error: unsatisfied lifetime constraints
  --> $DIR/regions-creating-enums3.rs:17:5
   |
LL | fn mk_add_bad1<'a,'b>(x: &'a ast<'a>, y: &'b ast<'b>) -> ast<'a> {
   |                -- -- lifetime `'b` defined here
   |                |
   |                lifetime `'a` defined here
LL |     ast::add(x, y)
   |     ^^^^^^^^^^^^^^ function was supposed to return data with lifetime `'a` but it
   |                    is returning data with lifetime `'b`

fn add_static_impl_trait_suggestion(
    &self,
    infcx: &InferCtxt<'_, 'tcx>,
    diag: &mut DiagnosticBuilder,
    fr: RegionVid,
    fr_name: RegionName,
    outlived_fr: RegionVid
)
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Adds a suggestion to errors where a impl Trait is returned.

help: to allow this `impl Trait` to capture borrowed data with lifetime `'1`, add `'_` as
      a constraint
   |
LL |     fn iter_values_anon(&self) -> impl Iterator<Item=u32> + 'a {
   |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

pub(crate) fn free_region_constraint_info(
    &self,
    body: &Body<'tcx>,
    upvars: &[Upvar],
    mir_def_id: DefId,
    infcx: &InferCtxt<'_, 'tcx>,
    borrow_region: RegionVid,
    outlived_region: RegionVid
) -> (ConstraintCategory, bool, Span, Option<RegionName>)
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub(crate) fn find_sub_region_live_at(
    &self,
    fr1: RegionVid,
    elem: Location
) -> RegionVid
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub(crate) fn find_outlives_blame_span(
    &self,
    body: &Body<'tcx>,
    fr1: RegionVid,
    fr1_origin: NLLRegionVariableOrigin,
    fr2: RegionVid
) -> (ConstraintCategory, Span)
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn retrieve_closure_constraint_info(
    &self,
    body: &Body<'tcx>,
    constraint: &OutlivesConstraint
) -> (ConstraintCategory, bool, Span)
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

pub(crate) fn is_closure_fn_mut(
    &self,
    infcx: &InferCtxt<'_, 'tcx>,
    fr: RegionVid
) -> bool
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Returns true if a closure is inferred to be an FnMut closure.

fn cannot_name_placeholder(&self, r1: RegionVid, r2: RegionVid) -> bool[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

If r2 represents a placeholder region, then this returns true if r1 cannot name that placeholder in its value; otherwise, returns false.

impl<'tcx> RegionInferenceContext<'tcx>[src]

pub(crate) fn dump_graphviz_raw_constraints(
    &self,
    w: &mut dyn Write
) -> Result<()>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Write out the region constraint graph.

pub(crate) fn dump_graphviz_scc_constraints(
    &self,
    w: &mut dyn Write
) -> Result<()>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Write out the region constraint graph.

impl<'tcx> RegionInferenceContext<'tcx>[src]

pub(crate) fn new(
    var_infos: VarInfos,
    universal_regions: Rc<UniversalRegions<'tcx>>,
    placeholder_indices: Rc<PlaceholderIndices>,
    universal_region_relations: Rc<UniversalRegionRelations<'tcx>>,
    _body: &Body<'tcx>,
    outlives_constraints: OutlivesConstraintSet,
    member_constraints_in: MemberConstraintSet<'tcx, RegionVid>,
    closure_bounds_mapping: FxHashMap<Location, FxHashMap<(RegionVid, RegionVid), (ConstraintCategory, Span)>>,
    type_tests: Vec<TypeTest<'tcx>>,
    liveness_constraints: LivenessValues<RegionVid>,
    elements: &Rc<RegionValueElements>
) -> Self
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Creates a new region inference context with a total of num_region_variables valid inference variables; the first N of those will be constant regions representing the free regions defined in universal_regions.

The outlives_constraints and type_tests are an initial set of constraints produced by the MIR type check.

fn compute_scc_universes(
    constraints_scc: &Sccs<RegionVid, ConstraintSccIndex>,
    definitions: &IndexVec<RegionVid, RegionDefinition<'tcx>>
) -> IndexVec<ConstraintSccIndex, UniverseIndex>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Each SCC is the combination of many region variables which have been equated. Therefore, we can associate a universe with each SCC which is minimum of all the universes of its constituent regions -- this is because whatever value the SCC takes on must be a value that each of the regions within the SCC could have as well. This implies that the SCC must have the minimum, or narrowest, universe.

fn compute_scc_representatives(
    constraints_scc: &Sccs<RegionVid, ConstraintSccIndex>,
    definitions: &IndexVec<RegionVid, RegionDefinition<'tcx>>
) -> IndexVec<ConstraintSccIndex, RegionVid>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

For each SCC, we compute a unique RegionVid (in fact, the minimal one that belongs to the SCC). See scc_representatives field of RegionInferenceContext for more details.

fn init_free_and_bound_regions(&mut self)[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Initializes the region variables for each universally quantified region (lifetime parameter). The first N variables always correspond to the regions appearing in the function signature (both named and anonymous) and where-clauses. This function iterates over those regions and initializes them with minimum values.

For example:

fn foo<'a, 'b>(..) where 'a: 'b

would initialize two variables like so:

R0 = { CFG, R0 } // 'a
R1 = { CFG, R0, R1 } // 'b

Here, R0 represents 'a, and it contains (a) the entire CFG and (b) any universally quantified regions that it outlives, which in this case is just itself. R1 ('b) in contrast also outlives 'a and hence contains R0 and R1.

pub fn regions(&self) -> impl Iterator<Item = RegionVid>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Returns an iterator over all the region indices.

pub fn to_region_vid(&self, r: Region<'tcx>) -> RegionVid[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Given a universal region in scope on the MIR, returns the corresponding index.

(Panics if r is not a registered universal region.)

pub(crate) fn annotate(&self, tcx: TyCtxt<'tcx>, err: &mut DiagnosticBuilder)[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Adds annotations for #[rustc_regions]; see UniversalRegions::annotate.

pub(crate) fn region_contains(
    &self,
    r: impl ToRegionVid,
    p: impl ToElementIndex
) -> bool
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Returns true if the region r contains the point p.

Panics if called before solve() executes,

pub(crate) fn region_value_str(&self, r: RegionVid) -> String[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Returns access to the value of r for debugging purposes.

pub(crate) fn region_universe(&self, r: RegionVid) -> UniverseIndex[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Returns access to the value of r for debugging purposes.

fn applied_member_constraints(
    &self,
    r: impl ToRegionVid
) -> &[AppliedMemberConstraint]
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Once region solving has completed, this function will return the member constraints that were applied to the value of a given region r. See AppliedMemberConstraint.

pub(super) fn solve(
    &mut self,
    infcx: &InferCtxt<'_, 'tcx>,
    body: &Body<'tcx>,
    upvars: &[Upvar],
    mir_def_id: DefId,
    errors_buffer: &mut Vec<Diagnostic>
) -> Option<ClosureRegionRequirements<'tcx>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Performs region inference and report errors if we see any unsatisfiable constraints. If this is a closure, returns the region requirements to propagate to our creator, if any.

fn propagate_constraints(&mut self, _body: &Body<'tcx>)[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Propagate the region constraints: this will grow the values for each region variable until all the constraints are satisfied. Note that some values may grow too large to be feasible, but we check this later.

fn propagate_constraint_sccs_if_new(
    &mut self,
    scc_a: ConstraintSccIndex,
    visited: &mut BitSet<ConstraintSccIndex>
)
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Computes the value of the SCC scc_a if it has not already been computed. The visited parameter is a bitset

fn propagate_constraint_sccs_new(
    &mut self,
    scc_a: ConstraintSccIndex,
    visited: &mut BitSet<ConstraintSccIndex>
)
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Computes the value of the SCC scc_a, which has not yet been computed. This works by first computing all successors of the SCC (if they haven't been computed already) and then unioning together their elements.

fn apply_member_constraint(
    &mut self,
    scc: ConstraintSccIndex,
    member_constraint_index: NllMemberConstraintIndex,
    choice_regions: &[RegionVid]
) -> bool
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Invoked for each R0 member of [R1..Rn] constraint.

scc is the SCC containing R0, and choice_regions are the R1..Rn regions -- they are always known to be universal regions (and if that's not true, we just don't attempt to enforce the constraint).

The current value of scc at the time the method is invoked is considered a lower bound. If possible, we will modify the constraint to set it equal to one of the option regions. If we make any changes, returns true, else false.

fn upper_bounds<'a>(
    &'a mut self,
    scc0: ConstraintSccIndex,
    rev_constraint_graph: &'a VecGraph<ConstraintSccIndex>
) -> impl Iterator<Item = RegionVid> + 'a
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Compute and return the reverse SCC-based constraint graph (lazilly).

fn rev_constraint_graph(&mut self) -> Rc<VecGraph<ConstraintSccIndex>>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Compute and return the reverse SCC-based constraint graph (lazilly).

fn universe_compatible(
    &self,
    scc_b: ConstraintSccIndex,
    scc_a: ConstraintSccIndex
) -> bool
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Returns true if all the elements in the value of scc_b are nameable in scc_a. Used during constraint propagation, and only once the value of scc_b has been computed.

fn add_incompatible_universe(&mut self, scc: ConstraintSccIndex)[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Extend scc so that it can outlive some placeholder region from a universe it can't name; at present, the only way for this to be true is if scc outlives 'static. This is actually stricter than necessary: ideally, we'd support bounds like for<'a: 'b>that might then allow us to approximate'awith'band not'static`. But it will have to do for now.

fn check_type_tests(
    &self,
    infcx: &InferCtxt<'_, 'tcx>,
    body: &Body<'tcx>,
    mir_def_id: DefId,
    propagated_outlives_requirements: Option<&mut Vec<ClosureOutlivesRequirement<'tcx>>>,
    errors_buffer: &mut Vec<Diagnostic>
)
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Once regions have been propagated, this method is used to see whether the "type tests" produced by typeck were satisfied; type tests encode type-outlives relationships like T: 'a. See TypeTest for more details.

pub fn to_error_region(&self, r: RegionVid) -> Option<Region<'tcx>>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Converts a region inference variable into a ty::Region that we can use for error reporting. If r is universally bound, then we use the name that we have on record for it. If r is existentially bound, then we check its inferred value and try to find a good name from that. Returns None if we can't find one (e.g., this is just some random part of the CFG).

pub fn to_error_region_vid(&self, r: RegionVid) -> Option<RegionVid>[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Returns the RegionVid corresponding to the region returned by to_error_region.

fn try_promote_type_test(
    &self,
    infcx: &InferCtxt<'_, 'tcx>,
    body: &Body<'tcx>,
    type_test: &TypeTest<'tcx>,
    propagated_outlives_requirements: &mut Vec<ClosureOutlivesRequirement<'tcx>>
) -> bool
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Invoked when we have some type-test (e.g., T: 'X) that we cannot prove to be satisfied. If this is a closure, we will attempt to "promote" this type-test into our ClosureRegionRequirements and hence pass it up the creator. To do this, we have to phrase the type-test in terms of external free regions, as local free regions are not nameable by the closure's creator.

Promotion works as follows: we first check that the type T contains only regions that the creator knows about. If this is true, then -- as a consequence -- we know that all regions in the type T are free regions that outlive the closure body. If false, then promotion fails.

Once we've promoted T, we have to "promote" 'X to some region that is "external" to the closure. Generally speaking, a region may be the union of some points in the closure body as well as various free lifetimes. We can ignore the points in the closure body: if the type T can be expressed in terms of external regions, we know it outlives the points in the closure body. That just leaves the free regions.

The idea then is to lower the T: 'X constraint into multiple bounds -- e.g., if 'X is the union of two free lifetimes, '1 and '2, then we would create T: '1 and T: '2.

fn try_promote_type_test_subject(
    &self,
    infcx: &InferCtxt<'_, 'tcx>,
    ty: Ty<'tcx>
) -> Option<ClosureOutlivesSubject<'tcx>>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

When we promote a type test T: 'r, we have to convert the type T into something we can store in a query result (so something allocated for 'tcx). This is problematic if ty contains regions. During the course of NLL region checking, we will have replaced all of those regions with fresh inference variables. To create a test subject, we want to replace those inference variables with some region from the closure signature -- this is not always possible, so this is a fallible process. Presuming we do find a suitable region, we will represent it with a ReClosureBound, which is a RegionKind variant that can be allocated in the gcx.

fn non_local_universal_upper_bound(&self, r: RegionVid) -> RegionVid[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Given some universal or existential region r, finds a non-local, universal region r+ that outlives r at entry to (and exit from) the closure. In the worst case, this will be 'static.

This is used for two purposes. First, if we are propagated some requirement T: r, we can use this method to enlarge r to something we can encode for our creator (which only knows about non-local, universal regions). It is also used when encoding T as part of try_promote_type_test_subject (see that fn for details).

This is based on the result 'y of universal_upper_bound, except that it converts further takes the non-local upper bound of 'y, so that the final result is non-local.

fn universal_upper_bound(&self, r: RegionVid) -> RegionVid[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Returns a universally quantified region that outlives the value of r (r may be existentially or universally quantified).

Since r is (potentially) an existential region, it has some value which may include (a) any number of points in the CFG and (b) any number of end('x) elements of universally quantified regions. To convert this into a single universal region we do as follows:

  • Ignore the CFG points in 'r. All universally quantified regions include the CFG anyhow.
  • For each end('x) element in 'r, compute the mutual LUB, yielding a result 'y.

fn eval_verify_bound(
    &self,
    tcx: TyCtxt<'tcx>,
    body: &Body<'tcx>,
    generic_ty: Ty<'tcx>,
    lower_bound: RegionVid,
    verify_bound: &VerifyBound<'tcx>
) -> bool
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Tests if test is true when applied to lower_bound at point.

fn eval_if_eq(
    &self,
    tcx: TyCtxt<'tcx>,
    body: &Body<'tcx>,
    generic_ty: Ty<'tcx>,
    lower_bound: RegionVid,
    test_ty: Ty<'tcx>,
    verify_bound: &VerifyBound<'tcx>
) -> bool
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn normalize_to_scc_representatives<T>(&self, tcx: TyCtxt<'tcx>, value: T) -> T where
    T: TypeFoldable<'tcx>, 
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

This is a conservative normalization procedure. It takes every free region in value and replaces it with the "representative" of its SCC (see scc_representatives field). We are guaranteed that if two values normalize to the same thing, then they are equal; this is a conservative check in that they could still be equal even if they normalize to different results. (For example, there might be two regions with the same value that are not in the same SCC).

N.B., this is not an ideal approach and I would like to revisit it. However, it works pretty well in practice. In particular, this is needed to deal with projection outlives bounds like

<T as Foo<'0>>::Item: '1

In particular, this routine winds up being important when there are bounds like where <T as Foo<'a>>::Item: 'b in the environment. In this case, if we can show that '0 == 'a, and that 'b: '1, then we know that the clause is satisfied. In such cases, particularly due to limitations of the trait solver =), we usually wind up with a where-clause like T: Foo<'a> in scope, which thus forces '0 == 'a to be added as a constraint, and thus ensures that they are in the same SCC.

So why can't we do a more correct routine? Well, we could almost use the relate_tys code, but the way it is currently setup it creates inference variables to deal with higher-ranked things and so forth, and right now the inference context is not permitted to make more inference variables. So we use this kind of hacky solution.

fn eval_equal(&self, r1: RegionVid, r2: RegionVid) -> bool[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn eval_outlives(&self, sup_region: RegionVid, sub_region: RegionVid) -> bool[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn check_universal_regions(
    &self,
    infcx: &InferCtxt<'_, 'tcx>,
    body: &Body<'tcx>,
    upvars: &[Upvar],
    mir_def_id: DefId,
    propagated_outlives_requirements: Option<&mut Vec<ClosureOutlivesRequirement<'tcx>>>,
    errors_buffer: &mut Vec<Diagnostic>,
    region_naming: &mut RegionErrorNamingCtx
)
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Once regions have been propagated, this method is used to see whether any of the constraints were too strong. In particular, we want to check for a case where a universally quantified region exceeded its bounds. Consider:

fn foo<'a, 'b>(x: &'a u32) -> &'b u32 { x }

In this case, returning x requires &'a u32 <: &'b u32 and hence we establish (transitively) a constraint that 'a: 'b. The propagate_constraints code above will therefore add end('a) into the region for 'b -- but we have no evidence that 'b outlives 'a, so we want to report an error.

If propagated_outlives_requirements is Some, then we will push unsatisfied obligations into there. Otherwise, we'll report them as errors.

fn check_universal_region(
    &self,
    infcx: &InferCtxt<'_, 'tcx>,
    body: &Body<'tcx>,
    upvars: &[Upvar],
    mir_def_id: DefId,
    longer_fr: RegionVid,
    propagated_outlives_requirements: &mut Option<&mut Vec<ClosureOutlivesRequirement<'tcx>>>,
    outlives_suggestion: &mut OutlivesSuggestionBuilder,
    errors_buffer: &mut Vec<Diagnostic>,
    region_naming: &mut RegionErrorNamingCtx
)
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Checks the final value for the free region fr to see if it grew too large. In particular, examine what end(X) points wound up in fr's final value; for each end(X) where X != fr, we want to check that fr: X. If not, that's either an error, or something we have to propagate to our creator.

Things that are to be propagated are accumulated into the outlives_requirements vector.

fn check_universal_region_relation(
    &self,
    longer_fr: RegionVid,
    shorter_fr: RegionVid,
    infcx: &InferCtxt<'_, 'tcx>,
    body: &Body<'tcx>,
    upvars: &[Upvar],
    mir_def_id: DefId,
    propagated_outlives_requirements: &mut Option<&mut Vec<ClosureOutlivesRequirement<'tcx>>>,
    outlives_suggestion: &mut OutlivesSuggestionBuilder,
    errors_buffer: &mut Vec<Diagnostic>,
    region_naming: &mut RegionErrorNamingCtx
) -> Option<ErrorReported>
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn check_bound_universal_region(
    &self,
    infcx: &InferCtxt<'_, 'tcx>,
    body: &Body<'tcx>,
    _mir_def_id: DefId,
    longer_fr: RegionVid,
    placeholder: PlaceholderRegion
)
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

fn check_member_constraints(
    &self,
    infcx: &InferCtxt<'_, 'tcx>,
    mir_def_id: DefId,
    errors_buffer: &mut Vec<Diagnostic>
)
[src]

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

Auto Trait Implementations

impl<'tcx> !Send for RegionInferenceContext<'tcx>

impl<'tcx> !Sync for RegionInferenceContext<'tcx>

impl<'tcx> Unpin for RegionInferenceContext<'tcx>

impl<'tcx> !UnwindSafe for RegionInferenceContext<'tcx>

impl<'tcx> !RefUnwindSafe for RegionInferenceContext<'tcx>

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = !

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<E> SpecializationError for E[src]

impl<T> Erased for T[src]

impl<T> MaybeResult<T> for T[src]

type Error = !

⚙️ This is an internal compiler API. (rustc_private)

This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml.

impl<'a, T> Captures<'a> for T where
    T: ?Sized
[src]