Skip to content

Commit eb90af8

Browse files
committed
Rollup merge of #28554 - christopherdumas:E0422, r=arielb1
2 parents d9d9ca1 + a818f9f commit eb90af8

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

src/librustc_resolve/diagnostics.rs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,29 @@ match Something::NotFoo {
609609
```
610610
"##,
611611

612+
E0422: r##"
613+
You are trying to use an identifier that is either undefined or not a
614+
struct. For instance:
615+
```
616+
fn main () {
617+
let x = Foo { x: 1, y: 2 };
618+
}
619+
```
620+
621+
In this case, `Foo` is undefined, so it inherently isn't anything, and
622+
definitely not a struct.
623+
624+
```
625+
fn main () {
626+
let foo = 1;
627+
let x = foo { x: 1, y: 2 };
628+
}
629+
```
630+
631+
In this case, `foo` is defined, but is not a struct, so Rust can't use
632+
it as one.
633+
"##,
634+
612635
E0423: r##"
613636
A `struct` variant name was used like a function name. Example of
614637
erroneous code:
@@ -888,7 +911,6 @@ register_diagnostics! {
888911
E0418, // is not an enum variant, struct or const
889912
E0420, // is not an associated const
890913
E0421, // unresolved associated const
891-
E0422, // does not name a structure
892914
E0427, // cannot use `ref` binding mode with ...
893915
E0429, // `self` imports are only allowed within a { } list
894916
E0434, // can't capture dynamic environment in a fn item

0 commit comments

Comments
 (0)