]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #60823 - oli-obk:used_unused_no_mangle, r=michaelwoerister
authorMazdak Farrokhzad <twingoow@gmail.com>
Mon, 20 May 2019 21:03:00 +0000 (23:03 +0200)
committerGitHub <noreply@github.com>
Mon, 20 May 2019 21:03:00 +0000 (23:03 +0200)
Fix incremental compilation of cdylib emitting spurious unused_attributes lint

fixes #60050

src/libsyntax/feature_gate.rs
src/test/incremental/no_mangle.rs [new file with mode: 0644]
src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.rs
src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr

index 8a066f3f4a093a82c2fd96c84727d31a166520c3..5b1a9bb739ff8346ec9e889b313d0bebf67129e2 100644 (file)
@@ -998,7 +998,7 @@ pub fn is_builtin_attr(attr: &ast::Attribute) -> bool {
     (sym::repr, Normal, template!(List: "C, packed, ..."), Ungated),
     (sym::path, Normal, template!(NameValueStr: "file"), Ungated),
     (sym::automatically_derived, Normal, template!(Word), Ungated),
-    (sym::no_mangle, Normal, template!(Word), Ungated),
+    (sym::no_mangle, Whitelisted, template!(Word), Ungated),
     (sym::no_link, Normal, template!(Word), Ungated),
     (sym::derive, Normal, template!(List: "Trait1, Trait2, ..."), Ungated),
     (
diff --git a/src/test/incremental/no_mangle.rs b/src/test/incremental/no_mangle.rs
new file mode 100644 (file)
index 0000000..1b17886
--- /dev/null
@@ -0,0 +1,10 @@
+// revisions:rpass1 rpass2
+// compile-flags: --crate-type cdylib
+// skip-codegen
+
+#![deny(unused_attributes)]
+
+#[no_mangle]
+pub extern "C" fn rust_no_mangle() -> i32 {
+    42
+}
index 0129a3f72b2422d0b7c59ef6fd6ebc1b7c778f0d..ca0a432d3396e1a446f26c91c5018a5b000d115c 100644 (file)
@@ -52,7 +52,7 @@
 //~^ WARN unused attribute
 #![path = "3800"] //~ WARN unused attribute
 #![automatically_derived] //~ WARN unused attribute
-#![no_mangle] //~ WARN unused attribute
+#![no_mangle]
 #![no_link] //~ WARN unused attribute
 // see issue-43106-gating-of-derive.rs
 #![should_panic] //~ WARN unused attribute
index dcbe13a749f69b981661308165761959c3a26d47..c7081205e148195bdc5e2007bd025d2ffaf59a3f 100644 (file)
@@ -1152,12 +1152,6 @@ warning: unused attribute
 LL | #![automatically_derived]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^
 
-warning: unused attribute
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:55:1
-   |
-LL | #![no_mangle]
-   | ^^^^^^^^^^^^^
-
 warning: unused attribute
   --> $DIR/issue-43106-gating-of-builtin-attrs.rs:56:1
    |