rust/src/test/ui/asm/asm-parse-errors.rs
Andy Russell 0a6fb84738
make panictry! private to libsyntax
This commit completely removes usage of the `panictry!` macro from
outside libsyntax. The macro causes parse errors to be fatal, so using
it in libsyntax_ext caused parse failures *within* a syntax extension to
be fatal, which is probably not intended.

Furthermore, this commit adds spans to diagnostics emitted by empty
extensions if they were missing, à la #56491.
2019-01-02 11:02:30 -05:00

15 lines
864 B
Rust

#![feature(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
}