struct LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
r: &'a mut Resolver<'ra, 'tcx>,
parent_scope: ParentScope<'ra>,
ribs: PerNS<Vec<Rib<'ra>>>,
last_block_rib: Option<Rib<'ra>>,
label_ribs: Vec<Rib<'ra, NodeId>>,
lifetime_ribs: Vec<LifetimeRib>,
lifetime_elision_candidates: Option<Vec<(LifetimeRes, LifetimeElisionCandidate)>>,
current_trait_ref: Option<(Module<'ra>, TraitRef)>,
diag_metadata: Box<DiagMetadata<'ast>>,
in_func_body: bool,
lifetime_uses: FxHashMap<LocalDefId, LifetimeUseSet>,
}
Fields§
§r: &'a mut Resolver<'ra, 'tcx>
§parent_scope: ParentScope<'ra>
The module that represents the current item scope.
ribs: PerNS<Vec<Rib<'ra>>>
The current set of local scopes for types and values.
last_block_rib: Option<Rib<'ra>>
Previous popped rib
, only used for diagnostic.
label_ribs: Vec<Rib<'ra, 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<'ra>, TraitRef)>
The trait that the current context can refer to.
diag_metadata: Box<DiagMetadata<'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<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx>
impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, '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>>,
) -> (Diag<'tcx>, 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>>, ) -> (Diag<'tcx>, 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_assoc_type_constraint_meant_as_path( &self, err: &mut Diag<'_>, base_error: &BaseError, )
fn suggest_self_or_self_ref( &mut self, err: &mut Diag<'_>, path: &[Segment], span: Span, )
fn try_lookup_name_relaxed( &mut self, err: &mut Diag<'_>, source: PathSource<'_>, path: &[Segment], following_seg: Option<&Segment>, span: Span, res: Option<Res<NodeId>>, base_error: &BaseError, ) -> (bool, FxHashSet<String>, Vec<ImportSuggestion>)
fn suggest_trait_and_bounds( &mut self, err: &mut Diag<'_>, source: PathSource<'_>, res: Option<Res<NodeId>>, span: Span, base_error: &BaseError, ) -> bool
fn suggest_typo( &mut self, err: &mut Diag<'_>, source: PathSource<'_>, path: &[Segment], following_seg: Option<&Segment>, span: Span, base_error: &BaseError, suggested_candidates: FxHashSet<String>, ) -> bool
fn suggest_shadowed( &mut self, err: &mut Diag<'_>, source: PathSource<'_>, path: &[Segment], following_seg: Option<&Segment>, span: Span, ) -> bool
fn err_code_special_cases( &mut self, err: &mut Diag<'_>, source: PathSource<'_>, path: &[Segment], span: Span, )
Sourcefn suggest_self_ty(
&mut self,
err: &mut Diag<'_>,
source: PathSource<'_>,
path: &[Segment],
span: Span,
) -> bool
fn suggest_self_ty( &mut self, err: &mut Diag<'_>, source: PathSource<'_>, path: &[Segment], span: Span, ) -> bool
Emit special messages for unresolved Self
and self
.
fn suggest_self_value( &mut self, err: &mut Diag<'_>, source: PathSource<'_>, path: &[Segment], span: Span, ) -> bool
fn suggest_at_operator_in_slice_pat_with_range( &mut self, err: &mut Diag<'_>, path: &[Segment], )
fn suggest_swapping_misplaced_self_ty_and_trait( &mut self, err: &mut Diag<'_>, source: PathSource<'_>, res: Option<Res<NodeId>>, span: Span, )
fn suggest_bare_struct_literal(&mut self, err: &mut Diag<'_>)
fn explain_functions_in_pattern( &mut self, err: &mut Diag<'_>, res: Option<Res<NodeId>>, source: PathSource<'_>, )
fn suggest_changing_type_to_const_param( &mut self, err: &mut Diag<'_>, res: Option<Res<NodeId>>, source: PathSource<'_>, span: Span, )
fn suggest_pattern_match_with_let( &mut self, err: &mut Diag<'_>, 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 Diag<'_>,
) -> bool
fn restrict_assoc_type_in_where_clause( &mut self, span: Span, err: &mut Diag<'_>, ) -> 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 Diag<'_>,
span: Span,
source: PathSource<'_>,
path: &[Segment],
res: Res<NodeId>,
path_str: &str,
fallback_label: &str,
) -> bool
fn smart_resolve_context_dependent_help( &mut self, err: &mut Diag<'_>, span: Span, source: PathSource<'_>, path: &[Segment], 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.
fn suggest_alternative_construction_methods( &mut self, def_id: DefId, err: &mut Diag<'_>, path_span: Span, call_span: Span, args: &[P<Expr>], )
fn has_private_fields(&self, def_id: DefId) -> bool
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>
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 Diag<'_>, ident_span: Span, ) -> bool
fn find_module( &mut self, def_id: DefId, ) -> Option<(Module<'ra>, ImportSuggestion)>
fn collect_enum_ctors( &mut self, def_id: DefId, ) -> Option<Vec<(Path, DefId, CtorKind)>>
Sourcefn suggest_using_enum_variant(
&mut self,
err: &mut Diag<'_>,
source: PathSource<'_>,
def_id: DefId,
span: Span,
)
fn suggest_using_enum_variant( &mut self, err: &mut Diag<'_>, 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 Diag<'_>, name: Option<&str>, suggest: impl Fn(&mut Diag<'_>, bool, Span, Cow<'static, str>, String, Vec<(Span, 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 Diag<'_>, lifetime_refs: Vec<MissingLifetime>, function_param_lifetimes: Option<(Vec<MissingLifetime>, Vec<ElisionFnParameter>)>, )
Source§impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx>
impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx>
fn new( resolver: &'a mut Resolver<'ra, 'tcx>, ) -> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx>
fn maybe_resolve_ident_in_lexical_scope( &mut self, ident: Ident, ns: Namespace, ) -> Option<LexicalScopeBinding<'ra>>
fn resolve_ident_in_lexical_scope( &mut self, ident: Ident, ns: Namespace, finalize: Option<Finalize>, ignore_binding: Option<Interned<'ra, NameBindingData<'ra>>>, ) -> Option<LexicalScopeBinding<'ra>>
fn resolve_path( &mut self, path: &[Segment], opt_ns: Option<Namespace>, finalize: Option<Finalize>, ) -> PathResult<'ra>
Sourcefn with_rib<T>(
&mut self,
ns: Namespace,
kind: RibKind<'ra>,
work: impl FnOnce(&mut Self) -> T,
) -> T
fn with_rib<T>( &mut self, ns: Namespace, kind: RibKind<'ra>, 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, id_for_lint: NodeId, elided: bool, )
fn resolve_elided_lifetime(&mut self, anchor_id: NodeId, span: Span)
fn create_fresh_lifetime( &mut self, ident: Ident, binder: NodeId, kind: MissingLifetimeKind, ) -> LifetimeRes
fn resolve_elided_lifetimes_in_path( &mut self, 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<'ra>>
fn resolve_label( &mut self, label: Ident, ) -> Result<(NodeId, Span), ResolutionError<'ra>>
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<'ra>,
lifetime_kind: LifetimeRibKind,
f: F,
)where
F: FnOnce(&mut Self),
fn with_label_rib(&mut self, kind: RibKind<'ra>, f: impl FnOnce(&mut Self))
fn with_static_rib(&mut self, def_kind: DefKind, 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, )
fn resolve_const_body( &mut self, expr: &'ast Expr, item: Option<(Ident, ConstantItemKind)>, )
fn resolve_delegation(&mut self, delegation: &'ast Delegation)
fn resolve_params(&mut self, params: &'ast [Param])
fn resolve_local(&mut self, local: &'ast Local)
Sourcefn compute_and_check_binding_map(
&mut self,
pat: &Pat,
) -> Result<FxIndexMap<Ident, BindingInfo>, IsNeverPattern>
fn compute_and_check_binding_map( &mut self, pat: &Pat, ) -> Result<FxIndexMap<Ident, BindingInfo>, IsNeverPattern>
Build a map from pattern identifiers to binding-info’s, and check the bindings are consistent when encountering or-patterns and never patterns. 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.
A never pattern by definition indicates an unreachable case. For example, matching on
Result<T, &!>
could look like:
let foo: Result<u32, &!> = Ok(0);
match foo {
Ok(x) => bar(x),
Err(&!),
}
This extends to product types: (x, !)
is likewise unreachable. So it doesn’t make sense to
have a binding here, and we tell the user to use _
instead.
fn is_base_res_local(&self, nid: NodeId) -> bool
Sourcefn compute_and_check_or_pat_binding_map(
&mut self,
pats: &[P<Pat>],
) -> Result<FxIndexMap<Ident, BindingInfo>, IsNeverPattern>
fn compute_and_check_or_pat_binding_map( &mut self, pats: &[P<Pat>], ) -> Result<FxIndexMap<Ident, BindingInfo>, IsNeverPattern>
Compute the binding map for an or-pattern. Checks that all of the arms in the or-pattern have exactly the same set of bindings, with the same binding modes for each. Returns the computed binding map and a boolean indicating whether the pattern is a never pattern.
A never pattern by definition indicates an unreachable case. For example, destructuring a
Result<T, &!>
could look like:
let (Ok(x) | Err(&!)) = foo();
Because the Err(&!)
branch is never reached, it does not need to have the same bindings as
the other branches of the or-pattern. So we must ignore never pattern when checking the
bindings of an or-pattern.
Moreover, if all the subpatterns are never patterns (e.g. Ok(!) | Err(!)
), then the
pattern as a whole counts as a never pattern (since it’s definitionallly unreachable).
Sourcefn check_consistent_bindings(&mut self, pat: &'ast Pat)
fn check_consistent_bindings(&mut self, pat: &'ast Pat)
Check the consistency of bindings wrt or-patterns and never 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: BindingMode, 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<'ra>)
fn report_error(&mut self, span: Span, resolution_error: ResolutionError<'ra>)
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 or
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<'ra>>>
Sourcefn resolve_qpath(
&mut self,
qself: &Option<P<QSelf>>,
path: &[Segment],
ns: Namespace,
finalize: Finalize,
) -> Result<Option<PartialRes>, Spanned<ResolutionError<'ra>>>
fn resolve_qpath( &mut self, qself: &Option<P<QSelf>>, path: &[Segment], ns: Namespace, finalize: Finalize, ) -> Result<Option<PartialRes>, Spanned<ResolutionError<'ra>>>
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 legacy_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>
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<'_>, )
fn lint_unused_qualifications( &mut self, path: &[Segment], ns: Namespace, finalize: Finalize, )
Trait Implementations§
Source§impl<'ra: 'ast, 'ast, 'tcx> Visitor<'ast> for LateResolutionVisitor<'_, 'ast, 'ra, 'tcx>
impl<'ra: 'ast, 'ast, 'tcx> Visitor<'ast> for LateResolutionVisitor<'_, 'ast, 'ra, '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_pat(&mut self, p: &'ast Pat)
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_precise_capturing_arg(&mut self, arg: &'ast PreciseCapturingArg)
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_item_constraint(&mut self, constraint: &'ast AssocItemConstraint)
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: &'ast Ident) -> Self::Result
fn visit_stmt(&mut self, s: &'ast Stmt) -> Self::Result
fn visit_param(&mut self, param: &'ast Param) -> Self::Result
Source§fn visit_method_receiver_expr(&mut self, ex: &'ast Expr) -> Self::Result
fn visit_method_receiver_expr(&mut self, ex: &'ast Expr) -> Self::Result
stmt_expr_attributes
.
It can be removed once that feature is stabilized.fn visit_generic_param(&mut self, param: &'ast GenericParam) -> Self::Result
fn visit_assoc_item( &mut self, i: &'ast Item<AssocItemKind>, ctxt: AssocCtxt, ) -> Self::Result
fn visit_trait_ref(&mut self, t: &'ast TraitRef) -> Self::Result
fn visit_param_bound( &mut self, bounds: &'ast GenericBound, _ctxt: BoundKind, ) -> Self::Result
fn visit_variant_data(&mut self, s: &'ast VariantData) -> Self::Result
fn visit_enum_def(&mut self, enum_definition: &'ast EnumDef) -> Self::Result
fn visit_label(&mut self, label: &'ast Label) -> Self::Result
fn visit_mac_call(&mut self, mac: &'ast MacCall) -> Self::Result
fn visit_mac_def(&mut self, _mac: &'ast MacroDef, _id: NodeId) -> Self::Result
fn visit_path(&mut self, path: &'ast Path, _id: NodeId) -> Self::Result
fn visit_use_tree( &mut self, use_tree: &'ast UseTree, id: NodeId, _nested: bool, ) -> Self::Result
fn visit_generic_args( &mut self, generic_args: &'ast GenericArgs, ) -> Self::Result
fn visit_vis(&mut self, vis: &'ast Visibility) -> Self::Result
fn visit_fn_ret_ty(&mut self, ret_ty: &'ast FnRetTy) -> Self::Result
fn visit_fn_header(&mut self, _header: &'ast FnHeader) -> Self::Result
fn visit_expr_field(&mut self, f: &'ast ExprField) -> Self::Result
fn visit_pat_field(&mut self, fp: &'ast PatField) -> Self::Result
fn visit_crate(&mut self, krate: &'ast Crate) -> Self::Result
fn visit_format_args(&mut self, fmt: &'ast FormatArgs) -> Self::Result
fn visit_capture_by(&mut self, _capture_by: &'ast CaptureBy) -> Self::Result
Auto Trait Implementations§
impl<'a, 'ast, 'ra, 'tcx> !DynSend for LateResolutionVisitor<'a, 'ast, 'ra, 'tcx>
impl<'a, 'ast, 'ra, 'tcx> !DynSync for LateResolutionVisitor<'a, 'ast, 'ra, 'tcx>
impl<'a, 'ast, 'ra, 'tcx> Freeze for LateResolutionVisitor<'a, 'ast, 'ra, 'tcx>
impl<'a, 'ast, 'ra, 'tcx> !RefUnwindSafe for LateResolutionVisitor<'a, 'ast, 'ra, 'tcx>
impl<'a, 'ast, 'ra, 'tcx> !Send for LateResolutionVisitor<'a, 'ast, 'ra, 'tcx>
impl<'a, 'ast, 'ra, 'tcx> !Sync for LateResolutionVisitor<'a, 'ast, 'ra, 'tcx>
impl<'a, 'ast, 'ra, 'tcx> Unpin for LateResolutionVisitor<'a, 'ast, 'ra, 'tcx>
impl<'a, 'ast, 'ra, 'tcx> !UnwindSafe for LateResolutionVisitor<'a, 'ast, 'ra, '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
§impl<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
Source§impl<T> Filterable for T
impl<T> Filterable for T
Source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<P> IntoQueryParam<P> for P
impl<P> IntoQueryParam<P> for P
fn into_query_param(self) -> P
Source§impl<T> MaybeResult<T> for T
impl<T> MaybeResult<T> for T
Source§impl<T> Pointable for T
impl<T> Pointable for T
§impl<I, T> UpcastFrom<I, T> for T
impl<I, T> UpcastFrom<I, T> for T
fn upcast_from(from: T, _tcx: I) -> T
§impl<Tcx, T> Value<Tcx> for Twhere
Tcx: DepContext,
impl<Tcx, T> Value<Tcx> for Twhere
Tcx: DepContext,
default fn from_cycle_error( tcx: Tcx, cycle_error: &CycleError, _guar: ErrorGuaranteed, ) -> T
Source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
Source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
Source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<'a, T> Captures<'a> for Twhere
T: ?Sized,
impl<T> ErasedDestructor for Twhere
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: 336 bytes