Skip to content

Commit 6d86163

Browse files
committed
const-eval tests: make all unions repr(C)
1 parent e7fed14 commit 6d86163

31 files changed

+79
-59
lines changed

src/test/ui/consts/const-eval/const-pointer-values-in-various-types.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// only-x86_64
22

3+
#[repr(C)]
34
union Nonsense {
45
u: usize,
56
int_32_ref: &'static i32,

src/test/ui/consts/const-eval/const-pointer-values-in-various-types.stderr

Lines changed: 29 additions & 29 deletions
Large diffs are not rendered by default.

src/test/ui/consts/const-eval/const_transmute.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#![feature(const_fn_union)]
44

5+
#[repr(C)]
56
union Transmute<T: Copy, U: Copy> {
67
t: T,
78
u: U,

src/test/ui/consts/const-eval/double_check.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ enum Bar {
88
C = 42,
99
D = 99,
1010
}
11+
#[repr(C)]
1112
union Union {
1213
foo: &'static Foo,
1314
bar: &'static Bar,

src/test/ui/consts/const-eval/double_check2.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ enum Bar {
66
C = 42,
77
D = 99,
88
}
9+
#[repr(C)]
910
union Union {
1011
foo: &'static Foo,
1112
bar: &'static Bar,

src/test/ui/consts/const-eval/double_check2.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0080]: it is undefined behavior to use this value
2-
--> $DIR/double_check2.rs:15:1
2+
--> $DIR/double_check2.rs:16:1
33
|
44
LL | / static FOO: (&Foo, &Bar) = unsafe {(
55
LL | | Union { u8: &BAR }.foo,

src/test/ui/consts/const-eval/feature-gate-const_fn_union.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
fn main() {}
44

5+
#[repr(C)]
56
union Foo {
67
u: u32,
78
i: i32,

src/test/ui/consts/const-eval/feature-gate-const_fn_union.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0658]: unions in const fn are unstable
2-
--> $DIR/feature-gate-const_fn_union.rs:11:5
2+
--> $DIR/feature-gate-const_fn_union.rs:12:5
33
|
44
LL | Foo { u }.i
55
| ^^^^^^^^^^^

src/test/ui/consts/const-eval/issue-49296.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#![feature(const_fn_union)]
55

66
const unsafe fn transmute<T: Copy, U: Copy>(t: T) -> U {
7+
#[repr(C)]
78
union Transmute<T: Copy, U: Copy> {
89
from: T,
910
to: U,

src/test/ui/consts/const-eval/issue-49296.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: any use of this value will cause an error
2-
--> $DIR/issue-49296.rs:18:16
2+
--> $DIR/issue-49296.rs:19:16
33
|
44
LL | const X: u64 = *wat(42);
55
| ---------------^^^^^^^^-

0 commit comments

Comments
 (0)