[−][src]Struct rustc_infer::infer::error_reporting::nice_region_error::NiceRegionError
Fields
infcx: &'cx InferCtxt<'cx, 'tcx>error: Option<RegionResolutionError<'tcx>>regions: Option<(Span, Region<'tcx>, Region<'tcx>)>Implementations
impl<'a, 'tcx> NiceRegionError<'a, 'tcx>[src]
pub(in infer::error_reporting::nice_region_error) fn try_report_anon_anon_conflict(
&self
) -> Option<ErrorReported>[src]
&self
) -> Option<ErrorReported>
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, 'tcx> NiceRegionError<'a, 'tcx>[src]
pub(in infer::error_reporting::nice_region_error) fn find_anon_type(
&self,
region: Region<'tcx>,
br: &BoundRegion
) -> Option<(&Ty<'tcx>, &FnDecl<'tcx>)>[src]
&self,
region: Region<'tcx>,
br: &BoundRegion
) -> Option<(&Ty<'tcx>, &FnDecl<'tcx>)>
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.
pub(in infer::error_reporting::nice_region_error::find_anon_type) fn find_component_for_bound_region(
&self,
arg: &'tcx Ty<'tcx>,
br: &BoundRegion
) -> Option<&'tcx Ty<'tcx>>[src]
&self,
arg: &'tcx Ty<'tcx>,
br: &BoundRegion
) -> Option<&'tcx Ty<'tcx>>
impl<'a, 'tcx> NiceRegionError<'a, 'tcx>[src]
pub(in infer::error_reporting::nice_region_error) fn try_report_named_anon_conflict(
&self
) -> Option<DiagnosticBuilder<'a>>[src]
&self
) -> Option<DiagnosticBuilder<'a>>
When given a ConcreteFailure for a function with parameters containing a named region and
an anonymous region, emit an descriptive diagnostic error.
impl<'me, 'tcx> NiceRegionError<'me, 'tcx>[src]
pub(in infer::error_reporting::nice_region_error) fn try_report_placeholder_conflict(
&self
) -> Option<DiagnosticBuilder<'me>>[src]
&self
) -> Option<DiagnosticBuilder<'me>>
When given a ConcreteFailure for a function with arguments containing a named region and
an anonymous region, emit a descriptive diagnostic error.
pub(in infer::error_reporting::nice_region_error::placeholder_error) fn try_report_placeholders_trait(
&self,
vid: Option<Region<'tcx>>,
cause: &ObligationCause<'tcx>,
sub_placeholder: Option<Region<'tcx>>,
sup_placeholder: Option<Region<'tcx>>,
trait_def_id: DefId,
expected_substs: SubstsRef<'tcx>,
actual_substs: SubstsRef<'tcx>
) -> DiagnosticBuilder<'me>[src]
&self,
vid: Option<Region<'tcx>>,
cause: &ObligationCause<'tcx>,
sub_placeholder: Option<Region<'tcx>>,
sup_placeholder: Option<Region<'tcx>>,
trait_def_id: DefId,
expected_substs: SubstsRef<'tcx>,
actual_substs: SubstsRef<'tcx>
) -> DiagnosticBuilder<'me>
pub(in infer::error_reporting::nice_region_error::placeholder_error) fn explain_actual_impl_that_was_found(
&self,
err: &mut DiagnosticBuilder<'_>,
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
)[src]
&self,
err: &mut DiagnosticBuilder<'_>,
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
)
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.
impl<'a, 'tcx> NiceRegionError<'a, 'tcx>[src]
pub(in infer::error_reporting::nice_region_error) fn try_report_static_impl_trait(
&self
) -> Option<ErrorReported>[src]
&self
) -> Option<ErrorReported>
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.
pub(in infer::error_reporting::nice_region_error::static_impl_trait) fn get_impl_ident_and_self_ty_from_trait(
&self,
def_id: DefId,
trait_objects: &[DefId]
) -> Option<(Ident, &'tcx Ty<'tcx>)>[src]
&self,
def_id: DefId,
trait_objects: &[DefId]
) -> Option<(Ident, &'tcx Ty<'tcx>)>
pub(in infer::error_reporting::nice_region_error::static_impl_trait) fn find_impl_on_dyn_trait(
&self,
err: &mut DiagnosticBuilder<'_>,
ty: Ty<'_>,
ctxt: &UnifyReceiverContext<'tcx>
) -> bool[src]
&self,
err: &mut DiagnosticBuilder<'_>,
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.
pub(in infer::error_reporting::nice_region_error::static_impl_trait) fn suggest_constrain_dyn_trait_in_impl(
&self,
err: &mut DiagnosticBuilder<'_>,
found_dids: &[DefId],
ident: Ident,
self_ty: &Ty<'_>
) -> bool[src]
&self,
err: &mut DiagnosticBuilder<'_>,
found_dids: &[DefId],
ident: Ident,
self_ty: &Ty<'_>
) -> bool
impl<'a, 'tcx> NiceRegionError<'a, 'tcx>[src]
pub(in infer::error_reporting::nice_region_error) fn try_report_impl_not_conforming_to_trait(
&self
) -> Option<ErrorReported>[src]
&self
) -> Option<ErrorReported>
Print the error message for lifetime errors when the impl doesn't conform to the trait.
pub(in infer::error_reporting::nice_region_error::trait_impl_difference) fn emit_err(
&self,
sp: Span,
expected: Ty<'tcx>,
found: Ty<'tcx>,
trait_def_id: DefId
)[src]
&self,
sp: Span,
expected: Ty<'tcx>,
found: Ty<'tcx>,
trait_def_id: DefId
)
impl<'a, 'tcx> NiceRegionError<'a, 'tcx>[src]
pub(in infer::error_reporting::nice_region_error) fn find_param_with_region(
&self,
anon_region: Region<'tcx>,
replace_region: Region<'tcx>
) -> Option<AnonymousParamInfo<'_>>[src]
&self,
anon_region: Region<'tcx>,
replace_region: Region<'tcx>
) -> Option<AnonymousParamInfo<'_>>
pub(in infer::error_reporting::nice_region_error) fn future_return_type(
&self,
local_def_id: LocalDefId
) -> Option<&Ty<'_>>[src]
&self,
local_def_id: LocalDefId
) -> Option<&Ty<'_>>
pub(in infer::error_reporting::nice_region_error) fn asyncness(
&self,
local_def_id: LocalDefId
) -> Option<IsAsync>[src]
&self,
local_def_id: LocalDefId
) -> Option<IsAsync>
pub(in infer::error_reporting::nice_region_error) fn is_return_type_anon(
&self,
scope_def_id: LocalDefId,
br: BoundRegion,
decl: &FnDecl<'_>
) -> Option<Span>[src]
&self,
scope_def_id: LocalDefId,
br: BoundRegion,
decl: &FnDecl<'_>
) -> Option<Span>
pub(in infer::error_reporting::nice_region_error) fn is_self_anon(
&self,
is_first: bool,
scope_def_id: LocalDefId
) -> bool[src]
&self,
is_first: bool,
scope_def_id: LocalDefId
) -> bool
impl<'cx, 'tcx> NiceRegionError<'cx, 'tcx>[src]
pub fn new(
infcx: &'cx InferCtxt<'cx, 'tcx>,
error: RegionResolutionError<'tcx>
) -> Self[src]
infcx: &'cx InferCtxt<'cx, 'tcx>,
error: RegionResolutionError<'tcx>
) -> Self
pub fn new_from_span(
infcx: &'cx InferCtxt<'cx, 'tcx>,
span: Span,
sub: Region<'tcx>,
sup: Region<'tcx>
) -> Self[src]
infcx: &'cx InferCtxt<'cx, 'tcx>,
span: Span,
sub: Region<'tcx>,
sup: Region<'tcx>
) -> Self
pub(in infer::error_reporting::nice_region_error) fn tcx(
&self
) -> TyCtxt<'tcx>[src]
&self
) -> TyCtxt<'tcx>
pub fn try_report_from_nll(&self) -> Option<DiagnosticBuilder<'cx>>[src]
pub fn try_report(&self) -> Option<ErrorReported>[src]
pub fn regions(&self) -> Option<(Span, Region<'tcx>, Region<'tcx>)>[src]
Auto Trait Implementations
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> where
'tcx: 'cx,
'tcx: 'cx,
impl<'cx, 'tcx> !UnwindSafe for NiceRegionError<'cx, 'tcx>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<'a, T> Captures<'a> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.