[Pkg-rust-maintainers] Bug#917191: rustc: Please include backported patch to fix double_check tests on big-endian
John Paul Adrian Glaubitz
glaubitz at physik.fu-berlin.de
Sun Dec 23 21:47:54 GMT 2018
Source: rustc
Version: 1.31.0+dfsg1-2
Severity: normal
Tags: upstream
User: debian-sparc at lists.debian.org
Usertags: sparc64
Hi!
The attached patch fixes the double_check tests which currently fail on all
big-endian targets. Upstream has a fix for that [1] which I verified to work
on s390x and sparc64.
Thanks,
Adrian
> [1] https://github.com/rust-lang/rust/pull/55561
--
.''`. John Paul Adrian Glaubitz
: :' : Debian Developer - glaubitz at debian.org
`. `' Freie Universitaet Berlin - glaubitz at physik.fu-berlin.de
`- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
-------------- next part --------------
>From 283f2be1421eca11b1a3abbaac40ca946e806037 Mon Sep 17 00:00:00 2001
From: Samuel Holland <samuel at sholland.org>
Date: Sun, 16 Sep 2018 18:27:56 +0000
Subject: [PATCH] Fix double_check tests on big-endian targets
Since the enums get optimized down to 1 byte long, the bits
set in the usize member don't align with the enums on big-endian
machines. Avoid this issue by shrinking the integer member to the
same size as the enums.
---
src/test/ui/consts/const-eval/double_check.rs | 8 ++++----
src/test/ui/consts/const-eval/double_check2.rs | 8 ++++----
src/test/ui/consts/const-eval/double_check2.stderr | 4 ++--
3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/test/ui/consts/const-eval/double_check.rs b/src/test/ui/consts/const-eval/double_check.rs
index 81f6e7ddd2..76f9276c05 100644
--- a/src/test/ui/consts/const-eval/double_check.rs
+++ b/src/test/ui/consts/const-eval/double_check.rs
@@ -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() {}
diff --git a/src/test/ui/consts/const-eval/double_check2.rs b/src/test/ui/consts/const-eval/double_check2.rs
index b661ee9247..701632362c 100644
--- a/src/test/ui/consts/const-eval/double_check2.rs
+++ b/src/test/ui/consts/const-eval/double_check2.rs
@@ -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() {}
diff --git a/src/test/ui/consts/const-eval/double_check2.stderr b/src/test/ui/consts/const-eval/double_check2.stderr
index 9dd7570232..28825477c8 100644
--- a/src/test/ui/consts/const-eval/double_check2.stderr
+++ b/src/test/ui/consts/const-eval/double_check2.stderr
@@ -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>
|
--
2.20.1
More information about the Pkg-rust-maintainers
mailing list