diff options
| author | bors <bors@rust-lang.org> | 2022-01-17 09:40:29 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-01-17 09:40:29 +0000 |
| commit | a34c0797528172ede89480e3033f7a5e71ea4735 (patch) | |
| tree | 2040a76ba69e7102179c469e0cc35a0884e628d7 /src/test | |
| parent | 128417f40f80ce585414bf5a017540447e6be775 (diff) | |
| parent | b085eb0b107a2dc4f426811d000ca4ac82bb71b6 (diff) | |
| download | rust-a34c0797528172ede89480e3033f7a5e71ea4735.tar.gz rust-a34c0797528172ede89480e3033f7a5e71ea4735.zip | |
Auto merge of #92816 - tmiasko:rm-llvm-asm, r=Amanieu
Remove deprecated LLVM-style inline assembly The `llvm_asm!` was deprecated back in #87590 1.56.0, with intention to remove it once `asm!` was stabilized, which already happened in #91728 1.59.0. Now it is time to remove `llvm_asm!` to avoid continued maintenance cost. Closes #70173. Closes #92794. Closes #87612. Closes #82065. cc `@rust-lang/wg-inline-asm` r? `@Amanieu`
Diffstat (limited to 'src/test')
82 files changed, 167 insertions, 1858 deletions
diff --git a/src/test/codegen/no-output-asm-is-volatile.rs b/src/test/codegen/no-output-asm-is-volatile.rs deleted file mode 100644 index 40376218908..00000000000 --- a/src/test/codegen/no-output-asm-is-volatile.rs +++ /dev/null @@ -1,14 +0,0 @@ -// compile-flags: -O - -#![feature(llvm_asm)] -#![crate_type = "lib"] - -// Check that inline assembly expressions without any outputs -// are marked as having side effects / being volatile - -// CHECK-LABEL: @assembly -#[no_mangle] -pub fn assembly() { - unsafe { llvm_asm!("") } -// CHECK: tail call void asm sideeffect "", {{.*}} -} diff --git a/src/test/incremental/hashes/inline_asm.rs b/src/test/incremental/hashes/inline_asm.rs index 1ddb345e566..bb836f203f5 100644 --- a/src/test/incremental/hashes/inline_asm.rs +++ b/src/test/incremental/hashes/inline_asm.rs @@ -18,23 +18,19 @@ #![allow(warnings)] #![feature(rustc_attrs)] -#![feature(llvm_asm)] #![crate_type="rlib"] - +use std::arch::asm; // Change template #[cfg(any(cfail1,cfail4))] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] -pub fn change_template(a: i32) -> i32 { +pub fn change_template(_a: i32) -> i32 { let c: i32; unsafe { - llvm_asm!("add 1, $0" - : "=r"(c) - : "0"(a) - : - : - ); + asm!("mov {0}, 1", + out(reg) c + ); } c } @@ -45,15 +41,12 @@ pub fn change_template(a: i32) -> i32 { #[rustc_clean(cfg="cfail5", except="hir_owner_nodes, optimized_mir")] #[rustc_clean(cfg="cfail6")] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] -pub fn change_template(a: i32) -> i32 { +pub fn change_template(_a: i32) -> i32 { let c: i32; unsafe { - llvm_asm!("add 2, $0" - : "=r"(c) - : "0"(a) - : - : - ); + asm!("mov {0}, 2", + out(reg) c + ); } c } @@ -67,12 +60,10 @@ pub fn change_output(a: i32) -> i32 { let mut _out1: i32 = 0; let mut _out2: i32 = 0; unsafe { - llvm_asm!("add 1, $0" - : "=r"(_out1) - : "0"(a) - : - : - ); + asm!("mov {0}, {1}", + out(reg) _out1, + in(reg) a + ); } _out1 } @@ -87,12 +78,10 @@ pub fn change_output(a: i32) -> i32 { let mut _out1: i32 = 0; let mut _out2: i32 = 0; unsafe { - llvm_asm!("add 1, $0" - : "=r"(_out2) - : "0"(a) - : - : - ); + asm!("mov {0}, {1}", + out(reg) _out2, + in(reg) a + ); } _out1 } @@ -105,12 +94,10 @@ pub fn change_output(a: i32) -> i32 { pub fn change_input(_a: i32, _b: i32) -> i32 { let _out; unsafe { - llvm_asm!("add 1, $0" - : "=r"(_out) - : "0"(_a) - : - : - ); + asm!("mov {0}, {1}", + out(reg) _out, + in(reg) _a + ); } _out } @@ -124,12 +111,10 @@ pub fn change_input(_a: i32, _b: i32) -> i32 { pub fn change_input(_a: i32, _b: i32) -> i32 { let _out; unsafe { - llvm_asm!("add 1, $0" - : "=r"(_out) - : "0"(_b) - : - : - ); + asm!("mov {0}, {1}", + out(reg) _out, + in(reg) _b + ); } _out } @@ -142,12 +127,10 @@ pub fn change_input(_a: i32, _b: i32) -> i32 { pub fn change_input_constraint(_a: i32, _b: i32) -> i32 { let _out; unsafe { - llvm_asm!("add 1, $0" - : "=r"(_out) - : "0"(_a), "r"(_b) - : - : - ); + asm!("mov {0}, {1}", + out(reg) _out, + in(reg) _a, + in("eax") _b); } _out } @@ -161,30 +144,26 @@ pub fn change_input_constraint(_a: i32, _b: i32) -> i32 { pub fn change_input_constraint(_a: i32, _b: i32) -> i32 { let _out; unsafe { - llvm_asm!("add 1, $0" - : "=r"(_out) - : "r"(_a), "0"(_b) - : - : - ); + asm!("mov {0}, {1}", + out(reg) _out, + in(reg) _a, + in("ecx") _b); } _out } - // Change clobber #[cfg(any(cfail1,cfail4))] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] pub fn change_clobber(_a: i32) -> i32 { let _out; unsafe { - llvm_asm!("add 1, $0" - : "=r"(_out) - : "0"(_a) - :/*--*/ - : - ); + asm!("mov {0}, {1}", + out(reg) _out, + in(reg) _a, + lateout("ecx") _ + ); } _out } @@ -198,12 +177,11 @@ pub fn change_clobber(_a: i32) -> i32 { pub fn change_clobber(_a: i32) -> i32 { let _out; unsafe { - llvm_asm!("add 1, $0" - : "=r"(_out) - : "0"(_a) - : "eax" - : - ); + asm!("mov {0}, {1}", + out(reg) _out, + in(reg) _a, + lateout("edx") _ + ); } _out } @@ -216,12 +194,11 @@ pub fn change_clobber(_a: i32) -> i32 { pub fn change_options(_a: i32) -> i32 { let _out; unsafe { - llvm_asm!("add 1, $0" - : "=r"(_out) - : "0"(_a) - : - :/*-------*/ - ); + asm!("mov {0}, {1}", + out(reg) _out, + in(reg) _a, + options(readonly), + ); } _out } @@ -235,12 +212,11 @@ pub fn change_options(_a: i32) -> i32 { pub fn change_options(_a: i32) -> i32 { let _out; unsafe { - llvm_asm!("add 1, $0" - : "=r"(_out) - : "0"(_a) - : - : "volatile" - ); + asm!("mov {0}, {1}", + out(reg) _out, + in(reg) _a, + options(nomem ), + ); } _out } diff --git a/src/test/mir-opt/unreachable_asm.main.UnreachablePropagation.diff b/src/test/mir-opt/unreachable_asm.main.UnreachablePropagation.diff deleted file mode 100644 index c60997be5d3..00000000000 --- a/src/test/mir-opt/unreachable_asm.main.UnreachablePropagation.diff +++ /dev/null @@ -1,75 +0,0 @@ -- // MIR for `main` before UnreachablePropagation -+ // MIR for `main` after UnreachablePropagation - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/unreachable_asm.rs:10:11: 10:11 - let mut _1: std::option::Option<Empty>; // in scope 0 at $DIR/unreachable_asm.rs:11:23: 11:30 - let mut _2: isize; // in scope 0 at $DIR/unreachable_asm.rs:11:12: 11:20 - let _3: Empty; // in scope 0 at $DIR/unreachable_asm.rs:11:17: 11:19 - let mut _4: i32; // in scope 0 at $DIR/unreachable_asm.rs:12:13: 12:19 - let _5: (); // in scope 0 at $DIR/unreachable_asm.rs:14:9: 18:10 - let mut _6: bool; // in scope 0 at $DIR/unreachable_asm.rs:14:12: 14:16 - let _7: (); // in scope 0 at $DIR/unreachable_asm.rs:21:9: 21:37 - let mut _8: !; // in scope 0 at $DIR/unreachable_asm.rs:22:9: 22:21 - scope 1 { - debug _x => _3; // in scope 1 at $DIR/unreachable_asm.rs:11:17: 11:19 - } - scope 2 { - debug _y => _4; // in scope 2 at $DIR/unreachable_asm.rs:12:13: 12:19 - scope 3 { - } - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/unreachable_asm.rs:11:23: 11:30 - _1 = empty() -> bb1; // scope 0 at $DIR/unreachable_asm.rs:11:23: 11:30 - // mir::Constant - // + span: $DIR/unreachable_asm.rs:11:23: 11:28 - // + literal: Const { ty: fn() -> std::option::Option<Empty> {empty}, val: Value(Scalar(<ZST>)) } - } - - bb1: { - _2 = discriminant(_1); // scope 0 at $DIR/unreachable_asm.rs:11:12: 11:20 - switchInt(move _2) -> [1_isize: bb2, otherwise: bb6]; // scope 0 at $DIR/unreachable_asm.rs:11:12: 11:20 - } - - bb2: { - StorageLive(_3); // scope 0 at $DIR/unreachable_asm.rs:11:17: 11:19 - _3 = move ((_1 as Some).0: Empty); // scope 0 at $DIR/unreachable_asm.rs:11:17: 11:19 - StorageLive(_4); // scope 0 at $DIR/unreachable_asm.rs:12:13: 12:19 - StorageLive(_5); // scope 2 at $DIR/unreachable_asm.rs:14:9: 18:10 - StorageLive(_6); // scope 2 at $DIR/unreachable_asm.rs:14:12: 14:16 - _6 = const true; // scope 2 at $DIR/unreachable_asm.rs:14:12: 14:16 - switchInt(move _6) -> [false: bb4, otherwise: bb3]; // scope 2 at $DIR/unreachable_asm.rs:14:12: 14:16 - } - - bb3: { - _4 = const 21_i32; // scope 2 at $DIR/unreachable_asm.rs:15:13: 15:20 - _5 = const (); // scope 2 at $DIR/unreachable_asm.rs:14:17: 16:10 - goto -> bb5; // scope 2 at $DIR/unreachable_asm.rs:14:9: 18:10 - } - - bb4: { - _4 = const 42_i32; // scope 2 at $DIR/unreachable_asm.rs:17:13: 17:20 - _5 = const (); // scope 2 at $DIR/unreachable_asm.rs:16:16: 18:10 - goto -> bb5; // scope 2 at $DIR/unreachable_asm.rs:14:9: 18:10 - } - - bb5: { - StorageDead(_6); // scope 2 at $DIR/unreachable_asm.rs:18:9: 18:10 - StorageDead(_5); // scope 2 at $DIR/unreachable_asm.rs:18:9: 18:10 - StorageLive(_7); // scope 2 at $DIR/unreachable_asm.rs:21:9: 21:37 - llvm_asm!(LlvmInlineAsmInner { asm: "NOP", asm_str_style: Cooked, outputs: [], inputs: [], clobbers: [], volatile: true, alignstack: false, dialect: Att } : [] : []); // scope 3 at $DIR/unreachable_asm.rs:21:18: 21:34 - _7 = const (); // scope 3 at $DIR/unreachable_asm.rs:21:9: 21:37 - StorageDead(_7); // scope 2 at $DIR/unreachable_asm.rs:21:36: 21:37 - StorageLive(_8); // scope 2 at $DIR/unreachable_asm.rs:22:9: 22:21 - unreachable; // scope 2 at $DIR/unreachable_asm.rs:22:15: 22:17 - } - - bb6: { - _0 = const (); // scope 0 at $DIR/unreachable_asm.rs:23:6: 23:6 - StorageDead(_1); // scope 0 at $DIR/unreachable_asm.rs:24:1: 24:2 - return; // scope 0 at $DIR/unreachable_asm.rs:24:2: 24:2 - } - } - diff --git a/src/test/mir-opt/unreachable_asm.rs b/src/test/mir-opt/unreachable_asm.rs deleted file mode 100644 index cbef05a3c05..00000000000 --- a/src/test/mir-opt/unreachable_asm.rs +++ /dev/null @@ -1,24 +0,0 @@ -#![feature(llvm_asm)] - -enum Empty {} - -fn empty() -> Option<Empty> { - None -} - -// EMIT_MIR unreachable_asm.main.UnreachablePropagation.diff -fn main() { - if let Some(_x) = empty() { - let mut _y; - - if true { - _y = 21; - } else { - _y = 42; - } - - // asm instruction stops unreachable propagation to if else blocks bb4 and bb5. - unsafe { llvm_asm!("NOP"); } - match _x { } - } -} diff --git a/src/test/mir-opt/unreachable_asm_2.main.UnreachablePropagation.diff b/src/test/mir-opt/unreachable_asm_2.main.UnreachablePropagation.diff deleted file mode 100644 index 28c5f031dbb..00000000000 --- a/src/test/mir-opt/unreachable_asm_2.main.UnreachablePropagation.diff +++ /dev/null @@ -1,85 +0,0 @@ -- // MIR for `main` before UnreachablePropagation -+ // MIR for `main` after UnreachablePropagation - - fn main() -> () { - let mut _0: (); // return place in scope 0 at $DIR/unreachable_asm_2.rs:10:11: 10:11 - let mut _1: std::option::Option<Empty>; // in scope 0 at $DIR/unreachable_asm_2.rs:11:23: 11:30 - let mut _2: isize; // in scope 0 at $DIR/unreachable_asm_2.rs:11:12: 11:20 - let _3: Empty; // in scope 0 at $DIR/unreachable_asm_2.rs:11:17: 11:19 - let mut _4: i32; // in scope 0 at $DIR/unreachable_asm_2.rs:12:13: 12:19 - let _5: (); // in scope 0 at $DIR/unreachable_asm_2.rs:14:9: 22:10 - let mut _6: bool; // in scope 0 at $DIR/unreachable_asm_2.rs:14:12: 14:16 - let _7: (); // in scope 0 at $DIR/unreachable_asm_2.rs:16:13: 16:41 - let _8: (); // in scope 0 at $DIR/unreachable_asm_2.rs:20:13: 20:41 - let mut _9: !; // in scope 0 at $DIR/unreachable_asm_2.rs:24:9: 24:21 - scope 1 { - debug _x => _3; // in scope 1 at $DIR/unreachable_asm_2.rs:11:17: 11:19 - } - scope 2 { - debug _y => _4; // in scope 2 at $DIR/unreachable_asm_2.rs:12:13: 12:19 - scope 3 { - } - scope 4 { - } - } - - bb0: { - StorageLive(_1); // scope 0 at $DIR/unreachable_asm_2.rs:11:23: 11:30 - _1 = empty() -> bb1; // scope 0 at $DIR/unreachable_asm_2.rs:11:23: 11:30 - // mir::Constant - // + span: $DIR/unreachable_asm_2.rs:11:23: 11:28 - // + literal: Const { ty: fn() -> std::option::Option<Empty> {empty}, val: Value(Scalar(<ZST>)) } - } - - bb1: { - _2 = discriminant(_1); // scope 0 at $DIR/unreachable_asm_2.rs:11:12: 11:20 -- switchInt(move _2) -> [1_isize: bb2, otherwise: bb6]; // scope 0 at $DIR/unreachable_asm_2.rs:11:12: 11:20 -+ switchInt(move _2) -> [1_isize: bb2, otherwise: bb5]; // scope 0 at $DIR/unreachable_asm_2.rs:11:12: 11:20 - } - - bb2: { - StorageLive(_3); // scope 0 at $DIR/unreachable_asm_2.rs:11:17: 11:19 - _3 = move ((_1 as Some).0: Empty); // scope 0 at $DIR/unreachable_asm_2.rs:11:17: 11:19 - StorageLive(_4); // scope 0 at $DIR/unreachable_asm_2.rs:12:13: 12:19 - StorageLive(_5); // scope 2 at $DIR/unreachable_asm_2.rs:14:9: 22:10 - StorageLive(_6); // scope 2 at $DIR/unreachable_asm_2.rs:14:12: 14:16 - _6 = const true; // scope 2 at $DIR/unreachable_asm_2.rs:14:12: 14:16 - switchInt(move _6) -> [false: bb4, otherwise: bb3]; // scope 2 at $DIR/unreachable_asm_2.rs:14:12: 14:16 - } - - bb3: { - StorageLive(_7); // scope 2 at $DIR/unreachable_asm_2.rs:16:13: 16:41 - llvm_asm!(LlvmInlineAsmInner { asm: "NOP", asm_str_style: Cooked, outputs: [], inputs: [], clobbers: [], volatile: true, alignstack: false, dialect: Att } : [] : []); // scope 3 at $DIR/unreachable_asm_2.rs:16:22: 16:38 - _7 = const (); // scope 3 at $DIR/unreachable_asm_2.rs:16:13: 16:41 - StorageDead(_7); // scope 2 at $DIR/unreachable_asm_2.rs:16:40: 16:41 - _4 = const 21_i32; // scope 2 at $DIR/unreachable_asm_2.rs:17:13: 17:20 - _5 = const (); // scope 2 at $DIR/unreachable_asm_2.rs:14:17: 18:10 -- goto -> bb5; // scope 2 at $DIR/unreachable_asm_2.rs:14:9: 22:10 -+ unreachable; // scope 2 at $DIR/unreachable_asm_2.rs:14:9: 22:10 - } - - bb4: { - StorageLive(_8); // scope 2 at $DIR/unreachable_asm_2.rs:20:13: 20:41 - llvm_asm!(LlvmInlineAsmInner { asm: "NOP", asm_str_style: Cooked, outputs: [], inputs: [], clobbers: [], volatile: true, alignstack: false, dialect: Att } : [] : []); // scope 4 at $DIR/unreachable_asm_2.rs:20:22: 20:38 - _8 = const (); // scope 4 at $DIR/unreachable_asm_2.rs:20:13: 20:41 - StorageDead(_8); // scope 2 at $DIR/unreachable_asm_2.rs:20:40: 20:41 - _4 = const 42_i32; // scope 2 at $DIR/unreachable_asm_2.rs:21:13: 21:20 - _5 = const (); // scope 2 at $DIR/unreachable_asm_2.rs:18:16: 22:10 -- goto -> bb5; // scope 2 at $DIR/unreachable_asm_2.rs:14:9: 22:10 -+ unreachable; // scope 2 at $DIR/unreachable_asm_2.rs:14:9: 22:10 - } - - bb5: { -- StorageDead(_6); // scope 2 at $DIR/unreachable_asm_2.rs:22:9: 22:10 -- StorageDead(_5); // scope 2 at $DIR/unreachable_asm_2.rs:22:9: 22:10 -- StorageLive(_9); // scope 2 at $DIR/unreachable_asm_2.rs:24:9: 24:21 -- unreachable; // scope 2 at $DIR/unreachable_asm_2.rs:24:15: 24:17 -- } -- -- bb6: { - _0 = const (); // scope 0 at $DIR/unreachable_asm_2.rs:25:6: 25:6 - StorageDead(_1); // scope 0 at $DIR/unreachable_asm_2.rs:26:1: 26:2 - return; // scope 0 at $DIR/unreachable_asm_2.rs:26:2: 26:2 - } - } - diff --git a/src/test/mir-opt/unreachable_asm_2.rs b/src/test/mir-opt/unreachable_asm_2.rs deleted file mode 100644 index e0d8e725147..00000000000 --- a/src/test/mir-opt/unreachable_asm_2.rs +++ /dev/null @@ -1,26 +0,0 @@ -#![feature(llvm_asm)] - -enum Empty {} - -fn empty() -> Option<Empty> { - None -} - -// EMIT_MIR unreachable_asm_2.main.UnreachablePropagation.diff -fn main() { - if let Some(_x) = empty() { - let mut _y; - - if true { - // asm instruction stops unreachable propagation to block bb3. - unsafe { llvm_asm!("NOP"); } - _y = 21; - } else { - // asm instruction stops unreachable propagation to block bb3. - unsafe { llvm_asm!("NOP"); } - _y = 42; - } - - match _x { } - } -} diff --git a/src/test/pretty/llvm-asm-clobbers.rs b/src/test/pretty/llvm-asm-clobbers.rs deleted file mode 100644 index 2c09646e47e..00000000000 --- a/src/test/pretty/llvm-asm-clobbers.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![feature(llvm_asm)] - -pub fn main() { unsafe { llvm_asm!("" : : : "hello", "world") }; } diff --git a/src/test/pretty/llvm-asm-options.rs b/src/test/pretty/llvm-asm-options.rs deleted file mode 100644 index 86a881bfbd1..00000000000 --- a/src/test/pretty/llvm-asm-options.rs +++ /dev/null @@ -1,11 +0,0 @@ -#![feature(llvm_asm)] - -// pp-exact - -pub fn main() { - unsafe { - llvm_asm!("" : : : : "volatile"); - llvm_asm!("" : : : : "alignstack"); - llvm_asm!("" : : : : "intel"); - } -} diff --git a/src/test/pretty/raw-str-nonexpr.rs b/src/test/pretty/raw-str-nonexpr.rs index 41227898f24..7af80979b43 100644 --- a/src/test/pretty/raw-str-nonexpr.rs +++ b/src/test/pretty/raw-str-nonexpr.rs @@ -1,8 +1,8 @@ // pp-exact -#![feature(llvm_asm)] - #[cfg(foo = r#"just parse this"#)] extern crate blah as blah; -fn main() { unsafe { llvm_asm!(r###"blah"###); } } +use std::arch::asm; + +fn main() { unsafe { asm!(r###"blah"###); } } diff --git a/src/test/run-make-fulldeps/intrinsic-unreachable/exit-ret.rs b/src/test/run-make-fulldeps/intrinsic-unreachable/exit-ret.rs index 2e81667cf39..e7b9694d9f2 100644 --- a/src/test/run-make-fulldeps/intrinsic-unreachable/exit-ret.rs +++ b/src/test/run-make-fulldeps/intrinsic-unreachable/exit-ret.rs @@ -1,12 +1,11 @@ -#![feature(llvm_asm)] #![crate_type="lib"] +use std::arch::asm; #[deny(unreachable_code)] pub fn exit(n: usize) -> i32 { unsafe { // Pretend this asm is an exit() syscall. - llvm_asm!("" :: "r"(n) :: "volatile"); - // Can't actually reach this point, but rustc doesn't know that. + asm!("/*{0}*/", in(reg) n); } // This return value is just here to generate some extra code for a return // value, making it easier for the test script to detect whether the diff --git a/src/test/run-make-fulldeps/intrinsic-unreachable/exit-unreachable.rs b/src/test/run-make-fulldeps/intrinsic-unreachable/exit-unreachable.rs index fb3848b0db6..ec85db733df 100644 --- a/src/test/run-make-fulldeps/intrinsic-unreachable/exit-unreachable.rs +++ b/src/test/run-make-fulldeps/intrinsic-unreachable/exit-unreachable.rs @@ -1,5 +1,6 @@ -#![feature(llvm_asm, core_intrinsics)] +#![feature(core_intrinsics)] #![crate_type="lib"] +use std::arch::asm; use std::intrinsics; @@ -7,7 +8,7 @@ use std::intrinsics; pub fn exit(n: usize) -> i32 { unsafe { // Pretend this asm is an exit() syscall. - llvm_asm!("" :: "r"(n) :: "volatile"); + asm!("/*{0}*/", in(reg) n); intrinsics::unreachable() } // This return value is just here to generate some extra code for a return diff --git a/src/test/ui/abi/abi-sysv64-register-usage.rs b/src/test/ui/abi/abi-sysv64-register-usage.rs index 9eba9e0ca76..e3eff2eb143 100644 --- a/src/test/ui/abi/abi-sysv64-register-usage.rs +++ b/src/test/ui/abi/abi-sysv64-register-usage.rs @@ -5,9 +5,7 @@ // ignore-android // ignore-arm // ignore-aarch64 - -#![feature(llvm_asm)] -#![allow(deprecated)] // llvm_asm! +#![feature(asm_sym)] #[cfg(target_arch = "x86_64")] pub extern "sysv64" fn all_the_registers(rdi: i64, rsi: i64, rdx: i64, @@ -54,37 +52,37 @@ pub extern "sysv64" fn large_struct_by_val(mut foo: LargeStruct) -> LargeStruct #[cfg(target_arch = "x86_64")] pub fn main() { + use std::arch::asm; + let result: i64; unsafe { - llvm_asm!("mov rdi, 1; - mov rsi, 2; - mov rdx, 3; - mov rcx, 4; - mov r8, 5; - mov r9, 6; - mov eax, 0x3F800000; - movd xmm0, eax; - mov eax, 0x40000000; - movd xmm1, eax; - mov eax, 0x40800000; - movd xmm2, eax; - mov eax, 0x41000000; - movd xmm3, eax; - mov eax, 0x41800000; - movd xmm4, eax; - mov eax, 0x42000000; - movd xmm5, eax; - mov eax, 0x42800000; - movd xmm6, eax; - mov eax, 0x43000000; - movd xmm7, eax; - call r10 - " - : "={rax}"(result) - : "{r10}"(all_the_registers as usize) - : "rdi", "rsi", "rdx", "rcx", "r8", "r9", "r11", "cc", "memory" - : "intel", "alignstack" - ) + asm!("mov rdi, 1", + "mov rsi, 2", + "mov rdx, 3", + "mov rcx, 4", + "mov r8, 5", + "mov r9, 6", + "mov eax, 0x3F800000", + "movd xmm0, eax", + "mov eax, 0x40000000", + "movd xmm1, eax", + "mov eax, 0x40800000", + "movd xmm2, eax", + "mov eax, 0x41000000", + "movd xmm3, eax", + "mov eax, 0x41800000", + "movd xmm4, eax", + "mov eax, 0x42000000", + "movd xmm5, eax", + "mov eax, 0x42800000", + "movd xmm6, eax", + "mov eax, 0x43000000", + "movd xmm7, eax", + "call {0}", + sym all_the_registers, + out("rax") result, + clobber_abi("sysv64"), + ); } assert_eq!(result, 42); 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; @@ -115,16 +113,6 @@ pub fn outer(x: u32) -> extern "C" fn(usize) -> usize { } #[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)); //~^ WARN asm options unsupported in naked functions: `nomem`, `preserves_flags` 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<std::ptr::NonNull<u8>>, | ^^^^^^^^^^^^^^ 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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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 <https://github.com/rust-lang/rust/issues/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<u32> = 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<A>(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 - --> <inline asm>: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<u32>) { - 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 - --> <inline asm>: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<NoisyDrop>; - 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..73c31cd9721 100644 --- a/src/test/ui/runtime/out-of-stack.rs +++ b/src/test/ui/runtime/out-of-stack.rs @@ -2,12 +2,11 @@ #![allow(unused_must_use)] #![allow(unconditional_recursion)] -#![allow(deprecated)] // llvm_asm! // ignore-android: FIXME (#20004) // ignore-emscripten no processes // ignore-sgx no processes -#![feature(llvm_asm)] +#![feature(core_intrinsics)] #![feature(rustc_private)] #[cfg(unix)] @@ -17,11 +16,10 @@ use std::env; use std::process::Command; use std::thread; -// lifted from the test module // Inlining to avoid llvm turning the recursive functions into tail calls, // which doesn't consume stack. #[inline(always)] -pub fn black_box<T>(dummy: T) { unsafe { llvm_asm!("" : : "r"(&dummy)) } } +pub fn black_box<T>(dummy: T) { std::intrinsics::black_box(dummy); } fn silent_recurse() { let buf = [0u8; 1000]; 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`. |
