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

Detect when unresolved import is caused by item that's cfged away #60279

Closed
estebank opened this issue Apr 25, 2019 · 1 comment
Closed

Detect when unresolved import is caused by item that's cfged away #60279

estebank opened this issue Apr 25, 2019 · 1 comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-libtest Area: `#[test]` / the `test` library A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix` C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@estebank
Copy link
Contributor

When having an annotated import like #[cfg(test)] use foo::bar; and elsewhere in the same scope we have use self::bar::baz; we currently get an error about unresolved imports when building regularly. We should point out that the import would be valid if it wasn't restricted to test runs and suggest to either remove the other imports annotation or adding one to the current import.

@estebank estebank added C-enhancement Category: An issue proposing an enhancement or a PR with one. A-diagnostics Area: Messages for errors, warnings, and lints A-libtest Area: `#[test]` / the `test` library A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix` labels Apr 25, 2019
@jonas-schievink jonas-schievink added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Apr 21, 2020
@estebank
Copy link
Contributor Author

Fixed by #109005

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-libtest Area: `#[test]` / the `test` library A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix` C-enhancement Category: An issue proposing an enhancement or a PR with one. 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