Skip to content
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

User-created 'core' crate confusingly shadows std 'core' crate #90960

Open
RobJellinghaus opened this issue Nov 16, 2021 · 0 comments
Open

User-created 'core' crate confusingly shadows std 'core' crate #90960

RobJellinghaus opened this issue Nov 16, 2021 · 0 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-resolve Area: Name resolution D-confusing Diagnostics: Confusing error or lint that should be reworked. D-newcomer-roadblock Diagnostics: Confusing error or lint; hard to understand for new users. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@RobJellinghaus
Copy link

RobJellinghaus commented Nov 16, 2021

This user reported a confusing error about core namespace not implementing an expected trait: https://twitter.com/Luminoth82/status/1459602117803450368

error[E0433]: failed to resolve: could not find `marker` in `core`
 --> runner-gui/src/app.rs:6:41
  |
6 | #[derive(Debug, Copy, Clone, PartialEq, EnumIter)]
  |                                         ^^^^^^^^ could not find `marker` in `core`
  |
  = note: this error originates in the derive macro `EnumIter` (in Nightly builds, run with -Z macro-backtrace for more info)

The root issue turned out to be that they had defined their own core crate which was shadowing the standard core crate. But the confusing error seems like it could be improved.

Ideally the output should look like:

error[E0433]: failed to resolve: could not find `marker` in `core`
 --> runner-gui/src/app.rs:6:41
  |
6 | #[derive(Debug, Copy, Clone, PartialEq, EnumIter)]
  |                                         ^^^^^^^^ could not find `marker` in `core`
  |
  = note: this error originates in the derive macro `EnumIter` (in Nightly builds, run with -Z macro-backtrace for more info)
  = note: the `core` crate is defined in `runner-gui\Cargo.toml`

Or some other additional note clarifying exactly which core is being built, or mentioning that there are shadowed core crates in scope, etc.

@RobJellinghaus RobJellinghaus added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 16, 2021
@RobJellinghaus RobJellinghaus changed the title User-created 'core' package confusingly shadows std 'core' package User-created 'core' crate confusingly shadows std 'core' crate Nov 16, 2021
@estebank estebank added A-resolve Area: Name resolution D-confusing Diagnostics: Confusing error or lint that should be reworked. D-newcomer-roadblock Diagnostics: Confusing error or lint; hard to understand for new users. labels Nov 18, 2021
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-resolve Area: Name resolution D-confusing Diagnostics: Confusing error or lint that should be reworked. D-newcomer-roadblock Diagnostics: Confusing error or lint; hard to understand for new users. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants