resolve: Remove Module from ScopeSet::Late
It can be passed in a more usual way through `ParentScope`
This commit is contained in:
@@ -107,7 +107,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
|
|||||||
};
|
};
|
||||||
let module = match scope_set {
|
let module = match scope_set {
|
||||||
// Start with the specified module.
|
// Start with the specified module.
|
||||||
ScopeSet::Late(_, module, _) | ScopeSet::ModuleAndExternPrelude(_, module) => module,
|
ScopeSet::ModuleAndExternPrelude(_, module) => module,
|
||||||
// Jump out of trait or enum modules, they do not act as scopes.
|
// Jump out of trait or enum modules, they do not act as scopes.
|
||||||
_ => parent_scope.module.nearest_item_scope(),
|
_ => parent_scope.module.nearest_item_scope(),
|
||||||
};
|
};
|
||||||
@@ -349,11 +349,12 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
|
|||||||
return Some(LexicalScopeBinding::Item(binding));
|
return Some(LexicalScopeBinding::Item(binding));
|
||||||
} else if let RibKind::Module(module) = rib.kind {
|
} else if let RibKind::Module(module) = rib.kind {
|
||||||
// Encountered a module item, abandon ribs and look into that module and preludes.
|
// Encountered a module item, abandon ribs and look into that module and preludes.
|
||||||
|
let parent_scope = &ParentScope { module, ..*parent_scope };
|
||||||
return self
|
return self
|
||||||
.cm()
|
.cm()
|
||||||
.resolve_ident_in_scope_set(
|
.resolve_ident_in_scope_set(
|
||||||
orig_ident,
|
orig_ident,
|
||||||
ScopeSet::Late(ns, module, finalize.map(|finalize| finalize.node_id)),
|
ScopeSet::Late(ns, finalize.map(|finalize| finalize.node_id)),
|
||||||
parent_scope,
|
parent_scope,
|
||||||
finalize,
|
finalize,
|
||||||
finalize.is_some(),
|
finalize.is_some(),
|
||||||
|
|||||||
@@ -38,8 +38,8 @@ use crate::late::{
|
|||||||
};
|
};
|
||||||
use crate::ty::fast_reject::SimplifiedType;
|
use crate::ty::fast_reject::SimplifiedType;
|
||||||
use crate::{
|
use crate::{
|
||||||
Module, ModuleKind, ModuleOrUniformRoot, PathResult, PathSource, Resolver, ScopeSet, Segment,
|
Module, ModuleKind, ModuleOrUniformRoot, ParentScope, PathResult, PathSource, Resolver,
|
||||||
errors, path_names_to_string,
|
ScopeSet, Segment, errors, path_names_to_string,
|
||||||
};
|
};
|
||||||
|
|
||||||
type Res = def::Res<ast::NodeId>;
|
type Res = def::Res<ast::NodeId>;
|
||||||
@@ -2460,10 +2460,11 @@ impl<'ast, 'ra, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
|
|||||||
self.r.add_module_candidates(module, &mut names, &filter_fn, Some(ctxt));
|
self.r.add_module_candidates(module, &mut names, &filter_fn, Some(ctxt));
|
||||||
} else if let RibKind::Module(module) = rib.kind {
|
} else if let RibKind::Module(module) = rib.kind {
|
||||||
// Encountered a module item, abandon ribs and look into that module and preludes.
|
// Encountered a module item, abandon ribs and look into that module and preludes.
|
||||||
|
let parent_scope = &ParentScope { module, ..self.parent_scope };
|
||||||
self.r.add_scope_set_candidates(
|
self.r.add_scope_set_candidates(
|
||||||
&mut names,
|
&mut names,
|
||||||
ScopeSet::Late(ns, module, None),
|
ScopeSet::Late(ns, None),
|
||||||
&self.parent_scope,
|
parent_scope,
|
||||||
ctxt,
|
ctxt,
|
||||||
filter_fn,
|
filter_fn,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ enum ScopeSet<'ra> {
|
|||||||
Macro(MacroKind),
|
Macro(MacroKind),
|
||||||
/// All scopes with the given namespace, used for partially performing late resolution.
|
/// All scopes with the given namespace, used for partially performing late resolution.
|
||||||
/// The node id enables lints and is used for reporting them.
|
/// The node id enables lints and is used for reporting them.
|
||||||
Late(Namespace, Module<'ra>, Option<NodeId>),
|
Late(Namespace, Option<NodeId>),
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Everything you need to know about a name's location to resolve it.
|
/// Everything you need to know about a name's location to resolve it.
|
||||||
|
|||||||
Reference in New Issue
Block a user