Skip to content

Commit

Permalink
Auto merge of #41433 - estebank:constructor, r=michaelwoerister
Browse files Browse the repository at this point in the history
Do not show `::{{constructor}}` on tuple struct diagnostics

Fix #41313.
  • Loading branch information
bors committed Apr 27, 2017
2 parents 54ef800 + cd60307 commit 79b05fe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/librustc/ty/item_path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
data @ DefPathData::LifetimeDef(..) |
data @ DefPathData::EnumVariant(..) |
data @ DefPathData::Field(..) |
data @ DefPathData::StructCtor |
data @ DefPathData::Initializer |
data @ DefPathData::MacroDef(..) |
data @ DefPathData::ClosureExpr |
Expand All @@ -186,6 +185,10 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
self.push_item_path(buffer, parent_def_id);
buffer.push(&data.as_interned_str());
}
DefPathData::StructCtor => { // present `X` instead of `X::{{constructor}}`
let parent_def_id = self.parent_def_id(def_id).unwrap();
self.push_item_path(buffer, parent_def_id);
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/numeric-fields.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ fn main() {
match s {
S{0: a, 0x1: b, ..} => {}
//~^ ERROR does not have a field named `0x1`
//~| NOTE struct `S::{{constructor}}` does not have field `0x1`
//~| NOTE struct `S` does not have field `0x1`
}
}

0 comments on commit 79b05fe

Please sign in to comment.