Skip to content

Commit 36b5724

Browse files
authored
Rollup merge of rust-lang#60823 - oli-obk:used_unused_no_mangle, r=michaelwoerister
Fix incremental compilation of cdylib emitting spurious unused_attributes lint fixes rust-lang#60050
2 parents a34dae3 + e92d13e commit 36b5724

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

src/libsyntax/feature_gate.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -998,7 +998,7 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
998998
(sym::repr, Normal, template!(List: "C, packed, ..."), Ungated),
999999
(sym::path, Normal, template!(NameValueStr: "file"), Ungated),
10001000
(sym::automatically_derived, Normal, template!(Word), Ungated),
1001-
(sym::no_mangle, Normal, template!(Word), Ungated),
1001+
(sym::no_mangle, Whitelisted, template!(Word), Ungated),
10021002
(sym::no_link, Normal, template!(Word), Ungated),
10031003
(sym::derive, Normal, template!(List: "Trait1, Trait2, ..."), Ungated),
10041004
(

src/test/incremental/no_mangle.rs

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// revisions:rpass1 rpass2
2+
// compile-flags: --crate-type cdylib
3+
// skip-codegen
4+
5+
#![deny(unused_attributes)]
6+
7+
#[no_mangle]
8+
pub extern "C" fn rust_no_mangle() -> i32 {
9+
42
10+
}

src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
//~^ WARN unused attribute
5353
#![path = "3800"] //~ WARN unused attribute
5454
#![automatically_derived] //~ WARN unused attribute
55-
#![no_mangle] //~ WARN unused attribute
55+
#![no_mangle]
5656
#![no_link] //~ WARN unused attribute
5757
// see issue-43106-gating-of-derive.rs
5858
#![should_panic] //~ WARN unused attribute

src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr

-6
Original file line numberDiff line numberDiff line change
@@ -1152,12 +1152,6 @@ warning: unused attribute
11521152
LL | #![automatically_derived]
11531153
| ^^^^^^^^^^^^^^^^^^^^^^^^^
11541154

1155-
warning: unused attribute
1156-
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:55:1
1157-
|
1158-
LL | #![no_mangle]
1159-
| ^^^^^^^^^^^^^
1160-
11611155
warning: unused attribute
11621156
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:56:1
11631157
|

0 commit comments

Comments
 (0)