forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add more tests and make used(linker/compiler) mutually exclusive
- Loading branch information
Showing
7 changed files
with
88 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,10 @@ | ||
// compile-flags: -O | ||
|
||
#![crate_type = "lib"] | ||
#![feature(used_with_arg)] | ||
|
||
// CHECK: @llvm.used = appending global [1 x i8*] | ||
// CHECK: @llvm.used = appending global [1 x i8*]{{.*}}USED_LINKER | ||
#[used(linker)] | ||
static mut USED_LINKER: [usize; 1] = [0]; | ||
|
||
// CHECK-NEXT: @llvm.compiler.used = appending global [1 x i8*] | ||
// CHECK-NEXT: @llvm.compiler.used = appending global [1 x i8*]{{.*}}USED_COMPILER | ||
#[used(compiler)] | ||
static mut USED_COMPILER: [usize; 1] = [0]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#![feature(used_with_arg)] | ||
|
||
#[used(linker)] | ||
static mut USED_LINKER: [usize; 1] = [0]; | ||
|
||
#[used(compiler)] | ||
static mut USED_COMPILER: [usize; 1] = [0]; | ||
|
||
#[used(compiler)] //~ ERROR `used(compiler)` and `used(linker)` can't be used together | ||
#[used(linker)] | ||
static mut USED_COMPILER_LINKER2: [usize; 1] = [0]; | ||
|
||
#[used(compiler)] //~ ERROR `used(compiler)` and `used(linker)` can't be used together | ||
#[used(linker)] | ||
#[used(compiler)] | ||
#[used(linker)] | ||
static mut USED_COMPILER_LINKER3: [usize; 1] = [0]; | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
error: `used(compiler)` and `used(linker)` can't be used together | ||
--> $DIR/used_with_arg.rs:9:1 | ||
| | ||
LL | #[used(compiler)] | ||
| ^^^^^^^^^^^^^^^^^ | ||
LL | #[used(linker)] | ||
| ^^^^^^^^^^^^^^^ | ||
|
||
error: `used(compiler)` and `used(linker)` can't be used together | ||
--> $DIR/used_with_arg.rs:13:1 | ||
| | ||
LL | #[used(compiler)] | ||
| ^^^^^^^^^^^^^^^^^ | ||
LL | #[used(linker)] | ||
| ^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 2 previous errors | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#![feature(used_with_arg)] | ||
|
||
#[used(compiler, linker)] //~ expected `used`, `used(compiler)` or `used(linker)` | ||
static mut USED_COMPILER_LINKER: [usize; 1] = [0]; | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
error: expected `used`, `used(compiler)` or `used(linker)` | ||
--> $DIR/used_with_multi_args.rs:3:1 | ||
| | ||
LL | #[used(compiler, linker)] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to previous error | ||
|