Skip to content

Fix double_check tests on big-endian targets #55561

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/test/ui/consts/const-eval/double_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ enum Bar {
union Union {
foo: &'static Foo,
bar: &'static Bar,
usize: &'static usize,
u8: &'static u8,
}
static BAR: usize = 42;
static BAR: u8 = 42;
static FOO: (&Foo, &Bar) = unsafe {(
Union { usize: &BAR }.foo,
Union { usize: &BAR }.bar,
Union { u8: &BAR }.foo,
Union { u8: &BAR }.bar,
)};

fn main() {}
8 changes: 4 additions & 4 deletions src/test/ui/consts/const-eval/double_check2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ enum Bar {
union Union {
foo: &'static Foo,
bar: &'static Bar,
usize: &'static usize,
u8: &'static u8,
}
static BAR: usize = 5;
static BAR: u8 = 5;
static FOO: (&Foo, &Bar) = unsafe {( //~ undefined behavior
Union { usize: &BAR }.foo,
Union { usize: &BAR }.bar,
Union { u8: &BAR }.foo,
Union { u8: &BAR }.bar,
)};

fn main() {}
4 changes: 2 additions & 2 deletions src/test/ui/consts/const-eval/double_check2.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/double_check2.rs:25:1
|
LL | / static FOO: (&Foo, &Bar) = unsafe {( //~ undefined behavior
LL | | Union { usize: &BAR }.foo,
LL | | Union { usize: &BAR }.bar,
LL | | Union { u8: &BAR }.foo,
LL | | Union { u8: &BAR }.bar,
LL | | )};
| |___^ type validation failed: encountered invalid enum discriminant 5 at .1.<deref>
|
Expand Down