]> git.proxmox.com Git - rustc.git/blame - debian/patches/u-84099.patch
refresh all patches, make diff markings consistent
[rustc.git] / debian / patches / u-84099.patch
CommitLineData
2a1338f7
XL
1From 5e87f97de789d68719efafde6a0175d64ed90e3b Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Tomasz=20Mi=C4=85sko?= <tomasz.miasko@gmail.com>
3Date: Sun, 11 Apr 2021 00:00:00 +0000
4Subject: [PATCH] Check for asm support in UI tests that require it
5
6Add `needs-asm-support` compiletest directive, and use it in asm tests
7that require asm support without relying on any architecture specific
8features.
9---
10 src/test/ui/asm/bad-options.rs | 2 +-
11 src/test/ui/asm/naked-invalid-attr.rs | 2 +-
12 .../ui/feature-gates/feature-gate-naked_functions.rs | 1 +
13 .../feature-gates/feature-gate-naked_functions.stderr | 4 ++--
14 src/test/ui/rfc-2091-track-caller/error-with-naked.rs | 1 +
15 .../ui/rfc-2091-track-caller/error-with-naked.stderr | 4 ++--
16 src/tools/compiletest/src/header.rs | 5 +++++
17 src/tools/compiletest/src/header/tests.rs | 11 +++++++++++
18 src/tools/compiletest/src/util.rs | 9 +++++++++
19 9 files changed, 33 insertions(+), 6 deletions(-)
20
2a1338f7
XL
21--- a/src/test/ui/asm/bad-options.rs
22+++ b/src/test/ui/asm/bad-options.rs
23@@ -1,4 +1,4 @@
24-// only-x86_64
25+// needs-asm-support
26
27 #![feature(asm)]
28
2a1338f7
XL
29--- a/src/test/ui/asm/naked-invalid-attr.rs
30+++ b/src/test/ui/asm/naked-invalid-attr.rs
31@@ -1,6 +1,6 @@
32 // Checks that #[naked] attribute can be placed on function definitions only.
33 //
34-// ignore-wasm32 asm unsupported
35+// needs-asm-support
36 #![feature(asm)]
37 #![feature(naked_functions)]
38 #![naked] //~ ERROR should be applied to a function definition
2a1338f7
XL
39--- a/src/test/ui/feature-gates/feature-gate-naked_functions.rs
40+++ b/src/test/ui/feature-gates/feature-gate-naked_functions.rs
41@@ -1,3 +1,4 @@
42+// needs-asm-support
43 #![feature(asm)]
44
45 #[naked]
2a1338f7
XL
46--- a/src/test/ui/feature-gates/feature-gate-naked_functions.stderr
47+++ b/src/test/ui/feature-gates/feature-gate-naked_functions.stderr
48@@ -1,5 +1,5 @@
49 error[E0658]: the `#[naked]` attribute is an experimental feature
50- --> $DIR/feature-gate-naked_functions.rs:3:1
51+ --> $DIR/feature-gate-naked_functions.rs:4:1
52 |
53 LL | #[naked]
54 | ^^^^^^^^
cefde48f 55@@ -8,7 +8,7 @@
2a1338f7
XL
56 = help: add `#![feature(naked_functions)]` to the crate attributes to enable
57
58 error[E0658]: the `#[naked]` attribute is an experimental feature
59- --> $DIR/feature-gate-naked_functions.rs:9:1
60+ --> $DIR/feature-gate-naked_functions.rs:10:1
61 |
62 LL | #[naked]
63 | ^^^^^^^^
2a1338f7
XL
64--- a/src/test/ui/rfc-2091-track-caller/error-with-naked.rs
65+++ b/src/test/ui/rfc-2091-track-caller/error-with-naked.rs
66@@ -1,3 +1,4 @@
67+// needs-asm-support
68 #![feature(asm, naked_functions)]
69
70 #[track_caller] //~ ERROR cannot use `#[track_caller]` with `#[naked]`
2a1338f7
XL
71--- a/src/test/ui/rfc-2091-track-caller/error-with-naked.stderr
72+++ b/src/test/ui/rfc-2091-track-caller/error-with-naked.stderr
73@@ -1,11 +1,11 @@
74 error[E0736]: cannot use `#[track_caller]` with `#[naked]`
75- --> $DIR/error-with-naked.rs:3:1
76+ --> $DIR/error-with-naked.rs:4:1
77 |
78 LL | #[track_caller]
79 | ^^^^^^^^^^^^^^^
80
81 error[E0736]: cannot use `#[track_caller]` with `#[naked]`
82- --> $DIR/error-with-naked.rs:12:5
83+ --> $DIR/error-with-naked.rs:13:5
84 |
85 LL | #[track_caller]
86 | ^^^^^^^^^^^^^^^
2a1338f7
XL
87--- a/src/tools/compiletest/src/header.rs
88+++ b/src/tools/compiletest/src/header.rs
cefde48f 89@@ -44,6 +44,7 @@
2a1338f7
XL
90 let mut props = EarlyProps::default();
91 let rustc_has_profiler_support = env::var_os("RUSTC_PROFILER_SUPPORT").is_some();
92 let rustc_has_sanitizer_support = env::var_os("RUSTC_SANITIZER_SUPPORT").is_some();
93+ let has_asm_support = util::has_asm_support(&config.target);
94 let has_asan = util::ASAN_SUPPORTED_TARGETS.contains(&&*config.target);
95 let has_lsan = util::LSAN_SUPPORTED_TARGETS.contains(&&*config.target);
96 let has_msan = util::MSAN_SUPPORTED_TARGETS.contains(&&*config.target);
cefde48f 97@@ -76,6 +77,10 @@
2a1338f7
XL
98 props.ignore = true;
99 }
100
101+ if !has_asm_support && config.parse_name_directive(ln, "needs-asm-support") {
102+ props.ignore = true;
103+ }
104+
105 if !rustc_has_profiler_support && config.parse_needs_profiler_support(ln) {
106 props.ignore = true;
107 }
2a1338f7
XL
108--- a/src/tools/compiletest/src/header/tests.rs
109+++ b/src/tools/compiletest/src/header/tests.rs
cefde48f 110@@ -224,6 +224,17 @@
2a1338f7
XL
111 }
112
cefde48f 113 #[test]
2a1338f7
XL
114+fn asm_support() {
115+ let mut config = config();
116+
117+ config.target = "avr-unknown-gnu-atmega328".to_owned();
118+ assert!(parse_rs(&config, "// needs-asm-support").ignore);
119+
120+ config.target = "i686-unknown-netbsd".to_owned();
121+ assert!(!parse_rs(&config, "// needs-asm-support").ignore);
122+}
123+
cefde48f 124+#[test]
2a1338f7
XL
125 fn test_extract_version_range() {
126 use super::{extract_llvm_version, extract_version_range};
cefde48f 127
2a1338f7
XL
128--- a/src/tools/compiletest/src/util.rs
129+++ b/src/tools/compiletest/src/util.rs
cefde48f 130@@ -128,6 +128,15 @@
2a1338f7
XL
131 "sparcv9",
132 ];
133
134+static ASM_SUPPORTED_ARCHS: &[&str] = &[
135+ "x86", "x86_64", "arm", "aarch64", "riscv32", "riscv64", "nvptx64", "hexagon", "mips",
136+ "mips64", "spirv", "wasm32",
137+];
138+
139+pub fn has_asm_support(triple: &str) -> bool {
140+ ASM_SUPPORTED_ARCHS.contains(&get_arch(triple))
141+}
142+
143 pub fn matches_os(triple: &str, name: &str) -> bool {
144 // For the wasm32 bare target we ignore anything also ignored on emscripten
145 // and then we also recognize `wasm32-bare` as the os for the target