Auto merge of #51363 - japaric:stable-used, r=cramertj

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
This commit is contained in:
bors 2018-09-11 08:54:11 +00:00
commit 7ee72070bd
11 changed files with 11 additions and 205 deletions

View file

@ -9,7 +9,6 @@
// except according to those terms.
#![crate_type = "lib"]
#![feature(used)]
#[used]
static FOO: u32 = 0;

View file

@ -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.
//
@ -15,6 +15,5 @@
#[used]
fn foo() {}
//~^^ ERROR the `#[used]` attribute is an experimental feature
fn main() {}

View file

@ -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`.

View file

@ -1,15 +0,0 @@
// Copyright 2017 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 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[used]
fn foo() {}
//~^^ ERROR the `#[used]` attribute is an experimental feature
fn main() {}

View file

@ -1,11 +0,0 @@
error[E0658]: the `#[used]` attribute is an experimental feature (see issue #40289)
--> $DIR/feature-gate-used.rs:11: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`.

View file

@ -10,7 +10,6 @@
// run-pass
#![deny(dead_code)]
#![feature(used)]
#[used]
static FOO: u32 = 0;

View file

@ -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

View file

@ -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
| ^^^^^^^