Skip to content

Commit 0d013de

Browse files
committed
resolve: Remove Module::as_local
1 parent b03e058 commit 0d013de

4 files changed

Lines changed: 6 additions & 13 deletions

File tree

compiler/rustc_resolve/src/diagnostics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3291,7 +3291,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
32913291
}
32923292
visited.insert(parent_module, false);
32933293
let mut res = false;
3294-
if let Some(m) = r.expect_module(parent_module).as_local() {
3294+
if let Module::Local(m) = r.expect_module(parent_module) {
32953295
for importer in m.glob_importers.borrow().iter() {
32963296
if let Some(next_parent_module) = importer.parent_scope.module.opt_def_id()
32973297
{

compiler/rustc_resolve/src/ident.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1122,7 +1122,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
11221122
}
11231123

11241124
// In extern modules everything is determined from the start.
1125-
let Some(module) = module.as_local() else {
1125+
let Module::Local(module) = module else {
11261126
return Err(ControlFlow::Continue(Determined));
11271127
};
11281128

compiler/rustc_resolve/src/imports.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ use crate::errors::{
4343
use crate::ref_mut::CmCell;
4444
use crate::{
4545
AmbiguityError, BindingKey, CmResolver, Decl, DeclData, DeclKind, Determinacy, Finalize,
46-
IdentKey, ImportSuggestion, ImportSummary, LocalModule, ModuleOrUniformRoot, ParentScope,
47-
PathResult, PerNS, Res, ResolutionError, Resolver, ScopeSet, Segment, Used, module_to_string,
48-
names_to_string,
46+
IdentKey, ImportSuggestion, ImportSummary, LocalModule, Module, ModuleOrUniformRoot,
47+
ParentScope, PathResult, PerNS, Res, ResolutionError, Resolver, ScopeSet, Segment, Used,
48+
module_to_string, names_to_string,
4949
};
5050

5151
/// A potential import declaration in the process of being planted into a module.
@@ -1790,7 +1790,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
17901790
}
17911791

17921792
// Add to module's glob_importers
1793-
if let Some(module) = module.as_local() {
1793+
if let Module::Local(module) = module {
17941794
module.glob_importers.borrow_mut_unchecked().push(import);
17951795
}
17961796

compiler/rustc_resolve/src/lib.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -827,13 +827,6 @@ impl<'ra> Module<'ra> {
827827
true
828828
}
829829

830-
fn as_local(self) -> Option<LocalModule<'ra>> {
831-
match self {
832-
Module::Local(m) => Some(m),
833-
Module::Extern(_) => None,
834-
}
835-
}
836-
837830
#[track_caller]
838831
fn expect_local(self) -> LocalModule<'ra> {
839832
match self {

0 commit comments

Comments
 (0)