Skip to content

Commit a6782d9

Browse files
committed
Update E0423 description
E0423 doesn't apply only to structs, update the error index description to make this clear.
1 parent 41affd0 commit a6782d9

File tree

1 file changed

+30
-4
lines changed

1 file changed

+30
-4
lines changed

src/librustc_resolve/diagnostics.rs

+30-4
Original file line numberDiff line numberDiff line change
@@ -967,16 +967,18 @@ one.
967967
"##,
968968

969969
E0423: r##"
970-
A `struct` variant name was used like a function name.
970+
An identifier was used like a function name or a value was expected and the
971+
identifier exists but it belongs to a different namespace.
971972
972-
Erroneous code example:
973+
For (an erroneous) example, here a `struct` variant name were used as a
974+
function:
973975
974976
```compile_fail,E0423
975977
struct Foo { a: bool };
976978
977979
let f = Foo();
978-
// error: `Foo` is a struct variant name, but this expression uses
979-
// it like a function name
980+
// error: expected function, found `Foo`
981+
// `Foo` is a struct name, but this expression uses it like a function name
980982
```
981983
982984
Please verify you didn't misspell the name of what you actually wanted to use
@@ -987,6 +989,30 @@ fn Foo() -> u32 { 0 }
987989
988990
let f = Foo(); // ok!
989991
```
992+
993+
It is common to forget the trailing `!` on macro invocations, which would also
994+
yield this error:
995+
996+
```compile_fail,E0423
997+
println("");
998+
// error: expected function, found macro `println`
999+
// did you mean `println!(...)`? (notice the trailing `!`)
1000+
```
1001+
1002+
Another case where this error is emitted is when a value is expected, but
1003+
something else is found:
1004+
1005+
```compile_fail,E0423
1006+
pub mod a {
1007+
pub const I: i32 = 1;
1008+
}
1009+
1010+
fn h1() -> i32 {
1011+
a.I
1012+
//~^ ERROR expected value, found module `a`
1013+
// did you mean `a::I`?
1014+
}
1015+
```
9901016
"##,
9911017

9921018
E0424: r##"

0 commit comments

Comments
 (0)