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

#[deriving] implementations need #[allow(unused_qualifications)] #19102

Closed
chris-morgan opened this issue Nov 19, 2014 · 1 comment · Fixed by #27239
Closed

#[deriving] implementations need #[allow(unused_qualifications)] #19102

chris-morgan opened this issue Nov 19, 2014 · 1 comment · Fixed by #27239
Labels
A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. A-syntaxext Area: Syntax extensions E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Comments

@chris-morgan
Copy link
Member

Example:

#![warn(unused_qualifications)]

use self::A::B;

#[deriving(PartialEq)]
pub enum A {
    B,
}

fn main() {
}

Output:

a.rs:7:5: 7:6 warning: unnecessary qualification
a.rs:7     B,
           ^
note: in expansion of #[deriving]
a.rs:5:1: 5:23 note: expansion site
a.rs:1:9: 1:30 note: lint level defined here
a.rs:1 #![warn(unused_qualifications)]
               ^~~~~~~~~~~~~~~~~~~~~
a.rs:7:5: 7:6 warning: unnecessary qualification
a.rs:7     B,
           ^
note: in expansion of #[deriving]
a.rs:5:1: 5:23 note: expansion site
a.rs:1:9: 1:30 note: lint level defined here
a.rs:1 #![warn(unused_qualifications)]
               ^~~~~~~~~~~~~~~~~~~~~
a.rs:7:5: 7:6 warning: unnecessary qualification
a.rs:7     B,
           ^
note: in expansion of #[deriving]
a.rs:5:1: 5:23 note: expansion site
a.rs:1:9: 1:30 note: lint level defined here
a.rs:1 #![warn(unused_qualifications)]
               ^~~~~~~~~~~~~~~~~~~~~
a.rs:7:5: 7:6 warning: unnecessary qualification
a.rs:7     B,
           ^
note: in expansion of #[deriving]
a.rs:5:1: 5:23 note: expansion site
a.rs:1:9: 1:30 note: lint level defined here
a.rs:1 #![warn(unused_qualifications)]
               ^~~~~~~~~~~~~~~~~~~~~

This is something that wasn’t an issue before, but with the scoping of enum variants can very easily become a problem now.

chris-morgan added a commit to chris-morgan/teepee that referenced this issue Nov 19, 2014
@sanxiyn sanxiyn added the A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. label Jan 27, 2015
@retep998
Copy link
Member

Just hit this while working on winapi. It's easy enough to just add a #[allow(unused_qualifications)] on the enum as a workaround though.

@sfackler sfackler added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. A-syntaxext Area: Syntax extensions labels Jun 12, 2015
bors added a commit that referenced this issue Aug 24, 2015
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue Jul 20, 2022
…-derive, r=oli-obk

Stop injecting `#[allow(unused_qualifications)]` in generated `derive` implementations

Currently, the `#[derive]` attribute always injects an `#[allow(unused_qualifications)]` attribute in the generated implementation. This results in an error when a derive is used in combination with `#![forbid(unused_qualifications)]`, because the `forbid` rule by definition cannot be overridden by `allow`.

It appears that the original issue that prompted the inclusion of `#[allow(unused_qualifications)]` (rust-lang#19102) is no longer present in the current stable release, and the associated [test case](https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-19102.rs) still passes, so the `allow` is simply removed here.

Fixes rust-lang#71898.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. A-syntaxext Area: Syntax extensions E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants