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

Fields§

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

Implementations§

source§

impl<'a, 'tcx> NiceRegionError<'a, 'tcx>

source

pub(super) fn try_report_anon_anon_conflict(&self) -> Option<ErrorGuaranteed>

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.

source§

impl<'a, 'tcx> NiceRegionError<'a, 'tcx>

source§

impl<'a, 'tcx> NiceRegionError<'a, 'tcx>

source

pub(super) fn try_report_named_anon_conflict(&self) -> Option<Diag<'tcx>>

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

source§

impl<'tcx> NiceRegionError<'_, 'tcx>

source

pub(super) fn try_report_placeholder_conflict(&self) -> Option<Diag<'tcx>>

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

source

fn try_report_trait_placeholder_mismatch( &self, vid: Option<Region<'tcx>>, cause: &ObligationCause<'tcx>, sub_placeholder: Option<Region<'tcx>>, sup_placeholder: Option<Region<'tcx>>, value_pairs: &ValuePairs<'tcx> ) -> Option<Diag<'tcx>>

source

fn report_trait_placeholder_mismatch( &self, vid: Option<Region<'tcx>>, cause: &ObligationCause<'tcx>, sub_placeholder: Option<Region<'tcx>>, sup_placeholder: Option<Region<'tcx>>, trait_def_id: DefId, expected_args: GenericArgsRef<'tcx>, actual_args: GenericArgsRef<'tcx> ) -> Diag<'tcx>

source

fn explain_actual_impl_that_was_found( &self, sub_placeholder: Option<Region<'tcx>>, sup_placeholder: Option<Region<'tcx>>, has_sub: Option<usize>, has_sup: Option<usize>, expected_trait_ref: TraitRef<'tcx>, actual_trait_ref: TraitRef<'tcx>, vid: Option<Region<'tcx>>, expected_has_vid: Option<usize>, actual_has_vid: Option<usize>, any_self_ty_has_vid: bool, leading_ellipsis: bool ) -> Vec<ActualImplExplNotes<'tcx>>

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.

source§

impl<'tcx> NiceRegionError<'_, 'tcx>

source

pub(super) fn try_report_placeholder_relation(&self) -> Option<Diag<'tcx>>

Emitted wwhen given a ConcreteFailure when relating two placeholders.

source§

impl<'a, 'tcx> NiceRegionError<'a, 'tcx>

source

pub(super) fn try_report_static_impl_trait(&self) -> Option<ErrorGuaranteed>

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.

source§

impl<'a, 'tcx> NiceRegionError<'a, 'tcx>

source

pub fn get_impl_ident_and_self_ty_from_trait( tcx: TyCtxt<'tcx>, def_id: DefId, trait_objects: &FxIndexSet<DefId> ) -> Option<(Ident, &'tcx Ty<'tcx>)>

source

fn find_impl_on_dyn_trait( &self, err: &mut Diag<'_>, ty: Ty<'_>, ctxt: &UnifyReceiverContext<'tcx> ) -> bool

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.

source

fn suggest_constrain_dyn_trait_in_impl( &self, err: &mut Diag<'_>, found_dids: &FxIndexSet<DefId>, ident: Ident, self_ty: &Ty<'_> ) -> bool

source§

impl<'a, 'tcx> NiceRegionError<'a, 'tcx>

source

pub(super) fn try_report_impl_not_conforming_to_trait( &self ) -> Option<ErrorGuaranteed>

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

source

fn emit_err( &self, sp: Span, expected: Ty<'tcx>, found: Ty<'tcx>, trait_def_id: DefId ) -> ErrorGuaranteed

source§

impl<'a, 'tcx> NiceRegionError<'a, 'tcx>

source

pub(super) fn find_param_with_region( &self, anon_region: Region<'tcx>, replace_region: Region<'tcx> ) -> Option<AnonymousParamInfo<'tcx>>

source

pub(super) fn is_return_type_anon( &self, scope_def_id: LocalDefId, br: BoundRegionKind, hir_sig: &FnSig<'_> ) -> Option<Span>

source

fn includes_region( &self, ty: Binder<'tcx, impl TypeFoldable<TyCtxt<'tcx>>>, region: BoundRegionKind ) -> bool

source

pub(super) fn is_self_anon( &self, is_first: bool, scope_def_id: LocalDefId ) -> bool

source§

impl<'cx, 'tcx> NiceRegionError<'cx, 'tcx>

source

pub fn new( cx: &'cx TypeErrCtxt<'cx, 'tcx>, error: RegionResolutionError<'tcx> ) -> Self

source

pub fn new_from_span( cx: &'cx TypeErrCtxt<'cx, 'tcx>, span: Span, sub: Region<'tcx>, sup: Region<'tcx> ) -> Self

source

fn tcx(&self) -> TyCtxt<'tcx>

source

pub fn try_report_from_nll(&self) -> Option<Diag<'tcx>>

source

pub fn try_report(&self) -> Option<ErrorGuaranteed>

source

pub(super) fn regions(&self) -> Option<(Span, Region<'tcx>, Region<'tcx>)>

Auto Trait Implementations§

§

impl<'cx, 'tcx> !DynSend for NiceRegionError<'cx, 'tcx>

§

impl<'cx, 'tcx> !DynSync for NiceRegionError<'cx, 'tcx>

§

impl<'cx, 'tcx> Freeze for NiceRegionError<'cx, 'tcx>

§

impl<'cx, 'tcx> !RefUnwindSafe for NiceRegionError<'cx, 'tcx>

§

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

§

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

§

impl<'cx, 'tcx> Unpin for NiceRegionError<'cx, 'tcx>

§

impl<'cx, 'tcx> !UnwindSafe for NiceRegionError<'cx, 'tcx>

Blanket Implementations§

source§

impl<T> Aligned for T

source§

const ALIGN: Alignment = _

Alignment of Self.
source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T, R> CollectAndApply<T, R> for T

source§

fn collect_and_apply<I, F>(iter: I, f: F) -> R
where I: Iterator<Item = T>, F: FnOnce(&[T]) -> R,

Equivalent to f(&iter.collect::<Vec<_>>()).

§

type Output = R

source§

impl<T> Filterable for T

source§

fn filterable( self, filter_name: &'static str ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>

Creates a filterable data provider with the given name for debugging. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<P> IntoQueryParam<P> for P

source§

impl<T> MaybeResult<T> for T

§

type Error = !

source§

fn from(_: Result<T, <T as MaybeResult<T>>::Error>) -> T

source§

fn to_result(self) -> Result<T, <T as MaybeResult<T>>::Error>

source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<'tcx, T> ToPredicate<'tcx, T> for T

source§

fn to_predicate(self, _tcx: TyCtxt<'tcx>) -> T

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<Tcx, T> Value<Tcx> for T
where Tcx: DepContext,

source§

default fn from_cycle_error( tcx: Tcx, cycle_error: &CycleError, _guar: ErrorGuaranteed ) -> T

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

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

source§

impl<T> ErasedDestructor for T
where T: 'static,

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: 168 bytes