Skip to content

Commit d6956c6

Browse files
committed
Fix tests to use static linking
1 parent 38bc246 commit d6956c6

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1+
//@ no-prefer-dynamic
2+
3+
#![crate_type = "lib"]
4+
15
pub static ARRAY: [u8; 1] = [1];

‎tests/ui/cross-crate/static-array-across-crate.rs‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,8 @@ static X: &'static u8 = &ARRAY[0];
1010
static Y: &'static u8 = &(&ARRAY)[0];
1111
static Z: u8 = (&ARRAY)[0];
1212

13-
pub fn main() {}
13+
pub fn main() {
14+
// Make sure to actually reference the statics.
15+
assert_eq!(&X, &Y);
16+
assert_eq!(&X, &&Z);
17+
}

‎tests/ui/statics/auxiliary/check_static_recursion_foreign_helper.rs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//@ no-prefer-dynamic
2+
13
// Helper definition for test/run-pass/check-static-recursion-foreign.rs.
24

35
#![feature(rustc_private)]

‎tests/ui/statics/check-recursion-foreign.rs‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,7 @@ extern "C" {
1515

1616
pub static B: &'static c_int = unsafe { &test_static };
1717

18-
pub fn main() {}
18+
pub fn main() {
19+
// Make sure to actually reference the static.
20+
unsafe { assert_eq!(test_static, 0); }
21+
}

0 commit comments

Comments
 (0)