]> git.proxmox.com Git - rustc.git/commitdiff
Fix more tests with a backported upstream PR
authorXimin Luo <infinity0@debian.org>
Mon, 12 Apr 2021 00:51:02 +0000 (01:51 +0100)
committerXimin Luo <infinity0@debian.org>
Mon, 12 Apr 2021 00:51:02 +0000 (01:51 +0100)
debian/changelog
debian/patches/series
debian/patches/u-84099.patch [new file with mode: 0644]
debian/patches/u-ignore-asm-unsupported.patch [deleted file]

index 7075deae99f6c14f87d981e9738461e68d8543e7..8b94bb61310a00cfb317e9d6c000aac224c6d63b 100644 (file)
@@ -1,3 +1,9 @@
+rustc (1.50.0+dfsg1-1~exp4) UNRELEASED; urgency=medium
+
+  * Fix more tests with a backported upstream PR.
+
+ -- Ximin Luo <infinity0@debian.org>  Mon, 12 Apr 2021 01:50:35 +0100
+
 rustc (1.50.0+dfsg1-1~exp3) experimental; urgency=medium
 
   * Fix cross-compile to windows using same-version stage0.
index 172e51936175c4e850b17f02e75f5d9b1c500615..4c99d823f1fd48c0208c6c05366f33fe7e5a007f 100644 (file)
@@ -3,7 +3,7 @@
 # pending, or forwarded
 9756838f612da2ef6c359aaea8bf0a69ad76716a.patch
 0001-Revert-Auto-merge-of-79547.patch
-u-ignore-asm-unsupported.patch
+u-84099.patch
 u-8d504aa90416668d8f6b4cbd449e2e1de20fb937.patch
 u-ignore-gdb-10-failures.patch
 u-update-version-check.patch
diff --git a/debian/patches/u-84099.patch b/debian/patches/u-84099.patch
new file mode 100644 (file)
index 0000000..24883c9
--- /dev/null
@@ -0,0 +1,163 @@
+From 5e87f97de789d68719efafde6a0175d64ed90e3b Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Tomasz=20Mi=C4=85sko?= <tomasz.miasko@gmail.com>
+Date: Sun, 11 Apr 2021 00:00:00 +0000
+Subject: [PATCH] Check for asm support in UI tests that require it
+
+Add `needs-asm-support` compiletest directive, and use it in asm tests
+that require asm support without relying on any architecture specific
+features.
+---
+ src/test/ui/asm/bad-options.rs                        |  2 +-
+ src/test/ui/asm/naked-invalid-attr.rs                 |  2 +-
+ .../ui/feature-gates/feature-gate-naked_functions.rs  |  1 +
+ .../feature-gates/feature-gate-naked_functions.stderr |  4 ++--
+ src/test/ui/rfc-2091-track-caller/error-with-naked.rs |  1 +
+ .../ui/rfc-2091-track-caller/error-with-naked.stderr  |  4 ++--
+ src/tools/compiletest/src/header.rs                   |  5 +++++
+ src/tools/compiletest/src/header/tests.rs             | 11 +++++++++++
+ src/tools/compiletest/src/util.rs                     |  9 +++++++++
+ 9 files changed, 33 insertions(+), 6 deletions(-)
+
+diff --git a/src/test/ui/asm/bad-options.rs b/src/test/ui/asm/bad-options.rs
+index 755fc2ca238aa..a60478f62154f 100644
+--- a/src/test/ui/asm/bad-options.rs
++++ b/src/test/ui/asm/bad-options.rs
+@@ -1,4 +1,4 @@
+-// only-x86_64
++// needs-asm-support
+ #![feature(asm)]
+diff --git a/src/test/ui/asm/naked-invalid-attr.rs b/src/test/ui/asm/naked-invalid-attr.rs
+index cdb6c17454b73..2576d1124c85c 100644
+--- a/src/test/ui/asm/naked-invalid-attr.rs
++++ b/src/test/ui/asm/naked-invalid-attr.rs
+@@ -1,6 +1,6 @@
+ // Checks that #[naked] attribute can be placed on function definitions only.
+ //
+-// ignore-wasm32 asm unsupported
++// needs-asm-support
+ #![feature(asm)]
+ #![feature(naked_functions)]
+ #![naked] //~ ERROR should be applied to a function definition
+diff --git a/src/test/ui/feature-gates/feature-gate-naked_functions.rs b/src/test/ui/feature-gates/feature-gate-naked_functions.rs
+index 06bddc422cf80..71ca5b9373a68 100644
+--- a/src/test/ui/feature-gates/feature-gate-naked_functions.rs
++++ b/src/test/ui/feature-gates/feature-gate-naked_functions.rs
+@@ -1,3 +1,4 @@
++// needs-asm-support
+ #![feature(asm)]
+ #[naked]
+diff --git a/src/test/ui/feature-gates/feature-gate-naked_functions.stderr b/src/test/ui/feature-gates/feature-gate-naked_functions.stderr
+index d95561d20133e..653d7b738da1a 100644
+--- a/src/test/ui/feature-gates/feature-gate-naked_functions.stderr
++++ b/src/test/ui/feature-gates/feature-gate-naked_functions.stderr
+@@ -1,5 +1,5 @@
+ error[E0658]: the `#[naked]` attribute is an experimental feature
+-  --> $DIR/feature-gate-naked_functions.rs:3:1
++  --> $DIR/feature-gate-naked_functions.rs:4:1
+    |
+ LL | #[naked]
+    | ^^^^^^^^
+@@ -8,7 +8,7 @@ LL | #[naked]
+    = help: add `#![feature(naked_functions)]` to the crate attributes to enable
+ error[E0658]: the `#[naked]` attribute is an experimental feature
+-  --> $DIR/feature-gate-naked_functions.rs:9:1
++  --> $DIR/feature-gate-naked_functions.rs:10:1
+    |
+ LL | #[naked]
+    | ^^^^^^^^
+diff --git a/src/test/ui/rfc-2091-track-caller/error-with-naked.rs b/src/test/ui/rfc-2091-track-caller/error-with-naked.rs
+index 70ec0e3033c6f..9464ffe872282 100644
+--- a/src/test/ui/rfc-2091-track-caller/error-with-naked.rs
++++ b/src/test/ui/rfc-2091-track-caller/error-with-naked.rs
+@@ -1,3 +1,4 @@
++// needs-asm-support
+ #![feature(asm, naked_functions)]
+ #[track_caller] //~ ERROR cannot use `#[track_caller]` with `#[naked]`
+diff --git a/src/test/ui/rfc-2091-track-caller/error-with-naked.stderr b/src/test/ui/rfc-2091-track-caller/error-with-naked.stderr
+index 1b49148d629b2..5f17d6b2b5173 100644
+--- a/src/test/ui/rfc-2091-track-caller/error-with-naked.stderr
++++ b/src/test/ui/rfc-2091-track-caller/error-with-naked.stderr
+@@ -1,11 +1,11 @@
+ error[E0736]: cannot use `#[track_caller]` with `#[naked]`
+-  --> $DIR/error-with-naked.rs:3:1
++  --> $DIR/error-with-naked.rs:4:1
+    |
+ LL | #[track_caller]
+    | ^^^^^^^^^^^^^^^
+ error[E0736]: cannot use `#[track_caller]` with `#[naked]`
+-  --> $DIR/error-with-naked.rs:12:5
++  --> $DIR/error-with-naked.rs:13:5
+    |
+ LL |     #[track_caller]
+    |     ^^^^^^^^^^^^^^^
+diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs
+index 531a23d76a27b..363105a9f09c0 100644
+--- a/src/tools/compiletest/src/header.rs
++++ b/src/tools/compiletest/src/header.rs
+@@ -44,6 +44,7 @@ impl EarlyProps {
+         let mut props = EarlyProps::default();
+         let rustc_has_profiler_support = env::var_os("RUSTC_PROFILER_SUPPORT").is_some();
+         let rustc_has_sanitizer_support = env::var_os("RUSTC_SANITIZER_SUPPORT").is_some();
++        let has_asm_support = util::has_asm_support(&config.target);
+         let has_asan = util::ASAN_SUPPORTED_TARGETS.contains(&&*config.target);
+         let has_lsan = util::LSAN_SUPPORTED_TARGETS.contains(&&*config.target);
+         let has_msan = util::MSAN_SUPPORTED_TARGETS.contains(&&*config.target);
+@@ -76,6 +77,10 @@ impl EarlyProps {
+                     props.ignore = true;
+                 }
++                if !has_asm_support && config.parse_name_directive(ln, "needs-asm-support") {
++                    props.ignore = true;
++                }
++
+                 if !rustc_has_profiler_support && config.parse_needs_profiler_support(ln) {
+                     props.ignore = true;
+                 }
+diff --git a/src/tools/compiletest/src/header/tests.rs b/src/tools/compiletest/src/header/tests.rs
+index ec99fde0df9c2..c41b43cdd0b53 100644
+--- a/src/tools/compiletest/src/header/tests.rs
++++ b/src/tools/compiletest/src/header/tests.rs
+@@ -223,6 +223,17 @@ fn sanitizers() {
+     assert!(parse_rs(&config, "// needs-sanitizer-thread").ignore);
+ }
++#[test]
++fn asm_support() {
++    let mut config = config();
++
++    config.target = "avr-unknown-gnu-atmega328".to_owned();
++    assert!(parse_rs(&config, "// needs-asm-support").ignore);
++
++    config.target = "i686-unknown-netbsd".to_owned();
++    assert!(!parse_rs(&config, "// needs-asm-support").ignore);
++}
++
+ #[test]
+ fn test_extract_version_range() {
+     use super::{extract_llvm_version, extract_version_range};
+diff --git a/src/tools/compiletest/src/util.rs b/src/tools/compiletest/src/util.rs
+index b302953708c18..7dbd70948b84d 100644
+--- a/src/tools/compiletest/src/util.rs
++++ b/src/tools/compiletest/src/util.rs
+@@ -128,6 +128,15 @@ const BIG_ENDIAN: &[&str] = &[
+     "sparcv9",
+ ];
++static ASM_SUPPORTED_ARCHS: &[&str] = &[
++    "x86", "x86_64", "arm", "aarch64", "riscv32", "riscv64", "nvptx64", "hexagon", "mips",
++    "mips64", "spirv", "wasm32",
++];
++
++pub fn has_asm_support(triple: &str) -> bool {
++    ASM_SUPPORTED_ARCHS.contains(&get_arch(triple))
++}
++
+ pub fn matches_os(triple: &str, name: &str) -> bool {
+     // For the wasm32 bare target we ignore anything also ignored on emscripten
+     // and then we also recognize `wasm32-bare` as the os for the target
diff --git a/debian/patches/u-ignore-asm-unsupported.patch b/debian/patches/u-ignore-asm-unsupported.patch
deleted file mode 100644 (file)
index 81b2170..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-Bug: https://github.com/rust-lang/rust/issues/84038
---- a/src/test/ui/asm/naked-invalid-attr.rs
-+++ b/src/test/ui/asm/naked-invalid-attr.rs
-@@ -1,6 +1,10 @@
- // Checks that #[naked] attribute can be placed on function definitions only.
- //
- // ignore-wasm32 asm unsupported
-+// ignore-powerpc64 asm unsupported
-+// ignore-powerpc64le asm unsupported
-+// ignore-s390x asm unsupported
-+// ignore-sparc64 asm unsupported
- #![feature(asm)]
- #![feature(naked_functions)]
- #![naked] //~ ERROR should be applied to a function definition
---- a/src/test/ui/feature-gates/feature-gate-naked_functions.rs
-+++ b/src/test/ui/feature-gates/feature-gate-naked_functions.rs
-@@ -1,3 +1,7 @@
-+// ignore-powerpc64 asm unsupported
-+// ignore-powerpc64le asm unsupported
-+// ignore-s390x asm unsupported
-+// ignore-sparc64 asm unsupported
- #![feature(asm)]
- #[naked]
---- a/src/test/ui/rfc-2091-track-caller/error-with-naked.rs
-+++ b/src/test/ui/rfc-2091-track-caller/error-with-naked.rs
-@@ -1,3 +1,7 @@
-+// ignore-powerpc64 asm unsupported
-+// ignore-powerpc64le asm unsupported
-+// ignore-s390x asm unsupported
-+// ignore-sparc64 asm unsupported
- #![feature(asm, naked_functions)]
- #[track_caller] //~ ERROR cannot use `#[track_caller]` with `#[naked]`