diff --git a/src/doc/unstable-book/src/library-features/asm.md b/src/doc/unstable-book/src/library-features/llvm-asm.md similarity index 81% rename from src/doc/unstable-book/src/library-features/asm.md rename to src/doc/unstable-book/src/library-features/llvm-asm.md index 2a1b6397781f9..e07f716e56718 100644 --- a/src/doc/unstable-book/src/library-features/asm.md +++ b/src/doc/unstable-book/src/library-features/llvm-asm.md @@ -1,17 +1,17 @@ -# `asm` +# `llvm_asm` -The tracking issue for this feature is: [#29722] +The tracking issue for this feature is: [#70173] -[#29722]: https://github.com/rust-lang/rust/issues/29722 +[#70173]: https://github.com/rust-lang/rust/issues/70173 ------------------------ For extremely low-level manipulations and performance reasons, one might wish to control the CPU directly. Rust supports using inline -assembly to do this via the `asm!` macro. +assembly to do this via the `llvm_asm!` macro. ```rust,ignore -asm!(assembly template +llvm_asm!(assembly template : output operands : input operands : clobbers @@ -19,7 +19,7 @@ asm!(assembly template ); ``` -Any use of `asm` is feature gated (requires `#![feature(asm)]` on the +Any use of `llvm_asm` is feature gated (requires `#![feature(llvm_asm)]` on the crate to allow) and of course requires an `unsafe` block. > **Note**: the examples here are given in x86/x86-64 assembly, but @@ -31,12 +31,12 @@ The `assembly template` is the only required parameter and must be a literal string (i.e. `""`) ```rust -#![feature(asm)] +#![feature(llvm_asm)] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] fn foo() { unsafe { - asm!("NOP"); + llvm_asm!("NOP"); } } @@ -51,16 +51,16 @@ fn main() { } ``` -(The `feature(asm)` and `#[cfg]`s are omitted from now on.) +(The `feature(llvm_asm)` and `#[cfg]`s are omitted from now on.) Output operands, input operands, clobbers and options are all optional but you must add the right number of `:` if you skip them: ```rust -# #![feature(asm)] +# #![feature(llvm_asm)] # #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] # fn main() { unsafe { -asm!("xor %eax, %eax" +llvm_asm!("xor %eax, %eax" : : : "eax" @@ -73,10 +73,10 @@ asm!("xor %eax, %eax" Whitespace also doesn't matter: ```rust -# #![feature(asm)] +# #![feature(llvm_asm)] # #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] # fn main() { unsafe { -asm!("xor %eax, %eax" ::: "eax"); +llvm_asm!("xor %eax, %eax" ::: "eax"); # } } # #[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))] # fn main() {} @@ -89,12 +89,12 @@ Input and output operands follow the same format: `: expressions must be mutable lvalues, or not yet assigned: ```rust -# #![feature(asm)] +# #![feature(llvm_asm)] # #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] fn add(a: i32, b: i32) -> i32 { let c: i32; unsafe { - asm!("add $2, $0" + llvm_asm!("add $2, $0" : "=r"(c) : "0"(a), "r"(b) ); @@ -116,11 +116,11 @@ operand. This is useful for very low level programming, where which register you use is important: ```rust -# #![feature(asm)] +# #![feature(llvm_asm)] # #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] # unsafe fn read_byte_in(port: u16) -> u8 { let result: u8; -asm!("in %dx, %al" : "={al}"(result) : "{dx}"(port)); +llvm_asm!("in %dx, %al" : "={al}"(result) : "{dx}"(port)); result # } ``` @@ -133,11 +133,11 @@ compiler not to assume any values loaded into those registers will stay valid. ```rust -# #![feature(asm)] +# #![feature(llvm_asm)] # #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] # fn main() { unsafe { // Put the value 0x200 in eax: -asm!("mov $$0x200, %eax" : /* no outputs */ : /* no inputs */ : "eax"); +llvm_asm!("mov $$0x200, %eax" : /* no outputs */ : /* no inputs */ : "eax"); # } } # #[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))] # fn main() {} @@ -167,12 +167,12 @@ Current valid options are: 3. *intel* - use intel syntax instead of the default AT&T. ```rust -# #![feature(asm)] +# #![feature(llvm_asm)] # #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] # fn main() { let result: i32; unsafe { - asm!("mov eax, 2" : "={eax}"(result) : : : "intel") + llvm_asm!("mov eax, 2" : "={eax}"(result) : : : "intel") } println!("eax is currently {}", result); # } @@ -182,7 +182,7 @@ println!("eax is currently {}", result); ## More Information -The current implementation of the `asm!` macro is a direct binding to [LLVM's +The current implementation of the `llvm_asm!` macro is a direct binding to [LLVM's inline assembler expressions][llvm-docs], so be sure to check out [their documentation as well][llvm-docs] for more information about clobbers, constraints, etc. @@ -190,4 +190,4 @@ constraints, etc. [llvm-docs]: http://llvm.org/docs/LangRef.html#inline-assembler-expressions If you need more power and don't mind losing some of the niceties of -`asm!`, check out [global_asm](global-asm.md). +`llvm_asm!`, check out [global_asm](global-asm.md). diff --git a/src/libcore/hint.rs b/src/libcore/hint.rs index 6cbd26a78de72..698c97999c457 100644 --- a/src/libcore/hint.rs +++ b/src/libcore/hint.rs @@ -113,7 +113,7 @@ pub fn black_box(dummy: T) -> T { // box. This isn't the greatest implementation since it probably deoptimizes // more than we want, but it's so far good enough. unsafe { - asm!("" : : "r"(&dummy)); + llvm_asm!("" : : "r"(&dummy)); dummy } } diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index 0bee16f98bd5e..73c5e3fad475d 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -98,6 +98,7 @@ #![feature(is_sorted)] #![feature(lang_items)] #![feature(link_llvm_intrinsics)] +#![feature(llvm_asm)] #![cfg_attr(not(bootstrap), feature(negative_impls))] #![feature(never_type)] #![feature(nll)] diff --git a/src/libcore/macros/mod.rs b/src/libcore/macros/mod.rs index a0873fe6b625d..f67762cd04346 100644 --- a/src/libcore/macros/mod.rs +++ b/src/libcore/macros/mod.rs @@ -1307,7 +1307,7 @@ pub(crate) mod builtin { /// [unstable book]: ../unstable-book/library-features/asm.html #[unstable( feature = "asm", - issue = "29722", + issue = "70173", reason = "inline assembly is not stable enough for use and is subject to change" )] #[rustc_builtin_macro] @@ -1322,6 +1322,47 @@ pub(crate) mod builtin { }; } + /// Inline assembly. + /// + /// Read the [unstable book] for the usage. + /// + /// [unstable book]: ../unstable-book/library-features/asm.html + #[cfg(bootstrap)] + #[unstable( + feature = "llvm_asm", + issue = "70173", + reason = "inline assembly is not stable enough for use and is subject to change" + )] + #[macro_export] + #[allow_internal_unstable(asm)] + macro_rules! llvm_asm { + // Redirect to asm! for stage0 + ($($arg:tt)*) => { $crate::asm!($($arg)*) } + } + + /// Inline assembly. + /// + /// Read the [unstable book] for the usage. + /// + /// [unstable book]: ../unstable-book/library-features/asm.html + #[cfg(not(bootstrap))] + #[unstable( + feature = "llvm_asm", + issue = "70173", + reason = "inline assembly is not stable enough for use and is subject to change" + )] + #[rustc_builtin_macro] + #[macro_export] + macro_rules! llvm_asm { + ("assembly template" + : $("output"(operand),)* + : $("input"(operand),)* + : $("clobbers",)* + : $("options",)*) => { + /* compiler built-in */ + }; + } + /// Module-level inline assembly. #[unstable( feature = "global_asm", diff --git a/src/libcore/num/dec2flt/algorithm.rs b/src/libcore/num/dec2flt/algorithm.rs index c5f6903f379c4..aaeb4d8a22c29 100644 --- a/src/libcore/num/dec2flt/algorithm.rs +++ b/src/libcore/num/dec2flt/algorithm.rs @@ -60,7 +60,7 @@ mod fpu_precision { fn set_cw(cw: u16) { // SAFETY: the `fldcw` instruction has been audited to be able to work correctly with // any `u16` - unsafe { asm!("fldcw $0" :: "m" (cw) :: "volatile") } + unsafe { llvm_asm!("fldcw $0" :: "m" (cw) :: "volatile") } } /// Sets the precision field of the FPU to `T` and returns a `FPUControlWord`. @@ -78,7 +78,7 @@ mod fpu_precision { // `FPUControlWord` structure is dropped // SAFETY: the `fnstcw` instruction has been audited to be able to work correctly with // any `u16` - unsafe { asm!("fnstcw $0" : "=*m" (&cw) ::: "volatile") } + unsafe { llvm_asm!("fnstcw $0" : "=*m" (&cw) ::: "volatile") } // Set the control word to the desired precision. This is achieved by masking away the old // precision (bits 8 and 9, 0x300) and replacing it with the precision flag computed above. diff --git a/src/libcore/prelude/v1.rs b/src/libcore/prelude/v1.rs index c91370b271992..9b4ed4e820512 100644 --- a/src/libcore/prelude/v1.rs +++ b/src/libcore/prelude/v1.rs @@ -57,8 +57,8 @@ pub use crate::hash::macros::Hash; #[doc(no_inline)] pub use crate::{ asm, assert, cfg, column, compile_error, concat, concat_idents, env, file, format_args, - format_args_nl, global_asm, include, include_bytes, include_str, line, log_syntax, module_path, - option_env, stringify, trace_macros, + format_args_nl, global_asm, include, include_bytes, include_str, line, llvm_asm, log_syntax, + module_path, option_env, stringify, trace_macros, }; #[stable(feature = "builtin_macro_prelude", since = "1.38.0")] diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs index 1e47317cf1ace..9ba9d816d0f3f 100644 --- a/src/librustc/mir/mod.rs +++ b/src/librustc/mir/mod.rs @@ -1584,7 +1584,7 @@ pub enum StatementKind<'tcx> { /// Executes a piece of inline Assembly. Stored in a Box to keep the size /// of `StatementKind` low. - InlineAsm(Box>), + LlvmInlineAsm(Box>), /// Retag references in the given place, ensuring they got fresh tags. This is /// part of the Stacked Borrows model. These statements are currently only interpreted @@ -1668,8 +1668,8 @@ pub enum FakeReadCause { } #[derive(Clone, Debug, PartialEq, RustcEncodable, RustcDecodable, HashStable, TypeFoldable)] -pub struct InlineAsm<'tcx> { - pub asm: hir::InlineAsmInner, +pub struct LlvmInlineAsm<'tcx> { + pub asm: hir::LlvmInlineAsmInner, pub outputs: Box<[Place<'tcx>]>, pub inputs: Box<[(Span, Operand<'tcx>)]>, } @@ -1696,8 +1696,8 @@ impl Debug for Statement<'_> { SetDiscriminant { ref place, variant_index } => { write!(fmt, "discriminant({:?}) = {:?}", place, variant_index) } - InlineAsm(ref asm) => { - write!(fmt, "asm!({:?} : {:?} : {:?})", asm.asm, asm.outputs, asm.inputs) + LlvmInlineAsm(ref asm) => { + write!(fmt, "llvm_asm!({:?} : {:?} : {:?})", asm.asm, asm.outputs, asm.inputs) } AscribeUserType(box (ref place, ref c_ty), ref variance) => { write!(fmt, "AscribeUserType({:?}, {:?}, {:?})", place, variance, c_ty) diff --git a/src/librustc/mir/visit.rs b/src/librustc/mir/visit.rs index 2aca6f684f4fe..c1b27b40f7dcf 100644 --- a/src/librustc/mir/visit.rs +++ b/src/librustc/mir/visit.rs @@ -385,7 +385,7 @@ macro_rules! make_mir_visitor { location ); } - StatementKind::InlineAsm(asm) => { + StatementKind::LlvmInlineAsm(asm) => { for output in & $($mutability)? asm.outputs[..] { self.visit_place( output, diff --git a/src/librustc/ty/structural_impls.rs b/src/librustc/ty/structural_impls.rs index 81be5b11143af..429791d09a49c 100644 --- a/src/librustc/ty/structural_impls.rs +++ b/src/librustc/ty/structural_impls.rs @@ -263,7 +263,7 @@ CloneTypeFoldableAndLiftImpls! { ::rustc_span::symbol::Symbol, ::rustc_hir::def::Res, ::rustc_hir::def_id::DefId, - ::rustc_hir::InlineAsmInner, + ::rustc_hir::LlvmInlineAsmInner, ::rustc_hir::MatchSource, ::rustc_hir::Mutability, ::rustc_hir::Unsafety, diff --git a/src/librustc_ast/ast.rs b/src/librustc_ast/ast.rs index 3e7fb0e73bffe..646294a7cca78 100644 --- a/src/librustc_ast/ast.rs +++ b/src/librustc_ast/ast.rs @@ -1114,7 +1114,7 @@ impl Expr { ExprKind::Break(..) => ExprPrecedence::Break, ExprKind::Continue(..) => ExprPrecedence::Continue, ExprKind::Ret(..) => ExprPrecedence::Ret, - ExprKind::InlineAsm(..) => ExprPrecedence::InlineAsm, + ExprKind::LlvmInlineAsm(..) => ExprPrecedence::InlineAsm, ExprKind::MacCall(..) => ExprPrecedence::Mac, ExprKind::Struct(..) => ExprPrecedence::Struct, ExprKind::Repeat(..) => ExprPrecedence::Repeat, @@ -1243,8 +1243,8 @@ pub enum ExprKind { /// A `return`, with an optional value to be returned. Ret(Option>), - /// Output of the `asm!()` macro. - InlineAsm(P), + /// Output of the `llvm_asm!()` macro. + LlvmInlineAsm(P), /// A macro invocation; pre-expansion. MacCall(MacCall), @@ -1860,37 +1860,37 @@ pub enum TraitObjectSyntax { /// Inline assembly dialect. /// -/// E.g., `"intel"` as in `asm!("mov eax, 2" : "={eax}"(result) : : : "intel")`. +/// E.g., `"intel"` as in `llvm_asm!("mov eax, 2" : "={eax}"(result) : : : "intel")`. #[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy, HashStable_Generic)] -pub enum AsmDialect { +pub enum LlvmAsmDialect { Att, Intel, } -/// Inline assembly. +/// LLVM-style inline assembly. /// -/// E.g., `"={eax}"(result)` as in `asm!("mov eax, 2" : "={eax}"(result) : : : "intel")`. +/// E.g., `"={eax}"(result)` as in `llvm_asm!("mov eax, 2" : "={eax}"(result) : : : "intel")`. #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] -pub struct InlineAsmOutput { +pub struct LlvmInlineAsmOutput { pub constraint: Symbol, pub expr: P, pub is_rw: bool, pub is_indirect: bool, } -/// Inline assembly. +/// LLVM-style inline assembly. /// -/// E.g., `asm!("NOP");`. +/// E.g., `llvm_asm!("NOP");`. #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] -pub struct InlineAsm { +pub struct LlvmInlineAsm { pub asm: Symbol, pub asm_str_style: StrStyle, - pub outputs: Vec, + pub outputs: Vec, pub inputs: Vec<(Symbol, P)>, pub clobbers: Vec, pub volatile: bool, pub alignstack: bool, - pub dialect: AsmDialect, + pub dialect: LlvmAsmDialect, } /// A parameter in a function header. diff --git a/src/librustc_ast/mut_visit.rs b/src/librustc_ast/mut_visit.rs index aa2968b3cbe44..67f7764d5bb27 100644 --- a/src/librustc_ast/mut_visit.rs +++ b/src/librustc_ast/mut_visit.rs @@ -1202,8 +1202,8 @@ pub fn noop_visit_expr(Expr { kind, id, span, attrs }: &mut Expr, ExprKind::Ret(expr) => { visit_opt(expr, |expr| vis.visit_expr(expr)); } - ExprKind::InlineAsm(asm) => { - let InlineAsm { + ExprKind::LlvmInlineAsm(asm) => { + let LlvmInlineAsm { asm: _, asm_str_style: _, outputs, @@ -1214,7 +1214,7 @@ pub fn noop_visit_expr(Expr { kind, id, span, attrs }: &mut Expr, dialect: _, } = asm.deref_mut(); for out in outputs { - let InlineAsmOutput { constraint: _, expr, is_rw: _, is_indirect: _ } = out; + let LlvmInlineAsmOutput { constraint: _, expr, is_rw: _, is_indirect: _ } = out; vis.visit_expr(expr); } visit_vec(inputs, |(_c, expr)| vis.visit_expr(expr)); diff --git a/src/librustc_ast/visit.rs b/src/librustc_ast/visit.rs index 39028b7583c63..cc2b1c48b51ac 100644 --- a/src/librustc_ast/visit.rs +++ b/src/librustc_ast/visit.rs @@ -813,7 +813,7 @@ pub fn walk_expr<'a, V: Visitor<'a>>(visitor: &mut V, expression: &'a Expr) { } ExprKind::MacCall(ref mac) => visitor.visit_mac(mac), ExprKind::Paren(ref subexpression) => visitor.visit_expr(subexpression), - ExprKind::InlineAsm(ref ia) => { + ExprKind::LlvmInlineAsm(ref ia) => { for &(_, ref input) in &ia.inputs { visitor.visit_expr(input) } diff --git a/src/librustc_ast_lowering/expr.rs b/src/librustc_ast_lowering/expr.rs index 239dec9e9746b..9984eb4e2825f 100644 --- a/src/librustc_ast_lowering/expr.rs +++ b/src/librustc_ast_lowering/expr.rs @@ -159,7 +159,7 @@ impl<'hir> LoweringContext<'_, 'hir> { let e = e.as_ref().map(|x| self.lower_expr(x)); hir::ExprKind::Ret(e) } - ExprKind::InlineAsm(ref asm) => self.lower_expr_asm(asm), + ExprKind::LlvmInlineAsm(ref asm) => self.lower_expr_asm(asm), ExprKind::Struct(ref path, ref fields, ref maybe_expr) => { let maybe_expr = maybe_expr.as_ref().map(|x| self.lower_expr(x)); hir::ExprKind::Struct( @@ -952,13 +952,13 @@ impl<'hir> LoweringContext<'_, 'hir> { result } - fn lower_expr_asm(&mut self, asm: &InlineAsm) -> hir::ExprKind<'hir> { - let inner = hir::InlineAsmInner { + fn lower_expr_asm(&mut self, asm: &LlvmInlineAsm) -> hir::ExprKind<'hir> { + let inner = hir::LlvmInlineAsmInner { inputs: asm.inputs.iter().map(|&(c, _)| c).collect(), outputs: asm .outputs .iter() - .map(|out| hir::InlineAsmOutput { + .map(|out| hir::LlvmInlineAsmOutput { constraint: out.constraint, is_rw: out.is_rw, is_indirect: out.is_indirect, @@ -972,7 +972,7 @@ impl<'hir> LoweringContext<'_, 'hir> { alignstack: asm.alignstack, dialect: asm.dialect, }; - let hir_asm = hir::InlineAsm { + let hir_asm = hir::LlvmInlineAsm { inner, inputs_exprs: self.arena.alloc_from_iter( asm.inputs.iter().map(|&(_, ref input)| self.lower_expr_mut(input)), @@ -981,7 +981,7 @@ impl<'hir> LoweringContext<'_, 'hir> { .arena .alloc_from_iter(asm.outputs.iter().map(|out| self.lower_expr_mut(&out.expr))), }; - hir::ExprKind::InlineAsm(self.arena.alloc(hir_asm)) + hir::ExprKind::LlvmInlineAsm(self.arena.alloc(hir_asm)) } fn lower_field(&mut self, f: &Field) -> hir::Field<'hir> { diff --git a/src/librustc_ast_passes/ast_validation.rs b/src/librustc_ast_passes/ast_validation.rs index d6d1153f2790f..885f2f939a653 100644 --- a/src/librustc_ast_passes/ast_validation.rs +++ b/src/librustc_ast_passes/ast_validation.rs @@ -716,12 +716,12 @@ impl<'a> Visitor<'a> for AstValidator<'a> { fn visit_expr(&mut self, expr: &'a Expr) { match &expr.kind { - ExprKind::InlineAsm(..) if !self.session.target.target.options.allow_asm => { + ExprKind::LlvmInlineAsm(..) if !self.session.target.target.options.allow_asm => { struct_span_err!( self.session, expr.span, E0472, - "asm! is unsupported on this target" + "llvm_asm! is unsupported on this target" ) .emit(); } diff --git a/src/librustc_ast_pretty/pprust.rs b/src/librustc_ast_pretty/pprust.rs index bb73e982a9c28..2d6932ffbeedf 100644 --- a/src/librustc_ast_pretty/pprust.rs +++ b/src/librustc_ast_pretty/pprust.rs @@ -2024,8 +2024,8 @@ impl<'a> State<'a> { self.print_expr_maybe_paren(expr, parser::PREC_JUMP); } } - ast::ExprKind::InlineAsm(ref a) => { - self.s.word("asm!"); + ast::ExprKind::LlvmInlineAsm(ref a) => { + self.s.word("llvm_asm!"); self.popen(); self.print_string(&a.asm.as_str(), a.asm_str_style); self.word_space(":"); @@ -2066,7 +2066,7 @@ impl<'a> State<'a> { if a.alignstack { options.push("alignstack"); } - if a.dialect == ast::AsmDialect::Intel { + if a.dialect == ast::LlvmAsmDialect::Intel { options.push("intel"); } diff --git a/src/librustc_builtin_macros/lib.rs b/src/librustc_builtin_macros/lib.rs index 26a59c6b1bedb..caed0bf7a0862 100644 --- a/src/librustc_builtin_macros/lib.rs +++ b/src/librustc_builtin_macros/lib.rs @@ -19,7 +19,6 @@ use rustc_expand::proc_macro::BangProcMacro; use rustc_span::edition::Edition; use rustc_span::symbol::sym; -mod asm; mod assert; mod cfg; mod cfg_accessible; @@ -32,6 +31,7 @@ mod format; mod format_foreign; mod global_allocator; mod global_asm; +mod llvm_asm; mod log_syntax; mod source_util; mod test; @@ -61,7 +61,7 @@ pub fn register_builtin_macros(resolver: &mut dyn Resolver, edition: Edition) { } register_bang! { - asm: asm::expand_asm, + asm: llvm_asm::expand_llvm_asm, assert: assert::expand_assert, cfg: cfg::expand_cfg, column: source_util::expand_column, @@ -77,6 +77,7 @@ pub fn register_builtin_macros(resolver: &mut dyn Resolver, edition: Edition) { include_str: source_util::expand_include_str, include: source_util::expand_include, line: source_util::expand_line, + llvm_asm: llvm_asm::expand_llvm_asm, log_syntax: log_syntax::expand_log_syntax, module_path: source_util::expand_mod, option_env: env::expand_option_env, diff --git a/src/librustc_builtin_macros/asm.rs b/src/librustc_builtin_macros/llvm_asm.rs similarity index 94% rename from src/librustc_builtin_macros/asm.rs rename to src/librustc_builtin_macros/llvm_asm.rs index 9811a6621afa5..88756f533d412 100644 --- a/src/librustc_builtin_macros/asm.rs +++ b/src/librustc_builtin_macros/llvm_asm.rs @@ -1,8 +1,8 @@ -// Inline assembly support. +// Llvm-style inline assembly support. // use State::*; -use rustc_ast::ast::{self, AsmDialect}; +use rustc_ast::ast::{self, LlvmAsmDialect}; use rustc_ast::ptr::P; use rustc_ast::token::{self, Token}; use rustc_ast::tokenstream::{self, TokenStream}; @@ -36,7 +36,7 @@ impl State { const OPTIONS: &[Symbol] = &[sym::volatile, sym::alignstack, sym::intel]; -pub fn expand_asm<'cx>( +pub fn expand_llvm_asm<'cx>( cx: &'cx mut ExtCtxt<'_>, sp: Span, tts: TokenStream, @@ -58,7 +58,7 @@ pub fn expand_asm<'cx>( MacEager::expr(P(ast::Expr { id: ast::DUMMY_NODE_ID, - kind: ast::ExprKind::InlineAsm(P(inline_asm)), + kind: ast::ExprKind::LlvmInlineAsm(P(inline_asm)), span: cx.with_def_site_ctxt(sp), attrs: ast::AttrVec::new(), })) @@ -80,9 +80,9 @@ fn parse_inline_asm<'a>( cx: &mut ExtCtxt<'a>, sp: Span, tts: TokenStream, -) -> Result, DiagnosticBuilder<'a>> { - // Split the tts before the first colon, to avoid `asm!("x": y)` being - // parsed as `asm!(z)` with `z = "x": y` which is type ascription. +) -> Result, DiagnosticBuilder<'a>> { + // Split the tts before the first colon, to avoid `llvm_asm!("x": y)` being + // parsed as `llvm_asm!(z)` with `z = "x": y` which is type ascription. let first_colon = tts .trees() .position(|tt| match tt { @@ -99,7 +99,7 @@ fn parse_inline_asm<'a>( let mut clobs = Vec::new(); let mut volatile = false; let mut alignstack = false; - let mut dialect = AsmDialect::Att; + let mut dialect = LlvmAsmDialect::Att; let mut state = Asm; @@ -183,7 +183,7 @@ fn parse_inline_asm<'a>( let is_rw = output.is_some(); let is_indirect = constraint_str.contains('*'); - outputs.push(ast::InlineAsmOutput { + outputs.push(ast::LlvmInlineAsmOutput { constraint: output.unwrap_or(constraint), expr, is_rw, @@ -257,7 +257,7 @@ fn parse_inline_asm<'a>( } else if option == sym::alignstack { alignstack = true; } else if option == sym::intel { - dialect = AsmDialect::Intel; + dialect = LlvmAsmDialect::Intel; } else { cx.span_warn(p.prev_token.span, "unrecognized option"); } @@ -287,7 +287,7 @@ fn parse_inline_asm<'a>( } } - Ok(Some(ast::InlineAsm { + Ok(Some(ast::LlvmInlineAsm { asm, asm_str_style: asm_str_style.unwrap(), outputs, diff --git a/src/librustc_codegen_llvm/asm.rs b/src/librustc_codegen_llvm/asm.rs index 6edc3d5ecd477..30bf3ce752859 100644 --- a/src/librustc_codegen_llvm/asm.rs +++ b/src/librustc_codegen_llvm/asm.rs @@ -14,9 +14,9 @@ use libc::{c_char, c_uint}; use log::debug; impl AsmBuilderMethods<'tcx> for Builder<'a, 'll, 'tcx> { - fn codegen_inline_asm( + fn codegen_llvm_inline_asm( &mut self, - ia: &hir::InlineAsmInner, + ia: &hir::LlvmInlineAsmInner, outputs: Vec>, mut inputs: Vec<&'ll Value>, span: Span, @@ -138,7 +138,7 @@ fn inline_asm_call( output: &'ll llvm::Type, volatile: bool, alignstack: bool, - dia: ::rustc_ast::ast::AsmDialect, + dia: ::rustc_ast::ast::LlvmAsmDialect, ) -> Option<&'ll Value> { let volatile = if volatile { llvm::True } else { llvm::False }; let alignstack = if alignstack { llvm::True } else { llvm::False }; diff --git a/src/librustc_codegen_llvm/llvm/ffi.rs b/src/librustc_codegen_llvm/llvm/ffi.rs index 69881e2149bc4..1d61d95cc6bf3 100644 --- a/src/librustc_codegen_llvm/llvm/ffi.rs +++ b/src/librustc_codegen_llvm/llvm/ffi.rs @@ -389,10 +389,10 @@ pub enum AsmDialect { } impl AsmDialect { - pub fn from_generic(asm: rustc_ast::ast::AsmDialect) -> Self { + pub fn from_generic(asm: rustc_ast::ast::LlvmAsmDialect) -> Self { match asm { - rustc_ast::ast::AsmDialect::Att => AsmDialect::Att, - rustc_ast::ast::AsmDialect::Intel => AsmDialect::Intel, + rustc_ast::ast::LlvmAsmDialect::Att => AsmDialect::Att, + rustc_ast::ast::LlvmAsmDialect::Intel => AsmDialect::Intel, } } } diff --git a/src/librustc_codegen_ssa/mir/statement.rs b/src/librustc_codegen_ssa/mir/statement.rs index e68b41ad18879..5edd9b9f0a05d 100644 --- a/src/librustc_codegen_ssa/mir/statement.rs +++ b/src/librustc_codegen_ssa/mir/statement.rs @@ -66,7 +66,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { } bx } - mir::StatementKind::InlineAsm(ref asm) => { + mir::StatementKind::LlvmInlineAsm(ref asm) => { let outputs = asm .outputs .iter() @@ -93,7 +93,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { ); if input_vals.len() == asm.inputs.len() { - let res = bx.codegen_inline_asm( + let res = bx.codegen_llvm_inline_asm( &asm.asm, outputs, input_vals, diff --git a/src/librustc_codegen_ssa/traits/asm.rs b/src/librustc_codegen_ssa/traits/asm.rs index d31b063232c85..1cdfd3ae356dd 100644 --- a/src/librustc_codegen_ssa/traits/asm.rs +++ b/src/librustc_codegen_ssa/traits/asm.rs @@ -1,13 +1,13 @@ use super::BackendTypes; use crate::mir::place::PlaceRef; -use rustc_hir::{GlobalAsm, InlineAsmInner}; +use rustc_hir::{GlobalAsm, LlvmInlineAsmInner}; use rustc_span::Span; pub trait AsmBuilderMethods<'tcx>: BackendTypes { /// Take an inline assembly expression and splat it out via LLVM - fn codegen_inline_asm( + fn codegen_llvm_inline_asm( &mut self, - ia: &InlineAsmInner, + ia: &LlvmInlineAsmInner, outputs: Vec>, inputs: Vec, span: Span, diff --git a/src/librustc_error_codes/error_codes.rs b/src/librustc_error_codes/error_codes.rs index fdcf3d639574b..fe68e9eacbfda 100644 --- a/src/librustc_error_codes/error_codes.rs +++ b/src/librustc_error_codes/error_codes.rs @@ -541,7 +541,7 @@ E0751: include_str!("./error_codes/E0751.md"), // E0467, removed // E0470, removed // E0471, // constant evaluation error (in pattern) - E0472, // asm! is unsupported on this target + E0472, // llvm_asm! is unsupported on this target E0473, // dereference of reference outside its lifetime E0474, // captured variable `..` does not outlive the enclosing closure E0475, // index of slice outside its lifetime diff --git a/src/librustc_error_codes/error_codes/E0660.md b/src/librustc_error_codes/error_codes/E0660.md index 189459175dca2..732de6a381871 100644 --- a/src/librustc_error_codes/error_codes/E0660.md +++ b/src/librustc_error_codes/error_codes/E0660.md @@ -1,9 +1,9 @@ -The argument to the `asm` macro is not well-formed. +The argument to the `llvm_asm` macro is not well-formed. Erroneous code example: ```compile_fail,E0660 -asm!("nop" "nop"); +llvm_asm!("nop" "nop"); ``` Considering that this would be a long explanation, we instead recommend you diff --git a/src/librustc_error_codes/error_codes/E0661.md b/src/librustc_error_codes/error_codes/E0661.md index b171ada620516..3d5cd90f6a37a 100644 --- a/src/librustc_error_codes/error_codes/E0661.md +++ b/src/librustc_error_codes/error_codes/E0661.md @@ -1,10 +1,10 @@ -An invalid syntax was passed to the second argument of an `asm` macro line. +An invalid syntax was passed to the second argument of an `llvm_asm` macro line. Erroneous code example: ```compile_fail,E0661 let a; -asm!("nop" : "r"(a)); +llvm_asm!("nop" : "r"(a)); ``` Considering that this would be a long explanation, we instead recommend you diff --git a/src/librustc_error_codes/error_codes/E0662.md b/src/librustc_error_codes/error_codes/E0662.md index c15e736610b5e..9858abd10c532 100644 --- a/src/librustc_error_codes/error_codes/E0662.md +++ b/src/librustc_error_codes/error_codes/E0662.md @@ -1,12 +1,13 @@ -An invalid input operand constraint was passed to the `asm` macro (third line). +An invalid input operand constraint was passed to the `llvm_asm` macro +(third line). Erroneous code example: ```compile_fail,E0662 -asm!("xor %eax, %eax" - : - : "=test"("a") - ); +llvm_asm!("xor %eax, %eax" + : + : "=test"("a") + ); ``` Considering that this would be a long explanation, we instead recommend you diff --git a/src/librustc_error_codes/error_codes/E0663.md b/src/librustc_error_codes/error_codes/E0663.md index bd450230ec3f2..36b87be7d6e38 100644 --- a/src/librustc_error_codes/error_codes/E0663.md +++ b/src/librustc_error_codes/error_codes/E0663.md @@ -1,12 +1,13 @@ -An invalid input operand constraint was passed to the `asm` macro (third line). +An invalid input operand constraint was passed to the `llvm_asm` macro +(third line). Erroneous code example: ```compile_fail,E0663 -asm!("xor %eax, %eax" - : - : "+test"("a") - ); +llvm_asm!("xor %eax, %eax" + : + : "+test"("a") + ); ``` Considering that this would be a long explanation, we instead recommend you diff --git a/src/librustc_error_codes/error_codes/E0664.md b/src/librustc_error_codes/error_codes/E0664.md index 768ffdf2de93b..33924b14e6d66 100644 --- a/src/librustc_error_codes/error_codes/E0664.md +++ b/src/librustc_error_codes/error_codes/E0664.md @@ -1,13 +1,13 @@ -A clobber was surrounded by braces in the `asm` macro. +A clobber was surrounded by braces in the `llvm_asm` macro. Erroneous code example: ```compile_fail,E0664 -asm!("mov $$0x200, %eax" - : - : - : "{eax}" - ); +llvm_asm!("mov $$0x200, %eax" + : + : + : "{eax}" + ); ``` Considering that this would be a long explanation, we instead recommend you diff --git a/src/librustc_error_codes/error_codes/E0668.md b/src/librustc_error_codes/error_codes/E0668.md index f5d26244fb961..3b43a1bcae9e6 100644 --- a/src/librustc_error_codes/error_codes/E0668.md +++ b/src/librustc_error_codes/error_codes/E0668.md @@ -7,12 +7,12 @@ assembly call. In particular, it can happen if you forgot the closing bracket of a register constraint (see issue #51430): ```compile_fail,E0668 -#![feature(asm)] +#![feature(llvm_asm)] fn main() { let rax: u64; unsafe { - asm!("" :"={rax"(rax)); + llvm_asm!("" :"={rax"(rax)); println!("Accumulator is: {}", rax); } } diff --git a/src/librustc_hir/arena.rs b/src/librustc_hir/arena.rs index 978565a4c39d7..b8a691dd9813e 100644 --- a/src/librustc_hir/arena.rs +++ b/src/librustc_hir/arena.rs @@ -28,7 +28,7 @@ macro_rules! arena_types { [] fn_decl: rustc_hir::FnDecl<$tcx>, [] foreign_item: rustc_hir::ForeignItem<$tcx>, [] impl_item_ref: rustc_hir::ImplItemRef<$tcx>, - [] inline_asm: rustc_hir::InlineAsm<$tcx>, + [] inline_asm: rustc_hir::LlvmInlineAsm<$tcx>, [] local: rustc_hir::Local<$tcx>, [few] macro_def: rustc_hir::MacroDef<$tcx>, [] param: rustc_hir::Param<$tcx>, diff --git a/src/librustc_hir/hir.rs b/src/librustc_hir/hir.rs index 2054759933f3c..b719d576d6f67 100644 --- a/src/librustc_hir/hir.rs +++ b/src/librustc_hir/hir.rs @@ -3,7 +3,7 @@ use crate::def_id::DefId; crate use crate::hir_id::HirId; use crate::itemlikevisit; -use rustc_ast::ast::{self, AsmDialect, CrateSugar, Ident, Name}; +use rustc_ast::ast::{self, CrateSugar, Ident, LlvmAsmDialect, Name}; use rustc_ast::ast::{AttrVec, Attribute, FloatTy, IntTy, Label, LitKind, StrStyle, UintTy}; pub use rustc_ast::ast::{BorrowKind, ImplPolarity, IsAuto}; pub use rustc_ast::ast::{CaptureBy, Movability, Mutability}; @@ -1344,7 +1344,7 @@ impl Expr<'_> { ExprKind::Break(..) => ExprPrecedence::Break, ExprKind::Continue(..) => ExprPrecedence::Continue, ExprKind::Ret(..) => ExprPrecedence::Ret, - ExprKind::InlineAsm(..) => ExprPrecedence::InlineAsm, + ExprKind::LlvmInlineAsm(..) => ExprPrecedence::InlineAsm, ExprKind::Struct(..) => ExprPrecedence::Struct, ExprKind::Repeat(..) => ExprPrecedence::Repeat, ExprKind::Yield(..) => ExprPrecedence::Yield, @@ -1399,7 +1399,7 @@ impl Expr<'_> { | ExprKind::Ret(..) | ExprKind::Loop(..) | ExprKind::Assign(..) - | ExprKind::InlineAsm(..) + | ExprKind::LlvmInlineAsm(..) | ExprKind::AssignOp(..) | ExprKind::Lit(_) | ExprKind::Unary(..) @@ -1575,8 +1575,8 @@ pub enum ExprKind<'hir> { /// A `return`, with an optional value to be returned. Ret(Option<&'hir Expr<'hir>>), - /// Inline assembly (from `asm!`), with its outputs and inputs. - InlineAsm(&'hir InlineAsm<'hir>), + /// Inline assembly (from `llvm_asm!`), with its outputs and inputs. + LlvmInlineAsm(&'hir LlvmInlineAsm<'hir>), /// A struct or struct-like variant literal expression. /// @@ -1999,7 +1999,7 @@ pub enum TyKind<'hir> { } #[derive(Copy, Clone, RustcEncodable, RustcDecodable, Debug, HashStable_Generic, PartialEq)] -pub struct InlineAsmOutput { +pub struct LlvmInlineAsmOutput { pub constraint: Symbol, pub is_rw: bool, pub is_indirect: bool, @@ -2009,20 +2009,20 @@ pub struct InlineAsmOutput { // NOTE(eddyb) This is used within MIR as well, so unlike the rest of the HIR, // it needs to be `Clone` and use plain `Vec` instead of arena-allocated slice. #[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable_Generic, PartialEq)] -pub struct InlineAsmInner { +pub struct LlvmInlineAsmInner { pub asm: Symbol, pub asm_str_style: StrStyle, - pub outputs: Vec, + pub outputs: Vec, pub inputs: Vec, pub clobbers: Vec, pub volatile: bool, pub alignstack: bool, - pub dialect: AsmDialect, + pub dialect: LlvmAsmDialect, } #[derive(RustcEncodable, RustcDecodable, Debug, HashStable_Generic)] -pub struct InlineAsm<'hir> { - pub inner: InlineAsmInner, +pub struct LlvmInlineAsm<'hir> { + pub inner: LlvmInlineAsmInner, pub outputs_exprs: &'hir [Expr<'hir>], pub inputs_exprs: &'hir [Expr<'hir>], } diff --git a/src/librustc_hir/intravisit.rs b/src/librustc_hir/intravisit.rs index 08b4ef1b918e1..5a763e4161b1e 100644 --- a/src/librustc_hir/intravisit.rs +++ b/src/librustc_hir/intravisit.rs @@ -1156,7 +1156,7 @@ pub fn walk_expr<'v, V: Visitor<'v>>(visitor: &mut V, expression: &'v Expr<'v>) ExprKind::Ret(ref optional_expression) => { walk_list!(visitor, visit_expr, optional_expression); } - ExprKind::InlineAsm(ref asm) => { + ExprKind::LlvmInlineAsm(ref asm) => { walk_list!(visitor, visit_expr, asm.outputs_exprs); walk_list!(visitor, visit_expr, asm.inputs_exprs); } diff --git a/src/librustc_hir_pretty/lib.rs b/src/librustc_hir_pretty/lib.rs index 88b1288848f4f..f30af78659f3b 100644 --- a/src/librustc_hir_pretty/lib.rs +++ b/src/librustc_hir_pretty/lib.rs @@ -1407,9 +1407,9 @@ impl<'a> State<'a> { self.print_expr_maybe_paren(&expr, parser::PREC_JUMP); } } - hir::ExprKind::InlineAsm(ref a) => { + hir::ExprKind::LlvmInlineAsm(ref a) => { let i = &a.inner; - self.s.word("asm!"); + self.s.word("llvm_asm!"); self.popen(); self.print_string(&i.asm.as_str(), i.asm_str_style); self.word_space(":"); @@ -1454,7 +1454,7 @@ impl<'a> State<'a> { if i.alignstack { options.push("alignstack"); } - if i.dialect == ast::AsmDialect::Intel { + if i.dialect == ast::LlvmAsmDialect::Intel { options.push("intel"); } diff --git a/src/librustc_mir/borrow_check/invalidation.rs b/src/librustc_mir/borrow_check/invalidation.rs index d33639aa9d9a0..3d1768cf0e596 100644 --- a/src/librustc_mir/borrow_check/invalidation.rs +++ b/src/librustc_mir/borrow_check/invalidation.rs @@ -68,7 +68,7 @@ impl<'cx, 'tcx> Visitor<'tcx> for InvalidationGenerator<'cx, 'tcx> { StatementKind::SetDiscriminant { ref place, variant_index: _ } => { self.mutate_place(location, place, Shallow(None), JustWrite); } - StatementKind::InlineAsm(ref asm) => { + StatementKind::LlvmInlineAsm(ref asm) => { for (o, output) in asm.asm.outputs.iter().zip(asm.outputs.iter()) { if o.is_indirect { // FIXME(eddyb) indirect inline asm outputs should diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs index 882c6bd0333ee..e3dc9e0f10503 100644 --- a/src/librustc_mir/borrow_check/mod.rs +++ b/src/librustc_mir/borrow_check/mod.rs @@ -550,7 +550,7 @@ impl<'cx, 'tcx> dataflow::ResultsVisitor<'cx, 'tcx> for MirBorrowckCtxt<'cx, 'tc StatementKind::SetDiscriminant { ref place, variant_index: _ } => { self.mutate_place(location, (place, span), Shallow(None), JustWrite, flow_state); } - StatementKind::InlineAsm(ref asm) => { + StatementKind::LlvmInlineAsm(ref asm) => { for (o, output) in asm.asm.outputs.iter().zip(asm.outputs.iter()) { if o.is_indirect { // FIXME(eddyb) indirect inline asm outputs should diff --git a/src/librustc_mir/borrow_check/type_check/mod.rs b/src/librustc_mir/borrow_check/type_check/mod.rs index 02f6bcade23a2..54ca0c6a2603a 100644 --- a/src/librustc_mir/borrow_check/type_check/mod.rs +++ b/src/librustc_mir/borrow_check/type_check/mod.rs @@ -1529,7 +1529,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> { StatementKind::FakeRead(..) | StatementKind::StorageLive(..) | StatementKind::StorageDead(..) - | StatementKind::InlineAsm { .. } + | StatementKind::LlvmInlineAsm { .. } | StatementKind::Retag { .. } | StatementKind::Nop => {} } diff --git a/src/librustc_mir/dataflow/impls/borrows.rs b/src/librustc_mir/dataflow/impls/borrows.rs index 9e9e414ad648b..d25d3a9bfc176 100644 --- a/src/librustc_mir/dataflow/impls/borrows.rs +++ b/src/librustc_mir/dataflow/impls/borrows.rs @@ -289,7 +289,7 @@ impl<'tcx> dataflow::GenKillAnalysis<'tcx> for Borrows<'_, 'tcx> { self.kill_borrows_on_place(trans, &Place::from(local)); } - mir::StatementKind::InlineAsm(ref asm) => { + mir::StatementKind::LlvmInlineAsm(ref asm) => { for (output, kind) in asm.outputs.iter().zip(&asm.asm.outputs) { if !kind.is_indirect && !kind.is_rw { self.kill_borrows_on_place(trans, output); diff --git a/src/librustc_mir/dataflow/impls/storage_liveness.rs b/src/librustc_mir/dataflow/impls/storage_liveness.rs index f8d1efabd33c0..67d024e62d913 100644 --- a/src/librustc_mir/dataflow/impls/storage_liveness.rs +++ b/src/librustc_mir/dataflow/impls/storage_liveness.rs @@ -124,7 +124,7 @@ impl<'mir, 'tcx> dataflow::GenKillAnalysis<'tcx> for MaybeRequiresStorage<'mir, | StatementKind::SetDiscriminant { box place, .. } => { trans.gen(place.local); } - StatementKind::InlineAsm(asm) => { + StatementKind::LlvmInlineAsm(asm) => { for place in &*asm.outputs { trans.gen(place.local); } diff --git a/src/librustc_mir/dataflow/move_paths/builder.rs b/src/librustc_mir/dataflow/move_paths/builder.rs index 276aabec13da0..8061765f66d90 100644 --- a/src/librustc_mir/dataflow/move_paths/builder.rs +++ b/src/librustc_mir/dataflow/move_paths/builder.rs @@ -295,7 +295,7 @@ impl<'b, 'a, 'tcx> Gatherer<'b, 'a, 'tcx> { StatementKind::FakeRead(_, ref place) => { self.create_move_path(place); } - StatementKind::InlineAsm(ref asm) => { + StatementKind::LlvmInlineAsm(ref asm) => { for (output, kind) in asm.outputs.iter().zip(&asm.asm.outputs) { if !kind.is_indirect { self.gather_init(output.as_ref(), InitKind::Deep); diff --git a/src/librustc_mir/interpret/step.rs b/src/librustc_mir/interpret/step.rs index 6ec11d42f52d2..01446c15ff691 100644 --- a/src/librustc_mir/interpret/step.rs +++ b/src/librustc_mir/interpret/step.rs @@ -124,7 +124,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { // size of MIR constantly. Nop => {} - InlineAsm { .. } => throw_unsup_format!("inline assembly is not supported"), + LlvmInlineAsm { .. } => throw_unsup_format!("inline assembly is not supported"), } self.stack[frame_idx].stmt += 1; diff --git a/src/librustc_mir/transform/check_consts/validation.rs b/src/librustc_mir/transform/check_consts/validation.rs index 7f4714e9f9c19..c315a8a65dfe6 100644 --- a/src/librustc_mir/transform/check_consts/validation.rs +++ b/src/librustc_mir/transform/check_consts/validation.rs @@ -488,7 +488,7 @@ impl Visitor<'tcx> for Validator<'_, 'mir, 'tcx> { StatementKind::FakeRead(..) | StatementKind::StorageLive(_) | StatementKind::StorageDead(_) - | StatementKind::InlineAsm { .. } + | StatementKind::LlvmInlineAsm { .. } | StatementKind::Retag { .. } | StatementKind::AscribeUserType(..) | StatementKind::Nop => {} diff --git a/src/librustc_mir/transform/check_unsafety.rs b/src/librustc_mir/transform/check_unsafety.rs index 3ba60e69041e7..7d5f286072869 100644 --- a/src/librustc_mir/transform/check_unsafety.rs +++ b/src/librustc_mir/transform/check_unsafety.rs @@ -106,7 +106,7 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> { // safe (at least as emitted during MIR construction) } - StatementKind::InlineAsm { .. } => self.require_unsafe( + StatementKind::LlvmInlineAsm { .. } => self.require_unsafe( "use of inline assembly", "inline assembly is entirely unchecked and can cause undefined behavior", UnsafetyViolationKind::General, diff --git a/src/librustc_mir/transform/qualify_min_const_fn.rs b/src/librustc_mir/transform/qualify_min_const_fn.rs index 5a99ee27301ad..b2d21d7a84bef 100644 --- a/src/librustc_mir/transform/qualify_min_const_fn.rs +++ b/src/librustc_mir/transform/qualify_min_const_fn.rs @@ -230,7 +230,7 @@ fn check_statement( // just an assignment StatementKind::SetDiscriminant { place, .. } => check_place(tcx, place, span, def_id, body), - StatementKind::InlineAsm { .. } => { + StatementKind::LlvmInlineAsm { .. } => { Err((span, "cannot use inline assembly in const fn".into())) } diff --git a/src/librustc_mir/transform/remove_noop_landing_pads.rs b/src/librustc_mir/transform/remove_noop_landing_pads.rs index 7ac9eccf46f56..91f8b7b1c858d 100644 --- a/src/librustc_mir/transform/remove_noop_landing_pads.rs +++ b/src/librustc_mir/transform/remove_noop_landing_pads.rs @@ -52,7 +52,7 @@ impl RemoveNoopLandingPads { StatementKind::Assign { .. } | StatementKind::SetDiscriminant { .. } - | StatementKind::InlineAsm { .. } + | StatementKind::LlvmInlineAsm { .. } | StatementKind::Retag { .. } => { return false; } diff --git a/src/librustc_mir/transform/simplify_try.rs b/src/librustc_mir/transform/simplify_try.rs index 3f28f033047a2..1c5f6762c6874 100644 --- a/src/librustc_mir/transform/simplify_try.rs +++ b/src/librustc_mir/transform/simplify_try.rs @@ -172,7 +172,7 @@ impl<'tcx> MirPass<'tcx> for SimplifyBranchSame { // so we cannot assume that the `unreachable` terminator itself is reachable. // FIXME(Centril): use a normalization pass instead of a check. || bb.statements.iter().any(|stmt| match stmt.kind { - StatementKind::InlineAsm(..) => true, + StatementKind::LlvmInlineAsm(..) => true, _ => false, }) }) diff --git a/src/librustc_mir/transform/unreachable_prop.rs b/src/librustc_mir/transform/unreachable_prop.rs index 27173e0c171b7..c5c84acb6b237 100644 --- a/src/librustc_mir/transform/unreachable_prop.rs +++ b/src/librustc_mir/transform/unreachable_prop.rs @@ -29,7 +29,7 @@ impl MirPass<'_> for UnreachablePropagation { // Accompanying testcases: mir-opt/unreachable_asm.rs and mir-opt/unreachable_asm_2.rs let asm_stmt_in_block = || { bb_data.statements.iter().any(|stmt: &Statement<'_>| match stmt.kind { - StatementKind::InlineAsm(..) => true, + StatementKind::LlvmInlineAsm(..) => true, _ => false, }) }; diff --git a/src/librustc_mir_build/build/expr/as_place.rs b/src/librustc_mir_build/build/expr/as_place.rs index d77cc49c94f67..8fa7bc7699030 100644 --- a/src/librustc_mir_build/build/expr/as_place.rs +++ b/src/librustc_mir_build/build/expr/as_place.rs @@ -255,7 +255,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { | ExprKind::Return { .. } | ExprKind::Literal { .. } | ExprKind::StaticRef { .. } - | ExprKind::InlineAsm { .. } + | ExprKind::LlvmInlineAsm { .. } | ExprKind::Yield { .. } | ExprKind::Call { .. } => { // these are not places, so we need to make a temporary. diff --git a/src/librustc_mir_build/build/expr/as_rvalue.rs b/src/librustc_mir_build/build/expr/as_rvalue.rs index dc97f321a36ad..4c7ff504722c5 100644 --- a/src/librustc_mir_build/build/expr/as_rvalue.rs +++ b/src/librustc_mir_build/build/expr/as_rvalue.rs @@ -251,7 +251,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { | ExprKind::Break { .. } | ExprKind::Continue { .. } | ExprKind::Return { .. } - | ExprKind::InlineAsm { .. } + | ExprKind::LlvmInlineAsm { .. } | ExprKind::PlaceTypeAscription { .. } | ExprKind::ValueTypeAscription { .. } => { // these do not have corresponding `Rvalue` variants, diff --git a/src/librustc_mir_build/build/expr/category.rs b/src/librustc_mir_build/build/expr/category.rs index cc139dee63f92..f8cae205453c3 100644 --- a/src/librustc_mir_build/build/expr/category.rs +++ b/src/librustc_mir_build/build/expr/category.rs @@ -64,7 +64,7 @@ impl Category { | ExprKind::Repeat { .. } | ExprKind::Assign { .. } | ExprKind::AssignOp { .. } - | ExprKind::InlineAsm { .. } => Some(Category::Rvalue(RvalueFunc::AsRvalue)), + | ExprKind::LlvmInlineAsm { .. } => Some(Category::Rvalue(RvalueFunc::AsRvalue)), ExprKind::Literal { .. } | ExprKind::StaticRef { .. } => Some(Category::Constant), diff --git a/src/librustc_mir_build/build/expr/into.rs b/src/librustc_mir_build/build/expr/into.rs index 4583e244f493d..62158d3b93124 100644 --- a/src/librustc_mir_build/build/expr/into.rs +++ b/src/librustc_mir_build/build/expr/into.rs @@ -328,7 +328,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { | ExprKind::AssignOp { .. } | ExprKind::Continue { .. } | ExprKind::Break { .. } - | ExprKind::InlineAsm { .. } + | ExprKind::LlvmInlineAsm { .. } | ExprKind::Return { .. } => { unpack!(block = this.stmt_expr(block, expr, None)); this.cfg.push_assign_unit(block, source_info, destination); diff --git a/src/librustc_mir_build/build/expr/stmt.rs b/src/librustc_mir_build/build/expr/stmt.rs index 882c5e85bb0ac..1dc530a7bc886 100644 --- a/src/librustc_mir_build/build/expr/stmt.rs +++ b/src/librustc_mir_build/build/expr/stmt.rs @@ -96,8 +96,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { ExprKind::Return { value } => { this.break_scope(block, value, BreakableTarget::Return, source_info) } - ExprKind::InlineAsm { asm, outputs, inputs } => { - debug!("stmt_expr InlineAsm block_context.push(SubExpr) : {:?}", expr2); + ExprKind::LlvmInlineAsm { asm, outputs, inputs } => { + debug!("stmt_expr LlvmInlineAsm block_context.push(SubExpr) : {:?}", expr2); this.block_context.push(BlockFrame::SubExpr); let outputs = outputs .into_iter() @@ -115,7 +115,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { block, Statement { source_info, - kind: StatementKind::InlineAsm(box InlineAsm { + kind: StatementKind::LlvmInlineAsm(box LlvmInlineAsm { asm: asm.clone(), outputs, inputs, diff --git a/src/librustc_mir_build/hair/cx/expr.rs b/src/librustc_mir_build/hair/cx/expr.rs index 9f93b817e38d8..ba17e2a75aaf3 100644 --- a/src/librustc_mir_build/hair/cx/expr.rs +++ b/src/librustc_mir_build/hair/cx/expr.rs @@ -398,7 +398,7 @@ fn make_mirror_unadjusted<'a, 'tcx>( convert_path_expr(cx, expr, res) } - hir::ExprKind::InlineAsm(ref asm) => ExprKind::InlineAsm { + hir::ExprKind::LlvmInlineAsm(ref asm) => ExprKind::LlvmInlineAsm { asm: &asm.inner, outputs: asm.outputs_exprs.to_ref(), inputs: asm.inputs_exprs.to_ref(), diff --git a/src/librustc_mir_build/hair/mod.rs b/src/librustc_mir_build/hair/mod.rs index 77042240acf32..ed60c79903d6a 100644 --- a/src/librustc_mir_build/hair/mod.rs +++ b/src/librustc_mir_build/hair/mod.rs @@ -277,8 +277,8 @@ crate enum ExprKind<'tcx> { literal: &'tcx Const<'tcx>, def_id: DefId, }, - InlineAsm { - asm: &'tcx hir::InlineAsmInner, + LlvmInlineAsm { + asm: &'tcx hir::LlvmInlineAsmInner, outputs: Vec>, inputs: Vec>, }, diff --git a/src/librustc_passes/liveness.rs b/src/librustc_passes/liveness.rs index e729c2d517fea..5df15a614e82a 100644 --- a/src/librustc_passes/liveness.rs +++ b/src/librustc_passes/liveness.rs @@ -532,7 +532,7 @@ fn visit_expr<'tcx>(ir: &mut IrMaps<'tcx>, expr: &'tcx Expr<'tcx>) { | hir::ExprKind::AssignOp(..) | hir::ExprKind::Struct(..) | hir::ExprKind::Repeat(..) - | hir::ExprKind::InlineAsm(..) + | hir::ExprKind::LlvmInlineAsm(..) | hir::ExprKind::Box(..) | hir::ExprKind::Yield(..) | hir::ExprKind::Type(..) @@ -1177,7 +1177,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { | hir::ExprKind::Yield(ref e, _) | hir::ExprKind::Repeat(ref e, _) => self.propagate_through_expr(&e, succ), - hir::ExprKind::InlineAsm(ref asm) => { + hir::ExprKind::LlvmInlineAsm(ref asm) => { let ia = &asm.inner; let outputs = asm.outputs_exprs; let inputs = asm.inputs_exprs; @@ -1398,7 +1398,7 @@ fn check_expr<'tcx>(this: &mut Liveness<'_, 'tcx>, expr: &'tcx Expr<'tcx>) { } } - hir::ExprKind::InlineAsm(ref asm) => { + hir::ExprKind::LlvmInlineAsm(ref asm) => { for input in asm.inputs_exprs { this.visit_expr(input); } diff --git a/src/librustc_span/symbol.rs b/src/librustc_span/symbol.rs index bb41629ef094d..54b404e1161b9 100644 --- a/src/librustc_span/symbol.rs +++ b/src/librustc_span/symbol.rs @@ -424,6 +424,7 @@ symbols! { LintPass, lint_reasons, literal, + llvm_asm, local_inner_macros, log_syntax, loop_break_value, diff --git a/src/librustc_typeck/check/expr.rs b/src/librustc_typeck/check/expr.rs index 53a20d9e86788..8cd6f7b8c88a8 100644 --- a/src/librustc_typeck/check/expr.rs +++ b/src/librustc_typeck/check/expr.rs @@ -230,7 +230,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { self.check_expr_addr_of(kind, mutbl, oprnd, expected, expr) } ExprKind::Path(ref qpath) => self.check_expr_path(qpath, expr), - ExprKind::InlineAsm(ref asm) => { + ExprKind::LlvmInlineAsm(ref asm) => { for expr in asm.outputs_exprs.iter().chain(asm.inputs_exprs.iter()) { self.check_expr(expr); } diff --git a/src/librustc_typeck/expr_use_visitor.rs b/src/librustc_typeck/expr_use_visitor.rs index a45d8ce6823a3..4eb6a6bda02eb 100644 --- a/src/librustc_typeck/expr_use_visitor.rs +++ b/src/librustc_typeck/expr_use_visitor.rs @@ -220,7 +220,7 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> { self.borrow_expr(&base, bk); } - hir::ExprKind::InlineAsm(ref ia) => { + hir::ExprKind::LlvmInlineAsm(ref ia) => { for (o, output) in ia.inner.outputs.iter().zip(ia.outputs_exprs) { if o.is_indirect { self.consume_expr(output); diff --git a/src/librustc_typeck/mem_categorization.rs b/src/librustc_typeck/mem_categorization.rs index 7d8bf71cf97b7..e76c67794e754 100644 --- a/src/librustc_typeck/mem_categorization.rs +++ b/src/librustc_typeck/mem_categorization.rs @@ -405,7 +405,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> { | hir::ExprKind::Continue(..) | hir::ExprKind::Struct(..) | hir::ExprKind::Repeat(..) - | hir::ExprKind::InlineAsm(..) + | hir::ExprKind::LlvmInlineAsm(..) | hir::ExprKind::Box(..) | hir::ExprKind::Err => Ok(self.cat_rvalue(expr.hir_id, expr.span, expr_ty)), } diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index d41105270549e..09bc183cf20da 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -274,6 +274,7 @@ #![feature(libc)] #![feature(link_args)] #![feature(linkage)] +#![feature(llvm_asm)] #![feature(log_syntax)] #![feature(maybe_uninit_ref)] #![feature(maybe_uninit_slice)] @@ -533,29 +534,9 @@ pub use core::{ // Re-export built-in macros defined through libcore. #[stable(feature = "builtin_macro_prelude", since = "1.38.0")] pub use core::{ - // Unstable - asm, - // Stable - assert, - cfg, - column, - compile_error, - concat, - concat_idents, - env, - file, - format_args, - format_args_nl, - global_asm, - include, - include_bytes, - include_str, - line, - log_syntax, - module_path, - option_env, - stringify, - trace_macros, + asm, assert, cfg, column, compile_error, concat, concat_idents, env, file, format_args, + format_args_nl, global_asm, include, include_bytes, include_str, line, llvm_asm, log_syntax, + module_path, option_env, stringify, trace_macros, }; #[stable(feature = "core_primitive", since = "1.43.0")] diff --git a/src/libstd/prelude/v1.rs b/src/libstd/prelude/v1.rs index 6712f5ba5808c..03686d789d721 100644 --- a/src/libstd/prelude/v1.rs +++ b/src/libstd/prelude/v1.rs @@ -39,8 +39,8 @@ pub use crate::result::Result::{self, Err, Ok}; #[doc(no_inline)] pub use core::prelude::v1::{ asm, assert, cfg, column, compile_error, concat, concat_idents, env, file, format_args, - format_args_nl, global_asm, include, include_bytes, include_str, line, log_syntax, module_path, - option_env, stringify, trace_macros, + format_args_nl, global_asm, include, include_bytes, include_str, line, llvm_asm, log_syntax, + module_path, option_env, stringify, trace_macros, }; // FIXME: Attribute and derive macros are not documented because for them rustdoc generates diff --git a/src/libstd/sys/sgx/abi/mem.rs b/src/libstd/sys/sgx/abi/mem.rs index 500e62b1cb59d..57fd7efdd49e6 100644 --- a/src/libstd/sys/sgx/abi/mem.rs +++ b/src/libstd/sys/sgx/abi/mem.rs @@ -22,7 +22,7 @@ extern "C" { #[unstable(feature = "sgx_platform", issue = "56975")] pub fn image_base() -> u64 { let base; - unsafe { asm!("lea IMAGE_BASE(%rip),$0":"=r"(base)) }; + unsafe { llvm_asm!("lea IMAGE_BASE(%rip),$0":"=r"(base)) }; base } diff --git a/src/libstd/sys/sgx/ext/arch.rs b/src/libstd/sys/sgx/ext/arch.rs index 5056e388112ce..0c97a87e2e445 100644 --- a/src/libstd/sys/sgx/ext/arch.rs +++ b/src/libstd/sys/sgx/ext/arch.rs @@ -31,7 +31,7 @@ pub fn egetkey(request: &Align512<[u8; 512]>) -> Result, u32> let mut out = MaybeUninit::uninit(); let error; - asm!( + llvm_asm!( "enclu" : "={eax}"(error) : "{eax}"(ENCLU_EGETKEY), @@ -60,7 +60,7 @@ pub fn ereport( unsafe { let mut report = MaybeUninit::uninit(); - asm!( + llvm_asm!( "enclu" : /* no output registers */ : "{eax}"(ENCLU_EREPORT), diff --git a/src/libstd/sys/windows/mod.rs b/src/libstd/sys/windows/mod.rs index b004cd19020f8..74dd41fd50147 100644 --- a/src/libstd/sys/windows/mod.rs +++ b/src/libstd/sys/windows/mod.rs @@ -267,7 +267,7 @@ pub fn dur2timeout(dur: Duration) -> c::DWORD { pub unsafe fn abort_internal() -> ! { #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] { - asm!("int $$0x29" :: "{ecx}"(7) ::: volatile); // 7 is FAST_FAIL_FATAL_APP_EXIT + llvm_asm!("int $$0x29" :: "{ecx}"(7) ::: volatile); // 7 is FAST_FAIL_FATAL_APP_EXIT crate::intrinsics::unreachable(); } crate::intrinsics::abort(); diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index 55f9df9caafb2..933b647071f79 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -20,7 +20,6 @@ #![crate_name = "test"] #![unstable(feature = "test", issue = "50297")] #![doc(html_root_url = "https://doc.rust-lang.org/nightly/", test(attr(deny(warnings))))] -#![feature(asm)] #![cfg_attr(any(unix, target_os = "cloudabi"), feature(libc))] #![feature(rustc_private)] #![feature(nll)] diff --git a/src/test/codegen/no-output-asm-is-volatile.rs b/src/test/codegen/no-output-asm-is-volatile.rs index 47b38d2941742..40376218908d1 100644 --- a/src/test/codegen/no-output-asm-is-volatile.rs +++ b/src/test/codegen/no-output-asm-is-volatile.rs @@ -1,6 +1,6 @@ // compile-flags: -O -#![feature(asm)] +#![feature(llvm_asm)] #![crate_type = "lib"] // Check that inline assembly expressions without any outputs @@ -9,6 +9,6 @@ // CHECK-LABEL: @assembly #[no_mangle] pub fn assembly() { - unsafe { asm!("") } + unsafe { llvm_asm!("") } // CHECK: tail call void asm sideeffect "", {{.*}} } diff --git a/src/test/compile-fail/asm-src-loc-codegen-units.rs b/src/test/compile-fail/asm-src-loc-codegen-units.rs index 798eb32181ce7..c9415aed930d5 100644 --- a/src/test/compile-fail/asm-src-loc-codegen-units.rs +++ b/src/test/compile-fail/asm-src-loc-codegen-units.rs @@ -3,10 +3,10 @@ // compile-flags: -C codegen-units=2 // ignore-emscripten -#![feature(asm)] +#![feature(llvm_asm)] fn main() { unsafe { - asm!("nowayisthisavalidinstruction"); //~ ERROR instruction + llvm_asm!("nowayisthisavalidinstruction"); //~ ERROR instruction } } diff --git a/src/test/compile-fail/asm-src-loc.rs b/src/test/compile-fail/asm-src-loc.rs index 0b60256e7fd09..7c87f370d4f68 100644 --- a/src/test/compile-fail/asm-src-loc.rs +++ b/src/test/compile-fail/asm-src-loc.rs @@ -1,9 +1,9 @@ // ignore-emscripten -#![feature(asm)] +#![feature(llvm_asm)] fn main() { unsafe { - asm!("nowayisthisavalidinstruction"); //~ ERROR instruction + llvm_asm!("nowayisthisavalidinstruction"); //~ ERROR instruction } } diff --git a/src/test/incremental/hashes/inline_asm.rs b/src/test/incremental/hashes/inline_asm.rs index fb3c6378f74ab..3eaffc440615f 100644 --- a/src/test/incremental/hashes/inline_asm.rs +++ b/src/test/incremental/hashes/inline_asm.rs @@ -11,7 +11,7 @@ #![allow(warnings)] #![feature(rustc_attrs)] -#![feature(asm)] +#![feature(llvm_asm)] #![crate_type="rlib"] @@ -22,12 +22,12 @@ pub fn change_template(a: i32) -> i32 { let c: i32; unsafe { - asm!("add 1, $0" - : "=r"(c) - : "0"(a) - : - : - ); + llvm_asm!("add 1, $0" + : "=r"(c) + : "0"(a) + : + : + ); } c } @@ -39,12 +39,12 @@ pub fn change_template(a: i32) -> i32 { pub fn change_template(a: i32) -> i32 { let c: i32; unsafe { - asm!("add 2, $0" - : "=r"(c) - : "0"(a) - : - : - ); + llvm_asm!("add 2, $0" + : "=r"(c) + : "0"(a) + : + : + ); } c } @@ -58,12 +58,12 @@ pub fn change_output(a: i32) -> i32 { let mut _out1: i32 = 0; let mut _out2: i32 = 0; unsafe { - asm!("add 1, $0" - : "=r"(_out1) - : "0"(a) - : - : - ); + llvm_asm!("add 1, $0" + : "=r"(_out1) + : "0"(a) + : + : + ); } _out1 } @@ -76,12 +76,12 @@ pub fn change_output(a: i32) -> i32 { let mut _out1: i32 = 0; let mut _out2: i32 = 0; unsafe { - asm!("add 1, $0" - : "=r"(_out2) - : "0"(a) - : - : - ); + llvm_asm!("add 1, $0" + : "=r"(_out2) + : "0"(a) + : + : + ); } _out1 } @@ -94,12 +94,12 @@ pub fn change_output(a: i32) -> i32 { pub fn change_input(_a: i32, _b: i32) -> i32 { let _out; unsafe { - asm!("add 1, $0" - : "=r"(_out) - : "0"(_a) - : - : - ); + llvm_asm!("add 1, $0" + : "=r"(_out) + : "0"(_a) + : + : + ); } _out } @@ -111,12 +111,12 @@ pub fn change_input(_a: i32, _b: i32) -> i32 { pub fn change_input(_a: i32, _b: i32) -> i32 { let _out; unsafe { - asm!("add 1, $0" - : "=r"(_out) - : "0"(_b) - : - : - ); + llvm_asm!("add 1, $0" + : "=r"(_out) + : "0"(_b) + : + : + ); } _out } @@ -129,12 +129,12 @@ pub fn change_input(_a: i32, _b: i32) -> i32 { pub fn change_input_constraint(_a: i32, _b: i32) -> i32 { let _out; unsafe { - asm!("add 1, $0" - : "=r"(_out) - : "0"(_a), "r"(_b) - : - : - ); + llvm_asm!("add 1, $0" + : "=r"(_out) + : "0"(_a), "r"(_b) + : + : + ); } _out } @@ -146,12 +146,12 @@ pub fn change_input_constraint(_a: i32, _b: i32) -> i32 { pub fn change_input_constraint(_a: i32, _b: i32) -> i32 { let _out; unsafe { - asm!("add 1, $0" - : "=r"(_out) - : "r"(_a), "0"(_b) - : - : - ); + llvm_asm!("add 1, $0" + : "=r"(_out) + : "r"(_a), "0"(_b) + : + : + ); } _out } @@ -164,12 +164,12 @@ pub fn change_input_constraint(_a: i32, _b: i32) -> i32 { pub fn change_clobber(_a: i32) -> i32 { let _out; unsafe { - asm!("add 1, $0" - : "=r"(_out) - : "0"(_a) - : - : - ); + llvm_asm!("add 1, $0" + : "=r"(_out) + : "0"(_a) + : + : + ); } _out } @@ -181,12 +181,12 @@ pub fn change_clobber(_a: i32) -> i32 { pub fn change_clobber(_a: i32) -> i32 { let _out; unsafe { - asm!("add 1, $0" - : "=r"(_out) - : "0"(_a) - : "eax" - : - ); + llvm_asm!("add 1, $0" + : "=r"(_out) + : "0"(_a) + : "eax" + : + ); } _out } @@ -199,12 +199,12 @@ pub fn change_clobber(_a: i32) -> i32 { pub fn change_options(_a: i32) -> i32 { let _out; unsafe { - asm!("add 1, $0" - : "=r"(_out) - : "0"(_a) - : - : - ); + llvm_asm!("add 1, $0" + : "=r"(_out) + : "0"(_a) + : + : + ); } _out } @@ -216,12 +216,12 @@ pub fn change_options(_a: i32) -> i32 { pub fn change_options(_a: i32) -> i32 { let _out; unsafe { - asm!("add 1, $0" - : "=r"(_out) - : "0"(_a) - : - : "volatile" - ); + llvm_asm!("add 1, $0" + : "=r"(_out) + : "0"(_a) + : + : "volatile" + ); } _out } diff --git a/src/test/mir-opt/unreachable_asm.rs b/src/test/mir-opt/unreachable_asm.rs index ca614ac32b764..990141657f467 100644 --- a/src/test/mir-opt/unreachable_asm.rs +++ b/src/test/mir-opt/unreachable_asm.rs @@ -1,5 +1,5 @@ // ignore-tidy-linelength -#![feature(asm)] +#![feature(llvm_asm)] enum Empty {} @@ -18,7 +18,7 @@ fn main() { } // asm instruction stops unreachable propagation to if else blocks bb4 and bb5. - unsafe { asm!("NOP"); } + unsafe { llvm_asm!("NOP"); } match _x { } } } @@ -39,7 +39,7 @@ fn main() { // StorageDead(_6); // StorageDead(_5); // StorageLive(_7); -// asm!(InlineAsmInner { asm: "NOP", asm_str_style: Cooked, outputs: [], inputs: [], clobbers: [], volatile: true, alignstack: false, dialect: Att } : [] : []); +// llvm_asm!(LlvmInlineAsmInner { asm: "NOP", asm_str_style: Cooked, outputs: [], inputs: [], clobbers: [], volatile: true, alignstack: false, dialect: Att } : [] : []); // _7 = (); // StorageDead(_7); // StorageLive(_8); @@ -62,7 +62,7 @@ fn main() { // StorageDead(_6); // StorageDead(_5); // StorageLive(_7); -// asm!(InlineAsmInner { asm: "NOP", asm_str_style: Cooked, outputs: [], inputs: [], clobbers: [], volatile: true, alignstack: false, dialect: Att } : [] : []); +// llvm_asm!(LlvmInlineAsmInner { asm: "NOP", asm_str_style: Cooked, outputs: [], inputs: [], clobbers: [], volatile: true, alignstack: false, dialect: Att } : [] : []); // _7 = (); // StorageDead(_7); // StorageLive(_8); diff --git a/src/test/mir-opt/unreachable_asm_2.rs b/src/test/mir-opt/unreachable_asm_2.rs index 8fdbcfb5cab7f..0851e24d410e7 100644 --- a/src/test/mir-opt/unreachable_asm_2.rs +++ b/src/test/mir-opt/unreachable_asm_2.rs @@ -1,5 +1,5 @@ // ignore-tidy-linelength -#![feature(asm)] +#![feature(llvm_asm)] enum Empty {} @@ -13,11 +13,11 @@ fn main() { if true { // asm instruction stops unreachable propagation to block bb3. - unsafe { asm!("NOP"); } + unsafe { llvm_asm!("NOP"); } _y = 21; } else { // asm instruction stops unreachable propagation to block bb3. - unsafe { asm!("NOP"); } + unsafe { llvm_asm!("NOP"); } _y = 42; } @@ -33,7 +33,7 @@ fn main() { // } // bb4: { // StorageLive(_8); -// asm!(InlineAsmInner { asm: "NOP", asm_str_style: Cooked, outputs: [], inputs: [], clobbers: [], volatile: true, alignstack: false, dialect: Att } : [] : []); +// llvm_asm!(LlvmInlineAsmInner { asm: "NOP", asm_str_style: Cooked, outputs: [], inputs: [], clobbers: [], volatile: true, alignstack: false, dialect: Att } : [] : []); // _8 = (); // StorageDead(_8); // _4 = const 42i32; @@ -42,7 +42,7 @@ fn main() { // } // bb5: { // StorageLive(_7); -// asm!(InlineAsmInner { asm: "NOP", asm_str_style: Cooked, outputs: [], inputs: [], clobbers: [], volatile: true, alignstack: false, dialect: Att } : [] : []); +// llvm_asm!(LlvmInlineAsmInner { asm: "NOP", asm_str_style: Cooked, outputs: [], inputs: [], clobbers: [], volatile: true, alignstack: false, dialect: Att } : [] : []); // _7 = (); // StorageDead(_7); // _4 = const 21i32; @@ -64,7 +64,7 @@ fn main() { // } // bb4: { // StorageLive(_8); -// asm!(InlineAsmInner { asm: "NOP", asm_str_style: Cooked, outputs: [], inputs: [], clobbers: [], volatile: true, alignstack: false, dialect: Att } : [] : []); +// llvm_asm!(LlvmInlineAsmInner { asm: "NOP", asm_str_style: Cooked, outputs: [], inputs: [], clobbers: [], volatile: true, alignstack: false, dialect: Att } : [] : []); // _8 = (); // StorageDead(_8); // _4 = const 42i32; @@ -73,7 +73,7 @@ fn main() { // } // bb5: { // StorageLive(_7); -// asm!(InlineAsmInner { asm: "NOP", asm_str_style: Cooked, outputs: [], inputs: [], clobbers: [], volatile: true, alignstack: false, dialect: Att } : [] : []); +// llvm_asm!(LlvmInlineAsmInner { asm: "NOP", asm_str_style: Cooked, outputs: [], inputs: [], clobbers: [], volatile: true, alignstack: false, dialect: Att } : [] : []); // _7 = (); // StorageDead(_7); // _4 = const 21i32; diff --git a/src/test/pretty/asm-clobbers.rs b/src/test/pretty/asm-clobbers.rs index 1bc9f008bbbf9..2c09646e47e4a 100644 --- a/src/test/pretty/asm-clobbers.rs +++ b/src/test/pretty/asm-clobbers.rs @@ -1,3 +1,3 @@ -#![feature(asm)] +#![feature(llvm_asm)] -pub fn main() { unsafe { asm!("" : : : "hello", "world") }; } +pub fn main() { unsafe { llvm_asm!("" : : : "hello", "world") }; } diff --git a/src/test/pretty/asm-options.rs b/src/test/pretty/asm-options.rs index 5c2bbd9edd931..86a881bfbd18a 100644 --- a/src/test/pretty/asm-options.rs +++ b/src/test/pretty/asm-options.rs @@ -1,11 +1,11 @@ -#![feature(asm)] +#![feature(llvm_asm)] // pp-exact pub fn main() { unsafe { - asm!("" : : : : "volatile"); - asm!("" : : : : "alignstack"); - asm!("" : : : : "intel"); + 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 cb23124f2103f..41227898f24a8 100644 --- a/src/test/pretty/raw-str-nonexpr.rs +++ b/src/test/pretty/raw-str-nonexpr.rs @@ -1,8 +1,8 @@ // pp-exact -#![feature(asm)] +#![feature(llvm_asm)] #[cfg(foo = r#"just parse this"#)] extern crate blah as blah; -fn main() { unsafe { asm!(r###"blah"###); } } +fn main() { unsafe { llvm_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 936001c43a48f..2e81667cf39c6 100644 --- a/src/test/run-make-fulldeps/intrinsic-unreachable/exit-ret.rs +++ b/src/test/run-make-fulldeps/intrinsic-unreachable/exit-ret.rs @@ -1,11 +1,11 @@ -#![feature(asm)] +#![feature(llvm_asm)] #![crate_type="lib"] #[deny(unreachable_code)] pub fn exit(n: usize) -> i32 { unsafe { // Pretend this asm is an exit() syscall. - asm!("" :: "r"(n) :: "volatile"); + llvm_asm!("" :: "r"(n) :: "volatile"); // Can't actually reach this point, but rustc doesn't know that. } // This return value is just here to generate some extra code for a return 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 00b09cb9460b1..fb3848b0db617 100644 --- a/src/test/run-make-fulldeps/intrinsic-unreachable/exit-unreachable.rs +++ b/src/test/run-make-fulldeps/intrinsic-unreachable/exit-unreachable.rs @@ -1,4 +1,4 @@ -#![feature(asm, core_intrinsics)] +#![feature(llvm_asm, core_intrinsics)] #![crate_type="lib"] use std::intrinsics; @@ -7,7 +7,7 @@ use std::intrinsics; pub fn exit(n: usize) -> i32 { unsafe { // Pretend this asm is an exit() syscall. - asm!("" :: "r"(n) :: "volatile"); + llvm_asm!("" :: "r"(n) :: "volatile"); 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 0c7e2d906b7c1..fcdff59ffa984 100644 --- a/src/test/ui/abi/abi-sysv64-register-usage.rs +++ b/src/test/ui/abi/abi-sysv64-register-usage.rs @@ -6,7 +6,7 @@ // ignore-arm // ignore-aarch64 -#![feature(asm)] +#![feature(llvm_asm)] #[cfg(target_arch = "x86_64")] pub extern "sysv64" fn all_the_registers(rdi: i64, rsi: i64, rdx: i64, @@ -54,34 +54,34 @@ pub extern "sysv64" fn large_struct_by_val(mut foo: LargeStruct) -> LargeStruct pub fn main() { let result: i64; unsafe { - 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" + 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" ) } assert_eq!(result, 42); diff --git a/src/test/ui/asm-concat-src.rs b/src/test/ui/asm-concat-src.rs index c4160bfeca105..1dc1c859c6b0e 100644 --- a/src/test/ui/asm-concat-src.rs +++ b/src/test/ui/asm-concat-src.rs @@ -2,8 +2,8 @@ // pretty-expanded FIXME #23616 // ignore-emscripten no asm -#![feature(asm)] +#![feature(llvm_asm)] pub fn main() { - unsafe { asm!(concat!("", "")) }; + unsafe { llvm_asm!(concat!("", "")) }; } diff --git a/src/test/ui/asm-in-moved.rs b/src/test/ui/asm-in-moved.rs index 6525d2f53b099..35f4d92c8ffbc 100644 --- a/src/test/ui/asm-in-moved.rs +++ b/src/test/ui/asm-in-moved.rs @@ -1,6 +1,6 @@ // run-pass -#![feature(asm)] +#![feature(llvm_asm)] #![allow(dead_code)] use std::cell::Cell; @@ -20,7 +20,7 @@ fn main() { let _y: Box; let x = Box::new(NoisyDrop(&status)); unsafe { - asm!("mov $1, $0" : "=r"(_y) : "r"(x)); + llvm_asm!("mov $1, $0" : "=r"(_y) : "r"(x)); } assert_eq!(status.get(), "alive"); } diff --git a/src/test/ui/asm-in-out-operand.rs b/src/test/ui/asm-in-out-operand.rs index 13d0363a6a070..acefabd8a666e 100644 --- a/src/test/ui/asm-in-out-operand.rs +++ b/src/test/ui/asm-in-out-operand.rs @@ -1,21 +1,21 @@ // run-pass -#![feature(asm)] +#![feature(llvm_asm)] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] unsafe fn next_power_of_2(n: u32) -> u32 { let mut tmp = n; - asm!("dec $0" : "+rm"(tmp) :: "cc"); + llvm_asm!("dec $0" : "+rm"(tmp) :: "cc"); let mut shift = 1_u32; while shift <= 16 { - asm!( + llvm_asm!( "shr %cl, $2 or $2, $0 shl $$1, $1" : "+&rm"(tmp), "+{ecx}"(shift) : "r"(tmp) : "cc" ); } - asm!("inc $0" : "+rm"(tmp) :: "cc"); + llvm_asm!("inc $0" : "+rm"(tmp) :: "cc"); return tmp; } @@ -30,7 +30,7 @@ pub fn main() { let x: isize; unsafe { // Treat the output as initialization. - asm!( + llvm_asm!( "shl $2, $1 add $3, $1 mov $1, $0" @@ -47,7 +47,7 @@ pub fn main() { // Assignment to mutable. // Early clobber "&": // Forbids the use of a single register by both operands. - asm!("shr $$2, $1; add $1, $0" : "+&r"(x) : "r"(x) : "cc"); + llvm_asm!("shr $$2, $1; add $1, $0" : "+&r"(x) : "r"(x) : "cc"); } assert_eq!(x, 60); } diff --git a/src/test/ui/asm-indirect-memory.rs b/src/test/ui/asm-indirect-memory.rs index 2e8011af50295..556ad83a4ead8 100644 --- a/src/test/ui/asm-indirect-memory.rs +++ b/src/test/ui/asm-indirect-memory.rs @@ -1,12 +1,12 @@ // run-pass -#![feature(asm)] +#![feature(llvm_asm)] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] fn read(ptr: &u32) -> u32 { let out: u32; unsafe { - asm!("mov $1, $0" : "=r" (out) : "*m" (ptr)); + llvm_asm!("mov $1, $0" : "=r" (out) : "*m" (ptr)); } out } @@ -14,7 +14,7 @@ fn read(ptr: &u32) -> u32 { #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] fn write(ptr: &mut u32, val: u32) { unsafe { - asm!("mov $1, $0" : "=*m" (ptr) : "r" (val)); + llvm_asm!("mov $1, $0" : "=*m" (ptr) : "r" (val)); } } @@ -22,7 +22,7 @@ fn write(ptr: &mut u32, val: u32) { fn replace(ptr: &mut u32, val: u32) -> u32 { let out: u32; unsafe { - asm!("mov $0, $1; mov $2, $0" : "+*m" (ptr), "=&r" (out) : "r" (val)); + llvm_asm!("mov $0, $1; mov $2, $0" : "+*m" (ptr), "=&r" (out) : "r" (val)); } out } diff --git a/src/test/ui/asm-out-assign.rs b/src/test/ui/asm-out-assign.rs index ed63d1b4d492a..321f28565ff18 100644 --- a/src/test/ui/asm-out-assign.rs +++ b/src/test/ui/asm-out-assign.rs @@ -1,13 +1,13 @@ // run-pass -#![feature(asm)] +#![feature(llvm_asm)] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] pub fn main() { let x: isize; unsafe { // Treat the output as initialization. - asm!("mov $1, $0" : "=r"(x) : "r"(5_usize)); + llvm_asm!("mov $1, $0" : "=r"(x) : "r"(5_usize)); } assert_eq!(x, 5); @@ -16,7 +16,7 @@ pub fn main() { unsafe { // Assignment to mutable. - asm!("mov $1, $0" : "=r"(x) : "r"(x + 7)); + llvm_asm!("mov $1, $0" : "=r"(x) : "r"(x + 7)); } assert_eq!(x, 13); } diff --git a/src/test/ui/asm/asm-bad-clobber.rs b/src/test/ui/asm/asm-bad-clobber.rs index 8406a1cc7a824..9f5662cbd1e93 100644 --- a/src/test/ui/asm/asm-bad-clobber.rs +++ b/src/test/ui/asm/asm-bad-clobber.rs @@ -11,7 +11,7 @@ // ignore-mips // ignore-mips64 -#![feature(asm)] +#![feature(llvm_asm)] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] @@ -19,7 +19,7 @@ pub fn main() { unsafe { // clobber formatted as register input/output - asm!("xor %eax, %eax" : : : "{eax}"); + llvm_asm!("xor %eax, %eax" : : : "{eax}"); //~^ ERROR clobber should not be surrounded by braces } } diff --git a/src/test/ui/asm/asm-bad-clobber.stderr b/src/test/ui/asm/asm-bad-clobber.stderr index a279421241fac..8c5d04694c497 100644 --- a/src/test/ui/asm/asm-bad-clobber.stderr +++ b/src/test/ui/asm/asm-bad-clobber.stderr @@ -1,8 +1,8 @@ error[E0664]: clobber should not be surrounded by braces - --> $DIR/asm-bad-clobber.rs:22:37 + --> $DIR/asm-bad-clobber.rs:22:42 | -LL | asm!("xor %eax, %eax" : : : "{eax}"); - | ^^^^^^^ +LL | llvm_asm!("xor %eax, %eax" : : : "{eax}"); + | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/asm/asm-in-bad-modifier.rs b/src/test/ui/asm/asm-in-bad-modifier.rs index 38cd11e251586..b791ec3e8c8b1 100644 --- a/src/test/ui/asm/asm-in-bad-modifier.rs +++ b/src/test/ui/asm/asm-in-bad-modifier.rs @@ -8,7 +8,7 @@ // ignore-mips // ignore-mips64 -#![feature(asm)] +#![feature(llvm_asm)] fn foo(x: isize) { println!("{}", x); } @@ -20,8 +20,8 @@ pub fn main() { let x: isize; let y: isize; unsafe { - asm!("mov $1, $0" : "=r"(x) : "=r"(5)); //~ ERROR operand constraint contains '=' - asm!("mov $1, $0" : "=r"(y) : "+r"(5)); //~ ERROR operand constraint contains '+' + 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); diff --git a/src/test/ui/asm/asm-in-bad-modifier.stderr b/src/test/ui/asm/asm-in-bad-modifier.stderr index d45b3e57038cd..f1624f74a70ac 100644 --- a/src/test/ui/asm/asm-in-bad-modifier.stderr +++ b/src/test/ui/asm/asm-in-bad-modifier.stderr @@ -1,14 +1,14 @@ error[E0662]: input operand constraint contains '=' - --> $DIR/asm-in-bad-modifier.rs:23:39 + --> $DIR/asm-in-bad-modifier.rs:23:44 | -LL | asm!("mov $1, $0" : "=r"(x) : "=r"(5)); - | ^^^^ +LL | llvm_asm!("mov $1, $0" : "=r"(x) : "=r"(5)); + | ^^^^ error[E0663]: input operand constraint contains '+' - --> $DIR/asm-in-bad-modifier.rs:24:39 + --> $DIR/asm-in-bad-modifier.rs:24:44 | -LL | asm!("mov $1, $0" : "=r"(y) : "+r"(5)); - | ^^^^ +LL | llvm_asm!("mov $1, $0" : "=r"(y) : "+r"(5)); + | ^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/asm/asm-literal-escaping.rs b/src/test/ui/asm/asm-literal-escaping.rs index 8d464e752e637..5d45f5084c5ee 100644 --- a/src/test/ui/asm/asm-literal-escaping.rs +++ b/src/test/ui/asm/asm-literal-escaping.rs @@ -1,12 +1,12 @@ // build-pass // only-x86_64 -#![feature(asm)] +#![feature(llvm_asm)] fn main() { unsafe { // "nop" :: "r"(x) : "eax" : "volatile" let x = 10; - asm!("\x6Eop" :: "\x72"(x) : "\x65ax" : "\x76olatile"); + llvm_asm!("\x6Eop" :: "\x72"(x) : "\x65ax" : "\x76olatile"); } } diff --git a/src/test/ui/asm/asm-misplaced-option.rs b/src/test/ui/asm/asm-misplaced-option.rs index 14ff4c2e981b3..3c44fc90ef3f2 100644 --- a/src/test/ui/asm/asm-misplaced-option.rs +++ b/src/test/ui/asm/asm-misplaced-option.rs @@ -12,7 +12,7 @@ // ignore-mips // ignore-mips64 -#![feature(asm)] +#![feature(llvm_asm)] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] @@ -21,14 +21,14 @@ fn main() { let mut x: isize = 0; unsafe { // extra colon - asm!("mov $1, $0" : "=r"(x) : "r"(5_usize), "0"(x) : : "cc"); + 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 - asm!("add $2, $1; mov $1, $0" : "=r"(x) : "r"(x), "r"(8_usize) : "cc", "volatile"); + 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/asm/asm-misplaced-option.stderr b/src/test/ui/asm/asm-misplaced-option.stderr index 3d4b28c3dc444..ea9267c643b13 100644 --- a/src/test/ui/asm/asm-misplaced-option.stderr +++ b/src/test/ui/asm/asm-misplaced-option.stderr @@ -1,12 +1,12 @@ warning: unrecognized option - --> $DIR/asm-misplaced-option.rs:24:64 + --> $DIR/asm-misplaced-option.rs:24:69 | -LL | asm!("mov $1, $0" : "=r"(x) : "r"(5_usize), "0"(x) : : "cc"); - | ^^^^ +LL | llvm_asm!("mov $1, $0" : "=r"(x) : "r"(5_usize), "0"(x) : : "cc"); + | ^^^^ warning: expected a clobber, found an option - --> $DIR/asm-misplaced-option.rs:31:80 + --> $DIR/asm-misplaced-option.rs:31:85 | -LL | asm!("add $2, $1; mov $1, $0" : "=r"(x) : "r"(x), "r"(8_usize) : "cc", "volatile"); - | ^^^^^^^^^^ +LL | llvm_asm!("add $2, $1; mov $1, $0" : "=r"(x) : "r"(x), "r"(8_usize) : "cc", "volatile"); + | ^^^^^^^^^^ diff --git a/src/test/ui/asm/asm-out-assign-imm.rs b/src/test/ui/asm/asm-out-assign-imm.rs index 7a8be2a133ec7..1a46879f9f291 100644 --- a/src/test/ui/asm/asm-out-assign-imm.rs +++ b/src/test/ui/asm/asm-out-assign-imm.rs @@ -8,7 +8,7 @@ // ignore-mips // ignore-mips64 -#![feature(asm)] +#![feature(llvm_asm)] fn foo(x: isize) { println!("{}", x); } @@ -21,7 +21,7 @@ pub fn main() { x = 1; foo(x); unsafe { - asm!("mov $1, $0" : "=r"(x) : "r"(5)); + llvm_asm!("mov $1, $0" : "=r"(x) : "r"(5)); //~^ ERROR cannot assign twice to immutable variable `x` } foo(x); diff --git a/src/test/ui/asm/asm-out-assign-imm.stderr b/src/test/ui/asm/asm-out-assign-imm.stderr index ac38218b8492f..feec61b4fc6ef 100644 --- a/src/test/ui/asm/asm-out-assign-imm.stderr +++ b/src/test/ui/asm/asm-out-assign-imm.stderr @@ -1,13 +1,13 @@ error[E0384]: cannot assign twice to immutable variable `x` - --> $DIR/asm-out-assign-imm.rs:24:34 + --> $DIR/asm-out-assign-imm.rs:24:39 | LL | let x: isize; | - help: make this binding mutable: `mut x` LL | x = 1; | ----- first assignment to `x` ... -LL | asm!("mov $1, $0" : "=r"(x) : "r"(5)); - | ^ cannot assign twice to immutable variable +LL | llvm_asm!("mov $1, $0" : "=r"(x) : "r"(5)); + | ^ cannot assign twice to immutable variable error: aborting due to previous error diff --git a/src/test/ui/asm/asm-out-no-modifier.rs b/src/test/ui/asm/asm-out-no-modifier.rs index d9142b9f2e0c8..d198437c50894 100644 --- a/src/test/ui/asm/asm-out-no-modifier.rs +++ b/src/test/ui/asm/asm-out-no-modifier.rs @@ -8,7 +8,7 @@ // ignore-mips // ignore-mips64 -#![feature(asm)] +#![feature(llvm_asm)] fn foo(x: isize) { println!("{}", x); } @@ -19,7 +19,7 @@ fn foo(x: isize) { println!("{}", x); } pub fn main() { let x: isize; unsafe { - asm!("mov $1, $0" : "r"(x) : "r"(5)); //~ ERROR output operand constraint lacks '=' + llvm_asm!("mov $1, $0" : "r"(x) : "r"(5)); //~ ERROR output operand constraint lacks '=' } foo(x); } diff --git a/src/test/ui/asm/asm-out-no-modifier.stderr b/src/test/ui/asm/asm-out-no-modifier.stderr index 99134ceba3327..1c9e108f910c6 100644 --- a/src/test/ui/asm/asm-out-no-modifier.stderr +++ b/src/test/ui/asm/asm-out-no-modifier.stderr @@ -1,8 +1,8 @@ error[E0661]: output operand constraint lacks '=' or '+' - --> $DIR/asm-out-no-modifier.rs:22:29 + --> $DIR/asm-out-no-modifier.rs:22:34 | -LL | asm!("mov $1, $0" : "r"(x) : "r"(5)); - | ^^^ +LL | llvm_asm!("mov $1, $0" : "r"(x) : "r"(5)); + | ^^^ error: aborting due to previous error diff --git a/src/test/ui/asm/asm-out-read-uninit.rs b/src/test/ui/asm/asm-out-read-uninit.rs index 78458ff60d4aa..d45498d4bb4a1 100644 --- a/src/test/ui/asm/asm-out-read-uninit.rs +++ b/src/test/ui/asm/asm-out-read-uninit.rs @@ -8,7 +8,7 @@ // ignore-mips // ignore-mips64 -#![feature(asm)] +#![feature(llvm_asm)] fn foo(x: isize) { println!("{}", x); } @@ -19,7 +19,7 @@ fn foo(x: isize) { println!("{}", x); } pub fn main() { let x: isize; unsafe { - asm!("mov $1, $0" : "=r"(x) : "r"(x)); + llvm_asm!("mov $1, $0" : "=r"(x) : "r"(x)); //~^ ERROR use of possibly-uninitialized variable: `x` } foo(x); diff --git a/src/test/ui/asm/asm-out-read-uninit.stderr b/src/test/ui/asm/asm-out-read-uninit.stderr index 71aeda2ad4d2e..3c3f3a6febb5a 100644 --- a/src/test/ui/asm/asm-out-read-uninit.stderr +++ b/src/test/ui/asm/asm-out-read-uninit.stderr @@ -1,8 +1,8 @@ error[E0381]: use of possibly-uninitialized variable: `x` - --> $DIR/asm-out-read-uninit.rs:22:43 + --> $DIR/asm-out-read-uninit.rs:22:48 | -LL | asm!("mov $1, $0" : "=r"(x) : "r"(x)); - | ^ use of possibly-uninitialized `x` +LL | llvm_asm!("mov $1, $0" : "=r"(x) : "r"(x)); + | ^ use of possibly-uninitialized `x` error: aborting due to previous error diff --git a/src/test/ui/asm/asm-parse-errors.rs b/src/test/ui/asm/asm-parse-errors.rs index e712ac5826e2c..d458be815296b 100644 --- a/src/test/ui/asm/asm-parse-errors.rs +++ b/src/test/ui/asm/asm-parse-errors.rs @@ -1,15 +1,15 @@ -#![feature(asm)] +#![feature(llvm_asm)] fn main() { - asm!(); //~ ERROR requires a string literal as an argument - asm!("nop" : struct); //~ ERROR expected string literal - asm!("mov %eax, $$0x2" : struct); //~ ERROR expected string literal - asm!("mov %eax, $$0x2" : "={eax}" struct); //~ ERROR expected `(` - asm!("mov %eax, $$0x2" : "={eax}"(struct)); //~ ERROR expected expression - asm!("in %dx, %al" : "={al}"(result) : struct); //~ ERROR expected string literal - asm!("in %dx, %al" : "={al}"(result) : "{dx}" struct); //~ ERROR expected `(` - asm!("in %dx, %al" : "={al}"(result) : "{dx}"(struct)); //~ ERROR expected expression - asm!("mov $$0x200, %eax" : : : struct); //~ ERROR expected string literal - asm!("mov eax, 2" : "={eax}"(foo) : : : struct); //~ ERROR expected string literal - asm!(123); //~ ERROR inline assembly must be a string literal + 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/asm/asm-parse-errors.stderr b/src/test/ui/asm/asm-parse-errors.stderr index 2b29332fef5e5..64f295c3b3698 100644 --- a/src/test/ui/asm/asm-parse-errors.stderr +++ b/src/test/ui/asm/asm-parse-errors.stderr @@ -1,68 +1,68 @@ error: macro requires a string literal as an argument --> $DIR/asm-parse-errors.rs:4:5 | -LL | asm!(); - | ^^^^^^^ string literal required +LL | llvm_asm!(); + | ^^^^^^^^^^^^ string literal required error: expected string literal - --> $DIR/asm-parse-errors.rs:5:18 + --> $DIR/asm-parse-errors.rs:5:23 | -LL | asm!("nop" : struct); - | ^^^^^^ not a string literal +LL | llvm_asm!("nop" : struct); + | ^^^^^^ not a string literal error: expected string literal - --> $DIR/asm-parse-errors.rs:6:30 + --> $DIR/asm-parse-errors.rs:6:35 | -LL | asm!("mov %eax, $$0x2" : struct); - | ^^^^^^ not a string literal +LL | llvm_asm!("mov %eax, $$0x2" : struct); + | ^^^^^^ not a string literal error: expected `(`, found keyword `struct` - --> $DIR/asm-parse-errors.rs:7:39 + --> $DIR/asm-parse-errors.rs:7:44 | -LL | asm!("mov %eax, $$0x2" : "={eax}" struct); - | ^^^^^^ expected `(` +LL | llvm_asm!("mov %eax, $$0x2" : "={eax}" struct); + | ^^^^^^ expected `(` error: expected expression, found keyword `struct` - --> $DIR/asm-parse-errors.rs:8:39 + --> $DIR/asm-parse-errors.rs:8:44 | -LL | asm!("mov %eax, $$0x2" : "={eax}"(struct)); - | ^^^^^^ expected expression +LL | llvm_asm!("mov %eax, $$0x2" : "={eax}"(struct)); + | ^^^^^^ expected expression error: expected string literal - --> $DIR/asm-parse-errors.rs:9:44 + --> $DIR/asm-parse-errors.rs:9:49 | -LL | asm!("in %dx, %al" : "={al}"(result) : struct); - | ^^^^^^ not a string literal +LL | llvm_asm!("in %dx, %al" : "={al}"(result) : struct); + | ^^^^^^ not a string literal error: expected `(`, found keyword `struct` - --> $DIR/asm-parse-errors.rs:10:51 + --> $DIR/asm-parse-errors.rs:10:56 | -LL | asm!("in %dx, %al" : "={al}"(result) : "{dx}" struct); - | ^^^^^^ expected `(` +LL | llvm_asm!("in %dx, %al" : "={al}"(result) : "{dx}" struct); + | ^^^^^^ expected `(` error: expected expression, found keyword `struct` - --> $DIR/asm-parse-errors.rs:11:51 + --> $DIR/asm-parse-errors.rs:11:56 | -LL | asm!("in %dx, %al" : "={al}"(result) : "{dx}"(struct)); - | ^^^^^^ expected expression +LL | llvm_asm!("in %dx, %al" : "={al}"(result) : "{dx}"(struct)); + | ^^^^^^ expected expression error: expected string literal - --> $DIR/asm-parse-errors.rs:12:36 + --> $DIR/asm-parse-errors.rs:12:41 | -LL | asm!("mov $$0x200, %eax" : : : struct); - | ^^^^^^ not a string literal +LL | llvm_asm!("mov $$0x200, %eax" : : : struct); + | ^^^^^^ not a string literal error: expected string literal - --> $DIR/asm-parse-errors.rs:13:45 + --> $DIR/asm-parse-errors.rs:13:50 | -LL | asm!("mov eax, 2" : "={eax}"(foo) : : : struct); - | ^^^^^^ not a string literal +LL | llvm_asm!("mov eax, 2" : "={eax}"(foo) : : : struct); + | ^^^^^^ not a string literal error: inline assembly must be a string literal - --> $DIR/asm-parse-errors.rs:14:10 + --> $DIR/asm-parse-errors.rs:14:15 | -LL | asm!(123); - | ^^^ +LL | llvm_asm!(123); + | ^^^ error: aborting due to 11 previous errors diff --git a/src/test/ui/asm/issue-51431.rs b/src/test/ui/asm/issue-51431.rs index 4cef42d17d600..ca06bdab27b96 100644 --- a/src/test/ui/asm/issue-51431.rs +++ b/src/test/ui/asm/issue-51431.rs @@ -1,11 +1,11 @@ // build-fail -// ignore-emscripten no asm! support +// ignore-emscripten no llvm_asm! support -#![feature(asm)] +#![feature(llvm_asm)] fn main() { unsafe { - asm! {"mov $0,$1"::"0"("bx"),"1"(0x00)} + llvm_asm! {"mov $0,$1"::"0"("bx"),"1"(0x00)} //~^ ERROR: invalid value for constraint in inline assembly } } diff --git a/src/test/ui/asm/issue-51431.stderr b/src/test/ui/asm/issue-51431.stderr index a024f3311f186..b4b39a2a44ec3 100644 --- a/src/test/ui/asm/issue-51431.stderr +++ b/src/test/ui/asm/issue-51431.stderr @@ -1,8 +1,8 @@ error[E0669]: invalid value for constraint in inline assembly - --> $DIR/issue-51431.rs:8:32 + --> $DIR/issue-51431.rs:8:37 | -LL | asm! {"mov $0,$1"::"0"("bx"),"1"(0x00)} - | ^^^^ +LL | llvm_asm! {"mov $0,$1"::"0"("bx"),"1"(0x00)} + | ^^^^ error: aborting due to previous error diff --git a/src/test/ui/asm/issue-62046.rs b/src/test/ui/asm/issue-62046.rs index 105dadd5fd373..fd4d9bdd23dbf 100644 --- a/src/test/ui/asm/issue-62046.rs +++ b/src/test/ui/asm/issue-62046.rs @@ -1,11 +1,11 @@ // build-fail // ignore-emscripten no asm! support -#![feature(asm)] +#![feature(llvm_asm)] fn main() { unsafe { - asm!("nop" : "+r"("r15")); + llvm_asm!("nop" : "+r"("r15")); //~^ malformed inline assembly } } diff --git a/src/test/ui/asm/issue-62046.stderr b/src/test/ui/asm/issue-62046.stderr index a38a300548d48..cf27052df05aa 100644 --- a/src/test/ui/asm/issue-62046.stderr +++ b/src/test/ui/asm/issue-62046.stderr @@ -1,8 +1,8 @@ error[E0668]: malformed inline assembly --> $DIR/issue-62046.rs:8:9 | -LL | asm!("nop" : "+r"("r15")); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | llvm_asm!("nop" : "+r"("r15")); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/asm/issue-69092.rs b/src/test/ui/asm/issue-69092.rs index caa5c2e0b9f96..ecce7bfdf5bba 100644 --- a/src/test/ui/asm/issue-69092.rs +++ b/src/test/ui/asm/issue-69092.rs @@ -2,9 +2,9 @@ // ignore-emscripten no asm! support // Regression test for #69092 -#![feature(asm)] +#![feature(llvm_asm)] fn main() { - unsafe { asm!(".ascii \"Xen\0\""); } + unsafe { llvm_asm!(".ascii \"Xen\0\""); } //~^ ERROR: :1:9: error: expected string in '.ascii' directive } diff --git a/src/test/ui/asm/issue-69092.stderr b/src/test/ui/asm/issue-69092.stderr index 5661097cb8b80..35f77edc3c402 100644 --- a/src/test/ui/asm/issue-69092.stderr +++ b/src/test/ui/asm/issue-69092.stderr @@ -4,8 +4,8 @@ error: :1:9: error: expected string in '.ascii' directive --> $DIR/issue-69092.rs:8:14 | -LL | unsafe { asm!(".ascii \"Xen\0\""); } - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | unsafe { llvm_asm!(".ascii \"Xen\0\""); } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/ast-json/ast-json-ice.rs b/src/test/ui/ast-json/ast-json-ice.rs index e8a622e1b8772..60e6c88fc7924 100644 --- a/src/test/ui/ast-json/ast-json-ice.rs +++ b/src/test/ui/ast-json/ast-json-ice.rs @@ -8,7 +8,7 @@ // check-pass // dont-check-compiler-stdout - don't check for any AST change. -#![feature(asm)] +#![feature(llvm_asm)] enum V { A(i32), @@ -30,7 +30,7 @@ fn main() { target_arch = "x86_64", target_arch = "arm", target_arch = "aarch64"))] - unsafe { asm!(""::::); } + 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 index c1b0f39f9366c..d16b424536aac 100644 --- a/src/test/ui/borrowck/borrowck-asm.rs +++ b/src/test/ui/borrowck/borrowck-asm.rs @@ -6,7 +6,7 @@ // ignore-sparc // ignore-sparc64 -#![feature(asm)] +#![feature(llvm_asm)] #[cfg(any(target_arch = "x86", target_arch = "x86_64", @@ -19,7 +19,7 @@ mod test_cases { let y: &mut isize; let x = &mut 0isize; unsafe { - asm!("nop" : : "r"(x)); + llvm_asm!("nop" : : "r"(x)); } let z = x; //~ ERROR use of moved value: `x` } @@ -28,7 +28,7 @@ mod test_cases { let mut x = 3; let y = &mut x; unsafe { - asm!("nop" : : "r"(x)); //~ ERROR cannot use + llvm_asm!("nop" : : "r"(x)); //~ ERROR cannot use } let z = y; } @@ -36,12 +36,12 @@ mod test_cases { fn out_is_assign() { let x = 3; unsafe { - asm!("nop" : "=r"(x)); //~ ERROR cannot assign twice + llvm_asm!("nop" : "=r"(x)); //~ ERROR cannot assign twice } let mut a = &mut 3; let b = &*a; unsafe { - asm!("nop" : "=r"(a)); // OK, Shallow write to `a` + llvm_asm!("nop" : "=r"(a)); // OK, Shallow write to `a` } let c = b; let d = *a; @@ -50,14 +50,14 @@ mod test_cases { fn rw_is_assign() { let x = 3; unsafe { - asm!("nop" : "+r"(x)); //~ ERROR cannot assign twice + llvm_asm!("nop" : "+r"(x)); //~ ERROR cannot assign twice } } fn indirect_is_not_init() { let x: i32; unsafe { - asm!("nop" : "=*r"(x)); //~ ERROR use of possibly-uninitialized variable + llvm_asm!("nop" : "=*r"(x)); //~ ERROR use of possibly-uninitialized variable } } @@ -65,7 +65,7 @@ mod test_cases { let mut x = &mut 3; let y = &*x; unsafe { - asm!("nop" : "+r"(x)); //~ ERROR cannot assign to `x` because it is borrowed + llvm_asm!("nop" : "+r"(x)); //~ ERROR cannot assign to `x` because it is borrowed } let z = y; } @@ -73,7 +73,7 @@ mod test_cases { fn two_moves() { let x = &mut 2; unsafe { - asm!("nop" : : "r"(x), "r"(x) ); //~ ERROR use of moved value + llvm_asm!("nop" : : "r"(x), "r"(x) ); //~ ERROR use of moved value } } } diff --git a/src/test/ui/borrowck/borrowck-asm.stderr b/src/test/ui/borrowck/borrowck-asm.stderr index f85b5983acced..d7e94bd34d35b 100644 --- a/src/test/ui/borrowck/borrowck-asm.stderr +++ b/src/test/ui/borrowck/borrowck-asm.stderr @@ -4,26 +4,26 @@ error[E0382]: use of moved value: `x` LL | let x = &mut 0isize; | - move occurs because `x` has type `&mut isize`, which does not implement the `Copy` trait LL | unsafe { -LL | asm!("nop" : : "r"(x)); - | - value moved here +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:31:32 + --> $DIR/borrowck-asm.rs:31:37 | LL | let y = &mut x; | ------ borrow of `x` occurs here LL | unsafe { -LL | asm!("nop" : : "r"(x)); - | ^ use of borrowed `x` +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:39:31 + --> $DIR/borrowck-asm.rs:39:36 | LL | let x = 3; | - @@ -31,11 +31,11 @@ LL | let x = 3; | first assignment to `x` | help: make this binding mutable: `mut x` LL | unsafe { -LL | asm!("nop" : "=r"(x)); - | ^ cannot assign twice to immutable variable +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:53:31 + --> $DIR/borrowck-asm.rs:53:36 | LL | let x = 3; | - @@ -43,37 +43,37 @@ LL | let x = 3; | first assignment to `x` | help: make this binding mutable: `mut x` LL | unsafe { -LL | asm!("nop" : "+r"(x)); - | ^ cannot assign twice to immutable variable +LL | llvm_asm!("nop" : "+r"(x)); + | ^ cannot assign twice to immutable variable error[E0381]: use of possibly-uninitialized variable: `x` - --> $DIR/borrowck-asm.rs:60:32 + --> $DIR/borrowck-asm.rs:60:37 | -LL | asm!("nop" : "=*r"(x)); - | ^ use of possibly-uninitialized `x` +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:68:31 + --> $DIR/borrowck-asm.rs:68:36 | LL | let y = &*x; | --- borrow of `x` occurs here LL | unsafe { -LL | asm!("nop" : "+r"(x)); - | ^ assignment to borrowed `x` occurs here +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:76:40 + --> $DIR/borrowck-asm.rs:76:45 | LL | let x = &mut 2; | - move occurs because `x` has type `&mut i32`, which does not implement the `Copy` trait LL | unsafe { -LL | asm!("nop" : : "r"(x), "r"(x) ); - | - ^ value used here after move - | | - | value moved here +LL | llvm_asm!("nop" : : "r"(x), "r"(x) ); + | - ^ value used here after move + | | + | value moved here error: aborting due to 7 previous errors diff --git a/src/test/ui/error-codes/E0660.rs b/src/test/ui/error-codes/E0660.rs index 6280d39061035..842ae59ee8deb 100644 --- a/src/test/ui/error-codes/E0660.rs +++ b/src/test/ui/error-codes/E0660.rs @@ -1,9 +1,9 @@ -#![feature(asm)] +#![feature(llvm_asm)] fn main() { let a; - asm!("nop" "nop"); + llvm_asm!("nop" "nop"); //~^ ERROR E0660 - asm!("nop" "nop" : "=r"(a)); + 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 index d355531ef5d91..69288ea6fcdb3 100644 --- a/src/test/ui/error-codes/E0660.stderr +++ b/src/test/ui/error-codes/E0660.stderr @@ -1,14 +1,14 @@ error[E0660]: malformed inline assembly --> $DIR/E0660.rs:5:5 | -LL | asm!("nop" "nop"); - | ^^^^^^^^^^^^^^^^^^ +LL | llvm_asm!("nop" "nop"); + | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0660]: malformed inline assembly --> $DIR/E0660.rs:7:5 | -LL | asm!("nop" "nop" : "=r"(a)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | llvm_asm!("nop" "nop" : "=r"(a)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/error-codes/E0661.rs b/src/test/ui/error-codes/E0661.rs index 5ac0c415ae1b2..1099edd848b28 100644 --- a/src/test/ui/error-codes/E0661.rs +++ b/src/test/ui/error-codes/E0661.rs @@ -1,9 +1,9 @@ // ignore-emscripten -#![feature(asm)] +#![feature(llvm_asm)] fn main() { let a; //~ ERROR type annotations needed - asm!("nop" : "r"(a)); + 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 index 6e849649aca2a..fe3887e72604d 100644 --- a/src/test/ui/error-codes/E0661.stderr +++ b/src/test/ui/error-codes/E0661.stderr @@ -1,8 +1,8 @@ error[E0661]: output operand constraint lacks '=' or '+' - --> $DIR/E0661.rs:7:18 + --> $DIR/E0661.rs:7:23 | -LL | asm!("nop" : "r"(a)); - | ^^^ +LL | llvm_asm!("nop" : "r"(a)); + | ^^^ error[E0282]: type annotations needed --> $DIR/E0661.rs:6:9 diff --git a/src/test/ui/error-codes/E0662.rs b/src/test/ui/error-codes/E0662.rs index 343ed27f83f7e..095005999039f 100644 --- a/src/test/ui/error-codes/E0662.rs +++ b/src/test/ui/error-codes/E0662.rs @@ -1,10 +1,10 @@ // ignore-emscripten -#![feature(asm)] +#![feature(llvm_asm)] fn main() { - asm!("xor %eax, %eax" - : - : "=test"("a") //~ ERROR E0662 - ); + 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 index 7480f03c3d4c3..ebc5f628f2699 100644 --- a/src/test/ui/error-codes/E0662.stderr +++ b/src/test/ui/error-codes/E0662.stderr @@ -1,8 +1,8 @@ error[E0662]: input operand constraint contains '=' - --> $DIR/E0662.rs:8:12 + --> $DIR/E0662.rs:8:17 | -LL | : "=test"("a") - | ^^^^^^^ +LL | : "=test"("a") + | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0663.rs b/src/test/ui/error-codes/E0663.rs index cfbb4b37758ce..0783d705a5bfe 100644 --- a/src/test/ui/error-codes/E0663.rs +++ b/src/test/ui/error-codes/E0663.rs @@ -1,10 +1,10 @@ // ignore-emscripten -#![feature(asm)] +#![feature(llvm_asm)] fn main() { - asm!("xor %eax, %eax" - : - : "+test"("a") //~ ERROR E0663 - ); + 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 index 2b7598d1577a6..4e421aa007352 100644 --- a/src/test/ui/error-codes/E0663.stderr +++ b/src/test/ui/error-codes/E0663.stderr @@ -1,8 +1,8 @@ error[E0663]: input operand constraint contains '+' - --> $DIR/E0663.rs:8:12 + --> $DIR/E0663.rs:8:17 | -LL | : "+test"("a") - | ^^^^^^^ +LL | : "+test"("a") + | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0664.rs b/src/test/ui/error-codes/E0664.rs index fe70c9f96e06d..f8ca5c9c8c6de 100644 --- a/src/test/ui/error-codes/E0664.rs +++ b/src/test/ui/error-codes/E0664.rs @@ -1,11 +1,11 @@ // ignore-emscripten -#![feature(asm)] +#![feature(llvm_asm)] fn main() { - asm!("mov $$0x200, %eax" - : - : - : "{eax}" //~ ERROR E0664 - ); + 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 index 224fc63696a99..d0ed0f01ce79f 100644 --- a/src/test/ui/error-codes/E0664.stderr +++ b/src/test/ui/error-codes/E0664.stderr @@ -1,8 +1,8 @@ error[E0664]: clobber should not be surrounded by braces - --> $DIR/E0664.rs:9:12 + --> $DIR/E0664.rs:9:17 | -LL | : "{eax}" - | ^^^^^^^ +LL | : "{eax}" + | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/feature-gates/feature-gate-asm.rs b/src/test/ui/feature-gates/feature-gate-asm.rs index 1fce279c9ef3d..7eeeb4bc4e243 100644 --- a/src/test/ui/feature-gates/feature-gate-asm.rs +++ b/src/test/ui/feature-gates/feature-gate-asm.rs @@ -3,5 +3,6 @@ fn main() { unsafe { asm!(""); //~ ERROR inline assembly is not stable enough + llvm_asm!(""); //~ ERROR inline assembly is not stable enough } } diff --git a/src/test/ui/feature-gates/feature-gate-asm.stderr b/src/test/ui/feature-gates/feature-gate-asm.stderr index 265d38f83f540..1f9eaa5632e4a 100644 --- a/src/test/ui/feature-gates/feature-gate-asm.stderr +++ b/src/test/ui/feature-gates/feature-gate-asm.stderr @@ -4,9 +4,18 @@ error[E0658]: use of unstable library feature 'asm': inline assembly is not stab LL | asm!(""); | ^^^ | - = note: see issue #29722 for more information + = note: see issue #70173 for more information = help: add `#![feature(asm)]` to the crate attributes to enable -error: aborting due to previous error +error[E0658]: use of unstable library feature 'llvm_asm': inline assembly is not stable enough for use and is subject to change + --> $DIR/feature-gate-asm.rs:6: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 2 previous errors 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 index 4f56aa7234464..666a4894f6275 100644 --- a/src/test/ui/feature-gates/feature-gate-asm2.rs +++ b/src/test/ui/feature-gates/feature-gate-asm2.rs @@ -3,5 +3,6 @@ fn main() { unsafe { println!("{:?}", asm!("")); //~ ERROR inline assembly is not stable + println!("{:?}", llvm_asm!("")); //~ ERROR inline assembly is not stable } } diff --git a/src/test/ui/feature-gates/feature-gate-asm2.stderr b/src/test/ui/feature-gates/feature-gate-asm2.stderr index 7ea7bdac44183..17ba66e9842fa 100644 --- a/src/test/ui/feature-gates/feature-gate-asm2.stderr +++ b/src/test/ui/feature-gates/feature-gate-asm2.stderr @@ -4,9 +4,18 @@ error[E0658]: use of unstable library feature 'asm': inline assembly is not stab LL | println!("{:?}", asm!("")); | ^^^ | - = note: see issue #29722 for more information + = note: see issue #70173 for more information = help: add `#![feature(asm)]` to the crate attributes to enable -error: aborting due to previous error +error[E0658]: use of unstable library feature 'llvm_asm': inline assembly is not stable enough for use and is subject to change + --> $DIR/feature-gate-asm2.rs:6: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 2 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/inline-asm-bad-constraint.rs b/src/test/ui/inline-asm-bad-constraint.rs index 04fd5760cf8ce..edf2c2e3180e8 100644 --- a/src/test/ui/inline-asm-bad-constraint.rs +++ b/src/test/ui/inline-asm-bad-constraint.rs @@ -3,7 +3,7 @@ // build-fail // ignore-emscripten -#![feature(asm)] +#![feature(llvm_asm)] extern "C" { fn foo(a: usize); @@ -19,7 +19,7 @@ fn main() { fn bad_register_constraint() { let rax: u64; unsafe { - asm!("" :"={rax"(rax)) //~ ERROR E0668 + llvm_asm!("" :"={rax"(rax)) //~ ERROR E0668 }; println!("Accumulator is: {}", rax); } @@ -27,14 +27,14 @@ fn bad_register_constraint() { // Issue #54376 fn bad_input() { unsafe { - asm!("callq $0" : : "0"(foo)) //~ ERROR E0668 + llvm_asm!("callq $0" : : "0"(foo)) //~ ERROR E0668 }; } fn wrong_size_output() { let rax: u64 = 0; unsafe { - asm!("addb $1, $0" : "={rax}"((0i32, rax))); //~ ERROR E0668 + llvm_asm!("addb $1, $0" : "={rax}"((0i32, rax))); //~ ERROR E0668 } println!("rax: {}", rax); } diff --git a/src/test/ui/inline-asm-bad-constraint.stderr b/src/test/ui/inline-asm-bad-constraint.stderr index 2647e337b9d53..d6a3b6e8382f4 100644 --- a/src/test/ui/inline-asm-bad-constraint.stderr +++ b/src/test/ui/inline-asm-bad-constraint.stderr @@ -1,24 +1,24 @@ error[E0668]: malformed inline assembly --> $DIR/inline-asm-bad-constraint.rs:22:9 | -LL | asm!("" :"={rax"(rax)) - | ^^^^^^^^^^^^^^^^^^^^^^ +LL | llvm_asm!("" :"={rax"(rax)) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) error[E0668]: malformed inline assembly --> $DIR/inline-asm-bad-constraint.rs:30:9 | -LL | asm!("callq $0" : : "0"(foo)) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | llvm_asm!("callq $0" : : "0"(foo)) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) error[E0668]: malformed inline assembly --> $DIR/inline-asm-bad-constraint.rs:37:9 | -LL | asm!("addb $1, $0" : "={rax}"((0i32, rax))); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | llvm_asm!("addb $1, $0" : "={rax}"((0i32, rax))); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/inline-asm-bad-operand.rs b/src/test/ui/inline-asm-bad-operand.rs index f4e9922164f03..e5fc4ee010678 100644 --- a/src/test/ui/inline-asm-bad-operand.rs +++ b/src/test/ui/inline-asm-bad-operand.rs @@ -4,7 +4,7 @@ // build-fail // ignore-emscripten -#![feature(asm)] +#![feature(llvm_asm)] #[repr(C)] struct MyPtr(usize); @@ -19,41 +19,41 @@ fn main() { fn issue_37433() { unsafe { - asm!("" :: "r"("")); //~ ERROR E0669 + llvm_asm!("" :: "r"("")); //~ ERROR E0669 } unsafe { let target = MyPtr(0); - asm!("ret" : : "{rdi}"(target)); //~ ERROR E0669 + llvm_asm!("ret" : : "{rdi}"(target)); //~ ERROR E0669 } } fn issue_37437() { let hello: &str = "hello"; // this should fail... - unsafe { asm!("" :: "i"(hello)) }; //~ ERROR E0669 + unsafe { llvm_asm!("" :: "i"(hello)) }; //~ ERROR E0669 // but this should succeed. - unsafe { asm!("" :: "r"(hello.as_ptr())) }; + unsafe { llvm_asm!("" :: "r"(hello.as_ptr())) }; } fn issue_40187() { let arr: [u8; 1] = [0; 1]; unsafe { - asm!("movups $1, %xmm0"::"m"(arr)); //~ ERROR E0669 + llvm_asm!("movups $1, %xmm0"::"m"(arr)); //~ ERROR E0669 } } fn issue_54067() { let addr: Option = Some(123); unsafe { - asm!("mov sp, $0"::"r"(addr)); //~ ERROR E0669 + llvm_asm!("mov sp, $0"::"r"(addr)); //~ ERROR E0669 } } fn multiple_errors() { let addr: (u32, u32) = (1, 2); unsafe { - asm!("mov sp, $0"::"r"(addr), //~ ERROR E0669 - "r"("hello e0669")); //~ ERROR E0669 + llvm_asm!("mov sp, $0"::"r"(addr), //~ ERROR E0669 + "r"("hello e0669")); //~ ERROR E0669 } } diff --git a/src/test/ui/inline-asm-bad-operand.stderr b/src/test/ui/inline-asm-bad-operand.stderr index fe6c6c9914199..1ac7024ec8bf0 100644 --- a/src/test/ui/inline-asm-bad-operand.stderr +++ b/src/test/ui/inline-asm-bad-operand.stderr @@ -1,41 +1,41 @@ error[E0669]: invalid value for constraint in inline assembly - --> $DIR/inline-asm-bad-operand.rs:22:24 + --> $DIR/inline-asm-bad-operand.rs:22:29 | -LL | asm!("" :: "r"("")); - | ^^ +LL | llvm_asm!("" :: "r"("")); + | ^^ error[E0669]: invalid value for constraint in inline assembly - --> $DIR/inline-asm-bad-operand.rs:27:32 + --> $DIR/inline-asm-bad-operand.rs:27:37 | -LL | asm!("ret" : : "{rdi}"(target)); - | ^^^^^^ +LL | llvm_asm!("ret" : : "{rdi}"(target)); + | ^^^^^^ error[E0669]: invalid value for constraint in inline assembly - --> $DIR/inline-asm-bad-operand.rs:34:29 + --> $DIR/inline-asm-bad-operand.rs:34:34 | -LL | unsafe { asm!("" :: "i"(hello)) }; - | ^^^^^ +LL | unsafe { llvm_asm!("" :: "i"(hello)) }; + | ^^^^^ error[E0669]: invalid value for constraint in inline assembly - --> $DIR/inline-asm-bad-operand.rs:42:38 + --> $DIR/inline-asm-bad-operand.rs:42:43 | -LL | asm!("movups $1, %xmm0"::"m"(arr)); - | ^^^ +LL | llvm_asm!("movups $1, %xmm0"::"m"(arr)); + | ^^^ error[E0669]: invalid value for constraint in inline assembly - --> $DIR/inline-asm-bad-operand.rs:49:32 + --> $DIR/inline-asm-bad-operand.rs:49:37 | -LL | asm!("mov sp, $0"::"r"(addr)); - | ^^^^ +LL | llvm_asm!("mov sp, $0"::"r"(addr)); + | ^^^^ error[E0669]: invalid value for constraint in inline assembly - --> $DIR/inline-asm-bad-operand.rs:56:32 + --> $DIR/inline-asm-bad-operand.rs:56:37 | -LL | asm!("mov sp, $0"::"r"(addr), - | ^^^^ +LL | llvm_asm!("mov sp, $0"::"r"(addr), + | ^^^^ error[E0669]: invalid value for constraint in inline assembly - --> $DIR/inline-asm-bad-operand.rs:57:32 + --> $DIR/inline-asm-bad-operand.rs:57:37 | LL | ... "r"("hello e0669")); | ^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-14936.rs b/src/test/ui/issues/issue-14936.rs index 33532855fcd7e..02095a2f7e4d2 100644 --- a/src/test/ui/issues/issue-14936.rs +++ b/src/test/ui/issues/issue-14936.rs @@ -1,7 +1,7 @@ // build-pass #![allow(unused_macros)] #![allow(dead_code)] -#![feature(asm)] +#![feature(llvm_asm)] type History = Vec<&'static str>; @@ -18,10 +18,10 @@ macro_rules! demo { let mut history: History = vec![]; unsafe { - asm!("mov ($1), $0" - : $output_constraint (*wrap(&mut x, "out", &mut history)) - : "r"(&wrap(y, "in", &mut history)) - :: "volatile"); + 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"]; diff --git a/src/test/ui/issues/issue-23458.rs b/src/test/ui/issues/issue-23458.rs index 521db37170ab5..423b19c3ebd09 100644 --- a/src/test/ui/issues/issue-23458.rs +++ b/src/test/ui/issues/issue-23458.rs @@ -1,11 +1,11 @@ -#![feature(asm)] +#![feature(llvm_asm)] // build-fail // only-x86_64 fn main() { unsafe { - asm!("int $3"); //~ ERROR too few operands for instruction - //~| ERROR invalid operand in inline asm + llvm_asm!("int $3"); //~ ERROR too few operands for instruction + //~| ERROR invalid operand in inline asm } } diff --git a/src/test/ui/issues/issue-23458.stderr b/src/test/ui/issues/issue-23458.stderr index 76c3e6da82ea2..81f06e6397542 100644 --- a/src/test/ui/issues/issue-23458.stderr +++ b/src/test/ui/issues/issue-23458.stderr @@ -1,8 +1,8 @@ error: invalid operand in inline asm: 'int $3' --> $DIR/issue-23458.rs:8:9 | -LL | asm!("int $3"); - | ^^^^^^^^^^^^^^^ +LL | llvm_asm!("int $3"); + | ^^^^^^^^^^^^^^^^^^^^ error: :1:2: error: too few operands for instruction int @@ -10,8 +10,8 @@ error: :1:2: error: too few operands for instruction --> $DIR/issue-23458.rs:8:9 | -LL | asm!("int $3"); - | ^^^^^^^^^^^^^^^ +LL | llvm_asm!("int $3"); + | ^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-33264.rs b/src/test/ui/issues/issue-33264.rs index 31638b004391f..32a36e44aa1ae 100644 --- a/src/test/ui/issues/issue-33264.rs +++ b/src/test/ui/issues/issue-33264.rs @@ -2,7 +2,7 @@ // only-x86_64 #![allow(dead_code, non_upper_case_globals)] -#![feature(asm)] +#![feature(llvm_asm)] #[repr(C)] pub struct D32x4(f32,f32,f32,f32); @@ -11,16 +11,16 @@ impl D32x4 { fn add(&self, vec: Self) -> Self { unsafe { let ret: Self; - asm!(" - movaps $1, %xmm1 - movaps $2, %xmm2 - addps %xmm1, %xmm2 - movaps $xmm1, $0 - " - : "=r"(ret) - : "1"(self), "2"(vec) - : "xmm1", "xmm2" - ); + llvm_asm!(" + movaps $1, %xmm1 + movaps $2, %xmm2 + addps %xmm1, %xmm2 + movaps $xmm1, $0 + " + : "=r"(ret) + : "1"(self), "2"(vec) + : "xmm1", "xmm2" + ); ret } } diff --git a/src/test/ui/issues/issue-37366.rs b/src/test/ui/issues/issue-37366.rs index 6bf3a276ce138..be9b4af8fbc41 100644 --- a/src/test/ui/issues/issue-37366.rs +++ b/src/test/ui/issues/issue-37366.rs @@ -1,12 +1,12 @@ // check-pass // ignore-emscripten -#![feature(asm)] +#![feature(llvm_asm)] macro_rules! interrupt_handler { () => { unsafe fn _interrupt_handler() { - asm!("pop eax" :::: "intel"); + llvm_asm!("pop eax" :::: "intel"); } } } diff --git a/src/test/ui/issues/issue-37433.rs b/src/test/ui/issues/issue-37433.rs index c4d427f3ad3af..2ea970327f06b 100644 --- a/src/test/ui/issues/issue-37433.rs +++ b/src/test/ui/issues/issue-37433.rs @@ -1,11 +1,11 @@ // build-fail -// ignore-emscripten no asm! support +// ignore-emscripten no llvm_asm! support -#![feature(asm)] +#![feature(llvm_asm)] fn main() { unsafe { - asm!("" :: "r"("")); + llvm_asm!("" :: "r"("")); //~^ ERROR: invalid value for constraint in inline assembly } } diff --git a/src/test/ui/issues/issue-37433.stderr b/src/test/ui/issues/issue-37433.stderr index d9e1c98e9ee41..ff6965ad353b2 100644 --- a/src/test/ui/issues/issue-37433.stderr +++ b/src/test/ui/issues/issue-37433.stderr @@ -1,8 +1,8 @@ error[E0669]: invalid value for constraint in inline assembly - --> $DIR/issue-37433.rs:8:24 + --> $DIR/issue-37433.rs:8:29 | -LL | asm!("" :: "r"("")); - | ^^ +LL | llvm_asm!("" :: "r"("")); + | ^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-53787-inline-assembler-macro.rs b/src/test/ui/issues/issue-53787-inline-assembler-macro.rs index d911ac5efbe03..38591b0a9f84e 100644 --- a/src/test/ui/issues/issue-53787-inline-assembler-macro.rs +++ b/src/test/ui/issues/issue-53787-inline-assembler-macro.rs @@ -3,12 +3,12 @@ // build-fail // ignore-emscripten -#![feature(asm)] +#![feature(llvm_asm)] macro_rules! fake_jump { ($id:expr) => { unsafe { - asm!( + llvm_asm!( " jmp $0 lea eax, [ebx] diff --git a/src/test/ui/issues/issue-9129.rs b/src/test/ui/issues/issue-9129.rs index 3d87e1c203783..9a0376ad51f75 100644 --- a/src/test/ui/issues/issue-9129.rs +++ b/src/test/ui/issues/issue-9129.rs @@ -12,7 +12,7 @@ impl bomb for S { fn boom(&self, _: Ident) { } } pub struct Ident { name: usize } -// macro_rules! int3 { () => ( unsafe { asm!( "int3" ); } ) } +// macro_rules! int3 { () => ( unsafe { llvm_asm!( "int3" ); } ) } macro_rules! int3 { () => ( { } ) } fn Ident_new() -> Ident { diff --git a/src/test/ui/macros/macro-expanded-include/foo/mod.rs b/src/test/ui/macros/macro-expanded-include/foo/mod.rs index a8bfa0299f66f..f0eb92b2be820 100644 --- a/src/test/ui/macros/macro-expanded-include/foo/mod.rs +++ b/src/test/ui/macros/macro-expanded-include/foo/mod.rs @@ -5,5 +5,5 @@ macro_rules! m { } macro_rules! n { - () => { unsafe { asm!(include_str!("file.txt")); } } + () => { unsafe { llvm_asm!(include_str!("file.txt")); } } } diff --git a/src/test/ui/macros/macro-expanded-include/test.rs b/src/test/ui/macros/macro-expanded-include/test.rs index b8eb854b0b0f1..abf83a5c6ffd3 100644 --- a/src/test/ui/macros/macro-expanded-include/test.rs +++ b/src/test/ui/macros/macro-expanded-include/test.rs @@ -1,6 +1,6 @@ -// ignore-emscripten no asm! support +// ignore-emscripten no llvm_asm! support // build-pass (FIXME(62277): could be check-pass?) -#![feature(asm)] +#![feature(llvm_asm)] #![allow(unused)] #[macro_use] diff --git a/src/test/ui/macros/macros-nonfatal-errors.rs b/src/test/ui/macros/macros-nonfatal-errors.rs index 1eb82a20729ca..cc96a5bff522f 100644 --- a/src/test/ui/macros/macros-nonfatal-errors.rs +++ b/src/test/ui/macros/macros-nonfatal-errors.rs @@ -3,14 +3,14 @@ // test that errors in a (selection) of macros don't kill compilation // immediately, so that we get more errors listed at a time. -#![feature(asm)] +#![feature(llvm_asm)] #![feature(trace_macros, concat_idents)] #[derive(Default)] //~ ERROR enum OrDeriveThis {} fn main() { - asm!(invalid); //~ ERROR + llvm_asm!(invalid); //~ ERROR concat_idents!("not", "idents"); //~ ERROR diff --git a/src/test/ui/macros/macros-nonfatal-errors.stderr b/src/test/ui/macros/macros-nonfatal-errors.stderr index 1ab6b79a61ecb..f416c70123c66 100644 --- a/src/test/ui/macros/macros-nonfatal-errors.stderr +++ b/src/test/ui/macros/macros-nonfatal-errors.stderr @@ -7,10 +7,10 @@ LL | #[derive(Default)] = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: inline assembly must be a string literal - --> $DIR/macros-nonfatal-errors.rs:13:10 + --> $DIR/macros-nonfatal-errors.rs:13:15 | -LL | asm!(invalid); - | ^^^^^^^ +LL | llvm_asm!(invalid); + | ^^^^^^^ error: concat_idents! requires ident args. --> $DIR/macros-nonfatal-errors.rs:15:5 diff --git a/src/test/ui/out-of-stack.rs b/src/test/ui/out-of-stack.rs index 5e9265be4b982..d04b0c1a6303e 100644 --- a/src/test/ui/out-of-stack.rs +++ b/src/test/ui/out-of-stack.rs @@ -8,7 +8,7 @@ // ignore-emscripten no processes // ignore-sgx no processes -#![feature(asm)] +#![feature(llvm_asm)] #![feature(rustc_private)] #[cfg(unix)] @@ -22,7 +22,7 @@ use std::thread; // Inlining to avoid llvm turning the recursive functions into tail calls, // which doesn't consume stack. #[inline(always)] -pub fn black_box(dummy: T) { unsafe { asm!("" : : "r"(&dummy)) } } +pub fn black_box(dummy: T) { unsafe { llvm_asm!("" : : "r"(&dummy)) } } fn silent_recurse() { let buf = [0u8; 1000];