Skip to content

Commit 531b053

Browse files
committed
Auto merge of #29788 - mitaa:module_name, r=arielb1
f357d55 caused a regression by retrieving item names from metadata, while previously using the last element of its absolute path (which in the case of a root module is the prefixed crate name since the stored path in metadata is empty) fixes #28927
2 parents b7845f9 + 02f9a49 commit 531b053

File tree

4 files changed

+40
-1
lines changed

4 files changed

+40
-1
lines changed

src/librustc/metadata/encoder.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1500,7 +1500,7 @@ fn encode_info_for_items<'a, 'tcx>(ecx: &EncodeContext<'a, 'tcx>,
15001500
&[],
15011501
CRATE_NODE_ID,
15021502
[].iter().cloned().chain(LinkedPath::empty()),
1503-
syntax::parse::token::special_idents::invalid.name,
1503+
syntax::parse::token::intern(&ecx.link_meta.crate_name),
15041504
hir::Public);
15051505

15061506
visit::walk_crate(&mut EncodeVisitor {

src/test/auxiliary/issue-28927-1.rs

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
extern crate issue_28927_2 as inner2;
12+
pub use inner2 as bar;

src/test/auxiliary/issue-28927-2.rs

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
pub struct Baz;

src/test/rustdoc/issue-28927.rs

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// aux-build:issue-28927-2.rs
12+
// aux-build:issue-28927-1.rs
13+
// ignore-cross-compile
14+
15+
extern crate issue_28927_1 as inner1;
16+
pub use inner1 as foo;

0 commit comments

Comments
 (0)