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

Suggest macro import #75191

Closed
pickfire opened this issue Aug 5, 2020 · 0 comments · Fixed by #75209
Closed

Suggest macro import #75191

pickfire opened this issue Aug 5, 2020 · 0 comments · Fixed by #75209
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-proc-macros Area: Procedural macros 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. D-papercut Diagnostics: An error or lint that needs small tweaks. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@pickfire
Copy link
Contributor

pickfire commented Aug 5, 2020

I tried this code:

#[derive(Debug, Component, Clone, Copy)]
#[storage(VecStorage)]
pub struct Position {
    x: u8,
    y: u8,
    z: u8,
}

I expected to see this happen: compiler should suggest importing Component from specs (it is in Cargo.toml).

Instead, this happened: compiler say cannot find macro 'Component' but did not suggest importing it like other functions

error: cannot find derive macro `Component` in this scope
  --> src/main.rs:34:10
   |
34 | #[derive(Component)]
   |          ^^^^^^^^^

Meta

rustc --version --verbose:

rustc 1.47.0-nightly (d8cbd9cac 2020-08-03)
binary: rustc
commit-hash: d8cbd9caca648ecdb66ff4c945c060762aa6297f
commit-date: 2020-08-03
host: x86_64-unknown-linux-gnu
release: 1.47.0-nightly
LLVM version: 10.0

Also not available in stable.

@pickfire pickfire added the C-bug Category: This is a bug. label Aug 5, 2020
@JohnTitor JohnTitor added A-diagnostics Area: Messages for errors, warnings, and lints 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. and removed C-bug Category: This is a bug. labels Aug 5, 2020
@estebank estebank added A-proc-macros Area: Procedural macros D-papercut Diagnostics: An error or lint that needs small tweaks. labels Aug 5, 2020
JohnTitor added a commit to JohnTitor/rust that referenced this issue Oct 16, 2020
…stebank

Suggest imports of unresolved macros

Closes rust-lang#75191.
@bors bors closed this as completed in 7581bb7 Oct 16, 2020
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-proc-macros Area: Procedural macros 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. D-papercut Diagnostics: An error or lint that needs small tweaks. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants