From 61c233bac354df524f1e6daf29cf9521a6bb3de6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mi=C4=85sko?= Date: Wed, 12 Jan 2022 00:00:00 +0000 Subject: [PATCH] Remove ui tests for LLVM-style inline assembly --- src/test/ui/asm/naked-functions.rs | 12 --- src/test/ui/asm/naked-functions.stderr | 91 +++++++------------ src/test/ui/ast-json/ast-json-ice.rs | 9 -- src/test/ui/borrowck/borrowck-asm.rs | 83 ----------------- src/test/ui/borrowck/borrowck-asm.stderr | 81 ----------------- .../ui/consts/miri_unleashed/inline_asm.rs | 13 +-- .../consts/miri_unleashed/inline_asm.stderr | 20 +--- src/test/ui/error-codes/E0660.rs | 10 -- src/test/ui/error-codes/E0660.stderr | 15 --- src/test/ui/error-codes/E0661.rs | 10 -- src/test/ui/error-codes/E0661.stderr | 16 ---- src/test/ui/error-codes/E0662.rs | 11 --- src/test/ui/error-codes/E0662.stderr | 9 -- src/test/ui/error-codes/E0663.rs | 11 --- src/test/ui/error-codes/E0663.stderr | 9 -- src/test/ui/error-codes/E0664.rs | 12 --- src/test/ui/error-codes/E0664.stderr | 9 -- src/test/ui/feature-gates/feature-gate-asm.rs | 10 -- .../ui/feature-gates/feature-gate-asm.stderr | 12 --- .../ui/feature-gates/feature-gate-asm2.rs | 10 -- .../ui/feature-gates/feature-gate-asm2.stderr | 12 --- src/test/ui/issues/issue-9129.rs | 2 - .../ui/llvm-asm/asm-src-loc-codegen-units.rs | 13 --- src/test/ui/llvm-asm/asm-src-loc.rs | 12 --- .../ui/llvm-asm/inline-asm-bad-constraint.rs | 41 --------- .../llvm-asm/inline-asm-bad-constraint.stderr | 27 ------ .../ui/llvm-asm/inline-asm-bad-operand.rs | 60 ------------ .../ui/llvm-asm/inline-asm-bad-operand.stderr | 45 --------- src/test/ui/llvm-asm/issue-14936.rs | 49 ---------- src/test/ui/llvm-asm/issue-23458.rs | 12 --- src/test/ui/llvm-asm/issue-23458.stderr | 20 ---- src/test/ui/llvm-asm/issue-33264.rs | 30 ------ src/test/ui/llvm-asm/issue-37366.rs | 16 ---- src/test/ui/llvm-asm/issue-37433.rs | 12 --- src/test/ui/llvm-asm/issue-37433.stderr | 9 -- src/test/ui/llvm-asm/issue-51431.rs | 12 --- src/test/ui/llvm-asm/issue-51431.stderr | 9 -- .../issue-53787-inline-assembler-macro.rs | 27 ------ .../issue-53787-inline-assembler-macro.stderr | 9 -- src/test/ui/llvm-asm/issue-54067.rs | 13 --- src/test/ui/llvm-asm/issue-62046.rs | 12 --- src/test/ui/llvm-asm/issue-62046.stderr | 11 --- src/test/ui/llvm-asm/issue-69092.rs | 13 --- src/test/ui/llvm-asm/issue-69092.stderr | 14 --- src/test/ui/llvm-asm/llvm-asm-bad-clobber.rs | 27 ------ .../ui/llvm-asm/llvm-asm-bad-clobber.stderr | 9 -- src/test/ui/llvm-asm/llvm-asm-concat-src.rs | 10 -- .../ui/llvm-asm/llvm-asm-in-bad-modifier.rs | 36 -------- .../llvm-asm/llvm-asm-in-bad-modifier.stderr | 16 ---- src/test/ui/llvm-asm/llvm-asm-in-moved.rs | 32 ------- .../ui/llvm-asm/llvm-asm-in-out-operand.rs | 57 ------------ .../ui/llvm-asm/llvm-asm-indirect-memory.rs | 44 --------- .../ui/llvm-asm/llvm-asm-literal-escaping.rs | 13 --- .../ui/llvm-asm/llvm-asm-misplaced-option.rs | 37 -------- .../llvm-asm/llvm-asm-misplaced-option.stderr | 14 --- .../ui/llvm-asm/llvm-asm-out-assign-imm.rs | 36 -------- .../llvm-asm/llvm-asm-out-assign-imm.stderr | 14 --- src/test/ui/llvm-asm/llvm-asm-out-assign.rs | 26 ------ .../ui/llvm-asm/llvm-asm-out-no-modifier.rs | 33 ------- .../llvm-asm/llvm-asm-out-no-modifier.stderr | 9 -- .../ui/llvm-asm/llvm-asm-out-read-uninit.rs | 34 ------- .../llvm-asm/llvm-asm-out-read-uninit.stderr | 9 -- src/test/ui/llvm-asm/llvm-asm-parse-errors.rs | 16 ---- .../ui/llvm-asm/llvm-asm-parse-errors.stderr | 68 -------------- src/test/ui/macros/macros-nonfatal-errors.rs | 2 - .../ui/macros/macros-nonfatal-errors.stderr | 68 +++++++------- src/test/ui/runtime/out-of-stack.rs | 1 - src/test/ui/unsafe/inline_asm.mir.stderr | 13 +-- src/test/ui/unsafe/inline_asm.rs | 4 - src/test/ui/unsafe/inline_asm.thir.stderr | 13 +-- 70 files changed, 74 insertions(+), 1500 deletions(-) delete mode 100644 src/test/ui/borrowck/borrowck-asm.rs delete mode 100644 src/test/ui/borrowck/borrowck-asm.stderr delete mode 100644 src/test/ui/error-codes/E0660.rs delete mode 100644 src/test/ui/error-codes/E0660.stderr delete mode 100644 src/test/ui/error-codes/E0661.rs delete mode 100644 src/test/ui/error-codes/E0661.stderr delete mode 100644 src/test/ui/error-codes/E0662.rs delete mode 100644 src/test/ui/error-codes/E0662.stderr delete mode 100644 src/test/ui/error-codes/E0663.rs delete mode 100644 src/test/ui/error-codes/E0663.stderr delete mode 100644 src/test/ui/error-codes/E0664.rs delete mode 100644 src/test/ui/error-codes/E0664.stderr delete mode 100644 src/test/ui/feature-gates/feature-gate-asm.rs delete mode 100644 src/test/ui/feature-gates/feature-gate-asm.stderr delete mode 100644 src/test/ui/feature-gates/feature-gate-asm2.rs delete mode 100644 src/test/ui/feature-gates/feature-gate-asm2.stderr delete mode 100644 src/test/ui/llvm-asm/asm-src-loc-codegen-units.rs delete mode 100644 src/test/ui/llvm-asm/asm-src-loc.rs delete mode 100644 src/test/ui/llvm-asm/inline-asm-bad-constraint.rs delete mode 100644 src/test/ui/llvm-asm/inline-asm-bad-constraint.stderr delete mode 100644 src/test/ui/llvm-asm/inline-asm-bad-operand.rs delete mode 100644 src/test/ui/llvm-asm/inline-asm-bad-operand.stderr delete mode 100644 src/test/ui/llvm-asm/issue-14936.rs delete mode 100644 src/test/ui/llvm-asm/issue-23458.rs delete mode 100644 src/test/ui/llvm-asm/issue-23458.stderr delete mode 100644 src/test/ui/llvm-asm/issue-33264.rs delete mode 100644 src/test/ui/llvm-asm/issue-37366.rs delete mode 100644 src/test/ui/llvm-asm/issue-37433.rs delete mode 100644 src/test/ui/llvm-asm/issue-37433.stderr delete mode 100644 src/test/ui/llvm-asm/issue-51431.rs delete mode 100644 src/test/ui/llvm-asm/issue-51431.stderr delete mode 100644 src/test/ui/llvm-asm/issue-53787-inline-assembler-macro.rs delete mode 100644 src/test/ui/llvm-asm/issue-53787-inline-assembler-macro.stderr delete mode 100644 src/test/ui/llvm-asm/issue-54067.rs delete mode 100644 src/test/ui/llvm-asm/issue-62046.rs delete mode 100644 src/test/ui/llvm-asm/issue-62046.stderr delete mode 100644 src/test/ui/llvm-asm/issue-69092.rs delete mode 100644 src/test/ui/llvm-asm/issue-69092.stderr delete mode 100644 src/test/ui/llvm-asm/llvm-asm-bad-clobber.rs delete mode 100644 src/test/ui/llvm-asm/llvm-asm-bad-clobber.stderr delete mode 100644 src/test/ui/llvm-asm/llvm-asm-concat-src.rs delete mode 100644 src/test/ui/llvm-asm/llvm-asm-in-bad-modifier.rs delete mode 100644 src/test/ui/llvm-asm/llvm-asm-in-bad-modifier.stderr delete mode 100644 src/test/ui/llvm-asm/llvm-asm-in-moved.rs delete mode 100644 src/test/ui/llvm-asm/llvm-asm-in-out-operand.rs delete mode 100644 src/test/ui/llvm-asm/llvm-asm-indirect-memory.rs delete mode 100644 src/test/ui/llvm-asm/llvm-asm-literal-escaping.rs delete mode 100644 src/test/ui/llvm-asm/llvm-asm-misplaced-option.rs delete mode 100644 src/test/ui/llvm-asm/llvm-asm-misplaced-option.stderr delete mode 100644 src/test/ui/llvm-asm/llvm-asm-out-assign-imm.rs delete mode 100644 src/test/ui/llvm-asm/llvm-asm-out-assign-imm.stderr delete mode 100644 src/test/ui/llvm-asm/llvm-asm-out-assign.rs delete mode 100644 src/test/ui/llvm-asm/llvm-asm-out-no-modifier.rs delete mode 100644 src/test/ui/llvm-asm/llvm-asm-out-no-modifier.stderr delete mode 100644 src/test/ui/llvm-asm/llvm-asm-out-read-uninit.rs delete mode 100644 src/test/ui/llvm-asm/llvm-asm-out-read-uninit.stderr delete mode 100644 src/test/ui/llvm-asm/llvm-asm-parse-errors.rs delete mode 100644 src/test/ui/llvm-asm/llvm-asm-parse-errors.stderr diff --git a/src/test/ui/asm/naked-functions.rs b/src/test/ui/asm/naked-functions.rs index b44204b9005..32431d9e7c6 100644 --- a/src/test/ui/asm/naked-functions.rs +++ b/src/test/ui/asm/naked-functions.rs @@ -3,12 +3,10 @@ // ignore-spirv // ignore-wasm32 -#![feature(llvm_asm)] #![feature(naked_functions)] #![feature(or_patterns)] #![feature(asm_const, asm_sym)] #![crate_type = "lib"] -#![allow(deprecated)] // llvm_asm! use std::arch::asm; @@ -114,16 +112,6 @@ pub fn outer(x: u32) -> extern "C" fn(usize) -> usize { inner } -#[naked] -unsafe extern "C" fn llvm() -> ! { - //~^ WARN naked functions must contain a single asm block - //~| WARN this was previously accepted - llvm_asm!(""); - //~^ WARN LLVM-style inline assembly is unsupported in naked functions - //~| WARN this was previously accepted - core::hint::unreachable_unchecked(); -} - #[naked] unsafe extern "C" fn invalid_options() { asm!("", options(nomem, preserves_flags, noreturn)); diff --git a/src/test/ui/asm/naked-functions.stderr b/src/test/ui/asm/naked-functions.stderr index 8e177f5a52c..c2dfe443d60 100644 --- a/src/test/ui/asm/naked-functions.stderr +++ b/src/test/ui/asm/naked-functions.stderr @@ -1,35 +1,35 @@ error: asm with the `pure` option must have at least one output - --> $DIR/naked-functions.rs:136:14 + --> $DIR/naked-functions.rs:124:14 | LL | asm!("", options(readonly, nostack), options(pure)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^ error: patterns not allowed in naked function parameters - --> $DIR/naked-functions.rs:23:5 + --> $DIR/naked-functions.rs:21:5 | LL | mut a: u32, | ^^^^^ error: patterns not allowed in naked function parameters - --> $DIR/naked-functions.rs:25:5 + --> $DIR/naked-functions.rs:23:5 | LL | &b: &i32, | ^^ error: patterns not allowed in naked function parameters - --> $DIR/naked-functions.rs:27:6 + --> $DIR/naked-functions.rs:25:6 | LL | (None | Some(_)): Option>, | ^^^^^^^^^^^^^^ error: patterns not allowed in naked function parameters - --> $DIR/naked-functions.rs:29:5 + --> $DIR/naked-functions.rs:27:5 | LL | P { x, y }: P, | ^^^^^^^^^^ error: referencing function parameters is not allowed in naked functions - --> $DIR/naked-functions.rs:39:5 + --> $DIR/naked-functions.rs:37:5 | LL | a + 1 | ^ @@ -37,7 +37,7 @@ LL | a + 1 = help: follow the calling convention in asm block to use parameters warning: naked functions must contain a single asm block - --> $DIR/naked-functions.rs:36:1 + --> $DIR/naked-functions.rs:34:1 | LL | / pub unsafe extern "C" fn inc(a: u32) -> u32 { LL | | @@ -53,7 +53,7 @@ LL | | } = note: for more information, see issue #32408 error: referencing function parameters is not allowed in naked functions - --> $DIR/naked-functions.rs:45:31 + --> $DIR/naked-functions.rs:43:31 | LL | asm!("/* {0} */", in(reg) a, options(noreturn)); | ^ @@ -61,7 +61,7 @@ LL | asm!("/* {0} */", in(reg) a, options(noreturn)); = help: follow the calling convention in asm block to use parameters warning: only `const` and `sym` operands are supported in naked functions - --> $DIR/naked-functions.rs:45:23 + --> $DIR/naked-functions.rs:43:23 | LL | asm!("/* {0} */", in(reg) a, options(noreturn)); | ^^^^^^^^^ @@ -70,7 +70,7 @@ LL | asm!("/* {0} */", in(reg) a, options(noreturn)); = note: for more information, see issue #32408 warning: naked functions must contain a single asm block - --> $DIR/naked-functions.rs:52:1 + --> $DIR/naked-functions.rs:50:1 | LL | / pub unsafe extern "C" fn inc_closure(a: u32) -> u32 { LL | | @@ -84,7 +84,7 @@ LL | | } = note: for more information, see issue #32408 warning: only `const` and `sym` operands are supported in naked functions - --> $DIR/naked-functions.rs:72:10 + --> $DIR/naked-functions.rs:70:10 | LL | in(reg) a, | ^^^^^^^^^ @@ -102,7 +102,7 @@ LL | out(reg) e, = note: for more information, see issue #32408 warning: asm in naked functions must use `noreturn` option - --> $DIR/naked-functions.rs:69:5 + --> $DIR/naked-functions.rs:67:5 | LL | / asm!("/* {0} {1} {2} {3} {4} {5} {6} */", LL | | @@ -117,7 +117,7 @@ LL | | ); = note: for more information, see issue #32408 warning: naked functions must contain a single asm block - --> $DIR/naked-functions.rs:59:1 + --> $DIR/naked-functions.rs:57:1 | LL | / pub unsafe extern "C" fn unsupported_operands() { LL | | @@ -141,7 +141,7 @@ LL | | } = note: for more information, see issue #32408 warning: naked functions must contain a single asm block - --> $DIR/naked-functions.rs:85:1 + --> $DIR/naked-functions.rs:83:1 | LL | / pub extern "C" fn missing_assembly() { LL | | @@ -153,7 +153,7 @@ LL | | } = note: for more information, see issue #32408 warning: asm in naked functions must use `noreturn` option - --> $DIR/naked-functions.rs:94:5 + --> $DIR/naked-functions.rs:92:5 | LL | asm!(""); | ^^^^^^^^ @@ -162,7 +162,7 @@ LL | asm!(""); = note: for more information, see issue #32408 warning: asm in naked functions must use `noreturn` option - --> $DIR/naked-functions.rs:97:5 + --> $DIR/naked-functions.rs:95:5 | LL | asm!(""); | ^^^^^^^^ @@ -171,7 +171,7 @@ LL | asm!(""); = note: for more information, see issue #32408 warning: asm in naked functions must use `noreturn` option - --> $DIR/naked-functions.rs:100:5 + --> $DIR/naked-functions.rs:98:5 | LL | asm!(""); | ^^^^^^^^ @@ -180,7 +180,7 @@ LL | asm!(""); = note: for more information, see issue #32408 warning: naked functions must contain a single asm block - --> $DIR/naked-functions.rs:91:1 + --> $DIR/naked-functions.rs:89:1 | LL | / pub extern "C" fn too_many_asm_blocks() { LL | | @@ -202,7 +202,7 @@ LL | | } = note: for more information, see issue #32408 error: referencing function parameters is not allowed in naked functions - --> $DIR/naked-functions.rs:111:11 + --> $DIR/naked-functions.rs:109:11 | LL | *&y | ^ @@ -210,7 +210,7 @@ LL | *&y = help: follow the calling convention in asm block to use parameters warning: naked functions must contain a single asm block - --> $DIR/naked-functions.rs:108:5 + --> $DIR/naked-functions.rs:106:5 | LL | / pub extern "C" fn inner(y: usize) -> usize { LL | | @@ -224,35 +224,8 @@ LL | | } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #32408 -warning: the LLVM-style inline assembly is unsupported in naked functions - --> $DIR/naked-functions.rs:121:5 - | -LL | llvm_asm!(""); - | ^^^^^^^^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #32408 - = help: use the new asm! syntax specified in RFC 2873 - = note: this warning originates in the macro `llvm_asm` (in Nightly builds, run with -Z macro-backtrace for more info) - -warning: naked functions must contain a single asm block - --> $DIR/naked-functions.rs:118:1 - | -LL | / unsafe extern "C" fn llvm() -> ! { -LL | | -LL | | -LL | | llvm_asm!(""); -... | -LL | | core::hint::unreachable_unchecked(); - | | ------------------------------------ non-asm is unsupported in naked functions -LL | | } - | |_^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #32408 - warning: asm options unsupported in naked functions: `nomem`, `preserves_flags` - --> $DIR/naked-functions.rs:129:5 + --> $DIR/naked-functions.rs:117:5 | LL | asm!("", options(nomem, preserves_flags, noreturn)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -261,7 +234,7 @@ LL | asm!("", options(nomem, preserves_flags, noreturn)); = note: for more information, see issue #32408 warning: asm options unsupported in naked functions: `nostack`, `pure`, `readonly` - --> $DIR/naked-functions.rs:136:5 + --> $DIR/naked-functions.rs:124:5 | LL | asm!("", options(readonly, nostack), options(pure)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -270,7 +243,7 @@ LL | asm!("", options(readonly, nostack), options(pure)); = note: for more information, see issue #32408 warning: asm in naked functions must use `noreturn` option - --> $DIR/naked-functions.rs:136:5 + --> $DIR/naked-functions.rs:124:5 | LL | asm!("", options(readonly, nostack), options(pure)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -279,7 +252,7 @@ LL | asm!("", options(readonly, nostack), options(pure)); = note: for more information, see issue #32408 warning: Rust ABI is unsupported in naked functions - --> $DIR/naked-functions.rs:145:15 + --> $DIR/naked-functions.rs:133:15 | LL | pub unsafe fn default_abi() { | ^^^^^^^^^^^ @@ -287,13 +260,13 @@ LL | pub unsafe fn default_abi() { = note: `#[warn(undefined_naked_function_abi)]` on by default warning: Rust ABI is unsupported in naked functions - --> $DIR/naked-functions.rs:151:15 + --> $DIR/naked-functions.rs:139:15 | LL | pub unsafe fn rust_abi() { | ^^^^^^^^ warning: naked functions cannot be inlined - --> $DIR/naked-functions.rs:191:1 + --> $DIR/naked-functions.rs:179:1 | LL | #[inline] | ^^^^^^^^^ @@ -302,7 +275,7 @@ LL | #[inline] = note: for more information, see issue #32408 warning: naked functions cannot be inlined - --> $DIR/naked-functions.rs:199:1 + --> $DIR/naked-functions.rs:187:1 | LL | #[inline(always)] | ^^^^^^^^^^^^^^^^^ @@ -311,7 +284,7 @@ LL | #[inline(always)] = note: for more information, see issue #32408 warning: naked functions cannot be inlined - --> $DIR/naked-functions.rs:207:1 + --> $DIR/naked-functions.rs:195:1 | LL | #[inline(never)] | ^^^^^^^^^^^^^^^^ @@ -320,7 +293,7 @@ LL | #[inline(never)] = note: for more information, see issue #32408 warning: naked functions cannot be inlined - --> $DIR/naked-functions.rs:215:1 + --> $DIR/naked-functions.rs:203:1 | LL | #[inline] | ^^^^^^^^^ @@ -329,7 +302,7 @@ LL | #[inline] = note: for more information, see issue #32408 warning: naked functions cannot be inlined - --> $DIR/naked-functions.rs:218:1 + --> $DIR/naked-functions.rs:206:1 | LL | #[inline(always)] | ^^^^^^^^^^^^^^^^^ @@ -338,7 +311,7 @@ LL | #[inline(always)] = note: for more information, see issue #32408 warning: naked functions cannot be inlined - --> $DIR/naked-functions.rs:221:1 + --> $DIR/naked-functions.rs:209:1 | LL | #[inline(never)] | ^^^^^^^^^^^^^^^^ @@ -346,5 +319,5 @@ LL | #[inline(never)] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #32408 -error: aborting due to 8 previous errors; 25 warnings emitted +error: aborting due to 8 previous errors; 23 warnings emitted diff --git a/src/test/ui/ast-json/ast-json-ice.rs b/src/test/ui/ast-json/ast-json-ice.rs index 1a19883ae15..ce93e4b5d4b 100644 --- a/src/test/ui/ast-json/ast-json-ice.rs +++ b/src/test/ui/ast-json/ast-json-ice.rs @@ -8,9 +8,6 @@ // check-pass // dont-check-compiler-stdout - don't check for any AST change. -#![feature(llvm_asm)] -#![allow(deprecated)] // llvm_asm! - enum V { A(i32), B { f: [i64; 3 + 4] } @@ -27,12 +24,6 @@ macro_rules! call_println { } fn main() { - #[cfg(any(target_arch = "x86", - target_arch = "x86_64", - target_arch = "arm", - target_arch = "aarch64"))] - unsafe { llvm_asm!(""::::); } - let x: (i32) = 35; let y = x as i64<> + 5; diff --git a/src/test/ui/borrowck/borrowck-asm.rs b/src/test/ui/borrowck/borrowck-asm.rs deleted file mode 100644 index 0d202c1b452..00000000000 --- a/src/test/ui/borrowck/borrowck-asm.rs +++ /dev/null @@ -1,83 +0,0 @@ -// ignore-s390x -// ignore-emscripten -// ignore-powerpc -// ignore-powerpc64 -// ignore-powerpc64le -// ignore-riscv64 -// ignore-sparc -// ignore-sparc64 - -#![feature(llvm_asm)] -#![allow(deprecated)] // llvm_asm! - -#[cfg(any(target_arch = "x86", - target_arch = "x86_64", - target_arch = "arm", - target_arch = "aarch64", - target_arch = "mips", - target_arch = "mips64"))] -mod test_cases { - fn is_move() { - let y: &mut isize; - let x = &mut 0isize; - unsafe { - llvm_asm!("nop" : : "r"(x)); - } - let z = x; //~ ERROR use of moved value: `x` - } - - fn in_is_read() { - let mut x = 3; - let y = &mut x; - unsafe { - llvm_asm!("nop" : : "r"(x)); //~ ERROR cannot use - } - let z = y; - } - - fn out_is_assign() { - let x = 3; - unsafe { - llvm_asm!("nop" : "=r"(x)); //~ ERROR cannot assign twice - } - let mut a = &mut 3; - let b = &*a; - unsafe { - llvm_asm!("nop" : "=r"(a)); // OK, Shallow write to `a` - } - let c = b; - let d = *a; - } - - fn rw_is_assign() { - let x = 3; - unsafe { - llvm_asm!("nop" : "+r"(x)); //~ ERROR cannot assign twice - } - } - - fn indirect_is_not_init() { - let x: i32; - unsafe { - llvm_asm!("nop" : "=*r"(x)); //~ ERROR use of possibly-uninitialized variable - } - } - - fn rw_is_read() { - let mut x = &mut 3; - let y = &*x; - unsafe { - llvm_asm!("nop" : "+r"(x)); //~ ERROR cannot assign to `x` because it is borrowed - } - let z = y; - } - - fn two_moves() { - let x = &mut 2; - unsafe { - llvm_asm!("nop" : : "r"(x), "r"(x) ); //~ ERROR use of moved value - } - } -} - -fn main() {} diff --git a/src/test/ui/borrowck/borrowck-asm.stderr b/src/test/ui/borrowck/borrowck-asm.stderr deleted file mode 100644 index ff5847d826e..00000000000 --- a/src/test/ui/borrowck/borrowck-asm.stderr +++ /dev/null @@ -1,81 +0,0 @@ -error[E0382]: use of moved value: `x` - --> $DIR/borrowck-asm.rs:26:17 - | -LL | let x = &mut 0isize; - | - move occurs because `x` has type `&mut isize`, which does not implement the `Copy` trait -LL | unsafe { -LL | llvm_asm!("nop" : : "r"(x)); - | - value moved here -LL | } -LL | let z = x; - | ^ value used here after move - -error[E0503]: cannot use `x` because it was mutably borrowed - --> $DIR/borrowck-asm.rs:33:37 - | -LL | let y = &mut x; - | ------ borrow of `x` occurs here -LL | unsafe { -LL | llvm_asm!("nop" : : "r"(x)); - | ^ use of borrowed `x` -LL | } -LL | let z = y; - | - borrow later used here - -error[E0384]: cannot assign twice to immutable variable `x` - --> $DIR/borrowck-asm.rs:41:36 - | -LL | let x = 3; - | - - | | - | first assignment to `x` - | help: consider making this binding mutable: `mut x` -LL | unsafe { -LL | llvm_asm!("nop" : "=r"(x)); - | ^ cannot assign twice to immutable variable - -error[E0384]: cannot assign twice to immutable variable `x` - --> $DIR/borrowck-asm.rs:55:36 - | -LL | let x = 3; - | - - | | - | first assignment to `x` - | help: consider making this binding mutable: `mut x` -LL | unsafe { -LL | llvm_asm!("nop" : "+r"(x)); - | ^ cannot assign twice to immutable variable - -error[E0381]: use of possibly-uninitialized variable: `x` - --> $DIR/borrowck-asm.rs:62:37 - | -LL | llvm_asm!("nop" : "=*r"(x)); - | ^ use of possibly-uninitialized `x` - -error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/borrowck-asm.rs:70:36 - | -LL | let y = &*x; - | --- borrow of `x` occurs here -LL | unsafe { -LL | llvm_asm!("nop" : "+r"(x)); - | ^ assignment to borrowed `x` occurs here -LL | } -LL | let z = y; - | - borrow later used here - -error[E0382]: use of moved value: `x` - --> $DIR/borrowck-asm.rs:78:45 - | -LL | let x = &mut 2; - | - move occurs because `x` has type `&mut i32`, which does not implement the `Copy` trait -LL | unsafe { -LL | llvm_asm!("nop" : : "r"(x), "r"(x) ); - | - ^ value used here after move - | | - | value moved here - -error: aborting due to 7 previous errors - -Some errors have detailed explanations: E0381, E0382, E0384, E0503, E0506. -For more information about an error, try `rustc --explain E0381`. diff --git a/src/test/ui/consts/miri_unleashed/inline_asm.rs b/src/test/ui/consts/miri_unleashed/inline_asm.rs index 1bb22a1301a..6971170337d 100644 --- a/src/test/ui/consts/miri_unleashed/inline_asm.rs +++ b/src/test/ui/consts/miri_unleashed/inline_asm.rs @@ -1,24 +1,13 @@ // compile-flags: -Zunleash-the-miri-inside-of-you // only-x86_64 -#![feature(llvm_asm)] #![allow(const_err)] -#![allow(deprecated)] // llvm_asm! use std::arch::asm; fn main() {} // Make sure we catch executing inline assembly. -static TEST_BAD1: () = { - unsafe { llvm_asm!("xor %eax, %eax" ::: "eax"); } - //~^ ERROR could not evaluate static initializer - //~| NOTE inline assembly is not supported - //~| NOTE in this expansion of llvm_asm! - //~| NOTE in this expansion of llvm_asm! -}; - -// Make sure we catch executing inline assembly. -static TEST_BAD2: () = { +static TEST_BAD: () = { unsafe { asm!("nop"); } //~^ ERROR could not evaluate static initializer //~| NOTE inline assembly is not supported diff --git a/src/test/ui/consts/miri_unleashed/inline_asm.stderr b/src/test/ui/consts/miri_unleashed/inline_asm.stderr index 34ac808ed17..595b859cbce 100644 --- a/src/test/ui/consts/miri_unleashed/inline_asm.stderr +++ b/src/test/ui/consts/miri_unleashed/inline_asm.stderr @@ -1,13 +1,5 @@ error[E0080]: could not evaluate static initializer - --> $DIR/inline_asm.rs:13:14 - | -LL | unsafe { llvm_asm!("xor %eax, %eax" ::: "eax"); } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ inline assembly is not supported - | - = note: this error originates in the macro `llvm_asm` (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0080]: could not evaluate static initializer - --> $DIR/inline_asm.rs:22:14 + --> $DIR/inline_asm.rs:11:14 | LL | unsafe { asm!("nop"); } | ^^^^^^^^^^^ inline assembly is not supported @@ -15,17 +7,11 @@ LL | unsafe { asm!("nop"); } warning: skipping const checks | help: skipping check that does not even have a feature gate - --> $DIR/inline_asm.rs:13:14 - | -LL | unsafe { llvm_asm!("xor %eax, %eax" ::: "eax"); } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -help: skipping check that does not even have a feature gate - --> $DIR/inline_asm.rs:22:14 + --> $DIR/inline_asm.rs:11:14 | LL | unsafe { asm!("nop"); } | ^^^^^^^^^^^ - = note: this warning originates in the macro `llvm_asm` (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to 2 previous errors; 1 warning emitted +error: aborting due to previous error; 1 warning emitted For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/error-codes/E0660.rs b/src/test/ui/error-codes/E0660.rs deleted file mode 100644 index 43af2406f5e..00000000000 --- a/src/test/ui/error-codes/E0660.rs +++ /dev/null @@ -1,10 +0,0 @@ -#![feature(llvm_asm)] -#![allow(deprecated)] // llvm_asm! - -fn main() { - let a; - llvm_asm!("nop" "nop"); - //~^ ERROR E0660 - llvm_asm!("nop" "nop" : "=r"(a)); - //~^ ERROR E0660 -} diff --git a/src/test/ui/error-codes/E0660.stderr b/src/test/ui/error-codes/E0660.stderr deleted file mode 100644 index d9d2f35251b..00000000000 --- a/src/test/ui/error-codes/E0660.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0660]: malformed inline assembly - --> $DIR/E0660.rs:6:5 - | -LL | llvm_asm!("nop" "nop"); - | ^^^^^^^^^^^^^^^^^^^^^^ - -error[E0660]: malformed inline assembly - --> $DIR/E0660.rs:8:5 - | -LL | llvm_asm!("nop" "nop" : "=r"(a)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0660`. diff --git a/src/test/ui/error-codes/E0661.rs b/src/test/ui/error-codes/E0661.rs deleted file mode 100644 index 854675c3639..00000000000 --- a/src/test/ui/error-codes/E0661.rs +++ /dev/null @@ -1,10 +0,0 @@ -// ignore-emscripten - -#![feature(llvm_asm)] -#![allow(deprecated)] // llvm_asm! - -fn main() { - let a; //~ ERROR type annotations needed - llvm_asm!("nop" : "r"(a)); - //~^ ERROR E0661 -} diff --git a/src/test/ui/error-codes/E0661.stderr b/src/test/ui/error-codes/E0661.stderr deleted file mode 100644 index 73745ef9775..00000000000 --- a/src/test/ui/error-codes/E0661.stderr +++ /dev/null @@ -1,16 +0,0 @@ -error[E0661]: output operand constraint lacks '=' or '+' - --> $DIR/E0661.rs:8:23 - | -LL | llvm_asm!("nop" : "r"(a)); - | ^^^ - -error[E0282]: type annotations needed - --> $DIR/E0661.rs:7:9 - | -LL | let a; - | ^ consider giving `a` a type - -error: aborting due to 2 previous errors - -Some errors have detailed explanations: E0282, E0661. -For more information about an error, try `rustc --explain E0282`. diff --git a/src/test/ui/error-codes/E0662.rs b/src/test/ui/error-codes/E0662.rs deleted file mode 100644 index 679a88c3433..00000000000 --- a/src/test/ui/error-codes/E0662.rs +++ /dev/null @@ -1,11 +0,0 @@ -// ignore-emscripten - -#![feature(llvm_asm)] -#![allow(deprecated)] // llvm_asm! - -fn main() { - llvm_asm!("xor %eax, %eax" - : - : "=test"("a") //~ ERROR E0662 - ); -} diff --git a/src/test/ui/error-codes/E0662.stderr b/src/test/ui/error-codes/E0662.stderr deleted file mode 100644 index f6695d700fb..00000000000 --- a/src/test/ui/error-codes/E0662.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0662]: input operand constraint contains '=' - --> $DIR/E0662.rs:9:17 - | -LL | : "=test"("a") - | ^^^^^^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0662`. diff --git a/src/test/ui/error-codes/E0663.rs b/src/test/ui/error-codes/E0663.rs deleted file mode 100644 index b82f1adfb42..00000000000 --- a/src/test/ui/error-codes/E0663.rs +++ /dev/null @@ -1,11 +0,0 @@ -// ignore-emscripten - -#![feature(llvm_asm)] -#![allow(deprecated)] // llvm_asm! - -fn main() { - llvm_asm!("xor %eax, %eax" - : - : "+test"("a") //~ ERROR E0663 - ); -} diff --git a/src/test/ui/error-codes/E0663.stderr b/src/test/ui/error-codes/E0663.stderr deleted file mode 100644 index 5f8dede0242..00000000000 --- a/src/test/ui/error-codes/E0663.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0663]: input operand constraint contains '+' - --> $DIR/E0663.rs:9:17 - | -LL | : "+test"("a") - | ^^^^^^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0663`. diff --git a/src/test/ui/error-codes/E0664.rs b/src/test/ui/error-codes/E0664.rs deleted file mode 100644 index d2730f04f45..00000000000 --- a/src/test/ui/error-codes/E0664.rs +++ /dev/null @@ -1,12 +0,0 @@ -// ignore-emscripten - -#![feature(llvm_asm)] -#![allow(deprecated)] // llvm_asm! - -fn main() { - llvm_asm!("mov $$0x200, %eax" - : - : - : "{eax}" //~ ERROR E0664 - ); -} diff --git a/src/test/ui/error-codes/E0664.stderr b/src/test/ui/error-codes/E0664.stderr deleted file mode 100644 index 5e6836f28e3..00000000000 --- a/src/test/ui/error-codes/E0664.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0664]: clobber should not be surrounded by braces - --> $DIR/E0664.rs:10:17 - | -LL | : "{eax}" - | ^^^^^^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0664`. diff --git a/src/test/ui/feature-gates/feature-gate-asm.rs b/src/test/ui/feature-gates/feature-gate-asm.rs deleted file mode 100644 index 556219b98a9..00000000000 --- a/src/test/ui/feature-gates/feature-gate-asm.rs +++ /dev/null @@ -1,10 +0,0 @@ -// only-x86_64 - -#![allow(deprecated)] // llvm_asm! - -fn main() { - unsafe { - llvm_asm!(""); - //~^ ERROR prefer using the new asm! syntax instead - } -} diff --git a/src/test/ui/feature-gates/feature-gate-asm.stderr b/src/test/ui/feature-gates/feature-gate-asm.stderr deleted file mode 100644 index 72ba70d0d91..00000000000 --- a/src/test/ui/feature-gates/feature-gate-asm.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0658]: use of unstable library feature 'llvm_asm': prefer using the new asm! syntax instead - --> $DIR/feature-gate-asm.rs:7:9 - | -LL | llvm_asm!(""); - | ^^^^^^^^ - | - = note: see issue #70173 for more information - = help: add `#![feature(llvm_asm)]` to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/feature-gates/feature-gate-asm2.rs b/src/test/ui/feature-gates/feature-gate-asm2.rs deleted file mode 100644 index 712e3a56fd8..00000000000 --- a/src/test/ui/feature-gates/feature-gate-asm2.rs +++ /dev/null @@ -1,10 +0,0 @@ -// only-x86_64 - -#![allow(deprecated)] // llvm_asm! - -fn main() { - unsafe { - println!("{:?}", llvm_asm!("")); - //~^ ERROR prefer using the new asm! syntax instead - } -} diff --git a/src/test/ui/feature-gates/feature-gate-asm2.stderr b/src/test/ui/feature-gates/feature-gate-asm2.stderr deleted file mode 100644 index 0297fec16dd..00000000000 --- a/src/test/ui/feature-gates/feature-gate-asm2.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0658]: use of unstable library feature 'llvm_asm': prefer using the new asm! syntax instead - --> $DIR/feature-gate-asm2.rs:7:26 - | -LL | println!("{:?}", llvm_asm!("")); - | ^^^^^^^^ - | - = note: see issue #70173 for more information - = help: add `#![feature(llvm_asm)]` to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/issues/issue-9129.rs b/src/test/ui/issues/issue-9129.rs index 825fed5c722..780a6419c5f 100644 --- a/src/test/ui/issues/issue-9129.rs +++ b/src/test/ui/issues/issue-9129.rs @@ -2,7 +2,6 @@ #![allow(dead_code)] #![allow(non_camel_case_types)] #![allow(non_snake_case)] -#![allow(deprecated)] // llvm_asm! // ignore-pretty unreported #![feature(box_syntax)] @@ -13,7 +12,6 @@ impl bomb for S { fn boom(&self, _: Ident) { } } pub struct Ident { name: usize } -// macro_rules! int3 { () => ( unsafe { llvm_asm!( "int3" ); } ) } macro_rules! int3 { () => ( { } ) } fn Ident_new() -> Ident { diff --git a/src/test/ui/llvm-asm/asm-src-loc-codegen-units.rs b/src/test/ui/llvm-asm/asm-src-loc-codegen-units.rs deleted file mode 100644 index d178c65dff4..00000000000 --- a/src/test/ui/llvm-asm/asm-src-loc-codegen-units.rs +++ /dev/null @@ -1,13 +0,0 @@ -// build-fail -// dont-check-compiler-stderr -// compile-flags: -C codegen-units=2 -// ignore-emscripten - -#![feature(llvm_asm)] -#![allow(deprecated)] // llvm_asm! - -fn main() { - unsafe { - llvm_asm!("nowayisthisavalidinstruction"); //~ ERROR instruction - } -} diff --git a/src/test/ui/llvm-asm/asm-src-loc.rs b/src/test/ui/llvm-asm/asm-src-loc.rs deleted file mode 100644 index 4506c12a0e6..00000000000 --- a/src/test/ui/llvm-asm/asm-src-loc.rs +++ /dev/null @@ -1,12 +0,0 @@ -// build-fail -// dont-check-compiler-stderr -// ignore-emscripten - -#![feature(llvm_asm)] -#![allow(deprecated)] // llvm_asm! - -fn main() { - unsafe { - llvm_asm!("nowayisthisavalidinstruction"); //~ ERROR instruction - } -} diff --git a/src/test/ui/llvm-asm/inline-asm-bad-constraint.rs b/src/test/ui/llvm-asm/inline-asm-bad-constraint.rs deleted file mode 100644 index 6a2ce111cb3..00000000000 --- a/src/test/ui/llvm-asm/inline-asm-bad-constraint.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Test that the compiler will catch invalid inline assembly constraints. - -// build-fail -// ignore-emscripten - -#![feature(llvm_asm)] -#![allow(deprecated)] // llvm_asm! - -extern "C" { - fn foo(a: usize); -} - -fn main() { - bad_register_constraint(); - bad_input(); - wrong_size_output(); -} - -// Issue #54130 -fn bad_register_constraint() { - let rax: u64; - unsafe { - llvm_asm!("" :"={rax"(rax)) //~ ERROR E0668 - }; - println!("Accumulator is: {}", rax); -} - -// Issue #54376 -fn bad_input() { - unsafe { - llvm_asm!("callq $0" : : "0"(foo)) //~ ERROR E0668 - }; -} - -fn wrong_size_output() { - let rax: u64 = 0; - unsafe { - llvm_asm!("addb $1, $0" : "={rax}"((0i32, rax))); //~ ERROR E0668 - } - println!("rax: {}", rax); -} diff --git a/src/test/ui/llvm-asm/inline-asm-bad-constraint.stderr b/src/test/ui/llvm-asm/inline-asm-bad-constraint.stderr deleted file mode 100644 index a624829f149..00000000000 --- a/src/test/ui/llvm-asm/inline-asm-bad-constraint.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error[E0668]: malformed inline assembly - --> $DIR/inline-asm-bad-constraint.rs:23:9 - | -LL | llvm_asm!("" :"={rax"(rax)) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: this error originates in the macro `llvm_asm` (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0668]: malformed inline assembly - --> $DIR/inline-asm-bad-constraint.rs:31:9 - | -LL | llvm_asm!("callq $0" : : "0"(foo)) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: this error originates in the macro `llvm_asm` (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0668]: malformed inline assembly - --> $DIR/inline-asm-bad-constraint.rs:38:9 - | -LL | llvm_asm!("addb $1, $0" : "={rax}"((0i32, rax))); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: this error originates in the macro `llvm_asm` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0668`. diff --git a/src/test/ui/llvm-asm/inline-asm-bad-operand.rs b/src/test/ui/llvm-asm/inline-asm-bad-operand.rs deleted file mode 100644 index 1746c487b1e..00000000000 --- a/src/test/ui/llvm-asm/inline-asm-bad-operand.rs +++ /dev/null @@ -1,60 +0,0 @@ -// Test that the compiler will catch passing invalid values to inline assembly -// operands. - -// build-fail -// ignore-emscripten - -#![feature(llvm_asm)] -#![allow(deprecated)] // llvm_asm! - -#[repr(C)] -struct MyPtr(usize); - -fn main() { - issue_37433(); - issue_37437(); - issue_40187(); - issue_54067(); - multiple_errors(); -} - -fn issue_37433() { - unsafe { - llvm_asm!("" :: "r"("")); //~ ERROR E0669 - } - - unsafe { - let target = MyPtr(0); - llvm_asm!("ret" : : "{rdi}"(target)); //~ ERROR E0669 - } -} - -fn issue_37437() { - let hello: &str = "hello"; - // this should fail... - unsafe { llvm_asm!("" :: "i"(hello)) }; //~ ERROR E0669 - // but this should succeed. - unsafe { llvm_asm!("" :: "r"(hello.as_ptr())) }; -} - -fn issue_40187() { - let arr: [u8; 1] = [0; 1]; - unsafe { - llvm_asm!("movups $1, %xmm0"::"m"(arr)); //~ ERROR E0669 - } -} - -fn issue_54067() { - let addr: Option = Some(123); - unsafe { - llvm_asm!("mov sp, $0"::"r"(addr)); //~ ERROR E0669 - } -} - -fn multiple_errors() { - let addr: (u32, u32) = (1, 2); - unsafe { - llvm_asm!("mov sp, $0"::"r"(addr), //~ ERROR E0669 - "r"("hello e0669")); //~ ERROR E0669 - } -} diff --git a/src/test/ui/llvm-asm/inline-asm-bad-operand.stderr b/src/test/ui/llvm-asm/inline-asm-bad-operand.stderr deleted file mode 100644 index 8bb8a7ae82e..00000000000 --- a/src/test/ui/llvm-asm/inline-asm-bad-operand.stderr +++ /dev/null @@ -1,45 +0,0 @@ -error[E0669]: invalid value for constraint in inline assembly - --> $DIR/inline-asm-bad-operand.rs:23:29 - | -LL | llvm_asm!("" :: "r"("")); - | ^^ - -error[E0669]: invalid value for constraint in inline assembly - --> $DIR/inline-asm-bad-operand.rs:28:37 - | -LL | llvm_asm!("ret" : : "{rdi}"(target)); - | ^^^^^^ - -error[E0669]: invalid value for constraint in inline assembly - --> $DIR/inline-asm-bad-operand.rs:35:34 - | -LL | unsafe { llvm_asm!("" :: "i"(hello)) }; - | ^^^^^ - -error[E0669]: invalid value for constraint in inline assembly - --> $DIR/inline-asm-bad-operand.rs:43:43 - | -LL | llvm_asm!("movups $1, %xmm0"::"m"(arr)); - | ^^^ - -error[E0669]: invalid value for constraint in inline assembly - --> $DIR/inline-asm-bad-operand.rs:50:37 - | -LL | llvm_asm!("mov sp, $0"::"r"(addr)); - | ^^^^ - -error[E0669]: invalid value for constraint in inline assembly - --> $DIR/inline-asm-bad-operand.rs:57:37 - | -LL | llvm_asm!("mov sp, $0"::"r"(addr), - | ^^^^ - -error[E0669]: invalid value for constraint in inline assembly - --> $DIR/inline-asm-bad-operand.rs:58:37 - | -LL | ... "r"("hello e0669")); - | ^^^^^^^^^^^^^ - -error: aborting due to 7 previous errors - -For more information about this error, try `rustc --explain E0669`. diff --git a/src/test/ui/llvm-asm/issue-14936.rs b/src/test/ui/llvm-asm/issue-14936.rs deleted file mode 100644 index 46e5a2a8092..00000000000 --- a/src/test/ui/llvm-asm/issue-14936.rs +++ /dev/null @@ -1,49 +0,0 @@ -// build-pass -#![allow(unused_macros)] -#![allow(dead_code)] -#![allow(deprecated)] // llvm_asm! -#![feature(llvm_asm)] - -type History = Vec<&'static str>; - -fn wrap(x:A, which: &'static str, history: &mut History) -> A { - history.push(which); - x -} - -macro_rules! demo { - ( $output_constraint:tt ) => { - { - let mut x: isize = 0; - let y: isize = 1; - - let mut history: History = vec![]; - unsafe { - llvm_asm!("mov ($1), $0" - : $output_constraint (*wrap(&mut x, "out", &mut history)) - : "r"(&wrap(y, "in", &mut history)) - :: "volatile"); - } - assert_eq!((x,y), (1,1)); - let b: &[_] = &["out", "in"]; - assert_eq!(history, b); - } - } -} - -#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] -fn main() { - fn out_write_only_expr_then_in_expr() { - demo!("=r") - } - - fn out_read_write_expr_then_in_expr() { - demo!("+r") - } - - out_write_only_expr_then_in_expr(); - out_read_write_expr_then_in_expr(); -} - -#[cfg(all(not(target_arch = "x86"), not(target_arch = "x86_64")))] -pub fn main() {} diff --git a/src/test/ui/llvm-asm/issue-23458.rs b/src/test/ui/llvm-asm/issue-23458.rs deleted file mode 100644 index d640828c16d..00000000000 --- a/src/test/ui/llvm-asm/issue-23458.rs +++ /dev/null @@ -1,12 +0,0 @@ -#![feature(llvm_asm)] -#![allow(deprecated)] // llvm_asm! -// compile-flags: -Ccodegen-units=1 -// build-fail -// only-x86_64 - -fn main() { - unsafe { - llvm_asm!("int $3"); //~ ERROR too few operands for instruction - //~| ERROR invalid operand in inline asm - } -} diff --git a/src/test/ui/llvm-asm/issue-23458.stderr b/src/test/ui/llvm-asm/issue-23458.stderr deleted file mode 100644 index 69e458f7ca0..00000000000 --- a/src/test/ui/llvm-asm/issue-23458.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error: invalid operand in inline asm: 'int $3' - --> $DIR/issue-23458.rs:9:9 - | -LL | llvm_asm!("int $3"); - | ^ - -error: too few operands for instruction - --> $DIR/issue-23458.rs:9:9 - | -LL | llvm_asm!("int $3"); - | ^ - | -note: instantiated into assembly here - --> :1:2 - | -LL | int - | ^ - -error: aborting due to 2 previous errors - diff --git a/src/test/ui/llvm-asm/issue-33264.rs b/src/test/ui/llvm-asm/issue-33264.rs deleted file mode 100644 index 8ebf0cfe217..00000000000 --- a/src/test/ui/llvm-asm/issue-33264.rs +++ /dev/null @@ -1,30 +0,0 @@ -// build-pass -// only-x86_64 - -#![allow(dead_code, non_upper_case_globals)] -#![feature(llvm_asm)] -#![allow(deprecated)] // llvm_asm! - -#[repr(C)] -pub struct D32x4(f32,f32,f32,f32); - -impl D32x4 { - fn add(&self, vec: Self) -> Self { - unsafe { - let ret: Self; - llvm_asm!(" - movaps $1, %xmm1 - movaps $2, %xmm2 - addps %xmm1, %xmm2 - movaps $xmm1, $0 - " - : "=r"(ret) - : "1"(self), "2"(vec) - : "xmm1", "xmm2" - ); - ret - } - } -} - -fn main() { } diff --git a/src/test/ui/llvm-asm/issue-37366.rs b/src/test/ui/llvm-asm/issue-37366.rs deleted file mode 100644 index acc2f3e9f5f..00000000000 --- a/src/test/ui/llvm-asm/issue-37366.rs +++ /dev/null @@ -1,16 +0,0 @@ -// check-pass -// ignore-emscripten - -#![feature(llvm_asm)] -#![allow(deprecated)] // llvm_asm! - -macro_rules! interrupt_handler { - () => { - unsafe fn _interrupt_handler() { - llvm_asm!("pop eax" :::: "intel"); - } - } -} -interrupt_handler!{} - -fn main() {} diff --git a/src/test/ui/llvm-asm/issue-37433.rs b/src/test/ui/llvm-asm/issue-37433.rs deleted file mode 100644 index 1c362e8aba0..00000000000 --- a/src/test/ui/llvm-asm/issue-37433.rs +++ /dev/null @@ -1,12 +0,0 @@ -// build-fail -// ignore-emscripten no llvm_asm! support - -#![feature(llvm_asm)] -#![allow(deprecated)] // llvm_asm! - -fn main() { - unsafe { - llvm_asm!("" :: "r"("")); - //~^ ERROR: invalid value for constraint in inline assembly - } -} diff --git a/src/test/ui/llvm-asm/issue-37433.stderr b/src/test/ui/llvm-asm/issue-37433.stderr deleted file mode 100644 index 44a8eb32b7c..00000000000 --- a/src/test/ui/llvm-asm/issue-37433.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0669]: invalid value for constraint in inline assembly - --> $DIR/issue-37433.rs:9:29 - | -LL | llvm_asm!("" :: "r"("")); - | ^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0669`. diff --git a/src/test/ui/llvm-asm/issue-51431.rs b/src/test/ui/llvm-asm/issue-51431.rs deleted file mode 100644 index 706b7147661..00000000000 --- a/src/test/ui/llvm-asm/issue-51431.rs +++ /dev/null @@ -1,12 +0,0 @@ -// build-fail -// ignore-emscripten no llvm_asm! support - -#![feature(llvm_asm)] -#![allow(deprecated)] // llvm_asm! - -fn main() { - unsafe { - llvm_asm! {"mov $0,$1"::"0"("bx"),"1"(0x00)} - //~^ ERROR: invalid value for constraint in inline assembly - } -} diff --git a/src/test/ui/llvm-asm/issue-51431.stderr b/src/test/ui/llvm-asm/issue-51431.stderr deleted file mode 100644 index 35c8c1b66f6..00000000000 --- a/src/test/ui/llvm-asm/issue-51431.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0669]: invalid value for constraint in inline assembly - --> $DIR/issue-51431.rs:9:37 - | -LL | llvm_asm! {"mov $0,$1"::"0"("bx"),"1"(0x00)} - | ^^^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0669`. diff --git a/src/test/ui/llvm-asm/issue-53787-inline-assembler-macro.rs b/src/test/ui/llvm-asm/issue-53787-inline-assembler-macro.rs deleted file mode 100644 index d9fe7cada27..00000000000 --- a/src/test/ui/llvm-asm/issue-53787-inline-assembler-macro.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Regression test for Issue #53787: Fix ICE when creating a label in inline assembler with macros. - -// build-fail -// ignore-emscripten - -#![feature(llvm_asm)] -#![allow(deprecated)] // llvm_asm! - -macro_rules! fake_jump { - ($id:expr) => { - unsafe { - llvm_asm!( - " - jmp $0 - lea eax, [ebx] - xor eax, 0xDEADBEEF - retn - $0: - "::"0"($id)::"volatile", "intel"); - } - }; -} - -fn main() { - fake_jump!("FirstFunc"); //~ ERROR invalid value for constraint in inline assembly - println!("Hello, world!"); -} diff --git a/src/test/ui/llvm-asm/issue-53787-inline-assembler-macro.stderr b/src/test/ui/llvm-asm/issue-53787-inline-assembler-macro.stderr deleted file mode 100644 index fd755e30d58..00000000000 --- a/src/test/ui/llvm-asm/issue-53787-inline-assembler-macro.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0669]: invalid value for constraint in inline assembly - --> $DIR/issue-53787-inline-assembler-macro.rs:25:16 - | -LL | fake_jump!("FirstFunc"); - | ^^^^^^^^^^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0669`. diff --git a/src/test/ui/llvm-asm/issue-54067.rs b/src/test/ui/llvm-asm/issue-54067.rs deleted file mode 100644 index 6e931b9003a..00000000000 --- a/src/test/ui/llvm-asm/issue-54067.rs +++ /dev/null @@ -1,13 +0,0 @@ -// check-pass -// ignore-emscripten no llvm_asm! support - -#![feature(llvm_asm)] -#![allow(deprecated)] // llvm_asm! - -pub fn boot(addr: Option) { - unsafe { - llvm_asm!("mov sp, $0"::"r" (addr)); - } -} - -fn main() {} diff --git a/src/test/ui/llvm-asm/issue-62046.rs b/src/test/ui/llvm-asm/issue-62046.rs deleted file mode 100644 index 38b5f1a1862..00000000000 --- a/src/test/ui/llvm-asm/issue-62046.rs +++ /dev/null @@ -1,12 +0,0 @@ -// build-fail -// ignore-emscripten no asm! support - -#![feature(llvm_asm)] -#![allow(deprecated)] // llvm_asm! - -fn main() { - unsafe { - llvm_asm!("nop" : "+r"("r15")); - //~^ malformed inline assembly - } -} diff --git a/src/test/ui/llvm-asm/issue-62046.stderr b/src/test/ui/llvm-asm/issue-62046.stderr deleted file mode 100644 index ae271afe262..00000000000 --- a/src/test/ui/llvm-asm/issue-62046.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0668]: malformed inline assembly - --> $DIR/issue-62046.rs:9:9 - | -LL | llvm_asm!("nop" : "+r"("r15")); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: this error originates in the macro `llvm_asm` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0668`. diff --git a/src/test/ui/llvm-asm/issue-69092.rs b/src/test/ui/llvm-asm/issue-69092.rs deleted file mode 100644 index ea1b80cc9b0..00000000000 --- a/src/test/ui/llvm-asm/issue-69092.rs +++ /dev/null @@ -1,13 +0,0 @@ -// build-fail -// ignore-emscripten no asm! support -// The error message differs slightly between LLVM versions -// min-llvm-version: 13.0 -// Regression test for #69092 - -#![feature(llvm_asm)] -#![allow(deprecated)] // llvm_asm! - -fn main() { - unsafe { llvm_asm!(".ascii \"Xen\0\""); } - //~^ ERROR: expected string -} diff --git a/src/test/ui/llvm-asm/issue-69092.stderr b/src/test/ui/llvm-asm/issue-69092.stderr deleted file mode 100644 index 28c5fbbca3c..00000000000 --- a/src/test/ui/llvm-asm/issue-69092.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error: expected string - --> $DIR/issue-69092.rs:11:14 - | -LL | unsafe { llvm_asm!(".ascii \"Xen\0\""); } - | ^ - | -note: instantiated into assembly here - --> :1:9 - | -LL | .ascii "Xen - | ^ - -error: aborting due to previous error - diff --git a/src/test/ui/llvm-asm/llvm-asm-bad-clobber.rs b/src/test/ui/llvm-asm/llvm-asm-bad-clobber.rs deleted file mode 100644 index c15009f15e6..00000000000 --- a/src/test/ui/llvm-asm/llvm-asm-bad-clobber.rs +++ /dev/null @@ -1,27 +0,0 @@ -// ignore-android -// ignore-arm -// ignore-aarch64 -// ignore-s390x -// ignore-emscripten -// ignore-powerpc -// ignore-powerpc64 -// ignore-powerpc64le -// ignore-riscv64 -// ignore-sparc -// ignore-sparc64 -// ignore-mips -// ignore-mips64 - -#![feature(llvm_asm)] -#![allow(deprecated)] // llvm_asm! - -#[cfg(any(target_arch = "x86", - target_arch = "x86_64"))] - -pub fn main() { - unsafe { - // clobber formatted as register input/output - llvm_asm!("xor %eax, %eax" : : : "{eax}"); - //~^ ERROR clobber should not be surrounded by braces - } -} diff --git a/src/test/ui/llvm-asm/llvm-asm-bad-clobber.stderr b/src/test/ui/llvm-asm/llvm-asm-bad-clobber.stderr deleted file mode 100644 index bb72a142853..00000000000 --- a/src/test/ui/llvm-asm/llvm-asm-bad-clobber.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0664]: clobber should not be surrounded by braces - --> $DIR/llvm-asm-bad-clobber.rs:24:42 - | -LL | llvm_asm!("xor %eax, %eax" : : : "{eax}"); - | ^^^^^^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0664`. diff --git a/src/test/ui/llvm-asm/llvm-asm-concat-src.rs b/src/test/ui/llvm-asm/llvm-asm-concat-src.rs deleted file mode 100644 index 722eb07a270..00000000000 --- a/src/test/ui/llvm-asm/llvm-asm-concat-src.rs +++ /dev/null @@ -1,10 +0,0 @@ -// run-pass -// pretty-expanded FIXME #23616 -// ignore-emscripten no asm - -#![feature(llvm_asm)] -#![allow(deprecated)] // llvm_asm! - -pub fn main() { - unsafe { llvm_asm!(concat!("", "")) }; -} diff --git a/src/test/ui/llvm-asm/llvm-asm-in-bad-modifier.rs b/src/test/ui/llvm-asm/llvm-asm-in-bad-modifier.rs deleted file mode 100644 index 1bccb0b73a8..00000000000 --- a/src/test/ui/llvm-asm/llvm-asm-in-bad-modifier.rs +++ /dev/null @@ -1,36 +0,0 @@ -// ignore-s390x -// ignore-emscripten -// ignore-powerpc -// ignore-powerpc64 -// ignore-powerpc64le -// ignore-riscv64 -// ignore-sparc -// ignore-sparc64 -// ignore-mips -// ignore-mips64 - -#![feature(llvm_asm)] -#![allow(deprecated)] // llvm_asm! - -fn foo(x: isize) { println!("{}", x); } - -#[cfg(any(target_arch = "x86", - target_arch = "x86_64", - target_arch = "arm", - target_arch = "aarch64"))] -pub fn main() { - let x: isize; - let y: isize; - unsafe { - llvm_asm!("mov $1, $0" : "=r"(x) : "=r"(5)); //~ ERROR operand constraint contains '=' - llvm_asm!("mov $1, $0" : "=r"(y) : "+r"(5)); //~ ERROR operand constraint contains '+' - } - foo(x); - foo(y); -} - -#[cfg(not(any(target_arch = "x86", - target_arch = "x86_64", - target_arch = "arm", - target_arch = "aarch64")))] -pub fn main() {} diff --git a/src/test/ui/llvm-asm/llvm-asm-in-bad-modifier.stderr b/src/test/ui/llvm-asm/llvm-asm-in-bad-modifier.stderr deleted file mode 100644 index f6c618e4c13..00000000000 --- a/src/test/ui/llvm-asm/llvm-asm-in-bad-modifier.stderr +++ /dev/null @@ -1,16 +0,0 @@ -error[E0662]: input operand constraint contains '=' - --> $DIR/llvm-asm-in-bad-modifier.rs:25:44 - | -LL | llvm_asm!("mov $1, $0" : "=r"(x) : "=r"(5)); - | ^^^^ - -error[E0663]: input operand constraint contains '+' - --> $DIR/llvm-asm-in-bad-modifier.rs:26:44 - | -LL | llvm_asm!("mov $1, $0" : "=r"(y) : "+r"(5)); - | ^^^^ - -error: aborting due to 2 previous errors - -Some errors have detailed explanations: E0662, E0663. -For more information about an error, try `rustc --explain E0662`. diff --git a/src/test/ui/llvm-asm/llvm-asm-in-moved.rs b/src/test/ui/llvm-asm/llvm-asm-in-moved.rs deleted file mode 100644 index f7b0fe5566c..00000000000 --- a/src/test/ui/llvm-asm/llvm-asm-in-moved.rs +++ /dev/null @@ -1,32 +0,0 @@ -// run-pass - -#![feature(llvm_asm)] -#![allow(deprecated)] // llvm_asm! -#![allow(dead_code)] - -use std::cell::Cell; - -#[repr(C)] -struct NoisyDrop<'a>(&'a Cell<&'static str>); -impl<'a> Drop for NoisyDrop<'a> { - fn drop(&mut self) { - self.0.set("destroyed"); - } -} - -#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] -fn main() { - let status = Cell::new("alive"); - { - let _y: Box; - let x = Box::new(NoisyDrop(&status)); - unsafe { - llvm_asm!("mov $1, $0" : "=r"(_y) : "r"(x)); - } - assert_eq!(status.get(), "alive"); - } - assert_eq!(status.get(), "destroyed"); -} - -#[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))] -fn main() {} diff --git a/src/test/ui/llvm-asm/llvm-asm-in-out-operand.rs b/src/test/ui/llvm-asm/llvm-asm-in-out-operand.rs deleted file mode 100644 index 2429b512e86..00000000000 --- a/src/test/ui/llvm-asm/llvm-asm-in-out-operand.rs +++ /dev/null @@ -1,57 +0,0 @@ -// run-pass - -#![feature(llvm_asm)] -#![allow(deprecated)] // llvm_asm! - -#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] -unsafe fn next_power_of_2(n: u32) -> u32 { - let mut tmp = n; - llvm_asm!("dec $0" : "+rm"(tmp) :: "cc"); - let mut shift = 1_u32; - while shift <= 16 { - llvm_asm!( - "shr %cl, $2 - or $2, $0 - shl $$1, $1" - : "+&rm"(tmp), "+{ecx}"(shift) : "r"(tmp) : "cc" - ); - } - llvm_asm!("inc $0" : "+rm"(tmp) :: "cc"); - return tmp; -} - -#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] -pub fn main() { - unsafe { - assert_eq!(64, next_power_of_2(37)); - assert_eq!(2147483648, next_power_of_2(2147483647)); - } - - let mut y: isize = 5; - let x: isize; - unsafe { - // Treat the output as initialization. - llvm_asm!( - "shl $2, $1 - add $3, $1 - mov $1, $0" - : "=r"(x), "+r"(y) : "i"(3_usize), "ir"(7_usize) : "cc" - ); - } - assert_eq!(x, 47); - assert_eq!(y, 47); - - let mut x = x + 1; - assert_eq!(x, 48); - - unsafe { - // Assignment to mutable. - // Early clobber "&": - // Forbids the use of a single register by both operands. - llvm_asm!("shr $$2, $1; add $1, $0" : "+&r"(x) : "r"(x) : "cc"); - } - assert_eq!(x, 60); -} - -#[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))] -pub fn main() {} diff --git a/src/test/ui/llvm-asm/llvm-asm-indirect-memory.rs b/src/test/ui/llvm-asm/llvm-asm-indirect-memory.rs deleted file mode 100644 index 441c62b04b5..00000000000 --- a/src/test/ui/llvm-asm/llvm-asm-indirect-memory.rs +++ /dev/null @@ -1,44 +0,0 @@ -// run-pass - -#![feature(llvm_asm)] -#![allow(deprecated)] // llvm_asm! - -#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] -fn read(ptr: &u32) -> u32 { - let out: u32; - unsafe { - llvm_asm!("mov $1, $0" : "=r" (out) : "*m" (ptr)); - } - out -} - -#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] -fn write(ptr: &mut u32, val: u32) { - unsafe { - llvm_asm!("mov $1, $0" : "=*m" (ptr) : "r" (val)); - } -} - -#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] -fn replace(ptr: &mut u32, val: u32) -> u32 { - let out: u32; - unsafe { - llvm_asm!("mov $0, $1; mov $2, $0" : "+*m" (ptr), "=&r" (out) : "r" (val)); - } - out -} - -#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] -pub fn main() { - let a = 1; - assert_eq!(read(&a), 1); - let mut b = 2; - write(&mut b, 3); - assert_eq!(b, 3); - let mut c = 4; - assert_eq!(replace(&mut c, 5), 4); - assert_eq!(c, 5); -} - -#[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))] -pub fn main() {} diff --git a/src/test/ui/llvm-asm/llvm-asm-literal-escaping.rs b/src/test/ui/llvm-asm/llvm-asm-literal-escaping.rs deleted file mode 100644 index ecd0c2f9734..00000000000 --- a/src/test/ui/llvm-asm/llvm-asm-literal-escaping.rs +++ /dev/null @@ -1,13 +0,0 @@ -// build-pass -// only-x86_64 - -#![feature(llvm_asm)] -#![allow(deprecated)] // llvm_asm! - -fn main() { - unsafe { - // "nop" :: "r"(x) : "eax" : "volatile" - let x = 10; - llvm_asm!("\x6Eop" :: "\x72"(x) : "\x65ax" : "\x76olatile"); - } -} diff --git a/src/test/ui/llvm-asm/llvm-asm-misplaced-option.rs b/src/test/ui/llvm-asm/llvm-asm-misplaced-option.rs deleted file mode 100644 index 04f0972ed4b..00000000000 --- a/src/test/ui/llvm-asm/llvm-asm-misplaced-option.rs +++ /dev/null @@ -1,37 +0,0 @@ -// check-pass -// ignore-android -// ignore-arm -// ignore-aarch64 -// ignore-s390x -// ignore-emscripten -// ignore-powerpc -// ignore-powerpc64 -// ignore-powerpc64le -// ignore-riscv64 -// ignore-sparc -// ignore-sparc64 -// ignore-mips -// ignore-mips64 - -#![feature(llvm_asm)] -#![allow(deprecated)] // llvm_asm! - -#[cfg(any(target_arch = "x86", - target_arch = "x86_64"))] -fn main() { - // assignment not dead - let mut x: isize = 0; - unsafe { - // extra colon - llvm_asm!("mov $1, $0" : "=r"(x) : "r"(5_usize), "0"(x) : : "cc"); - //~^ WARNING unrecognized option - } - assert_eq!(x, 5); - - unsafe { - // comma in place of a colon - llvm_asm!("add $2, $1; mov $1, $0" : "=r"(x) : "r"(x), "r"(8_usize) : "cc", "volatile"); - //~^ WARNING expected a clobber, found an option - } - assert_eq!(x, 13); -} diff --git a/src/test/ui/llvm-asm/llvm-asm-misplaced-option.stderr b/src/test/ui/llvm-asm/llvm-asm-misplaced-option.stderr deleted file mode 100644 index d1250d99b8f..00000000000 --- a/src/test/ui/llvm-asm/llvm-asm-misplaced-option.stderr +++ /dev/null @@ -1,14 +0,0 @@ -warning: unrecognized option - --> $DIR/llvm-asm-misplaced-option.rs:26:69 - | -LL | llvm_asm!("mov $1, $0" : "=r"(x) : "r"(5_usize), "0"(x) : : "cc"); - | ^^^^ - -warning: expected a clobber, found an option - --> $DIR/llvm-asm-misplaced-option.rs:33:85 - | -LL | llvm_asm!("add $2, $1; mov $1, $0" : "=r"(x) : "r"(x), "r"(8_usize) : "cc", "volatile"); - | ^^^^^^^^^^ - -warning: 2 warnings emitted - diff --git a/src/test/ui/llvm-asm/llvm-asm-out-assign-imm.rs b/src/test/ui/llvm-asm/llvm-asm-out-assign-imm.rs deleted file mode 100644 index 7f51b50f258..00000000000 --- a/src/test/ui/llvm-asm/llvm-asm-out-assign-imm.rs +++ /dev/null @@ -1,36 +0,0 @@ -// ignore-s390x -// ignore-emscripten -// ignore-powerpc -// ignore-powerpc64 -// ignore-powerpc64le -// ignore-riscv64 -// ignore-sparc -// ignore-sparc64 -// ignore-mips -// ignore-mips64 - -#![feature(llvm_asm)] -#![allow(deprecated)] // llvm_asm! - -fn foo(x: isize) { println!("{}", x); } - -#[cfg(any(target_arch = "x86", - target_arch = "x86_64", - target_arch = "arm", - target_arch = "aarch64"))] -pub fn main() { - let x: isize; - x = 1; - foo(x); - unsafe { - llvm_asm!("mov $1, $0" : "=r"(x) : "r"(5)); - //~^ ERROR cannot assign twice to immutable variable `x` - } - foo(x); -} - -#[cfg(not(any(target_arch = "x86", - target_arch = "x86_64", - target_arch = "arm", - target_arch = "aarch64")))] -pub fn main() {} diff --git a/src/test/ui/llvm-asm/llvm-asm-out-assign-imm.stderr b/src/test/ui/llvm-asm/llvm-asm-out-assign-imm.stderr deleted file mode 100644 index 390c0324601..00000000000 --- a/src/test/ui/llvm-asm/llvm-asm-out-assign-imm.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0384]: cannot assign twice to immutable variable `x` - --> $DIR/llvm-asm-out-assign-imm.rs:26:39 - | -LL | let x: isize; - | - help: consider making this binding mutable: `mut x` -LL | x = 1; - | ----- first assignment to `x` -... -LL | llvm_asm!("mov $1, $0" : "=r"(x) : "r"(5)); - | ^ cannot assign twice to immutable variable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0384`. diff --git a/src/test/ui/llvm-asm/llvm-asm-out-assign.rs b/src/test/ui/llvm-asm/llvm-asm-out-assign.rs deleted file mode 100644 index c5f4a9a198e..00000000000 --- a/src/test/ui/llvm-asm/llvm-asm-out-assign.rs +++ /dev/null @@ -1,26 +0,0 @@ -// run-pass - -#![feature(llvm_asm)] -#![allow(deprecated)] // llvm_asm!s - -#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] -pub fn main() { - let x: isize; - unsafe { - // Treat the output as initialization. - llvm_asm!("mov $1, $0" : "=r"(x) : "r"(5_usize)); - } - assert_eq!(x, 5); - - let mut x = x + 1; - assert_eq!(x, 6); - - unsafe { - // Assignment to mutable. - llvm_asm!("mov $1, $0" : "=r"(x) : "r"(x + 7)); - } - assert_eq!(x, 13); -} - -#[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))] -pub fn main() {} diff --git a/src/test/ui/llvm-asm/llvm-asm-out-no-modifier.rs b/src/test/ui/llvm-asm/llvm-asm-out-no-modifier.rs deleted file mode 100644 index c74d156cf3e..00000000000 --- a/src/test/ui/llvm-asm/llvm-asm-out-no-modifier.rs +++ /dev/null @@ -1,33 +0,0 @@ -// ignore-s390x -// ignore-emscripten -// ignore-powerpc -// ignore-powerpc64 -// ignore-powerpc64le -// ignore-riscv64 -// ignore-sparc -// ignore-sparc64 -// ignore-mips -// ignore-mips64 - -#![feature(llvm_asm)] -#![allow(deprecated)] // llvm_asm! - -fn foo(x: isize) { println!("{}", x); } - -#[cfg(any(target_arch = "x86", - target_arch = "x86_64", - target_arch = "arm", - target_arch = "aarch64"))] -pub fn main() { - let x: isize; - unsafe { - llvm_asm!("mov $1, $0" : "r"(x) : "r"(5)); //~ ERROR output operand constraint lacks '=' - } - foo(x); -} - -#[cfg(not(any(target_arch = "x86", - target_arch = "x86_64", - target_arch = "arm", - target_arch = "aarch64")))] -pub fn main() {} diff --git a/src/test/ui/llvm-asm/llvm-asm-out-no-modifier.stderr b/src/test/ui/llvm-asm/llvm-asm-out-no-modifier.stderr deleted file mode 100644 index f426170ad87..00000000000 --- a/src/test/ui/llvm-asm/llvm-asm-out-no-modifier.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0661]: output operand constraint lacks '=' or '+' - --> $DIR/llvm-asm-out-no-modifier.rs:24:34 - | -LL | llvm_asm!("mov $1, $0" : "r"(x) : "r"(5)); - | ^^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0661`. diff --git a/src/test/ui/llvm-asm/llvm-asm-out-read-uninit.rs b/src/test/ui/llvm-asm/llvm-asm-out-read-uninit.rs deleted file mode 100644 index 161add7e56a..00000000000 --- a/src/test/ui/llvm-asm/llvm-asm-out-read-uninit.rs +++ /dev/null @@ -1,34 +0,0 @@ -// ignore-s390x -// ignore-emscripten -// ignore-powerpc -// ignore-powerpc64 -// ignore-powerpc64le -// ignore-riscv64 -// ignore-sparc -// ignore-sparc64 -// ignore-mips -// ignore-mips64 - -#![feature(llvm_asm)] -#![allow(deprecated)] // llvm_asm! - -fn foo(x: isize) { println!("{}", x); } - -#[cfg(any(target_arch = "x86", - target_arch = "x86_64", - target_arch = "arm", - target_arch = "aarch64"))] -pub fn main() { - let x: isize; - unsafe { - llvm_asm!("mov $1, $0" : "=r"(x) : "r"(x)); - //~^ ERROR use of possibly-uninitialized variable: `x` - } - foo(x); -} - -#[cfg(not(any(target_arch = "x86", - target_arch = "x86_64", - target_arch = "arm", - target_arch = "aarch64")))] -pub fn main() {} diff --git a/src/test/ui/llvm-asm/llvm-asm-out-read-uninit.stderr b/src/test/ui/llvm-asm/llvm-asm-out-read-uninit.stderr deleted file mode 100644 index 7e57dc45aad..00000000000 --- a/src/test/ui/llvm-asm/llvm-asm-out-read-uninit.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0381]: use of possibly-uninitialized variable: `x` - --> $DIR/llvm-asm-out-read-uninit.rs:24:48 - | -LL | llvm_asm!("mov $1, $0" : "=r"(x) : "r"(x)); - | ^ use of possibly-uninitialized `x` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0381`. diff --git a/src/test/ui/llvm-asm/llvm-asm-parse-errors.rs b/src/test/ui/llvm-asm/llvm-asm-parse-errors.rs deleted file mode 100644 index cdd0b943b71..00000000000 --- a/src/test/ui/llvm-asm/llvm-asm-parse-errors.rs +++ /dev/null @@ -1,16 +0,0 @@ -#![feature(llvm_asm)] -#![allow(deprecated)] // llvm_asm! - -fn main() { - llvm_asm!(); //~ ERROR requires a string literal as an argument - llvm_asm!("nop" : struct); //~ ERROR expected string literal - llvm_asm!("mov %eax, $$0x2" : struct); //~ ERROR expected string literal - llvm_asm!("mov %eax, $$0x2" : "={eax}" struct); //~ ERROR expected `(` - llvm_asm!("mov %eax, $$0x2" : "={eax}"(struct)); //~ ERROR expected expression - llvm_asm!("in %dx, %al" : "={al}"(result) : struct); //~ ERROR expected string literal - llvm_asm!("in %dx, %al" : "={al}"(result) : "{dx}" struct); //~ ERROR expected `(` - llvm_asm!("in %dx, %al" : "={al}"(result) : "{dx}"(struct)); //~ ERROR expected expression - llvm_asm!("mov $$0x200, %eax" : : : struct); //~ ERROR expected string literal - llvm_asm!("mov eax, 2" : "={eax}"(foo) : : : struct); //~ ERROR expected string literal - llvm_asm!(123); //~ ERROR inline assembly must be a string literal -} diff --git a/src/test/ui/llvm-asm/llvm-asm-parse-errors.stderr b/src/test/ui/llvm-asm/llvm-asm-parse-errors.stderr deleted file mode 100644 index 715d05beaae..00000000000 --- a/src/test/ui/llvm-asm/llvm-asm-parse-errors.stderr +++ /dev/null @@ -1,68 +0,0 @@ -error: macro requires a string literal as an argument - --> $DIR/llvm-asm-parse-errors.rs:5:5 - | -LL | llvm_asm!(); - | ^^^^^^^^^^^ string literal required - -error: expected string literal - --> $DIR/llvm-asm-parse-errors.rs:6:23 - | -LL | llvm_asm!("nop" : struct); - | ^^^^^^ not a string literal - -error: expected string literal - --> $DIR/llvm-asm-parse-errors.rs:7:35 - | -LL | llvm_asm!("mov %eax, $$0x2" : struct); - | ^^^^^^ not a string literal - -error: expected `(`, found keyword `struct` - --> $DIR/llvm-asm-parse-errors.rs:8:44 - | -LL | llvm_asm!("mov %eax, $$0x2" : "={eax}" struct); - | ^^^^^^ expected `(` - -error: expected expression, found keyword `struct` - --> $DIR/llvm-asm-parse-errors.rs:9:44 - | -LL | llvm_asm!("mov %eax, $$0x2" : "={eax}"(struct)); - | ^^^^^^ expected expression - -error: expected string literal - --> $DIR/llvm-asm-parse-errors.rs:10:49 - | -LL | llvm_asm!("in %dx, %al" : "={al}"(result) : struct); - | ^^^^^^ not a string literal - -error: expected `(`, found keyword `struct` - --> $DIR/llvm-asm-parse-errors.rs:11:56 - | -LL | llvm_asm!("in %dx, %al" : "={al}"(result) : "{dx}" struct); - | ^^^^^^ expected `(` - -error: expected expression, found keyword `struct` - --> $DIR/llvm-asm-parse-errors.rs:12:56 - | -LL | llvm_asm!("in %dx, %al" : "={al}"(result) : "{dx}"(struct)); - | ^^^^^^ expected expression - -error: expected string literal - --> $DIR/llvm-asm-parse-errors.rs:13:41 - | -LL | llvm_asm!("mov $$0x200, %eax" : : : struct); - | ^^^^^^ not a string literal - -error: expected string literal - --> $DIR/llvm-asm-parse-errors.rs:14:50 - | -LL | llvm_asm!("mov eax, 2" : "={eax}"(foo) : : : struct); - | ^^^^^^ not a string literal - -error: inline assembly must be a string literal - --> $DIR/llvm-asm-parse-errors.rs:15:15 - | -LL | llvm_asm!(123); - | ^^^ - -error: aborting due to 11 previous errors - diff --git a/src/test/ui/macros/macros-nonfatal-errors.rs b/src/test/ui/macros/macros-nonfatal-errors.rs index 3bab95083b6..98f64aa6f80 100644 --- a/src/test/ui/macros/macros-nonfatal-errors.rs +++ b/src/test/ui/macros/macros-nonfatal-errors.rs @@ -3,11 +3,9 @@ // test that errors in a (selection) of macros don't kill compilation // immediately, so that we get more errors listed at a time. -#![feature(llvm_asm)] #![feature(trace_macros, concat_idents)] #![feature(stmt_expr_attributes, arbitrary_enum_discriminant)] #![feature(derive_default_enum)] -#![allow(deprecated)] // llvm_asm! use std::arch::asm; diff --git a/src/test/ui/macros/macros-nonfatal-errors.stderr b/src/test/ui/macros/macros-nonfatal-errors.stderr index 9a360206e6e..79e8db9c1d4 100644 --- a/src/test/ui/macros/macros-nonfatal-errors.stderr +++ b/src/test/ui/macros/macros-nonfatal-errors.stderr @@ -1,41 +1,41 @@ error: the `#[default]` attribute may only be used on unit enum variants - --> $DIR/macros-nonfatal-errors.rs:16:5 + --> $DIR/macros-nonfatal-errors.rs:14:5 | LL | #[default] | ^^^^^^^^^^ error: the `#[default]` attribute may only be used on unit enum variants - --> $DIR/macros-nonfatal-errors.rs:21:36 + --> $DIR/macros-nonfatal-errors.rs:19:36 | LL | struct DefaultInnerAttrTupleStruct(#[default] ()); | ^^^^^^^^^^ error: the `#[default]` attribute may only be used on unit enum variants - --> $DIR/macros-nonfatal-errors.rs:25:1 + --> $DIR/macros-nonfatal-errors.rs:23:1 | LL | #[default] | ^^^^^^^^^^ error: the `#[default]` attribute may only be used on unit enum variants - --> $DIR/macros-nonfatal-errors.rs:29:1 + --> $DIR/macros-nonfatal-errors.rs:27:1 | LL | #[default] | ^^^^^^^^^^ error: the `#[default]` attribute may only be used on unit enum variants - --> $DIR/macros-nonfatal-errors.rs:39:11 + --> $DIR/macros-nonfatal-errors.rs:37:11 | LL | Foo = #[default] 0, | ^^^^^^^^^^ error: the `#[default]` attribute may only be used on unit enum variants - --> $DIR/macros-nonfatal-errors.rs:40:14 + --> $DIR/macros-nonfatal-errors.rs:38:14 | LL | Bar([u8; #[default] 1]), | ^^^^^^^^^^ error: no default declared - --> $DIR/macros-nonfatal-errors.rs:45:10 + --> $DIR/macros-nonfatal-errors.rs:43:10 | LL | #[derive(Default)] | ^^^^^^^ @@ -44,7 +44,7 @@ LL | #[derive(Default)] = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info) error: multiple declared defaults - --> $DIR/macros-nonfatal-errors.rs:51:10 + --> $DIR/macros-nonfatal-errors.rs:49:10 | LL | #[derive(Default)] | ^^^^^^^ @@ -62,7 +62,7 @@ LL | Baz, = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info) error: `#[default]` attribute does not accept a value - --> $DIR/macros-nonfatal-errors.rs:63:5 + --> $DIR/macros-nonfatal-errors.rs:61:5 | LL | #[default = 1] | ^^^^^^^^^^^^^^ @@ -70,7 +70,7 @@ LL | #[default = 1] = help: try using `#[default]` error: multiple `#[default]` attributes - --> $DIR/macros-nonfatal-errors.rs:71:5 + --> $DIR/macros-nonfatal-errors.rs:69:5 | LL | #[default] | ---------- `#[default]` used here @@ -81,13 +81,13 @@ LL | Foo, | = note: only one `#[default]` attribute is needed help: try removing this - --> $DIR/macros-nonfatal-errors.rs:70:5 + --> $DIR/macros-nonfatal-errors.rs:68:5 | LL | #[default] | ^^^^^^^^^^ error: multiple `#[default]` attributes - --> $DIR/macros-nonfatal-errors.rs:81:5 + --> $DIR/macros-nonfatal-errors.rs:79:5 | LL | #[default] | ---------- `#[default]` used here @@ -99,7 +99,7 @@ LL | Foo, | = note: only one `#[default]` attribute is needed help: try removing these - --> $DIR/macros-nonfatal-errors.rs:78:5 + --> $DIR/macros-nonfatal-errors.rs:76:5 | LL | #[default] | ^^^^^^^^^^ @@ -109,7 +109,7 @@ LL | #[default] | ^^^^^^^^^^ error: the `#[default]` attribute may only be used on unit enum variants - --> $DIR/macros-nonfatal-errors.rs:88:5 + --> $DIR/macros-nonfatal-errors.rs:86:5 | LL | Foo {}, | ^^^ @@ -117,7 +117,7 @@ LL | Foo {}, = help: consider a manual implementation of `Default` error: default variant must be exhaustive - --> $DIR/macros-nonfatal-errors.rs:96:5 + --> $DIR/macros-nonfatal-errors.rs:94:5 | LL | #[non_exhaustive] | ----------------- declared `#[non_exhaustive]` here @@ -127,43 +127,37 @@ LL | Foo, = help: consider a manual implementation of `Default` error: asm template must be a string literal - --> $DIR/macros-nonfatal-errors.rs:101:10 + --> $DIR/macros-nonfatal-errors.rs:99:10 | LL | asm!(invalid); | ^^^^^^^ -error: inline assembly must be a string literal - --> $DIR/macros-nonfatal-errors.rs:102:15 - | -LL | llvm_asm!(invalid); - | ^^^^^^^ - error: concat_idents! requires ident args - --> $DIR/macros-nonfatal-errors.rs:104:5 + --> $DIR/macros-nonfatal-errors.rs:102:5 | LL | concat_idents!("not", "idents"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: argument must be a string literal - --> $DIR/macros-nonfatal-errors.rs:106:17 + --> $DIR/macros-nonfatal-errors.rs:104:17 | LL | option_env!(invalid); | ^^^^^^^ error: expected string literal - --> $DIR/macros-nonfatal-errors.rs:107:10 + --> $DIR/macros-nonfatal-errors.rs:105:10 | LL | env!(invalid); | ^^^^^^^ error: expected string literal - --> $DIR/macros-nonfatal-errors.rs:108:10 + --> $DIR/macros-nonfatal-errors.rs:106:10 | LL | env!(foo, abr, baz); | ^^^ error: environment variable `RUST_HOPEFULLY_THIS_DOESNT_EXIST` not defined - --> $DIR/macros-nonfatal-errors.rs:109:5 + --> $DIR/macros-nonfatal-errors.rs:107:5 | LL | env!("RUST_HOPEFULLY_THIS_DOESNT_EXIST"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -171,7 +165,7 @@ LL | env!("RUST_HOPEFULLY_THIS_DOESNT_EXIST"); = note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info) error: format argument must be a string literal - --> $DIR/macros-nonfatal-errors.rs:111:13 + --> $DIR/macros-nonfatal-errors.rs:109:13 | LL | format!(invalid); | ^^^^^^^ @@ -182,19 +176,19 @@ LL | format!("{}", invalid); | +++++ error: argument must be a string literal - --> $DIR/macros-nonfatal-errors.rs:113:14 + --> $DIR/macros-nonfatal-errors.rs:111:14 | LL | include!(invalid); | ^^^^^^^ error: argument must be a string literal - --> $DIR/macros-nonfatal-errors.rs:115:18 + --> $DIR/macros-nonfatal-errors.rs:113:18 | LL | include_str!(invalid); | ^^^^^^^ error: couldn't read $DIR/i'd be quite surprised if a file with this name existed: $FILE_NOT_FOUND_MSG (os error 2) - --> $DIR/macros-nonfatal-errors.rs:116:5 + --> $DIR/macros-nonfatal-errors.rs:114:5 | LL | include_str!("i'd be quite surprised if a file with this name existed"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -202,13 +196,13 @@ LL | include_str!("i'd be quite surprised if a file with this name existed") = note: this error originates in the macro `include_str` (in Nightly builds, run with -Z macro-backtrace for more info) error: argument must be a string literal - --> $DIR/macros-nonfatal-errors.rs:117:20 + --> $DIR/macros-nonfatal-errors.rs:115:20 | LL | include_bytes!(invalid); | ^^^^^^^ error: couldn't read $DIR/i'd be quite surprised if a file with this name existed: $FILE_NOT_FOUND_MSG (os error 2) - --> $DIR/macros-nonfatal-errors.rs:118:5 + --> $DIR/macros-nonfatal-errors.rs:116:5 | LL | include_bytes!("i'd be quite surprised if a file with this name existed"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -216,10 +210,16 @@ LL | include_bytes!("i'd be quite surprised if a file with this name existed = note: this error originates in the macro `include_bytes` (in Nightly builds, run with -Z macro-backtrace for more info) error: trace_macros! accepts only `true` or `false` - --> $DIR/macros-nonfatal-errors.rs:120:5 + --> $DIR/macros-nonfatal-errors.rs:118:5 | LL | trace_macros!(invalid); | ^^^^^^^^^^^^^^^^^^^^^^ +error: cannot find macro `llvm_asm` in this scope + --> $DIR/macros-nonfatal-errors.rs:100:5 + | +LL | llvm_asm!(invalid); + | ^^^^^^^^ + error: aborting due to 27 previous errors diff --git a/src/test/ui/runtime/out-of-stack.rs b/src/test/ui/runtime/out-of-stack.rs index ce02553051d..2d59c9f29b1 100644 --- a/src/test/ui/runtime/out-of-stack.rs +++ b/src/test/ui/runtime/out-of-stack.rs @@ -2,7 +2,6 @@ #![allow(unused_must_use)] #![allow(unconditional_recursion)] -#![allow(deprecated)] // llvm_asm! // ignore-android: FIXME (#20004) // ignore-emscripten no processes // ignore-sgx no processes diff --git a/src/test/ui/unsafe/inline_asm.mir.stderr b/src/test/ui/unsafe/inline_asm.mir.stderr index fee93dc070d..633f1edb26c 100644 --- a/src/test/ui/unsafe/inline_asm.mir.stderr +++ b/src/test/ui/unsafe/inline_asm.mir.stderr @@ -1,20 +1,11 @@ error[E0133]: use of inline assembly is unsafe and requires unsafe function or block - --> $DIR/inline_asm.rs:11:5 + --> $DIR/inline_asm.rs:8:5 | LL | asm!("nop"); | ^^^^^^^^^^^ use of inline assembly | = note: inline assembly is entirely unchecked and can cause undefined behavior -error[E0133]: use of inline assembly is unsafe and requires unsafe function or block - --> $DIR/inline_asm.rs:12:5 - | -LL | llvm_asm!("nop"); - | ^^^^^^^^^^^^^^^^ use of inline assembly - | - = note: inline assembly is entirely unchecked and can cause undefined behavior - = note: this error originates in the macro `llvm_asm` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0133`. diff --git a/src/test/ui/unsafe/inline_asm.rs b/src/test/ui/unsafe/inline_asm.rs index 7c1f86ac0e0..12c7efe4f50 100644 --- a/src/test/ui/unsafe/inline_asm.rs +++ b/src/test/ui/unsafe/inline_asm.rs @@ -2,12 +2,8 @@ // [thir]compile-flags: -Z thir-unsafeck // needs-asm-support -#![feature(llvm_asm)] -#![allow(deprecated)] // llvm_asm! - use std::arch::asm; fn main() { asm!("nop"); //~ ERROR use of inline assembly is unsafe and requires unsafe function or block - llvm_asm!("nop"); //~ ERROR use of inline assembly is unsafe and requires unsafe function or block } diff --git a/src/test/ui/unsafe/inline_asm.thir.stderr b/src/test/ui/unsafe/inline_asm.thir.stderr index fee93dc070d..633f1edb26c 100644 --- a/src/test/ui/unsafe/inline_asm.thir.stderr +++ b/src/test/ui/unsafe/inline_asm.thir.stderr @@ -1,20 +1,11 @@ error[E0133]: use of inline assembly is unsafe and requires unsafe function or block - --> $DIR/inline_asm.rs:11:5 + --> $DIR/inline_asm.rs:8:5 | LL | asm!("nop"); | ^^^^^^^^^^^ use of inline assembly | = note: inline assembly is entirely unchecked and can cause undefined behavior -error[E0133]: use of inline assembly is unsafe and requires unsafe function or block - --> $DIR/inline_asm.rs:12:5 - | -LL | llvm_asm!("nop"); - | ^^^^^^^^^^^^^^^^ use of inline assembly - | - = note: inline assembly is entirely unchecked and can cause undefined behavior - = note: this error originates in the macro `llvm_asm` (in Nightly builds, run with -Z macro-backtrace for more info) - -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0133`.