about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-04-27 10:47:56 +0000
committerbors <bors@rust-lang.org>2017-04-27 10:47:56 +0000
commit79b05fee0fd1423a49e9655d554eec7bfebb0e87 (patch)
tree6fa551b022448d8dc361d32118f6a142b759b3aa
parent54ef80043a3864495555c96791118ab3a725fe6b (diff)
parentcd60307acb110ae268556e41a6abdc8d59d7e72b (diff)
downloadrust-79b05fee0fd1423a49e9655d554eec7bfebb0e87.tar.gz
rust-79b05fee0fd1423a49e9655d554eec7bfebb0e87.zip
Auto merge of #41433 - estebank:constructor, r=michaelwoerister
Do not show `::{{constructor}}` on tuple struct diagnostics

Fix #41313.
-rw-r--r--src/librustc/ty/item_path.rs5
-rw-r--r--src/test/compile-fail/numeric-fields.rs2
2 files changed, 5 insertions, 2 deletions
diff --git a/src/librustc/ty/item_path.rs b/src/librustc/ty/item_path.rs
index 9aa2caadd1d..eb31dfba4a4 100644
--- a/src/librustc/ty/item_path.rs
+++ b/src/librustc/ty/item_path.rs
@@ -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 |
@@ -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);
+            }
         }
     }
 
diff --git a/src/test/compile-fail/numeric-fields.rs b/src/test/compile-fail/numeric-fields.rs
index a67707257d2..0dc5c4bcfa2 100644
--- a/src/test/compile-fail/numeric-fields.rs
+++ b/src/test/compile-fail/numeric-fields.rs
@@ -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`
     }
 }