Struct rustc_mir::borrow_check::diagnostics::outlives_suggestion::OutlivesSuggestionBuilder[−][src]

pub struct OutlivesSuggestionBuilder {
    constraints_to_add: BTreeMap<RegionVid, Vec<RegionVid>>,
}
Expand description

Collects information about outlives constraints that needed to be added for a given MIR node corresponding to a function definition.

Adds a help note suggesting adding a where clause with the needed constraints.

Fields

constraints_to_add: BTreeMap<RegionVid, Vec<RegionVid>>
Expand description

The list of outlives constraints that need to be added. Specifically, we map each free region to all other regions that it must outlive. I will use the shorthand fr: outlived_frs. Not all of these regions will already have names necessarily. Some could be implicit free regions that we inferred. These will need to be given names in the final suggestion message.

Implementations

impl OutlivesSuggestionBuilder[src]

fn region_name_is_suggestable(name: &RegionName) -> bool[src]

Returns true iff the RegionNameSource is a valid source for an outlives suggestion.

fn region_vid_to_name(
    &self,
    mbcx: &MirBorrowckCtxt<'_, '_>,
    region: RegionVid
) -> Option<RegionName>
[src]

Returns a name for the region if it is suggestable. See region_name_is_suggestable.

fn compile_all_suggestions(
    &self,
    mbcx: &MirBorrowckCtxt<'_, '_>
) -> SmallVec<[SuggestedConstraint; 2]>
[src]

Compiles a list of all suggestions to be printed in the final big suggestion.

pub(crate) fn collect_constraint(
    &mut self,
    fr: RegionVid,
    outlived_fr: RegionVid
)
[src]

Add the outlives constraint fr: outlived_fr to the set of constraints we need to suggest.

pub(crate) fn intermediate_suggestion(
    &mut self,
    mbcx: &MirBorrowckCtxt<'_, '_>,
    errci: &ErrorConstraintInfo,
    diag: &mut DiagnosticBuilder<'_>
)
[src]

Emit an intermediate note on the given Diagnostic if the involved regions are suggestable.

pub(crate) fn add_suggestion(&self, mbcx: &mut MirBorrowckCtxt<'_, '_>)[src]

If there is a suggestion to emit, add a diagnostic to the buffer. This is the final suggestion including all collected constraints.

Trait Implementations

impl Default for OutlivesSuggestionBuilder[src]

fn default() -> OutlivesSuggestionBuilder[src]

Returns the “default value” for a type. Read more

Auto Trait Implementations

impl RefUnwindSafe for OutlivesSuggestionBuilder

impl Send for OutlivesSuggestionBuilder

impl Sync for OutlivesSuggestionBuilder

impl Unpin for OutlivesSuggestionBuilder

impl UnwindSafe for OutlivesSuggestionBuilder

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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

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]

Performs the conversion.

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.

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

Performs the conversion.

impl<T> WithConstness for T[src]

fn with_constness(self, constness: Constness) -> ConstnessAnd<Self>[src]

fn with_const(self) -> ConstnessAnd<Self>[src]

fn without_const(self) -> ConstnessAnd<Self>[src]