Skip to content

Commit

Permalink
Auto merge of #51363 - japaric:stable-used, r=cramertj
Browse files Browse the repository at this point in the history
stabilize #[used]

closes #40289

RFC for stabilization: rust-lang/rfcs#2386

r? @Centril

Where should this be documented? Currently the documentation is in the unstable book
  • Loading branch information
bors committed Sep 11, 2018
2 parents 1f02f23 + d37658a commit 7ee7207
Show file tree
Hide file tree
Showing 11 changed files with 11 additions and 205 deletions.
157 changes: 0 additions & 157 deletions src/doc/unstable-book/src/language-features/used.md

This file was deleted.

2 changes: 1 addition & 1 deletion src/libstd/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@
#![feature(doc_cfg)]
#![feature(doc_masked)]
#![feature(doc_spotlight)]
#![cfg_attr(windows, feature(used))]
#![cfg_attr(all(windows, stage0), feature(used))]
#![feature(doc_alias)]
#![feature(doc_keyword)]
#![feature(panic_info_message)]
Expand Down
11 changes: 4 additions & 7 deletions src/libsyntax/feature_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,9 +349,6 @@ declare_features! (
// Allows the `try {...}` expression
(active, try_blocks, "1.29.0", Some(31436), None),

// Used to preserve symbols (see llvm.used)
(active, used, "1.18.0", Some(40289), None),

// Allows module-level inline assembly by way of global_asm!()
(active, global_asm, "1.18.0", Some(35119), None),

Expand Down Expand Up @@ -677,6 +674,9 @@ declare_features! (
// Allows all literals in attribute lists and values of key-value pairs.
(accepted, attr_literals, "1.30.0", Some(34981), None),
(accepted, panic_handler, "1.30.0", Some(44489), None),
// Used to preserve symbols (see llvm.used)
(accepted, used, "1.30.0", Some(40289), None),

);

// If you change this, please modify src/doc/unstable-book as well. You must
Expand Down Expand Up @@ -1071,10 +1071,7 @@ pub const BUILTIN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeG
"unwind_attributes",
"#[unwind] is experimental",
cfg_fn!(unwind_attributes))),
("used", Whitelisted, Gated(
Stability::Unstable, "used",
"the `#[used]` attribute is an experimental feature",
cfg_fn!(used))),
("used", Whitelisted, Ungated),

// used in resolve
("prelude_import", Whitelisted, Gated(Stability::Unstable,
Expand Down
1 change: 0 additions & 1 deletion src/test/run-make-fulldeps/used/used.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
// except according to those terms.

#![crate_type = "lib"]
#![feature(used)]

#[used]
static FOO: u32 = 0;
Expand Down
3 changes: 1 addition & 2 deletions src/test/ui/feature-gates/feature-gate-linker-flavor.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// 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.
//
Expand All @@ -15,6 +15,5 @@

#[used]
fn foo() {}
//~^^ ERROR the `#[used]` attribute is an experimental feature

fn main() {}
5 changes: 1 addition & 4 deletions src/test/ui/feature-gates/feature-gate-linker-flavor.stderr
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
error[E0658]: the `#[used]` attribute is an experimental feature (see issue #40289)
error: attribute must be applied to a `static` variable
--> $DIR/feature-gate-linker-flavor.rs:16:1
|
LL | #[used]
| ^^^^^^^
|
= help: add #![feature(used)] to the crate attributes to enable

error: aborting due to previous error

For more information about this error, try `rustc --explain E0658`.
15 changes: 0 additions & 15 deletions src/test/ui/feature-gates/feature-gate-used.rs

This file was deleted.

11 changes: 0 additions & 11 deletions src/test/ui/feature-gates/feature-gate-used.stderr

This file was deleted.

1 change: 0 additions & 1 deletion src/test/ui/run-pass/issues/issue-41628.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

// run-pass
#![deny(dead_code)]
#![feature(used)]

#[used]
static FOO: u32 = 0;
Expand Down
2 changes: 0 additions & 2 deletions src/test/ui/used.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(used)]

#[used]
static FOO: u32 = 0; // OK

Expand Down
8 changes: 4 additions & 4 deletions src/test/ui/used.stderr
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
error: attribute must be applied to a `static` variable
--> $DIR/used.rs:16:1
--> $DIR/used.rs:14:1
|
LL | #[used] //~ ERROR attribute must be applied to a `static` variable
| ^^^^^^^

error: attribute must be applied to a `static` variable
--> $DIR/used.rs:19:1
--> $DIR/used.rs:17:1
|
LL | #[used] //~ ERROR attribute must be applied to a `static` variable
| ^^^^^^^

error: attribute must be applied to a `static` variable
--> $DIR/used.rs:22:1
--> $DIR/used.rs:20:1
|
LL | #[used] //~ ERROR attribute must be applied to a `static` variable
| ^^^^^^^

error: attribute must be applied to a `static` variable
--> $DIR/used.rs:25:1
--> $DIR/used.rs:23:1
|
LL | #[used] //~ ERROR attribute must be applied to a `static` variable
| ^^^^^^^
Expand Down

0 comments on commit 7ee7207

Please sign in to comment.