]>
Commit | Line | Data |
---|---|---|
e1599b0c XL |
1 | // Test that AST json serialization doesn't ICE (#63728). |
2 | ||
3 | // revisions: expand noexpand | |
4 | ||
5 | //[expand] compile-flags: -Zast-json | |
6 | //[noexpand] compile-flags: -Zast-json-noexpand | |
7 | ||
8 | // check-pass | |
9 | // dont-check-compiler-stdout - don't check for any AST change. | |
10 | ||
ba9703b0 | 11 | #![feature(llvm_asm)] |
e1599b0c XL |
12 | |
13 | enum V { | |
14 | A(i32), | |
15 | B { f: [i64; 3 + 4] } | |
16 | } | |
17 | ||
18 | trait X { | |
19 | type Output; | |
20 | fn read(&self) -> Self::Output; | |
21 | fn write(&mut self, _: Self::Output); | |
22 | } | |
23 | ||
24 | macro_rules! call_println { | |
25 | ($y:ident) => { println!("{}", $y) } | |
26 | } | |
27 | ||
28 | fn main() { | |
29 | #[cfg(any(target_arch = "x86", | |
30 | target_arch = "x86_64", | |
31 | target_arch = "arm", | |
32 | target_arch = "aarch64"))] | |
ba9703b0 | 33 | unsafe { llvm_asm!(""::::); } |
e1599b0c XL |
34 | |
35 | let x: (i32) = 35; | |
36 | let y = x as i64<> + 5; | |
37 | ||
38 | call_println!(y); | |
39 | ||
40 | struct A; | |
41 | } | |
29967ef6 XL |
42 | |
43 | // Regressions tests for issues #78398 and #78510 (captured tokens in associated and foreign items) | |
44 | ||
45 | struct S; | |
46 | ||
47 | macro_rules! mac_extern { | |
48 | ($i:item) => { | |
49 | extern "C" { $i } | |
50 | } | |
51 | } | |
52 | macro_rules! mac_assoc { | |
53 | ($i:item) => { | |
54 | impl S { $i } | |
55 | trait Bar { $i } | |
56 | } | |
57 | } | |
58 | ||
59 | mac_extern! { | |
60 | fn foo(); | |
61 | } | |
62 | mac_assoc! { | |
63 | fn foo() {} | |
64 | } |