]> git.lizzy.rs Git - rust.git/blob - src/test/ui/ast-json/ast-json-ice.rs
Rollup merge of #92959 - asquared31415:test-non-fn-help, r=estebank
[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 enum V {
12     A(i32),
13     B { f: [i64; 3 + 4] }
14 }
15
16 trait X {
17     type Output;
18     fn read(&self) -> Self::Output;
19     fn write(&mut self, _: Self::Output);
20 }
21
22 macro_rules! call_println {
23     ($y:ident) => { println!("{}", $y) }
24 }
25
26 fn main() {
27     let x: (i32) = 35;
28     let y = x as i64<> + 5;
29
30     call_println!(y);
31
32     struct A;
33 }
34
35 // Regressions tests for issues #78398 and #78510 (captured tokens in associated and foreign items)
36
37 struct S;
38
39 macro_rules! mac_extern {
40     ($i:item) => {
41         extern "C" { $i }
42     }
43 }
44 macro_rules! mac_assoc {
45     ($i:item) => {
46         impl S { $i }
47         trait Bar { $i }
48     }
49 }
50
51 mac_extern! {
52     fn foo();
53 }
54 mac_assoc! {
55     fn foo() {}
56 }