diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2018-06-09 14:21:07 -0700 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2018-06-09 14:27:42 -0700 |
| commit | a6782d9e4e38c1925d7db239bf26e3d228893ea5 (patch) | |
| tree | 49bdd26587b471945e9fb92645553a080ad1e88f /src | |
| parent | 41affd03eb169830773cd1b11efda562ab81fad0 (diff) | |
| download | rust-a6782d9e4e38c1925d7db239bf26e3d228893ea5.tar.gz rust-a6782d9e4e38c1925d7db239bf26e3d228893ea5.zip | |
Update E0423 description
E0423 doesn't apply only to structs, update the error index description to make this clear.
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_resolve/diagnostics.rs | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/src/librustc_resolve/diagnostics.rs b/src/librustc_resolve/diagnostics.rs index 232a32deb86..f0ef07276f6 100644 --- a/src/librustc_resolve/diagnostics.rs +++ b/src/librustc_resolve/diagnostics.rs @@ -967,16 +967,18 @@ one. "##, E0423: r##" -A `struct` variant name was used like a function name. +An identifier was used like a function name or a value was expected and the +identifier exists but it belongs to a different namespace. -Erroneous code example: +For (an erroneous) example, here a `struct` variant name were used as a +function: ```compile_fail,E0423 struct Foo { a: bool }; let f = Foo(); -// error: `Foo` is a struct variant name, but this expression uses -// it like a function name +// error: expected function, found `Foo` +// `Foo` is a struct name, but this expression uses it like a function name ``` Please verify you didn't misspell the name of what you actually wanted to use @@ -987,6 +989,30 @@ fn Foo() -> u32 { 0 } let f = Foo(); // ok! ``` + +It is common to forget the trailing `!` on macro invocations, which would also +yield this error: + +```compile_fail,E0423 +println(""); +// error: expected function, found macro `println` +// did you mean `println!(...)`? (notice the trailing `!`) +``` + +Another case where this error is emitted is when a value is expected, but +something else is found: + +```compile_fail,E0423 +pub mod a { + pub const I: i32 = 1; +} + +fn h1() -> i32 { + a.I + //~^ ERROR expected value, found module `a` + // did you mean `a::I`? +} +``` "##, E0424: r##" |
