Skip to content

Rollup of 7 pull requests #81832

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Feb 6, 2021
Merged
Changes from 2 commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions src/test/codegen/asm-sanitize-llvm.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// FIXME(nagisa): remove the flags here once all targets support `asm!`.
// compile-flags: --target x86_64-unknown-linux-gnu

// Verify we sanitize the special tokens for the LLVM inline-assembly, ensuring people won't
// inadvertently rely on the LLVM-specific syntax and features.
#![no_core]
#![feature(no_core, lang_items, rustc_attrs)]
#![crate_type = "rlib"]

#[rustc_builtin_macro]
macro_rules! asm {
() => {};
}

#[lang = "sized"]
trait Sized {}
#[lang = "copy"]
trait Copy {}

pub unsafe fn we_escape_dollar_signs() {
// CHECK: call void asm sideeffect alignstack inteldialect "banana$$:"
asm!(
r"banana$:",
)
}

pub unsafe fn we_escape_escapes_too() {
// CHECK: call void asm sideeffect alignstack inteldialect "banana\{{(\\|5C)}}36:"
asm!(
r"banana\36:",
)
}