about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2015-10-02 13:07:22 +0530
committerManish Goregaokar <manishsmail@gmail.com>2015-10-02 13:07:22 +0530
commitb1d2a49b87ff0041b4c6507f5be04083a0d0aa02 (patch)
treec2d9798ba27a70249329efa2f07578ffc084e966 /src
parent7643c4ca75305d37121616ca89fd5d994eeddfbc (diff)
parenta818f9f6b63eca633e51612a2674d3e69acb3294 (diff)
downloadrust-b1d2a49b87ff0041b4c6507f5be04083a0d0aa02.tar.gz
rust-b1d2a49b87ff0041b4c6507f5be04083a0d0aa02.zip
Rollup merge of #28554 - christopherdumas:E0422, r=arielb1
Diffstat (limited to 'src')
-rw-r--r--src/librustc_resolve/diagnostics.rs24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/librustc_resolve/diagnostics.rs b/src/librustc_resolve/diagnostics.rs
index f06fd9f70e2..4147f2bea48 100644
--- a/src/librustc_resolve/diagnostics.rs
+++ b/src/librustc_resolve/diagnostics.rs
@@ -609,6 +609,29 @@ match Something::NotFoo {
 ```
 "##,
 
+E0422: r##"
+You are trying to use an identifier that is either undefined or not a
+struct. For instance:
+```
+fn main () {
+    let x = Foo { x: 1, y: 2 };
+}
+```
+
+In this case, `Foo` is undefined, so it inherently isn't anything, and
+definitely not a struct.
+
+```
+fn main () {
+    let foo = 1;
+    let x = foo { x: 1, y: 2 };
+}
+```
+
+In this case, `foo` is defined, but is not a struct, so Rust can't use
+it as one.
+"##,
+
 E0423: r##"
 A `struct` variant name was used like a function name. Example of
 erroneous code:
@@ -888,7 +911,6 @@ register_diagnostics! {
     E0418, // is not an enum variant, struct or const
     E0420, // is not an associated const
     E0421, // unresolved associated const
-    E0422, // does not name a structure
     E0427, // cannot use `ref` binding mode with ...
     E0429, // `self` imports are only allowed within a { } list
     E0434, // can't capture dynamic environment in a fn item