Struct rustc_infer::infer::error_reporting::nice_region_error::NiceRegionError[−][src]

pub struct NiceRegionError<'cx, 'tcx> {
    infcx: &'cx InferCtxt<'cx, 'tcx>,
    error: Option<RegionResolutionError<'tcx>>,
    regions: Option<(Span, Region<'tcx>, Region<'tcx>)>,
}

Fields

infcx: &'cx InferCtxt<'cx, 'tcx>error: Option<RegionResolutionError<'tcx>>regions: Option<(Span, Region<'tcx>, Region<'tcx>)>

Implementations

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.

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

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

Add notes with details about the expected and actual trait refs, with attention to cases when placeholder regions are involved: either the trait or the self type containing them needs to be mentioned the closest to the placeholders. This makes the error messages read better, however at the cost of some complexity due to the number of combinations we have to deal with.

Print the error message for lifetime errors when the return type is a static impl Trait, dyn Trait or if a method call on a trait object introduces a static requirement.

When we call a method coming from an impl Foo for dyn Bar, dyn Bar introduces a default 'static obligation. Suggest relaxing that implicit bound.

Print the error message for lifetime errors when the impl doesn’t conform to the trait.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Layout

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.

Size: 184 bytes