Skip to content

Commit 79b05fe

Browse files
committed
Auto merge of #41433 - estebank:constructor, r=michaelwoerister
Do not show `::{{constructor}}` on tuple struct diagnostics Fix #41313.
2 parents 54ef800 + cd60307 commit 79b05fe

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/librustc/ty/item_path.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
175175
data @ DefPathData::LifetimeDef(..) |
176176
data @ DefPathData::EnumVariant(..) |
177177
data @ DefPathData::Field(..) |
178-
data @ DefPathData::StructCtor |
179178
data @ DefPathData::Initializer |
180179
data @ DefPathData::MacroDef(..) |
181180
data @ DefPathData::ClosureExpr |
@@ -186,6 +185,10 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
186185
self.push_item_path(buffer, parent_def_id);
187186
buffer.push(&data.as_interned_str());
188187
}
188+
DefPathData::StructCtor => { // present `X` instead of `X::{{constructor}}`
189+
let parent_def_id = self.parent_def_id(def_id).unwrap();
190+
self.push_item_path(buffer, parent_def_id);
191+
}
189192
}
190193
}
191194

src/test/compile-fail/numeric-fields.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ fn main() {
1919
match s {
2020
S{0: a, 0x1: b, ..} => {}
2121
//~^ ERROR does not have a field named `0x1`
22-
//~| NOTE struct `S::{{constructor}}` does not have field `0x1`
22+
//~| NOTE struct `S` does not have field `0x1`
2323
}
2424
}

0 commit comments

Comments
 (0)