Skip to content

Commit 726a0a6

Browse files
committed
resolve: Inline resolve_ident_in_virt_module_unadjusted into resolve_ident_in_module
1 parent 65f0757 commit 726a0a6

1 file changed

Lines changed: 13 additions & 43 deletions

File tree

compiler/rustc_resolve/src/ident.rs

Lines changed: 13 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -912,55 +912,24 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
912912
ignore_decl: Option<Decl<'ra>>,
913913
ignore_import: Option<Import<'ra>>,
914914
) -> Result<Decl<'ra>, Determinacy> {
915-
let tmp_parent_scope;
916-
let mut adjusted_parent_scope = parent_scope;
917915
match module {
918-
ModuleOrUniformRoot::Module(m) => {
919-
if let Some(def) = ident.span.normalize_to_macros_2_0_and_adjust(m.expansion) {
916+
ModuleOrUniformRoot::Module(module) => {
917+
let tmp_parent_scope;
918+
let mut adjusted_parent_scope = parent_scope;
919+
if let Some(def) = ident.span.normalize_to_macros_2_0_and_adjust(module.expansion) {
920920
tmp_parent_scope =
921921
ParentScope { module: self.expn_def_scope(def), ..*parent_scope };
922922
adjusted_parent_scope = &tmp_parent_scope;
923923
}
924+
self.resolve_ident_in_scope_set(
925+
ident,
926+
ScopeSet::Module(ns, module),
927+
&adjusted_parent_scope,
928+
finalize,
929+
ignore_decl,
930+
ignore_import,
931+
)
924932
}
925-
ModuleOrUniformRoot::ExternPrelude => {
926-
ident.span.normalize_to_macros_2_0_and_adjust(ExpnId::root());
927-
}
928-
ModuleOrUniformRoot::ModuleAndExternPrelude(..) | ModuleOrUniformRoot::CurrentScope => {
929-
// No adjustments
930-
}
931-
}
932-
self.resolve_ident_in_virt_module_unadjusted(
933-
module,
934-
ident,
935-
ns,
936-
adjusted_parent_scope,
937-
finalize,
938-
ignore_decl,
939-
ignore_import,
940-
)
941-
}
942-
943-
/// Attempts to resolve `ident` in namespace `ns` of `module`.
944-
#[instrument(level = "debug", skip(self))]
945-
fn resolve_ident_in_virt_module_unadjusted<'r>(
946-
self: CmResolver<'r, 'ra, 'tcx>,
947-
module: ModuleOrUniformRoot<'ra>,
948-
ident: Ident,
949-
ns: Namespace,
950-
parent_scope: &ParentScope<'ra>,
951-
finalize: Option<Finalize>,
952-
ignore_decl: Option<Decl<'ra>>,
953-
ignore_import: Option<Import<'ra>>,
954-
) -> Result<Decl<'ra>, Determinacy> {
955-
match module {
956-
ModuleOrUniformRoot::Module(module) => self.resolve_ident_in_scope_set(
957-
ident,
958-
ScopeSet::Module(ns, module),
959-
parent_scope,
960-
finalize,
961-
ignore_decl,
962-
ignore_import,
963-
),
964933
ModuleOrUniformRoot::ModuleAndExternPrelude(module) => self.resolve_ident_in_scope_set(
965934
ident,
966935
ScopeSet::ModuleAndExternPrelude(ns, module),
@@ -973,6 +942,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
973942
if ns != TypeNS {
974943
Err(Determined)
975944
} else {
945+
ident.span.normalize_to_macros_2_0_and_adjust(ExpnId::root());
976946
self.resolve_ident_in_scope_set(
977947
ident,
978948
ScopeSet::ExternPrelude,

0 commit comments

Comments
 (0)