Skip to content

Macros called as functions link to a misleading / inaccurate error index. #42077

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
shepmaster opened this issue May 18, 2017 · 2 comments
Closed
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools C-enhancement Category: An issue proposing an enhancement or a PR with one. P-medium Medium priority

Comments

@shepmaster
Copy link
Member

fn main() {
    println("");
}

Produces this error with the helpful text:

error[E0423]: expected function, found macro `println`
 --> src/main.rs:2:5
  |
2 |     println("");
  |     ^^^^^^^ did you mean `println!(...)`?

However, if you look at the error index for E0423...

A struct variant name was used like a function name.

That is not useful. This used to point to E0425:

An unresolved name was used.

@kennytm
Copy link
Member

kennytm commented May 18, 2017

Other E0423 instances:

test/ui/resolve/issue-18252.stderr:1:error[E0423]: expected function, found struct variant `Foo::Variant`
test/ui/resolve/issue-19452.stderr:1:error[E0423]: expected value, found struct variant `Homura::Madoka`
test/ui/resolve/issue-19452.stderr:7:error[E0423]: expected value, found struct variant `issue_19452_aux::Homura::Madoka`
test/ui/resolve/issue-33876.stderr:1:error[E0423]: expected value, found trait `Bar`
test/ui/resolve/issue-39226.stderr:1:error[E0423]: expected value, found struct `Handle`
test/ui/resolve/issue-6702.stderr:1:error[E0423]: expected function, found struct `Monster`
test/ui/resolve/privacy-struct-ctor.stderr:1:error[E0423]: expected value, found struct `Z`
test/ui/resolve/privacy-struct-ctor.stderr:14:error[E0423]: expected value, found struct `S`
test/ui/resolve/privacy-struct-ctor.stderr:26:error[E0423]: expected value, found struct `xcrate::S`
test/ui/resolve/resolve-hint-macro.stderr:1:error[E0423]: expected function, found macro `assert`
test/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr:1:error[E0423]: expected value, found module `a`
test/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr:9:error[E0423]: expected value, found module `a`
test/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr:17:error[E0423]: expected value, found module `a`
test/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr:25:error[E0423]: expected value, found module `a::b`
test/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr:34:error[E0423]: expected value, found module `a`
test/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr:42:error[E0423]: expected value, found module `a::b`
test/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr:50:error[E0423]: expected value, found module `a::b`
test/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr:59:error[E0423]: expected value, found module `a::b`
test/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr:67:error[E0423]: expected function, found module `a::b`
test/ui/resolve/tuple-struct-alias.stderr:1:error[E0423]: expected function, found self type `Self`
test/ui/resolve/tuple-struct-alias.stderr:13:error[E0423]: expected function, found type alias `A`

The error index should describe E0423 as an "expected (value | function) found something else" error. (E0425 is inaccurate since the name does exist, just in a different namespace.)

@petrochenkov
Copy link
Contributor

petrochenkov commented May 18, 2017

Yeah, description of E0423 needs to be expanded/reworded, "struct variant name was used like a function name" was a special case of "expected value, found something else".

@petrochenkov petrochenkov added the A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools label May 18, 2017
@frewsxcv frewsxcv added the A-diagnostics Area: Messages for errors, warnings, and lints label May 20, 2017
@Mark-Simulacrum Mark-Simulacrum added the C-enhancement Category: An issue proposing an enhancement or a PR with one. label Jul 26, 2017
@steveklabnik steveklabnik added the P-medium Medium priority label Aug 30, 2017
bors added a commit that referenced this issue Jun 11, 2018
Update E0423 description

E0423 doesn't apply only to structs, update the error index description
to make this clear.

Fix #42077.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools C-enhancement Category: An issue proposing an enhancement or a PR with one. P-medium Medium priority
Projects
None yet
Development

No branches or pull requests

6 participants