struct LateResolutionVisitor<'a, 'b, 'ast> {
    r: &'b mut Resolver<'a>,
    parent_scope: ParentScope<'a>,
    ribs: PerNS<Vec<Rib<'a>>>,
    last_block_rib: Option<Rib<'a>>,
    label_ribs: Vec<Rib<'a, NodeId>>,
    lifetime_ribs: Vec<LifetimeRib>,
    lifetime_elision_candidates: Option<Vec<(LifetimeRes, LifetimeElisionCandidate)>>,
    current_trait_ref: Option<(&'a ModuleData<'a>, TraitRef)>,
    diagnostic_metadata: Box<DiagnosticMetadata<'ast>>,
    in_func_body: bool,
    lifetime_uses: FxHashMap<LocalDefId, LifetimeUseSet>,
}

Fields§

§r: &'b mut Resolver<'a>§parent_scope: ParentScope<'a>

The module that represents the current item scope.

§ribs: PerNS<Vec<Rib<'a>>>

The current set of local scopes for types and values. FIXME #4948: Reuse ribs to avoid allocation.

§last_block_rib: Option<Rib<'a>>

Previous poped rib, only used for diagnostic.

§label_ribs: Vec<Rib<'a, NodeId>>

The current set of local scopes, for labels.

§lifetime_ribs: Vec<LifetimeRib>

The current set of local scopes for lifetimes.

§lifetime_elision_candidates: Option<Vec<(LifetimeRes, LifetimeElisionCandidate)>>

We are looking for lifetimes in an elision context. The set contains all the resolutions that we encountered so far. They will be used to determine the correct lifetime for the fn return type. The LifetimeElisionCandidate is used for diagnostics, to suggest introducing named lifetimes.

§current_trait_ref: Option<(&'a ModuleData<'a>, TraitRef)>

The trait that the current context can refer to.

§diagnostic_metadata: Box<DiagnosticMetadata<'ast>>

Fields used to add information to diagnostic errors.

§in_func_body: bool

State used to know whether to ignore resolution errors for function bodies.

In particular, rustdoc uses this to avoid giving errors for cfg() items. In most cases this will be None, in which case errors will always be reported. If it is true, then it will be updated when entering a nested function or trait body.

§lifetime_uses: FxHashMap<LocalDefId, LifetimeUseSet>

Count the number of places a lifetime is used.

Implementations§

Handles error reporting for smart_resolve_path_fragment function. Creates base error and amends it with one short label and possibly some longer helps/notes.

Emit special messages for unresolved Self and self.

Given where <T as Bar>::Baz: String, suggest where T: Bar<Baz = String>.

Check if the source is call expression and the first argument is self. If true, return the span of whole call and the span for all arguments expect the first one (self).

Provides context-dependent help for errors reported by the smart_resolve_path_fragment function. Returns true if able to provide context-dependent help.

Given the target ident and kind, search for the similarly named associated item in self.current_trait_ref.

Only used in a specific case of type ascription suggestions

Adds a suggestion for using an enum’s variant when an enum is used instead.

Given the target label, search the rib_indexth label rib for similarly named labels, optionally returning the closest match and whether it is reachable.

Non-static lifetimes are prohibited in anonymous constants under min_const_generics. This function will emit an error if generic_const_exprs is not enabled, the body identified by body_id is an anonymous constant and lifetime_ref is non-static.

Do some work within a new innermost rib of the given kind in the given namespace (ns).

Perform resolution of a function signature, accounting for lifetime elision.

Resolve inside function parameters and parameter types. Returns the lifetime for elision in fn return type, or diagnostic information in case of elision failure.

List all the lifetimes that appear in the provided type.

Searches the current set of local scopes for labels. Returns the NodeId of the resolved label and reports an error if the label is not found or is unreachable.

Determine whether or not a label from the rib_indexth label rib is reachable.

When evaluating a trait use its associated types’ idents for suggestions in E0412.

This is called to resolve a trait reference from an impl (i.e., impl Trait for Foo).

build a map from pattern identifiers to binding-info’s. this is done hygienically. This could arise for a macro that expands into an or-pattern where one ‘x’ was from the user and one ‘x’ came from the macro.

Checks that all of the arms in an or-pattern have exactly the same set of bindings, with the same binding modes for each.

Check the consistency of the outermost or-patterns.

Arising from source, resolve a top level pattern.

Resolve bindings in a pattern. This is a helper to resolve_pattern.

bindings

A stack of sets of bindings accumulated.

In each set, PatBoundCtx::Product denotes that a found binding in it should be interpreted as re-binding an already bound binding. This results in an error. Meanwhile, PatBound::Or denotes that a found binding in the set should result in reusing this binding rather than creating a fresh one.

When called at the top level, the stack must have a single element with PatBound::Product. Otherwise, pushing to the stack happens as or-patterns (p_0 | ... | p_n) are encountered and the context needs to be switched to PatBoundCtx::Or and then PatBoundCtx::Product for each p_i. When each p_i has been dealt with, the top set is merged with its parent. When a whole or-pattern has been dealt with, the thing happens.

See the implementation and fresh_binding for more details.

A wrapper around Resolver::report_error.

This doesn’t emit errors for function bodies if this is rustdoc.

If we’re actually rustdoc then avoid giving a name resolution error for cfg() items.

Handles paths that may refer to associated items.

Construct the list of in-scope lifetime parameters for async lowering. We include all lifetime parameters, either named or “Fresh”. The order of those parameters does not matter, as long as it is deterministic.

Trait Implementations§

Walks the whole crate in DFS order, visiting each item, resolving names as it goes.

This method is a hack to workaround unstable of stmt_expr_attributes. It can be removed once that feature is stabilized. Read more
source§

fn visit_expr_post(&mut self, _ex: &'ast Expr)

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

Returns the argument unchanged.

Calls U::from(self).

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

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