-
Notifications
You must be signed in to change notification settings - Fork 13.3k
"Unused imports" warning has false-positives in the presence of syntax extensions #6371
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
Comments
Nominating for milestone 5, production-ready. |
The emission of unused imports changed a fair amount in #6093, so this may be fixed by that. Is there a simple case that I can test one? I tried: #[deriving(IterBytes)]
enum A{
B, C, D
}
fn main(){} and I didn't get any errors. This makes me think that it may only pertain to things with |
Hmm, maybe you do need |
Yeah, @alexcrichton seems to be right. This only happens inside rustc. If you want to test it, try removing the rustc doesn't have |
This doesn't look to be an error, just an unfortunate stage0 thing. If you add #[deriving(IterBytes)]
enum A { B, }
#[doc = "Automatically derived."]
pub impl ::core::to_bytes::IterBytes for A {
pub fn iter_bytes(&self, __lsb0: bool, __f: core::to_bytes::Cb) {
match *self { B => { 0u.iter_bytes(__lsb0, __f); } }; }
} whereas now it spits out #[deriving(IterBytes)]
enum A { B, }
#[doc = "Automatically derived."]
pub impl ::core::to_bytes::IterBytes for A {
pub fn iter_bytes(&self, __arg_0: ::bool, __arg_1: ::core::to_bytes::Cb)
-> ::bool {
match *self { B => 0u.iter_bytes(__arg_0, __arg_1) }
}
} Which if you notice on the second argument, the path was changed from a relative path to an absolute one, which would explain why in later stages the |
Ah, ok. If it's a "this'll go away with the next snapshot" thing, then I'll be happy :-) |
Rustup changelog: none r? `@ghost`
For example, code with
deriving(IterBytes)
seems to need ause core;
in scope. however, this causes awarning: unused import
. Removing the import causes a resolve error, though.Or maybe the answer is for syntax extensions to not require a certain module to be in scope... I'm not sure.
The text was updated successfully, but these errors were encountered: