Skip to content

Commit 3257c34

Browse files
authored
Rollup merge of #99485 - mdholloway:unused-qualifications-in-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)]` (#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 #71898.
2 parents d9a71c1 + 05bb878 commit 3257c34

File tree

4 files changed

+39
-108
lines changed

4 files changed

+39
-108
lines changed

compiler/rustc_builtin_macros/src/deriving/generic/mod.rs

+1-9
Original file line numberDiff line numberDiff line change
@@ -727,16 +727,8 @@ impl<'a> TraitDef<'a> {
727727

728728
let attr = cx.attribute(cx.meta_word(self.span, sym::automatically_derived));
729729
let opt_trait_ref = Some(trait_ref);
730-
let unused_qual = {
731-
let word = rustc_ast::attr::mk_nested_word_item(Ident::new(
732-
sym::unused_qualifications,
733-
self.span,
734-
));
735-
let list = rustc_ast::attr::mk_list_item(Ident::new(sym::allow, self.span), vec![word]);
736-
cx.attribute(list)
737-
};
738730

739-
let mut a = vec![attr, unused_qual];
731+
let mut a = vec![attr];
740732
a.extend(self.attributes.iter().cloned());
741733

742734
cx.item(

0 commit comments

Comments
 (0)