Skip to content

Commit 198c5d7

Browse files
committed
Auto merge of #154477 - Kobzol:revert-154313, r=<try>
Revert "Rollup merge of #154313 - mu001999-contrib:fix/154295, r=petrochenkov"
2 parents fda6d37 + db307c5 commit 198c5d7

4 files changed

Lines changed: 10 additions & 92 deletions

File tree

compiler/rustc_resolve/src/lib.rs

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -547,13 +547,6 @@ impl ModuleKind {
547547
ModuleKind::Def(.., name) => name,
548548
}
549549
}
550-
551-
fn opt_def_id(&self) -> Option<DefId> {
552-
match self {
553-
ModuleKind::Def(_, def_id, _) => Some(*def_id),
554-
_ => None,
555-
}
556-
}
557550
}
558551

559552
/// Combination of a symbol and its macros 2.0 normalized hygiene context.
@@ -791,7 +784,10 @@ impl<'ra> Module<'ra> {
791784
}
792785

793786
fn opt_def_id(self) -> Option<DefId> {
794-
self.kind.opt_def_id()
787+
match self.kind {
788+
ModuleKind::Def(_, def_id, _) => Some(def_id),
789+
_ => None,
790+
}
795791
}
796792

797793
// `self` resolves to the first module ancestor that `is_normal`.
@@ -1454,19 +1450,14 @@ impl<'ra> ResolverArenas<'ra> {
14541450
&'ra self,
14551451
parent: Option<Module<'ra>>,
14561452
kind: ModuleKind,
1457-
vis: Visibility<DefId>,
14581453
expn_id: ExpnId,
14591454
span: Span,
14601455
no_implicit_prelude: bool,
14611456
) -> Module<'ra> {
14621457
let self_decl = match kind {
1463-
ModuleKind::Def(def_kind, def_id, _) => Some(self.new_def_decl(
1464-
Res::Def(def_kind, def_id),
1465-
vis,
1466-
span,
1467-
LocalExpnId::ROOT,
1468-
None,
1469-
)),
1458+
ModuleKind::Def(def_kind, def_id, _) => {
1459+
Some(self.new_pub_def_decl(Res::Def(def_kind, def_id), span, LocalExpnId::ROOT))
1460+
}
14701461
ModuleKind::Block => None,
14711462
};
14721463
Module(Interned::new_unchecked(self.modules.alloc(ModuleData::new(
@@ -1648,7 +1639,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
16481639
let graph_root = arenas.new_module(
16491640
None,
16501641
ModuleKind::Def(DefKind::Mod, root_def_id, None),
1651-
Visibility::Public,
16521642
ExpnId::root(),
16531643
crate_span,
16541644
attr::contains_name(attrs, sym::no_implicit_prelude),
@@ -1658,7 +1648,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
16581648
let empty_module = arenas.new_module(
16591649
None,
16601650
ModuleKind::Def(DefKind::Mod, root_def_id, None),
1661-
Visibility::Public,
16621651
ExpnId::root(),
16631652
DUMMY_SP,
16641653
true,
@@ -1760,9 +1749,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
17601749
span: Span,
17611750
no_implicit_prelude: bool,
17621751
) -> Module<'ra> {
1763-
let vis =
1764-
kind.opt_def_id().map_or(Visibility::Public, |def_id| self.tcx.visibility(def_id));
1765-
let module = self.arenas.new_module(parent, kind, vis, expn_id, span, no_implicit_prelude);
1752+
let module = self.arenas.new_module(parent, kind, expn_id, span, no_implicit_prelude);
17661753
self.local_modules.push(module);
17671754
if let Some(def_id) = module.opt_def_id() {
17681755
self.local_module_map.insert(def_id.expect_local(), module);
@@ -1778,9 +1765,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
17781765
span: Span,
17791766
no_implicit_prelude: bool,
17801767
) -> Module<'ra> {
1781-
let vis =
1782-
kind.opt_def_id().map_or(Visibility::Public, |def_id| self.tcx.visibility(def_id));
1783-
let module = self.arenas.new_module(parent, kind, vis, expn_id, span, no_implicit_prelude);
1768+
let module = self.arenas.new_module(parent, kind, expn_id, span, no_implicit_prelude);
17841769
self.extern_module_map.borrow_mut().insert(module.def_id(), module);
17851770
module
17861771
}

tests/ui/use/pub-use-self-super-crate.rs

Lines changed: 0 additions & 24 deletions
This file was deleted.

tests/ui/use/pub-use-self-super-crate.stderr

Lines changed: 0 additions & 43 deletions
This file was deleted.

tests/ui/use/use-path-segment-kw.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ macro_rules! macro_dollar_crate {
7070

7171
fn outer() {}
7272

73-
pub mod foo {
73+
mod foo {
7474
pub mod bar {
7575
pub mod foobar {
7676
pub mod qux {

0 commit comments

Comments
 (0)