From d7d704537457c613e667e9f0cd9fda32600bfb36 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 21 Sep 2018 15:58:11 -0700 Subject: [PATCH] rustc: Allow `#[no_mangle]` anywhere in a crate This commit updates the compiler to allow the `#[no_mangle]` (and `#[export_name]` attributes) to be located anywhere within a crate. These attributes are unconditionally processed, causing the compiler to always generate an exported symbol with the appropriate name. After some discussion on #54135 it was found that not a great reason this hasn't been allowed already, and it seems to match the behavior that many expect! Previously the compiler would only export a `#[no_mangle]` symbol if it were *publicly reachable*, meaning that it itself is `pub` and it's otherwise publicly reachable from the root of the crate. This new definition is that `#[no_mangle]` *is always reachable*, no matter where it is in a crate or whether it has `pub` or not. This should make it much easier to declare an exported symbol with a known and unique name, even when it's an internal implementation detail of the crate itself. Note that these symbols will persist beyond LTO as well, always making their way to the linker. Along the way this commit removes the `private_no_mangle_functions` lint (also for statics) as there's no longer any need to lint these situations. Furthermore a good number of tests were updated now that symbol visibility has been changed. Closes #54135 --- src/librustc/hir/mod.rs | 17 +- src/librustc/middle/dead.rs | 15 +- src/librustc/middle/reachable.rs | 2 +- src/librustc_lint/builtin.rs | 61 +---- src/librustc_lint/lib.rs | 4 + src/libstd/panicking.rs | 8 +- src/test/codegen/export-no-mangle.rs | 29 ++ src/test/codegen/external-no-mangle-fns.rs | 63 +++++ .../codegen/external-no-mangle-statics.rs | 88 ++++++ .../codegen/issue-44056-macos-tls-align.rs | 6 +- src/test/codegen/lto-removes-invokes.rs | 4 +- .../extern-fn-reachable/main.rs | 4 +- .../run-make/thumb-none-cortex-m/Makefile | 2 + .../auxiliary/linkage-visibility.rs | 4 +- src/test/run-pass/issues/issue-33992.rs | 1 + .../issue-43106-gating-of-builtin-attrs.rs | 1 - ...issue-43106-gating-of-builtin-attrs.stderr | 252 +++++++++--------- src/test/ui/lint/lint-unexported-no-mangle.rs | 4 +- .../ui/lint/lint-unexported-no-mangle.stderr | 27 +- src/test/ui/lint/suggestions.rs | 29 +- src/test/ui/lint/suggestions.stderr | 82 +++--- src/tools/cargotest/main.rs | 4 +- 22 files changed, 400 insertions(+), 307 deletions(-) create mode 100644 src/test/codegen/export-no-mangle.rs create mode 100644 src/test/codegen/external-no-mangle-fns.rs create mode 100644 src/test/codegen/external-no-mangle-statics.rs diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index 088bee3811680..b9310613d82fe 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -2370,9 +2370,22 @@ impl CodegenFnAttrs { } } - /// True if `#[no_mangle]` or `#[export_name(...)]` is present. + /// True if it looks like this symbol needs to be exported, for example: + /// + /// * `#[no_mangle]` is present + /// * `#[export_name(...)]` is present + /// * `#[linkage]` is present pub fn contains_extern_indicator(&self) -> bool { - self.flags.contains(CodegenFnAttrFlags::NO_MANGLE) || self.export_name.is_some() + self.flags.contains(CodegenFnAttrFlags::NO_MANGLE) || + self.export_name.is_some() || + match self.linkage { + // these are private, make sure we don't try to consider + // them external + None | + Some(Linkage::Internal) | + Some(Linkage::Private) => false, + Some(_) => true, + } } } diff --git a/src/librustc/middle/dead.rs b/src/librustc/middle/dead.rs index 66305ae8836ee..c4a44ac3d67ef 100644 --- a/src/librustc/middle/dead.rs +++ b/src/librustc/middle/dead.rs @@ -18,6 +18,7 @@ use hir::intravisit::{self, Visitor, NestedVisitorMap}; use hir::itemlikevisit::ItemLikeVisitor; use hir::def::Def; +use hir::CodegenFnAttrFlags; use hir::def_id::{DefId, LOCAL_CRATE}; use lint; use middle::privacy; @@ -304,14 +305,18 @@ fn has_allow_dead_code_or_lang_attr(tcx: TyCtxt<'_, '_, '_>, return true; } - // #[used] also keeps the item alive forcefully, - // e.g. for placing it in a specific section. - if attr::contains_name(attrs, "used") { + // Don't lint about global allocators + if attr::contains_name(attrs, "global_allocator") { return true; } - // Don't lint about global allocators - if attr::contains_name(attrs, "global_allocator") { + let def_id = tcx.hir.local_def_id(id); + let cg_attrs = tcx.codegen_fn_attrs(def_id); + + // #[used], #[no_mangle], #[export_name], etc also keeps the item alive + // forcefully, e.g. for placing it in a specific section. + if cg_attrs.contains_extern_indicator() || + cg_attrs.flags.contains(CodegenFnAttrFlags::USED) { return true; } diff --git a/src/librustc/middle/reachable.rs b/src/librustc/middle/reachable.rs index 9416d60c9d1a3..ce11cbdbe72fb 100644 --- a/src/librustc/middle/reachable.rs +++ b/src/librustc/middle/reachable.rs @@ -352,7 +352,7 @@ impl<'a, 'tcx: 'a> ItemLikeVisitor<'tcx> for CollectPrivateImplItemsVisitor<'a, // which are currently akin to allocator symbols. let def_id = self.tcx.hir.local_def_id(item.id); let codegen_attrs = self.tcx.codegen_fn_attrs(def_id); - if codegen_attrs.linkage.is_some() || + if codegen_attrs.contains_extern_indicator() || codegen_attrs.flags.contains(CodegenFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL) { self.worklist.push(item.id); } diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index 7eda6e94dd071..f04e5496ce443 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -1163,18 +1163,6 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for PluginAsLibrary { } } -declare_lint! { - PRIVATE_NO_MANGLE_FNS, - Warn, - "functions marked #[no_mangle] should be exported" -} - -declare_lint! { - PRIVATE_NO_MANGLE_STATICS, - Warn, - "statics marked #[no_mangle] should be exported" -} - declare_lint! { NO_MANGLE_CONST_ITEMS, Deny, @@ -1192,52 +1180,16 @@ pub struct InvalidNoMangleItems; impl LintPass for InvalidNoMangleItems { fn get_lints(&self) -> LintArray { - lint_array!(PRIVATE_NO_MANGLE_FNS, - PRIVATE_NO_MANGLE_STATICS, - NO_MANGLE_CONST_ITEMS, + lint_array!(NO_MANGLE_CONST_ITEMS, NO_MANGLE_GENERIC_ITEMS) } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for InvalidNoMangleItems { fn check_item(&mut self, cx: &LateContext, it: &hir::Item) { - let suggest_export = |vis: &hir::Visibility, err: &mut DiagnosticBuilder| { - let suggestion = match vis.node { - hir::VisibilityKind::Inherited => { - // inherited visibility is empty span at item start; need an extra space - Some("pub ".to_owned()) - }, - hir::VisibilityKind::Restricted { .. } | - hir::VisibilityKind::Crate(_) => { - Some("pub".to_owned()) - }, - hir::VisibilityKind::Public => { - err.help("try exporting the item with a `pub use` statement"); - None - } - }; - if let Some(replacement) = suggestion { - err.span_suggestion_with_applicability( - vis.span, - "try making it public", - replacement, - Applicability::MachineApplicable - ); - } - }; - match it.node { hir::ItemKind::Fn(.., ref generics, _) => { if let Some(no_mangle_attr) = attr::find_by_name(&it.attrs, "no_mangle") { - if attr::contains_name(&it.attrs, "linkage") { - return; - } - if !cx.access_levels.is_reachable(it.id) { - let msg = "function is marked #[no_mangle], but not exported"; - let mut err = cx.struct_span_lint(PRIVATE_NO_MANGLE_FNS, it.span, msg); - suggest_export(&it.vis, &mut err); - err.emit(); - } for param in &generics.params { match param.kind { GenericParamKind::Lifetime { .. } => {} @@ -1261,15 +1213,6 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for InvalidNoMangleItems { } } } - hir::ItemKind::Static(..) => { - if attr::contains_name(&it.attrs, "no_mangle") && - !cx.access_levels.is_reachable(it.id) { - let msg = "static is marked #[no_mangle], but not exported"; - let mut err = cx.struct_span_lint(PRIVATE_NO_MANGLE_STATICS, it.span, msg); - suggest_export(&it.vis, &mut err); - err.emit(); - } - } hir::ItemKind::Const(..) => { if attr::contains_name(&it.attrs, "no_mangle") { // Const items do not refer to a particular location in memory, and therefore @@ -1785,8 +1728,6 @@ impl LintPass for SoftLints { UNUSED_DOC_COMMENTS, UNCONDITIONAL_RECURSION, PLUGIN_AS_LIBRARY, - PRIVATE_NO_MANGLE_FNS, - PRIVATE_NO_MANGLE_STATICS, NO_MANGLE_CONST_ITEMS, NO_MANGLE_GENERIC_ITEMS, MUTABLE_TRANSMUTES, diff --git a/src/librustc_lint/lib.rs b/src/librustc_lint/lib.rs index 98d4c87dc3b5e..bdf09007fdd46 100644 --- a/src/librustc_lint/lib.rs +++ b/src/librustc_lint/lib.rs @@ -387,4 +387,8 @@ pub fn register_builtins(store: &mut lint::LintStore, sess: Option<&Session>) { "converted into hard error, see https://github.com/rust-lang/rust/issues/48950"); store.register_removed("resolve_trait_on_defaulted_unit", "converted into hard error, see https://github.com/rust-lang/rust/issues/48950"); + store.register_removed("private_no_mangle_fns", + "no longer an warning, #[no_mangle] functions always exported"); + store.register_removed("private_no_mangle_statics", + "no longer an warning, #[no_mangle] statics always exported"); } diff --git a/src/libstd/panicking.rs b/src/libstd/panicking.rs index df085a7f450b0..a0590a800d3cc 100644 --- a/src/libstd/panicking.rs +++ b/src/libstd/panicking.rs @@ -515,11 +515,11 @@ pub fn update_count_then_panic(msg: Box) -> ! { rust_panic(&mut RewrapBox(msg)) } -/// A private no-mangle function on which to slap yer breakpoints. +/// An unmangled function (through `rustc_std_internal_symbol`) on which to slap +/// yer breakpoints. #[inline(never)] -#[no_mangle] -#[allow(private_no_mangle_fns)] // yes we get it, but we like breakpoints -pub fn rust_panic(mut msg: &mut dyn BoxMeUp) -> ! { +#[cfg_attr(not(test), rustc_std_internal_symbol)] +fn rust_panic(mut msg: &mut dyn BoxMeUp) -> ! { let code = unsafe { let obj = &mut msg as *mut &mut dyn BoxMeUp; __rust_start_panic(obj as usize) diff --git a/src/test/codegen/export-no-mangle.rs b/src/test/codegen/export-no-mangle.rs new file mode 100644 index 0000000000000..3546284f9a3c5 --- /dev/null +++ b/src/test/codegen/export-no-mangle.rs @@ -0,0 +1,29 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type = "lib"] + +mod private { + // CHECK: @FOO = + #[no_mangle] + pub static FOO: u32 = 3; + + // CHECK: @BAR = + #[export_name = "BAR"] + static BAR: u32 = 3; + + // CHECK: void @foo() + #[no_mangle] + pub extern fn foo() {} + + // CHECK: void @bar() + #[export_name = "bar"] + extern fn bar() {} +} diff --git a/src/test/codegen/external-no-mangle-fns.rs b/src/test/codegen/external-no-mangle-fns.rs new file mode 100644 index 0000000000000..3f092b802f99a --- /dev/null +++ b/src/test/codegen/external-no-mangle-fns.rs @@ -0,0 +1,63 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags: -O +// `#[no_mangle]`d functions always have external linkage, i.e. no `internal` in their `define`s + +#![crate_type = "lib"] +#![no_std] + +// CHECK: define void @a() +#[no_mangle] +fn a() {} + +// CHECK: define void @b() +#[no_mangle] +pub fn b() {} + +mod private { + // CHECK: define void @c() + #[no_mangle] + fn c() {} + + // CHECK: define void @d() + #[no_mangle] + pub fn d() {} +} + +const HIDDEN: () = { + // CHECK: define void @e() + #[no_mangle] + fn e() {} + + // CHECK: define void @f() + #[no_mangle] + pub fn f() {} +}; + +// The surrounding item should not accidentally become external +// CHECK: define internal {{.*}} void @_ZN22external_no_mangle_fns1x +#[inline(never)] +fn x() { + // CHECK: define void @g() + #[no_mangle] + fn g() { + x(); + } + + // CHECK: define void @h() + #[no_mangle] + pub fn h() {} + + // side effect to keep `x` around + unsafe { + core::ptr::read_volatile(&42); + } +} diff --git a/src/test/codegen/external-no-mangle-statics.rs b/src/test/codegen/external-no-mangle-statics.rs new file mode 100644 index 0000000000000..59d829633e55c --- /dev/null +++ b/src/test/codegen/external-no-mangle-statics.rs @@ -0,0 +1,88 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags: -O +// `#[no_mangle]`d static variables always have external linkage, i.e. no `internal` in their +// definitions + +#![crate_type = "lib"] +#![no_std] + +// CHECK: @A = local_unnamed_addr constant +#[no_mangle] +static A: u8 = 0; + +// CHECK: @B = local_unnamed_addr global +#[no_mangle] +static mut B: u8 = 0; + +// CHECK: @C = local_unnamed_addr constant +#[no_mangle] +pub static C: u8 = 0; + +// CHECK: @D = local_unnamed_addr global +#[no_mangle] +pub static mut D: u8 = 0; + +mod private { + // CHECK: @E = local_unnamed_addr constant + #[no_mangle] + static E: u8 = 0; + + // CHECK: @F = local_unnamed_addr global + #[no_mangle] + static mut F: u8 = 0; + + // CHECK: @G = local_unnamed_addr constant + #[no_mangle] + pub static G: u8 = 0; + + // CHECK: @H = local_unnamed_addr global + #[no_mangle] + pub static mut H: u8 = 0; +} + +const HIDDEN: () = { + // CHECK: @I = local_unnamed_addr constant + #[no_mangle] + static I: u8 = 0; + + // CHECK: @J = local_unnamed_addr global + #[no_mangle] + static mut J: u8 = 0; + + // CHECK: @K = local_unnamed_addr constant + #[no_mangle] + pub static K: u8 = 0; + + // CHECK: @L = local_unnamed_addr global + #[no_mangle] + pub static mut L: u8 = 0; +}; + +// The surrounding item should not accidentally become external +fn x() { + // CHECK: @M = local_unnamed_addr constant + #[no_mangle] + static M: fn() = x; + + // CHECK: @N = local_unnamed_addr global + #[no_mangle] + static mut N: u8 = 0; + + // CHECK: @O = local_unnamed_addr constant + #[no_mangle] + pub static O: u8 = 0; + + // CHECK: @P = local_unnamed_addr global + #[no_mangle] + pub static mut P: u8 = 0; +} +// CHECK: define internal void @_ZN26external_no_mangle_statics1x{{.*$}} diff --git a/src/test/codegen/issue-44056-macos-tls-align.rs b/src/test/codegen/issue-44056-macos-tls-align.rs index 3235ef0bb3335..b146e106aa104 100644 --- a/src/test/codegen/issue-44056-macos-tls-align.rs +++ b/src/test/codegen/issue-44056-macos-tls-align.rs @@ -17,15 +17,13 @@ #![crate_type = "rlib"] #![feature(thread_local)] -// CHECK: @STATIC_VAR_1 = internal thread_local unnamed_addr global <{ [32 x i8] }> zeroinitializer, section "__DATA,__thread_bss", align 4 +// CHECK: @STATIC_VAR_1 = thread_local local_unnamed_addr global <{ [32 x i8] }> zeroinitializer, section "__DATA,__thread_bss", align 4 #[no_mangle] -#[allow(private_no_mangle_statics)] #[thread_local] static mut STATIC_VAR_1: [u32; 8] = [0; 8]; -// CHECK: @STATIC_VAR_2 = internal thread_local unnamed_addr global <{ [32 x i8] }> <{{[^>]*}}>, section "__DATA,__thread_data", align 4 +// CHECK: @STATIC_VAR_2 = thread_local local_unnamed_addr global <{ [32 x i8] }> <{{[^>]*}}>, section "__DATA,__thread_data", align 4 #[no_mangle] -#[allow(private_no_mangle_statics)] #[thread_local] static mut STATIC_VAR_2: [u32; 8] = [4; 8]; diff --git a/src/test/codegen/lto-removes-invokes.rs b/src/test/codegen/lto-removes-invokes.rs index b2f43489523d1..5ddca4763260d 100644 --- a/src/test/codegen/lto-removes-invokes.rs +++ b/src/test/codegen/lto-removes-invokes.rs @@ -20,8 +20,8 @@ fn main() { fn foo() { let _a = Box::new(3); bar(); -// CHECK-LABEL: foo -// CHECK: call {{.*}} void @bar +// CHECK-LABEL: define void @foo +// CHECK: call void @bar } #[inline(never)] diff --git a/src/test/run-make-fulldeps/extern-fn-reachable/main.rs b/src/test/run-make-fulldeps/extern-fn-reachable/main.rs index 27387332c1c1f..f0a9e95ed5af5 100644 --- a/src/test/run-make-fulldeps/extern-fn-reachable/main.rs +++ b/src/test/run-make-fulldeps/extern-fn-reachable/main.rs @@ -20,8 +20,8 @@ pub fn main() { let path = Path::new("libdylib.so"); let a = DynamicLibrary::open(Some(&path)).unwrap(); assert!(a.symbol::("fun1").is_ok()); - assert!(a.symbol::("fun2").is_err()); - assert!(a.symbol::("fun3").is_err()); + assert!(a.symbol::("fun2").is_ok()); + assert!(a.symbol::("fun3").is_ok()); assert!(a.symbol::("fun4").is_ok()); assert!(a.symbol::("fun5").is_ok()); } diff --git a/src/test/run-make/thumb-none-cortex-m/Makefile b/src/test/run-make/thumb-none-cortex-m/Makefile index a267016efc2e3..741bce921e67e 100644 --- a/src/test/run-make/thumb-none-cortex-m/Makefile +++ b/src/test/run-make/thumb-none-cortex-m/Makefile @@ -25,6 +25,8 @@ CRATE := cortex-m CRATE_URL := https://github.com/rust-embedded/cortex-m CRATE_SHA1 := a448e9156e2cb1e556e5441fd65426952ef4b927 # 0.5.0 +export RUSTFLAGS := --cap-lints=allow + all: env mkdir -p $(WORK_DIR) diff --git a/src/test/run-pass-fulldeps/auxiliary/linkage-visibility.rs b/src/test/run-pass-fulldeps/auxiliary/linkage-visibility.rs index 7a15a4cb3a2e8..4ea3d0d0d0a07 100644 --- a/src/test/run-pass-fulldeps/auxiliary/linkage-visibility.rs +++ b/src/test/run-pass-fulldeps/auxiliary/linkage-visibility.rs @@ -39,7 +39,7 @@ pub fn test() { let lib = DynamicLibrary::open(None).unwrap(); unsafe { assert!(lib.symbol::("foo").is_ok()); - assert!(lib.symbol::("baz").is_err()); - assert!(lib.symbol::("bar").is_err()); + assert!(lib.symbol::("baz").is_ok()); + assert!(lib.symbol::("bar").is_ok()); } } diff --git a/src/test/run-pass/issues/issue-33992.rs b/src/test/run-pass/issues/issue-33992.rs index d10c11644d5b9..cb9f5ca698dd7 100644 --- a/src/test/run-pass/issues/issue-33992.rs +++ b/src/test/run-pass/issues/issue-33992.rs @@ -11,6 +11,7 @@ // run-pass // ignore-windows // ignore-macos +// ignore-wasm32-bare common linkage not implemented right now #![feature(linkage)] diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.rs b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.rs index dd235cb9c3aa9..bbddbb7d679a8 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.rs +++ b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.rs @@ -393,7 +393,6 @@ mod no_mangle { mod inner { #![no_mangle="3500"] } #[no_mangle = "3500"] fn f() { } - //~^ WARN function is marked #[no_mangle], but not exported #[no_mangle = "3500"] struct S; diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr index fd38fb6f97641..3b31b411f3f56 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr @@ -173,13 +173,13 @@ LL | #[deny(x5100)] impl S { } | ^^^^^ warning: macro_escape is a deprecated synonym for macro_use - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:501:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:500:1 | LL | #[macro_escape] | ^^^^^^^^^^^^^^^ warning: macro_escape is a deprecated synonym for macro_use - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:504:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:503:17 | LL | mod inner { #![macro_escape] } | ^^^^^^^^^^^^^^^^ @@ -523,720 +523,710 @@ warning: unused attribute LL | #[automatically_derived = "3600"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: function is marked #[no_mangle], but not exported - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:395:27 - | -LL | #[no_mangle = "3500"] fn f() { } - | -^^^^^^^^^ - | | - | help: try making it public: `pub` - | - = note: #[warn(private_no_mangle_fns)] on by default - warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:408:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:407:17 | LL | mod inner { #![no_link="3400"] } | ^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:411:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:410:5 | LL | #[no_link = "3400"] fn f() { } | ^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:414:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:413:5 | LL | #[no_link = "3400"] struct S; | ^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:417:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:416:5 | LL | #[no_link = "3400"]type T = S; | ^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:420:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:419:5 | LL | #[no_link = "3400"] impl S { } | ^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:405:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:404:1 | LL | #[no_link = "3400"] | ^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:427:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:426:17 | LL | mod inner { #![should_panic="3200"] } | ^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:430:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:429:5 | LL | #[should_panic = "3200"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:433:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:432:5 | LL | #[should_panic = "3200"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:436:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:435:5 | LL | #[should_panic = "3200"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:439:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:438:5 | LL | #[should_panic = "3200"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:424:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:423:1 | LL | #[should_panic = "3200"] | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:446:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:445:17 | LL | mod inner { #![ignore="3100"] } | ^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:449:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:448:5 | LL | #[ignore = "3100"] fn f() { } | ^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:452:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:451:5 | LL | #[ignore = "3100"] struct S; | ^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:455:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:454:5 | LL | #[ignore = "3100"] type T = S; | ^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:458:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:457:5 | LL | #[ignore = "3100"] impl S { } | ^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:443:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:442:1 | LL | #[ignore = "3100"] | ^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:465:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:464:17 | LL | mod inner { #![no_implicit_prelude="3000"] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:468:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:467:5 | LL | #[no_implicit_prelude = "3000"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:471:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:470:5 | LL | #[no_implicit_prelude = "3000"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:474:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:473:5 | LL | #[no_implicit_prelude = "3000"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:477:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:476:5 | LL | #[no_implicit_prelude = "3000"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:462:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:461:1 | LL | #[no_implicit_prelude = "3000"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:484:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:483:17 | LL | mod inner { #![reexport_test_harness_main="2900"] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:487:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:486:5 | LL | #[reexport_test_harness_main = "2900"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:490:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:489:5 | LL | #[reexport_test_harness_main = "2900"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:493:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:492:5 | LL | #[reexport_test_harness_main = "2900"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:496:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:495:5 | LL | #[reexport_test_harness_main = "2900"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:481:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:480:1 | LL | #[reexport_test_harness_main = "2900"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:507:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:506:5 | LL | #[macro_escape] fn f() { } | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:510:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:509:5 | LL | #[macro_escape] struct S; | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:513:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:512:5 | LL | #[macro_escape] type T = S; | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:516:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:515:5 | LL | #[macro_escape] impl S { } | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:524:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:523:17 | LL | mod inner { #![no_std="2600"] } | ^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:524:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:523:17 | LL | mod inner { #![no_std="2600"] } | ^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:528:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:527:5 | LL | #[no_std = "2600"] fn f() { } | ^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:528:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:527:5 | LL | #[no_std = "2600"] fn f() { } | ^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:532:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:531:5 | LL | #[no_std = "2600"] struct S; | ^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:532:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:531:5 | LL | #[no_std = "2600"] struct S; | ^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:536:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:535:5 | LL | #[no_std = "2600"] type T = S; | ^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:536:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:535:5 | LL | #[no_std = "2600"] type T = S; | ^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:540:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:539:5 | LL | #[no_std = "2600"] impl S { } | ^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:540:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:539:5 | LL | #[no_std = "2600"] impl S { } | ^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:520:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:519:1 | LL | #[no_std = "2600"] | ^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:520:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:519:1 | LL | #[no_std = "2600"] | ^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:679:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:678:17 | LL | mod inner { #![crate_name="0900"] } | ^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:679:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:678:17 | LL | mod inner { #![crate_name="0900"] } | ^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:683:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:682:5 | LL | #[crate_name = "0900"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:683:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:682:5 | LL | #[crate_name = "0900"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:687:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:686:5 | LL | #[crate_name = "0900"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:687:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:686:5 | LL | #[crate_name = "0900"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:691:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:690:5 | LL | #[crate_name = "0900"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:691:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:690:5 | LL | #[crate_name = "0900"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:695:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:694:5 | LL | #[crate_name = "0900"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:695:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:694:5 | LL | #[crate_name = "0900"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:675:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:674:1 | LL | #[crate_name = "0900"] | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:675:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:674:1 | LL | #[crate_name = "0900"] | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:704:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:703:17 | LL | mod inner { #![crate_type="0800"] } | ^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:704:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:703:17 | LL | mod inner { #![crate_type="0800"] } | ^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:708:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:707:5 | LL | #[crate_type = "0800"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:708:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:707:5 | LL | #[crate_type = "0800"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:712:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:711:5 | LL | #[crate_type = "0800"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:712:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:711:5 | LL | #[crate_type = "0800"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:716:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:715:5 | LL | #[crate_type = "0800"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:716:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:715:5 | LL | #[crate_type = "0800"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:720:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:719:5 | LL | #[crate_type = "0800"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:720:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:719:5 | LL | #[crate_type = "0800"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:700:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:699:1 | LL | #[crate_type = "0800"] | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:700:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:699:1 | LL | #[crate_type = "0800"] | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:729:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:728:17 | LL | mod inner { #![feature(x0600)] } | ^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:729:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:728:17 | LL | mod inner { #![feature(x0600)] } | ^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:733:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:732:5 | LL | #[feature(x0600)] fn f() { } | ^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:733:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:732:5 | LL | #[feature(x0600)] fn f() { } | ^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:737:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:736:5 | LL | #[feature(x0600)] struct S; | ^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:737:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:736:5 | LL | #[feature(x0600)] struct S; | ^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:741:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:740:5 | LL | #[feature(x0600)] type T = S; | ^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:741:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:740:5 | LL | #[feature(x0600)] type T = S; | ^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:745:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:744:5 | LL | #[feature(x0600)] impl S { } | ^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:745:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:744:5 | LL | #[feature(x0600)] impl S { } | ^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:725:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:724:1 | LL | #[feature(x0600)] | ^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:725:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:724:1 | LL | #[feature(x0600)] | ^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:755:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:754:17 | LL | mod inner { #![no_main="0400"] } | ^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:755:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:754:17 | LL | mod inner { #![no_main="0400"] } | ^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:759:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:758:5 | LL | #[no_main = "0400"] fn f() { } | ^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:759:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:758:5 | LL | #[no_main = "0400"] fn f() { } | ^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:763:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:762:5 | LL | #[no_main = "0400"] struct S; | ^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:763:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:762:5 | LL | #[no_main = "0400"] struct S; | ^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:767:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:766:5 | LL | #[no_main = "0400"] type T = S; | ^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:767:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:766:5 | LL | #[no_main = "0400"] type T = S; | ^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:771:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:770:5 | LL | #[no_main = "0400"] impl S { } | ^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:771:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:770:5 | LL | #[no_main = "0400"] impl S { } | ^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:751:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:750:1 | LL | #[no_main = "0400"] | ^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:751:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:750:1 | LL | #[no_main = "0400"] | ^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:793:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:792:17 | LL | mod inner { #![recursion_limit="0200"] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:793:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:792:17 | LL | mod inner { #![recursion_limit="0200"] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:797:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:796:5 | LL | #[recursion_limit="0200"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:797:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:796:5 | LL | #[recursion_limit="0200"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:801:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:800:5 | LL | #[recursion_limit="0200"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:801:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:800:5 | LL | #[recursion_limit="0200"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:805:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:804:5 | LL | #[recursion_limit="0200"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:805:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:804:5 | LL | #[recursion_limit="0200"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:809:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:808:5 | LL | #[recursion_limit="0200"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:809:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:808:5 | LL | #[recursion_limit="0200"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:789:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:788:1 | LL | #[recursion_limit="0200"] | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:789:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:788:1 | LL | #[recursion_limit="0200"] | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:818:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:817:17 | LL | mod inner { #![type_length_limit="0100"] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:818:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:817:17 | LL | mod inner { #![type_length_limit="0100"] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:822:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:821:5 | LL | #[type_length_limit="0100"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:822:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:821:5 | LL | #[type_length_limit="0100"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:826:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:825:5 | LL | #[type_length_limit="0100"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:826:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:825:5 | LL | #[type_length_limit="0100"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:830:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:829:5 | LL | #[type_length_limit="0100"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:830:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:829:5 | LL | #[type_length_limit="0100"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:834:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:833:5 | LL | #[type_length_limit="0100"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:834:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:833:5 | LL | #[type_length_limit="0100"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:814:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:813:1 | LL | #[type_length_limit="0100"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:814:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:813:1 | LL | #[type_length_limit="0100"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1314,7 +1304,7 @@ LL | #![proc_macro_derive = "2500"] //~ WARN unused attribute | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: compilation successful - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:845:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:844:1 | LL | / fn main() { //~ ERROR compilation successful LL | | println!("Hello World"); diff --git a/src/test/ui/lint/lint-unexported-no-mangle.rs b/src/test/ui/lint/lint-unexported-no-mangle.rs index cd64dfa7a47dd..8188c2c455e40 100644 --- a/src/test/ui/lint/lint-unexported-no-mangle.rs +++ b/src/test/ui/lint/lint-unexported-no-mangle.rs @@ -11,7 +11,7 @@ // compile-flags:-F private_no_mangle_fns -F no_mangle_const_items -F private_no_mangle_statics #[no_mangle] -fn foo() { //~ ERROR function is marked #[no_mangle], but not exported +fn foo() { } #[allow(dead_code)] @@ -30,7 +30,7 @@ pub static BAR: u64 = 1; #[allow(dead_code)] #[no_mangle] -static PRIVATE_BAR: u64 = 1; //~ ERROR static is marked #[no_mangle], but not exported +static PRIVATE_BAR: u64 = 1; fn main() { diff --git a/src/test/ui/lint/lint-unexported-no-mangle.stderr b/src/test/ui/lint/lint-unexported-no-mangle.stderr index e7d49f339e6d8..063915d5b5f9a 100644 --- a/src/test/ui/lint/lint-unexported-no-mangle.stderr +++ b/src/test/ui/lint/lint-unexported-no-mangle.stderr @@ -1,15 +1,10 @@ -error: function is marked #[no_mangle], but not exported - --> $DIR/lint-unexported-no-mangle.rs:14:1 +warning: lint `private_no_mangle_fns` has been removed: `no longer an warning, #[no_mangle] functions always exported` | -LL | fn foo() { //~ ERROR function is marked #[no_mangle], but not exported - | ^ - | | - | _help: try making it public: `pub` - | | -LL | | } - | |_^ + = note: requested on the command line with `-F private_no_mangle_fns` + +warning: lint `private_no_mangle_statics` has been removed: `no longer an warning, #[no_mangle] statics always exported` | - = note: requested on the command line with `-F private-no-mangle-fns` + = note: requested on the command line with `-F private_no_mangle_statics` error: const items should never be #[no_mangle] --> $DIR/lint-unexported-no-mangle.rs:19:1 @@ -29,15 +24,5 @@ LL | pub const PUB_FOO: u64 = 1; //~ ERROR const items should never be #[no_mang | | | help: try a static value: `pub static` -error: static is marked #[no_mangle], but not exported - --> $DIR/lint-unexported-no-mangle.rs:33:1 - | -LL | static PRIVATE_BAR: u64 = 1; //~ ERROR static is marked #[no_mangle], but not exported - | -^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | help: try making it public: `pub` - | - = note: requested on the command line with `-F private-no-mangle-statics` - -error: aborting due to 4 previous errors +error: aborting due to 2 previous errors diff --git a/src/test/ui/lint/suggestions.rs b/src/test/ui/lint/suggestions.rs index 4da2700cb9fdb..ff50b3b1ab68f 100644 --- a/src/test/ui/lint/suggestions.rs +++ b/src/test/ui/lint/suggestions.rs @@ -13,9 +13,6 @@ #![warn(unused_mut, unused_parens)] // UI tests pass `-A unused`—see Issue #43896 #![feature(no_debug)] -#[no_mangle] static SHENZHOU: usize = 1; -//~^ WARN static is marked #[no_mangle] -//~| HELP try making it public #[no_mangle] const DISCOVERY: usize = 1; //~^ ERROR const items should never be #[no_mangle] //~| HELP try a static value @@ -27,27 +24,25 @@ pub fn defiant(_t: T) {} #[no_mangle] fn rio_grande() {} -//~^ WARN function is marked -//~| HELP try making it public mod badlands { // The private-no-mangle lints shouldn't suggest inserting `pub` when the // item is already `pub` (but triggered the lint because, e.g., it's in a // private module). (Issue #47383) - #[no_mangle] pub static DAUNTLESS: bool = true; - //~^ WARN static is marked - //~| HELP try exporting the item with a `pub use` statement - #[no_mangle] pub fn val_jean() {} - //~^ WARN function is marked - //~| HELP try exporting the item with a `pub use` statement + #[no_mangle] pub const DAUNTLESS: bool = true; + //~^ ERROR const items should never be #[no_mangle] + //~| HELP try a static value + #[no_mangle] pub fn val_jean() {} + //~^ WARN functions generic over types must be mangled + //~| HELP remove this attribute // ... but we can suggest just-`pub` instead of restricted - #[no_mangle] pub(crate) static VETAR: bool = true; - //~^ WARN static is marked - //~| HELP try making it public - #[no_mangle] pub(crate) fn crossfield() {} - //~^ WARN function is marked - //~| HELP try making it public + #[no_mangle] pub(crate) const VETAR: bool = true; + //~^ ERROR const items should never be #[no_mangle] + //~| HELP try a static value + #[no_mangle] pub(crate) fn crossfield() {} + //~^ WARN functions generic over types must be mangled + //~| HELP remove this attribute } struct Equinox { diff --git a/src/test/ui/lint/suggestions.stderr b/src/test/ui/lint/suggestions.stderr index 8e5dac8be7827..340a4a48512e2 100644 --- a/src/test/ui/lint/suggestions.stderr +++ b/src/test/ui/lint/suggestions.stderr @@ -1,5 +1,5 @@ warning: unnecessary parentheses around assigned value - --> $DIR/suggestions.rs:64:21 + --> $DIR/suggestions.rs:59:21 | LL | let mut a = (1); | ^^^ help: remove these parentheses @@ -11,7 +11,7 @@ LL | #![warn(unused_mut, unused_parens)] // UI tests pass `-A unused`—see Issu | ^^^^^^^^^^^^^ warning: use of deprecated attribute `no_debug`: the `#[no_debug]` attribute was an experimental feature that has been deprecated due to lack of demand. See https://github.com/rust-lang/rust/issues/29721 - --> $DIR/suggestions.rs:57:1 + --> $DIR/suggestions.rs:52:1 | LL | #[no_debug] // should suggest removal of deprecated attribute | ^^^^^^^^^^^ help: remove this attribute @@ -19,7 +19,7 @@ LL | #[no_debug] // should suggest removal of deprecated attribute = note: #[warn(deprecated)] on by default warning: variable does not need to be mutable - --> $DIR/suggestions.rs:64:13 + --> $DIR/suggestions.rs:59:13 | LL | let mut a = (1); | ----^ @@ -33,7 +33,7 @@ LL | #![warn(unused_mut, unused_parens)] // UI tests pass `-A unused`—see Issu | ^^^^^^^^^^ warning: variable does not need to be mutable - --> $DIR/suggestions.rs:70:13 + --> $DIR/suggestions.rs:65:13 | LL | let mut | _____________^ @@ -44,18 +44,8 @@ LL | || b = 1; | |____________| | help: remove this `mut` -warning: static is marked #[no_mangle], but not exported - --> $DIR/suggestions.rs:16:14 - | -LL | #[no_mangle] static SHENZHOU: usize = 1; - | -^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | help: try making it public: `pub` - | - = note: #[warn(private_no_mangle_statics)] on by default - error: const items should never be #[no_mangle] - --> $DIR/suggestions.rs:19:14 + --> $DIR/suggestions.rs:16:14 | LL | #[no_mangle] const DISCOVERY: usize = 1; | -----^^^^^^^^^^^^^^^^^^^^^^ @@ -65,7 +55,7 @@ LL | #[no_mangle] const DISCOVERY: usize = 1; = note: #[deny(no_mangle_const_items)] on by default warning: functions generic over types must be mangled - --> $DIR/suggestions.rs:25:1 + --> $DIR/suggestions.rs:22:1 | LL | #[no_mangle] | ------------ help: remove this attribute @@ -75,50 +65,40 @@ LL | pub fn defiant(_t: T) {} | = note: #[warn(no_mangle_generic_items)] on by default -warning: function is marked #[no_mangle], but not exported - --> $DIR/suggestions.rs:29:1 - | -LL | fn rio_grande() {} - | -^^^^^^^^^^^^^^^^^ - | | - | help: try making it public: `pub` +error: const items should never be #[no_mangle] + --> $DIR/suggestions.rs:32:18 | - = note: #[warn(private_no_mangle_fns)] on by default +LL | #[no_mangle] pub const DAUNTLESS: bool = true; + | ---------^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | help: try a static value: `pub static` -warning: static is marked #[no_mangle], but not exported - --> $DIR/suggestions.rs:37:18 - | -LL | #[no_mangle] pub static DAUNTLESS: bool = true; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +warning: functions generic over types must be mangled + --> $DIR/suggestions.rs:35:18 | - = help: try exporting the item with a `pub use` statement +LL | #[no_mangle] pub fn val_jean() {} + | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ + | | + | help: remove this attribute -warning: function is marked #[no_mangle], but not exported +error: const items should never be #[no_mangle] --> $DIR/suggestions.rs:40:18 | -LL | #[no_mangle] pub fn val_jean() {} - | ^^^^^^^^^^^^^^^^^^^^ - | - = help: try exporting the item with a `pub use` statement - -warning: static is marked #[no_mangle], but not exported - --> $DIR/suggestions.rs:45:18 - | -LL | #[no_mangle] pub(crate) static VETAR: bool = true; - | ----------^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[no_mangle] pub(crate) const VETAR: bool = true; + | ----------------^^^^^^^^^^^^^^^^^^^^ | | - | help: try making it public: `pub` + | help: try a static value: `pub static` -warning: function is marked #[no_mangle], but not exported - --> $DIR/suggestions.rs:48:18 +warning: functions generic over types must be mangled + --> $DIR/suggestions.rs:43:18 | -LL | #[no_mangle] pub(crate) fn crossfield() {} - | ----------^^^^^^^^^^^^^^^^^^^ - | | - | help: try making it public: `pub` +LL | #[no_mangle] pub(crate) fn crossfield() {} + | ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | help: remove this attribute warning: denote infinite loops with `loop { ... }` - --> $DIR/suggestions.rs:61:5 + --> $DIR/suggestions.rs:56:5 | LL | while true { | ^^^^^^^^^^ help: use `loop` @@ -126,7 +106,7 @@ LL | while true { = note: #[warn(while_true)] on by default warning: the `warp_factor:` in this pattern is redundant - --> $DIR/suggestions.rs:76:23 + --> $DIR/suggestions.rs:71:23 | LL | Equinox { warp_factor: warp_factor } => {} | ------------^^^^^^^^^^^^ @@ -135,5 +115,5 @@ LL | Equinox { warp_factor: warp_factor } => {} | = note: #[warn(non_shorthand_field_patterns)] on by default -error: aborting due to previous error +error: aborting due to 3 previous errors diff --git a/src/tools/cargotest/main.rs b/src/tools/cargotest/main.rs index 352480543c7e3..5b717c45254cc 100644 --- a/src/tools/cargotest/main.rs +++ b/src/tools/cargotest/main.rs @@ -61,11 +61,11 @@ const TEST_REPOS: &'static [Test] = &[ Test { name: "servo", repo: "https://github.com/servo/servo", - sha: "17e97b9320fdb7cdb33bbc5f4d0fde0653bbf2e4", + sha: "987e376ca7a4245dbc3e0c06e963278ee1ac92d1", lock: None, // Only test Stylo a.k.a. Quantum CSS, the parts of Servo going into Firefox. // This takes much less time to build than all of Servo and supports stable Rust. - packages: &["stylo_tests", "selectors"], + packages: &["selectors"], }, Test { name: "webrender",