]> git.lizzy.rs Git - rust.git/blob - src/test/ui/ast-json/ast-json-ice.rs
Auto merge of #87150 - rusticstuff:simplify_wrapping_neg, r=m-ou-se
[rust.git] / src / test / ui / ast-json / ast-json-ice.rs
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
11 #![feature(llvm_asm)]
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"))]
33     unsafe { llvm_asm!(""::::); }
34
35     let x: (i32) = 35;
36     let y = x as i64<> + 5;
37
38     call_println!(y);
39
40     struct A;
41 }
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 }