diff options
| author | cynecx <me@cynecx.net> | 2022-02-07 01:21:23 +0100 |
|---|---|---|
| committer | cynecx <me@cynecx.net> | 2022-02-07 01:21:23 +0100 |
| commit | e075586d4fd428374a788eecc391e23ec4a17b46 (patch) | |
| tree | 19b6ae50a00420b9dc690d7722e231ebbdce612a /src/test | |
| parent | 03733ca65a09a9b54b2c2a674e4145b165bd1cab (diff) | |
| download | rust-e075586d4fd428374a788eecc391e23ec4a17b46.tar.gz rust-e075586d4fd428374a788eecc391e23ec4a17b46.zip | |
add tests and fix comments
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/codegen/used_with_arg.rs | 12 | ||||
| -rw-r--r-- | src/test/ui/feature-gates/feature-gate-used_with_arg.rs | 7 | ||||
| -rw-r--r-- | src/test/ui/feature-gates/feature-gate-used_with_arg.stderr | 19 |
3 files changed, 38 insertions, 0 deletions
diff --git a/src/test/codegen/used_with_arg.rs b/src/test/codegen/used_with_arg.rs new file mode 100644 index 00000000000..cd759b167c0 --- /dev/null +++ b/src/test/codegen/used_with_arg.rs @@ -0,0 +1,12 @@ +// compile-flags: -O + +#![crate_type = "lib"] +#![feature(used_with_arg)] + +// CHECK: @llvm.used = appending global [1 x i8*] +#[used(linker)] +static mut USED_LINKER: [usize; 1] = [0]; + +// CHECK-NEXT: @llvm.compiler.used = appending global [1 x i8*] +#[used(compiler)] +static mut USED_COMPILER: [usize; 1] = [0]; diff --git a/src/test/ui/feature-gates/feature-gate-used_with_arg.rs b/src/test/ui/feature-gates/feature-gate-used_with_arg.rs new file mode 100644 index 00000000000..1c8f01bdef1 --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-used_with_arg.rs @@ -0,0 +1,7 @@ +#[used(linker)] //~ ERROR `#[used(linker)]` is currently unstable +static mut USED_LINKER: [usize; 1] = [0]; + +#[used(compiler)] //~ ERROR `#[used(compiler)]` is currently unstable +static mut USED_COMPILER: [usize; 1] = [0]; + +fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-used_with_arg.stderr b/src/test/ui/feature-gates/feature-gate-used_with_arg.stderr new file mode 100644 index 00000000000..aaf4ceaf795 --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-used_with_arg.stderr @@ -0,0 +1,19 @@ +error[E0658]: `#[used(linker)]` is currently unstable + --> $DIR/feature-gate-used_with_arg.rs:1:1 + | +LL | #[used(linker)] + | ^^^^^^^^^^^^^^^ + | + = help: add `#![feature(used_with_arg)]` to the crate attributes to enable + +error[E0658]: `#[used(compiler)]` is currently unstable + --> $DIR/feature-gate-used_with_arg.rs:4:1 + | +LL | #[used(compiler)] + | ^^^^^^^^^^^^^^^^^ + | + = help: add `#![feature(used_with_arg)]` to the crate attributes to enable + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0658`. |
