Skip to content

Commit 799efd3

Browse files
committed
Fix issue with using self module via indirection
1 parent 2d8d559 commit 799efd3

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/librustc_privacy/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -652,6 +652,9 @@ impl EmbargoVisitor<'tcx> {
652652
if let Some(item) = module
653653
.res
654654
.and_then(|res| res.mod_def_id())
655+
// If the module is `self`, i.e. the current crate,
656+
// there will be no corresponding item.
657+
.filter(|def_id| def_id.index != CRATE_DEF_INDEX || def_id.krate != LOCAL_CRATE)
655658
.and_then(|def_id| self.tcx.hir().as_local_hir_id(def_id))
656659
.map(|module_hir_id| self.tcx.hir().expect_item(module_hir_id))
657660
{

src/test/ui/issues/issue-68103.rs

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// check-pass
2+
3+
pub extern crate self as name;
4+
pub use name::name as bug;
5+
6+
fn main() {}

0 commit comments

Comments
 (0)