about summary refs log tree commit diff
path: root/tests/ui/asm/ice-bad-err-span-in-template-129503.rs
blob: 3b4390f881a7e042dbff2bb257b5c96bc67e5bf6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Regression test for ICE #129503


// Tests that we come up with decent error spans
// when the template fed to `asm!()` is itself a
// macro call like `concat!()` and should not ICE

use std::arch::asm;

fn main() {
    // Should not ICE
    asm!(concat!(r#"lJ𐏿Æ�.𐏿�"#, "r} {}"));
    //~^ ERROR invalid asm template string: unmatched `}` found


    // Macro call template: should point to
    // everything within `asm!()` as error span
    asm!(concat!("abc", "r} {}"));
    //~^ ERROR invalid asm template string: unmatched `}` found


    // Literal template: should point precisely to
    // just the `}` as error span
    asm!("abc", "r} {}");
    //~^ ERROR invalid asm template string: unmatched `}` found
}