]> git.lizzy.rs Git - rust.git/blob - src/test/codegen/asm-sanitize-llvm.rs
Rollup merge of #82296 - spastorino:pubrules, r=nikomatsakis
[rust.git] / src / test / codegen / asm-sanitize-llvm.rs
1 // FIXME(nagisa): remove the flags here once all targets support `asm!`.
2 // compile-flags: --target x86_64-unknown-linux-gnu
3
4 // Verify we sanitize the special tokens for the LLVM inline-assembly, ensuring people won't
5 // inadvertently rely on the LLVM-specific syntax and features.
6 #![no_core]
7 #![feature(no_core, lang_items, rustc_attrs)]
8 #![crate_type = "rlib"]
9
10 #[rustc_builtin_macro]
11 macro_rules! asm {
12     () => {};
13 }
14
15 #[lang = "sized"]
16 trait Sized {}
17 #[lang = "copy"]
18 trait Copy {}
19
20 pub unsafe fn we_escape_dollar_signs() {
21     // CHECK: call void asm sideeffect alignstack inteldialect "banana$$:"
22     asm!(
23         r"banana$:",
24     )
25 }
26
27 pub unsafe fn we_escape_escapes_too() {
28     // CHECK: call void asm sideeffect alignstack inteldialect "banana\{{(\\|5C)}}36:"
29     asm!(
30         r"banana\36:",
31     )
32 }