Skip to content

Commit 89c75bd

Browse files
authored
Rollup merge of rust-lang#74240 - da-x:fix-74081, r=Manishearth
Fix rust-lang#74081 and add the test case from rust-lang#74236
2 parents 2e95d26 + f5de23b commit 89c75bd

File tree

4 files changed

+29
-1
lines changed

4 files changed

+29
-1
lines changed

src/librustc_middle/ty/print/pretty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ pub trait PrettyPrinter<'tcx>:
393393
.tcx()
394394
.item_children(visible_parent)
395395
.iter()
396-
.find(|child| child.res.def_id() == def_id)
396+
.find(|child| child.res.opt_def_id() == Some(def_id))
397397
.map(|child| child.ident.name);
398398
if let Some(reexport) = reexport {
399399
*name = reexport;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// edition:2018
2+
3+
mod private { pub struct Pub; }
4+
5+
// Reexport built-in attribute without a DefId (requires Rust 2018).
6+
pub use cfg_attr as attr;
7+
// This export needs to be after the built-in attribute to trigger the bug.
8+
pub use private::Pub as Renamed;
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// edition:2018
2+
// aux-build:dep.rs
3+
// compile-flags:--extern dep
4+
5+
fn main() {
6+
// Trigger an error that will print the path of dep::private::Pub (as "dep::Renamed").
7+
let () = dep::Renamed;
8+
//~^ ERROR mismatched types
9+
}
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error[E0308]: mismatched types
2+
--> $DIR/main.rs:7:9
3+
|
4+
LL | let () = dep::Renamed;
5+
| ^^ ------------ this expression has type `dep::Renamed`
6+
| |
7+
| expected struct `dep::Renamed`, found `()`
8+
9+
error: aborting due to previous error
10+
11+
For more information about this error, try `rustc --explain E0308`.

0 commit comments

Comments
 (0)