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