Struct rustc_resolve::late::LateResolutionVisitor
source · struct LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
r: &'b mut Resolver<'a, 'tcx>,
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<(Module<'a>, TraitRef)>,
diagnostic_metadata: Box<DiagnosticMetadata<'ast>>,
in_func_body: bool,
lifetime_uses: FxHashMap<LocalDefId, LifetimeUseSet>,
}
Fields§
§r: &'b mut Resolver<'a, 'tcx>
§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.
last_block_rib: Option<Rib<'a>>
Previous popped 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<(Module<'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§
source§impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx>
impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx>
fn make_base_error( &mut self, path: &[Segment], span: Span, source: PathSource<'_>, res: Option<Res<NodeId>> ) -> BaseError
sourcepub(crate) fn smart_resolve_partial_mod_path_errors(
&mut self,
prefix_path: &[Segment],
following_seg: Option<&Segment>
) -> Vec<ImportSuggestion>
pub(crate) fn smart_resolve_partial_mod_path_errors( &mut self, prefix_path: &[Segment], following_seg: Option<&Segment> ) -> Vec<ImportSuggestion>
Try to suggest for a module path that cannot be resolved.
Such as fmt::Debug
where fmt
is not resolved without importing,
here we search with lookup_import_candidates
for a module named fmt
with TypeNS
as namespace.
We need a separate function here because we won’t suggest for a path with single segment
and we won’t change SourcePath
api is_expected
to match Type
with DefKind::Mod
sourcepub(crate) fn smart_resolve_report_errors(
&mut self,
path: &[Segment],
following_seg: Option<&Segment>,
span: Span,
source: PathSource<'_>,
res: Option<Res<NodeId>>
) -> (DiagnosticBuilder<'tcx, ErrorGuaranteed>, Vec<ImportSuggestion>)
pub(crate) fn smart_resolve_report_errors( &mut self, path: &[Segment], following_seg: Option<&Segment>, span: Span, source: PathSource<'_>, res: Option<Res<NodeId>> ) -> (DiagnosticBuilder<'tcx, ErrorGuaranteed>, Vec<ImportSuggestion>)
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.
fn detect_assoct_type_constraint_meant_as_path( &self, err: &mut Diagnostic, base_error: &BaseError )
fn suggest_self_or_self_ref( &mut self, err: &mut Diagnostic, path: &[Segment], span: Span )
fn try_lookup_name_relaxed( &mut self, err: &mut Diagnostic, source: PathSource<'_>, path: &[Segment], following_seg: Option<&Segment>, span: Span, res: Option<Res<NodeId>>, base_error: &BaseError ) -> (bool, Vec<ImportSuggestion>)
fn suggest_trait_and_bounds( &mut self, err: &mut Diagnostic, source: PathSource<'_>, res: Option<Res<NodeId>>, span: Span, base_error: &BaseError ) -> bool
fn suggest_typo( &mut self, err: &mut Diagnostic, source: PathSource<'_>, path: &[Segment], following_seg: Option<&Segment>, span: Span, base_error: &BaseError ) -> bool
fn err_code_special_cases( &mut self, err: &mut Diagnostic, source: PathSource<'_>, path: &[Segment], span: Span )
sourcefn suggest_self_ty(
&mut self,
err: &mut Diagnostic,
source: PathSource<'_>,
path: &[Segment],
span: Span
) -> bool
fn suggest_self_ty( &mut self, err: &mut Diagnostic, source: PathSource<'_>, path: &[Segment], span: Span ) -> bool
Emit special messages for unresolved Self
and self
.
fn suggest_self_value( &mut self, err: &mut Diagnostic, source: PathSource<'_>, path: &[Segment], span: Span ) -> bool
fn suggest_swapping_misplaced_self_ty_and_trait( &mut self, err: &mut Diagnostic, source: PathSource<'_>, res: Option<Res<NodeId>>, span: Span )
fn suggest_bare_struct_literal(&mut self, err: &mut Diagnostic)
fn suggest_pattern_match_with_let( &mut self, err: &mut Diagnostic, source: PathSource<'_>, span: Span ) -> bool
fn get_single_associated_item( &mut self, path: &[Segment], source: &PathSource<'_>, filter_fn: &impl Fn(Res<NodeId>) -> bool ) -> Option<TypoSuggestion>
sourcefn restrict_assoc_type_in_where_clause(
&mut self,
span: Span,
err: &mut Diagnostic
) -> bool
fn restrict_assoc_type_in_where_clause( &mut self, span: Span, err: &mut Diagnostic ) -> bool
Given where <T as Bar>::Baz: String
, suggest where T: Bar<Baz = String>
.
sourcefn call_has_self_arg(
&self,
source: PathSource<'_>
) -> Option<(Span, Option<Span>)>
fn call_has_self_arg( &self, source: PathSource<'_> ) -> Option<(Span, Option<Span>)>
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
).
fn followed_by_brace(&self, span: Span) -> (bool, Option<Span>)
sourcefn smart_resolve_context_dependent_help(
&mut self,
err: &mut Diagnostic,
span: Span,
source: PathSource<'_>,
res: Res<NodeId>,
path_str: &str,
fallback_label: &str
) -> bool
fn smart_resolve_context_dependent_help( &mut self, err: &mut Diagnostic, span: Span, source: PathSource<'_>, res: Res<NodeId>, path_str: &str, fallback_label: &str ) -> bool
Provides context-dependent help for errors reported by the smart_resolve_path_fragment
function.
Returns true
if able to provide context-dependent help.
sourcepub(crate) fn find_similarly_named_assoc_item(
&mut self,
ident: Symbol,
kind: &AssocItemKind
) -> Option<Symbol>
pub(crate) fn find_similarly_named_assoc_item( &mut self, ident: Symbol, kind: &AssocItemKind ) -> Option<Symbol>
Given the target ident
and kind
, search for the similarly named associated item
in self.current_trait_ref
.
fn lookup_assoc_candidate<FilterFn>( &mut self, ident: Ident, ns: Namespace, filter_fn: FilterFn, called: bool ) -> Option<AssocSuggestion>where FilterFn: Fn(Res<NodeId>) -> bool,
fn lookup_typo_candidate( &mut self, path: &[Segment], following_seg: Option<&Segment>, ns: Namespace, filter_fn: &impl Fn(Res<NodeId>) -> bool ) -> TypoCandidate
fn likely_rust_type(path: &[Segment]) -> Option<Symbol>
fn let_binding_suggestion( &mut self, err: &mut Diagnostic, ident_span: Span ) -> bool
fn find_module( &mut self, def_id: DefId ) -> Option<(Module<'a>, ImportSuggestion)>
fn collect_enum_ctors( &mut self, def_id: DefId ) -> Option<Vec<(Path, DefId, CtorKind)>>
sourcefn suggest_using_enum_variant(
&mut self,
err: &mut Diagnostic,
source: PathSource<'_>,
def_id: DefId,
span: Span
)
fn suggest_using_enum_variant( &mut self, err: &mut Diagnostic, source: PathSource<'_>, def_id: DefId, span: Span )
Adds a suggestion for using an enum’s variant when an enum is used instead.
pub(crate) fn suggest_adding_generic_parameter( &self, path: &[Segment], source: PathSource<'_> ) -> Option<(Span, &'static str, String, Applicability)>
sourcepub(crate) fn suggestion_for_label_in_rib(
&self,
rib_index: usize,
label: Ident
) -> Option<(Ident, bool)>
pub(crate) fn suggestion_for_label_in_rib( &self, rib_index: usize, label: Ident ) -> Option<(Ident, bool)>
Given the target label
, search the rib_index
th label rib for similarly named labels,
optionally returning the closest match and whether it is reachable.
pub(crate) fn maybe_report_lifetime_uses( &mut self, generics_span: Span, params: &[GenericParam] )
pub(crate) fn emit_undeclared_lifetime_error( &self, lifetime_ref: &Lifetime, outer_lifetime_ref: Option<Ident> )
fn suggest_introducing_lifetime( &self, err: &mut Diagnostic, name: Option<&str>, suggest: impl Fn(&mut Diagnostic, bool, Span, Cow<'static, str>, String) -> bool )
pub(crate) fn emit_non_static_lt_in_const_param_ty_error( &self, lifetime_ref: &Lifetime )
sourcepub(crate) fn emit_forbidden_non_static_lifetime_error(
&self,
cause: NoConstantGenericsReason,
lifetime_ref: &Lifetime
)
pub(crate) fn emit_forbidden_non_static_lifetime_error( &self, cause: NoConstantGenericsReason, lifetime_ref: &Lifetime )
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.
pub(crate) fn report_missing_lifetime_specifiers( &mut self, lifetime_refs: Vec<MissingLifetime>, function_param_lifetimes: Option<(Vec<MissingLifetime>, Vec<ElisionFnParameter>)> ) -> ErrorGuaranteed
fn add_missing_lifetime_specifiers_label( &mut self, err: &mut Diagnostic, lifetime_refs: Vec<MissingLifetime>, function_param_lifetimes: Option<(Vec<MissingLifetime>, Vec<ElisionFnParameter>)> )
source§impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx>
impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx>
fn new( resolver: &'b mut Resolver<'a, 'tcx> ) -> LateResolutionVisitor<'a, 'b, 'ast, 'tcx>
fn maybe_resolve_ident_in_lexical_scope( &mut self, ident: Ident, ns: Namespace ) -> Option<LexicalScopeBinding<'a>>
fn resolve_ident_in_lexical_scope( &mut self, ident: Ident, ns: Namespace, finalize: Option<Finalize>, ignore_binding: Option<Interned<'a, NameBindingData<'a>>> ) -> Option<LexicalScopeBinding<'a>>
fn resolve_path( &mut self, path: &[Segment], opt_ns: Option<Namespace>, finalize: Option<Finalize> ) -> PathResult<'a>
sourcefn with_rib<T>(
&mut self,
ns: Namespace,
kind: RibKind<'a>,
work: impl FnOnce(&mut Self) -> T
) -> T
fn with_rib<T>( &mut self, ns: Namespace, kind: RibKind<'a>, work: impl FnOnce(&mut Self) -> T ) -> T
Do some work
within a new innermost rib of the given kind
in the given namespace (ns
).
fn with_scope<T>(&mut self, id: NodeId, f: impl FnOnce(&mut Self) -> T) -> T
fn visit_generic_params( &mut self, params: &'ast [GenericParam], add_self_upper: bool )
fn with_lifetime_rib<T>( &mut self, kind: LifetimeRibKind, work: impl FnOnce(&mut Self) -> T ) -> T
fn resolve_lifetime(&mut self, lifetime: &'ast Lifetime, use_ctxt: LifetimeCtxt)
fn resolve_anonymous_lifetime(&mut self, lifetime: &Lifetime, elided: bool)
fn resolve_elided_lifetime(&mut self, anchor_id: NodeId, span: Span)
fn create_fresh_lifetime( &mut self, id: NodeId, ident: Ident, binder: NodeId ) -> LifetimeRes
fn resolve_elided_lifetimes_in_path( &mut self, path_id: NodeId, partial_res: PartialRes, path: &[Segment], source: PathSource<'_>, path_span: Span )
fn record_lifetime_res( &mut self, id: NodeId, res: LifetimeRes, candidate: LifetimeElisionCandidate )
fn record_lifetime_param(&mut self, id: NodeId, res: LifetimeRes)
sourcefn resolve_fn_signature(
&mut self,
fn_id: NodeId,
has_self: bool,
inputs: impl Iterator<Item = (Option<&'ast Pat>, &'ast Ty)> + Clone,
output_ty: &'ast FnRetTy
)
fn resolve_fn_signature( &mut self, fn_id: NodeId, has_self: bool, inputs: impl Iterator<Item = (Option<&'ast Pat>, &'ast Ty)> + Clone, output_ty: &'ast FnRetTy )
Perform resolution of a function signature, accounting for lifetime elision.
sourcefn resolve_fn_params(
&mut self,
has_self: bool,
inputs: impl Iterator<Item = (Option<&'ast Pat>, &'ast Ty)>
) -> Result<LifetimeRes, (Vec<MissingLifetime>, Vec<ElisionFnParameter>)>
fn resolve_fn_params( &mut self, has_self: bool, inputs: impl Iterator<Item = (Option<&'ast Pat>, &'ast Ty)> ) -> Result<LifetimeRes, (Vec<MissingLifetime>, Vec<ElisionFnParameter>)>
Resolve inside function parameters and parameter types. Returns the lifetime for elision in fn return type, or diagnostic information in case of elision failure.
sourcefn find_lifetime_for_self(&self, ty: &'ast Ty) -> Set1<LifetimeRes>
fn find_lifetime_for_self(&self, ty: &'ast Ty) -> Set1<LifetimeRes>
List all the lifetimes that appear in the provided type.
sourcefn resolve_label(
&mut self,
label: Ident
) -> Result<(NodeId, Span), ResolutionError<'a>>
fn resolve_label( &mut self, label: Ident ) -> Result<(NodeId, Span), ResolutionError<'a>>
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.
sourcefn is_label_valid_from_rib(&self, rib_index: usize) -> bool
fn is_label_valid_from_rib(&self, rib_index: usize) -> bool
Determine whether or not a label from the rib_index
th label rib is reachable.
fn resolve_adt(&mut self, item: &'ast Item, generics: &'ast Generics)
fn future_proof_import(&mut self, use_tree: &UseTree)
fn resolve_item(&mut self, item: &'ast Item)
fn with_generic_param_rib<'c, F>( &'c mut self, params: &'c [GenericParam], kind: RibKind<'a>, lifetime_kind: LifetimeRibKind, f: F )where F: FnOnce(&mut Self),
fn with_label_rib(&mut self, kind: RibKind<'a>, f: impl FnOnce(&mut Self))
fn with_static_rib(&mut self, f: impl FnOnce(&mut Self))
fn with_constant_rib( &mut self, is_repeat: IsRepeatExpr, may_use_generics: ConstantHasGenerics, item: Option<(Ident, ConstantItemKind)>, f: impl FnOnce(&mut Self) )
fn with_current_self_type<T>( &mut self, self_type: &Ty, f: impl FnOnce(&mut Self) -> T ) -> T
fn with_current_self_item<T>( &mut self, self_item: &Item, f: impl FnOnce(&mut Self) -> T ) -> T
sourcefn resolve_trait_items(&mut self, trait_items: &'ast [P<AssocItem>])
fn resolve_trait_items(&mut self, trait_items: &'ast [P<AssocItem>])
When evaluating a trait
use its associated types’ idents for suggestions in E0412.
sourcefn with_optional_trait_ref<T>(
&mut self,
opt_trait_ref: Option<&TraitRef>,
self_type: &'ast Ty,
f: impl FnOnce(&mut Self, Option<DefId>) -> T
) -> T
fn with_optional_trait_ref<T>( &mut self, opt_trait_ref: Option<&TraitRef>, self_type: &'ast Ty, f: impl FnOnce(&mut Self, Option<DefId>) -> T ) -> T
This is called to resolve a trait reference from an impl
(i.e., impl Trait for Foo
).
fn with_self_rib_ns( &mut self, ns: Namespace, self_res: Res<NodeId>, f: impl FnOnce(&mut Self) )
fn with_self_rib(&mut self, self_res: Res<NodeId>, f: impl FnOnce(&mut Self))
fn resolve_implementation( &mut self, attrs: &[Attribute], generics: &'ast Generics, opt_trait_reference: &'ast Option<TraitRef>, self_type: &'ast Ty, item_id: NodeId, impl_items: &'ast [P<AssocItem>] )
fn resolve_impl_item( &mut self, item: &'ast AssocItem, seen_trait_items: &mut FxHashMap<DefId, Span>, trait_id: Option<DefId> )
fn check_trait_item<F>( &mut self, id: NodeId, ident: Ident, kind: &AssocItemKind, ns: Namespace, span: Span, seen_trait_items: &mut FxHashMap<DefId, Span>, err: F )where F: FnOnce(Ident, String, Option<Symbol>) -> ResolutionError<'a>,
fn resolve_const_body( &mut self, expr: &'ast Expr, item: Option<(Ident, ConstantItemKind)> )
fn resolve_params(&mut self, params: &'ast [Param])
fn resolve_local(&mut self, local: &'ast Local)
sourcefn binding_mode_map(&mut self, pat: &Pat) -> FxIndexMap<Ident, BindingInfo>
fn binding_mode_map(&mut self, pat: &Pat) -> FxIndexMap<Ident, BindingInfo>
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.
fn is_base_res_local(&self, nid: NodeId) -> bool
sourcefn check_consistent_bindings(
&mut self,
pats: &[P<Pat>]
) -> Vec<FxIndexMap<Ident, BindingInfo>>
fn check_consistent_bindings( &mut self, pats: &[P<Pat>] ) -> Vec<FxIndexMap<Ident, BindingInfo>>
Checks that all of the arms in an or-pattern have exactly the same set of bindings, with the same binding modes for each.
sourcefn check_consistent_bindings_top(&mut self, pat: &'ast Pat)
fn check_consistent_bindings_top(&mut self, pat: &'ast Pat)
Check the consistency of the outermost or-patterns.
fn resolve_arm(&mut self, arm: &'ast Arm)
sourcefn resolve_pattern_top(&mut self, pat: &'ast Pat, pat_src: PatternSource)
fn resolve_pattern_top(&mut self, pat: &'ast Pat, pat_src: PatternSource)
Arising from source
, resolve a top level pattern.
fn resolve_pattern( &mut self, pat: &'ast Pat, pat_src: PatternSource, bindings: &mut SmallVec<[(PatBoundCtx, FxHashSet<Ident>); 1]> )
sourcefn resolve_pattern_inner(
&mut self,
pat: &Pat,
pat_src: PatternSource,
bindings: &mut SmallVec<[(PatBoundCtx, FxHashSet<Ident>); 1]>
)
fn resolve_pattern_inner( &mut self, pat: &Pat, pat_src: PatternSource, bindings: &mut SmallVec<[(PatBoundCtx, FxHashSet<Ident>); 1]> )
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.
fn fresh_binding( &mut self, ident: Ident, pat_id: NodeId, pat_src: PatternSource, bindings: &mut SmallVec<[(PatBoundCtx, FxHashSet<Ident>); 1]> ) -> Res<NodeId>
fn innermost_rib_bindings( &mut self, ns: Namespace ) -> &mut FxHashMap<Ident, Res<NodeId>>
fn try_resolve_as_non_binding( &mut self, pat_src: PatternSource, ann: BindingAnnotation, ident: Ident, has_sub: bool ) -> Option<Res<NodeId>>
fn smart_resolve_path( &mut self, id: NodeId, qself: &Option<P<QSelf>>, path: &Path, source: PathSource<'ast> )
fn smart_resolve_path_fragment( &mut self, qself: &Option<P<QSelf>>, path: &[Segment], source: PathSource<'ast>, finalize: Finalize, record_partial_res: RecordPartialRes ) -> PartialRes
fn self_type_is_available(&mut self) -> bool
fn self_value_is_available(&mut self, self_span: Span) -> bool
sourcefn report_error(&mut self, span: Span, resolution_error: ResolutionError<'a>)
fn report_error(&mut self, span: Span, resolution_error: ResolutionError<'a>)
A wrapper around Resolver::report_error
.
This doesn’t emit errors for function bodies if this is rustdoc.
sourcefn should_report_errs(&self) -> bool
fn should_report_errs(&self) -> bool
If we’re actually rustdoc then avoid giving a name resolution error for cfg()
items.
fn resolve_qpath_anywhere( &mut self, qself: &Option<P<QSelf>>, path: &[Segment], primary_ns: Namespace, span: Span, defer_to_typeck: bool, finalize: Finalize ) -> Result<Option<PartialRes>, Spanned<ResolutionError<'a>>>
sourcefn resolve_qpath(
&mut self,
qself: &Option<P<QSelf>>,
path: &[Segment],
ns: Namespace,
finalize: Finalize
) -> Result<Option<PartialRes>, Spanned<ResolutionError<'a>>>
fn resolve_qpath( &mut self, qself: &Option<P<QSelf>>, path: &[Segment], ns: Namespace, finalize: Finalize ) -> Result<Option<PartialRes>, Spanned<ResolutionError<'a>>>
Handles paths that may refer to associated items.
fn with_resolved_label( &mut self, label: Option<Label>, id: NodeId, f: impl FnOnce(&mut Self) )
fn resolve_labeled_block( &mut self, label: Option<Label>, id: NodeId, block: &'ast Block )
fn resolve_block(&mut self, block: &'ast Block)
fn resolve_anon_const( &mut self, constant: &'ast AnonConst, anon_const_kind: AnonConstKind )
sourcefn resolve_anon_const_manual(
&mut self,
is_trivial_const_arg: bool,
anon_const_kind: AnonConstKind,
resolve_expr: impl FnOnce(&mut Self)
)
fn resolve_anon_const_manual( &mut self, is_trivial_const_arg: bool, anon_const_kind: AnonConstKind, resolve_expr: impl FnOnce(&mut Self) )
There are a few places that we need to resolve an anon const but we did not parse an
anon const so cannot provide an &'ast AnonConst
. Right now this is just unbraced
const arguments that were parsed as type arguments, and legact_const_generics
which
parse as normal function argument expressions. To avoid duplicating the code for resolving
an anon const we have this function which lets the caller manually call resolve_expr
or
smart_resolve_path
.
fn resolve_expr_field(&mut self, f: &'ast ExprField, e: &'ast Expr)
fn resolve_expr(&mut self, expr: &'ast Expr, parent: Option<&'ast Expr>)
fn record_candidate_traits_for_expr_if_necessary(&mut self, expr: &'ast Expr)
fn traits_in_scope( &mut self, ident: Ident, ns: Namespace ) -> Vec<TraitCandidate>
sourcefn record_lifetime_params_for_impl_trait(&mut self, impl_trait_node_id: NodeId)
fn record_lifetime_params_for_impl_trait(&mut self, impl_trait_node_id: NodeId)
Construct the list of in-scope lifetime parameters for impl trait lowering. We include all lifetime parameters, either named or “Fresh”. The order of those parameters does not matter, as long as it is deterministic.
fn resolve_and_cache_rustdoc_path( &mut self, path_str: &str, ns: Namespace ) -> Option<Res<NodeId>>
fn resolve_doc_links( &mut self, attrs: &[Attribute], maybe_exported: MaybeExported<'_> )
Trait Implementations§
source§impl<'a: 'ast, 'ast, 'tcx> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast, 'tcx>
impl<'a: 'ast, 'ast, 'tcx> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast, 'tcx>
Walks the whole crate in DFS order, visiting each item, resolving names as it goes.
fn visit_attribute(&mut self, _: &'ast Attribute)
fn visit_item(&mut self, item: &'ast Item)
fn visit_arm(&mut self, arm: &'ast Arm)
fn visit_block(&mut self, block: &'ast Block)
fn visit_anon_const(&mut self, _constant: &'ast AnonConst)
fn visit_expr(&mut self, expr: &'ast Expr)
fn visit_local(&mut self, local: &'ast Local)
fn visit_ty(&mut self, ty: &'ast Ty)
fn visit_poly_trait_ref(&mut self, tref: &'ast PolyTraitRef)
fn visit_foreign_item(&mut self, foreign_item: &'ast ForeignItem)
fn visit_fn(&mut self, fn_kind: FnKind<'ast>, sp: Span, fn_id: NodeId)
fn visit_lifetime(&mut self, lifetime: &'ast Lifetime, use_ctxt: LifetimeCtxt)
fn visit_generics(&mut self, generics: &'ast Generics)
fn visit_closure_binder(&mut self, b: &'ast ClosureBinder)
fn visit_generic_arg(&mut self, arg: &'ast GenericArg)
fn visit_assoc_constraint(&mut self, constraint: &'ast AssocConstraint)
fn visit_path_segment(&mut self, path_segment: &'ast PathSegment)
fn visit_where_predicate(&mut self, p: &'ast WherePredicate)
fn visit_inline_asm(&mut self, asm: &'ast InlineAsm)
fn visit_inline_asm_sym(&mut self, sym: &'ast InlineAsmSym)
fn visit_variant(&mut self, v: &'ast Variant)
fn visit_variant_discr(&mut self, discr: &'ast AnonConst)
fn visit_field_def(&mut self, f: &'ast FieldDef)
fn visit_ident(&mut self, _ident: Ident)
fn visit_stmt(&mut self, s: &'ast Stmt)
fn visit_param(&mut self, param: &'ast Param)
fn visit_pat(&mut self, p: &'ast Pat)
source§fn visit_method_receiver_expr(&mut self, ex: &'ast Expr)
fn visit_method_receiver_expr(&mut self, ex: &'ast Expr)
stmt_expr_attributes
.
It can be removed once that feature is stabilized.fn visit_expr_post(&mut self, _ex: &'ast Expr)
fn visit_generic_param(&mut self, param: &'ast GenericParam)
fn visit_assoc_item(&mut self, i: &'ast Item<AssocItemKind>, ctxt: AssocCtxt)
fn visit_trait_ref(&mut self, t: &'ast TraitRef)
fn visit_param_bound(&mut self, bounds: &'ast GenericBound, _ctxt: BoundKind)
fn visit_variant_data(&mut self, s: &'ast VariantData)
fn visit_enum_def(&mut self, enum_definition: &'ast EnumDef)
fn visit_label(&mut self, label: &'ast Label)
fn visit_mac_call(&mut self, mac: &'ast MacCall)
fn visit_mac_def(&mut self, _mac: &'ast MacroDef, _id: NodeId)
fn visit_path(&mut self, path: &'ast Path, _id: NodeId)
fn visit_use_tree(&mut self, use_tree: &'ast UseTree, id: NodeId, _nested: bool)
fn visit_generic_args(&mut self, generic_args: &'ast GenericArgs)
fn visit_vis(&mut self, vis: &'ast Visibility)
fn visit_fn_ret_ty(&mut self, ret_ty: &'ast FnRetTy)
fn visit_fn_header(&mut self, _header: &'ast FnHeader)
fn visit_expr_field(&mut self, f: &'ast ExprField)
fn visit_pat_field(&mut self, fp: &'ast PatField)
fn visit_crate(&mut self, krate: &'ast Crate)
fn visit_format_args(&mut self, fmt: &'ast FormatArgs)
Auto Trait Implementations§
impl<'a, 'b, 'ast, 'tcx> !RefUnwindSafe for LateResolutionVisitor<'a, 'b, 'ast, 'tcx>
impl<'a, 'b, 'ast, 'tcx> !Send for LateResolutionVisitor<'a, 'b, 'ast, 'tcx>
impl<'a, 'b, 'ast, 'tcx> !Sync for LateResolutionVisitor<'a, 'b, 'ast, 'tcx>
impl<'a, 'b, 'ast, 'tcx> Unpin for LateResolutionVisitor<'a, 'b, 'ast, 'tcx>
impl<'a, 'b, 'ast, 'tcx> !UnwindSafe for LateResolutionVisitor<'a, 'b, 'ast, 'tcx>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
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