Struct rustc::infer::error_reporting::nice_region_error::NiceRegionError[][src]

pub struct NiceRegionError<'cx, 'gcx: 'tcx, 'tcx: 'cx> {
    tcx: TyCtxt<'cx, 'gcx, 'tcx>,
    error: Option<RegionResolutionError<'tcx>>,
    regions: Option<(Span, Region<'tcx>, Region<'tcx>)>,
    tables: Option<&'cx TypeckTables<'tcx>>,
}
🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

Fields

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

Methods

impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx>
[src]

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

Print the error message for lifetime errors when both the concerned regions are anonymous.

Consider a case where we have

fn foo(x: &mut Vec<&u8>, y: &u8) {
    x.push(y);
}

The example gives

fn foo(x: &mut Vec<&u8>, y: &u8) {
                   ---      --- these references are declared with different lifetimes...
    x.push(y);
    ^ ...but data from `y` flows into `x` here

It has been extended for the case of structs too.

Consider the example

struct Ref<'a> { x: &'a u32 }
fn foo(mut x: Vec<Ref>, y: Ref) {
                  ---      --- these structs are declared with different lifetimes...
    x.push(y);
    ^ ...but data from `y` flows into `x` here
}

It will later be extended to trait objects.

impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx>
[src]

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

This function calls the visit_ty method for the parameters corresponding to the anonymous regions. The nested_visitor.found_type contains the anonymous type.

Arguments

region - the anonymous region corresponding to the anon_anon conflict br - the bound region corresponding to the above region which is of type BrAnon(_)

Example

fn foo(x: &mut Vec<&u8>, y: &u8)
   { x.push(y); }

The function returns the nested type corresponding to the anonymous region for e.g. &u8 and Vec<&u8.

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx>
[src]

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

When given a ConcreteFailure for a function with arguments containing a named region and an anonymous region, emit an descriptive diagnostic error.

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx>
[src]

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

Print the error message for lifetime errors when binding excapes a closure.

Consider a case where we have

fn with_int<F>(f: F) where F: FnOnce(&isize) {
    let x = 3;
    f(&x);
}
fn main() {
    let mut x = None;
    with_int(|y| x = Some(y));
}

the output will be

    let mut x = None;
        ----- borrowed data cannot be stored into here...
    with_int(|y| x = Some(y));
             ---          ^ cannot be stored outside of its closure
             |
             ...because it cannot outlive this closure

impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx>
[src]

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

impl<'cx, 'gcx, 'tcx> NiceRegionError<'cx, 'gcx, 'tcx>
[src]

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

🔬 This is a nightly-only experimental API. (rustc_private)

this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?

Auto Trait Implementations

impl<'cx, 'gcx, 'tcx> !Send for NiceRegionError<'cx, 'gcx, 'tcx>

impl<'cx, 'gcx, 'tcx> !Sync for NiceRegionError<'cx, 'gcx, 'tcx>