|
2 | 2 | // edition:2021
|
3 | 3 | // compile-flags: --test
|
4 | 4 |
|
| 5 | +#![allow(incomplete_features)] |
5 | 6 | #![feature(async_closure)]
|
6 | 7 | #![feature(auto_traits)]
|
7 | 8 | #![feature(box_patterns)]
|
8 | 9 | #![feature(const_trait_impl)]
|
9 | 10 | #![feature(decl_macro)]
|
10 | 11 | #![feature(coroutines)]
|
| 12 | +#![feature(explicit_tail_calls)] |
11 | 13 | #![feature(more_qualified_paths)]
|
12 | 14 | #![feature(raw_ref_op)]
|
13 | 15 | #![feature(trait_alias)]
|
14 | 16 | #![feature(try_blocks)]
|
15 | 17 | #![feature(type_ascription)]
|
| 18 | +#![feature(yeet_expr)] |
16 | 19 | #![deny(unused_macros)]
|
17 | 20 |
|
18 | 21 | // These macros force the use of AST pretty-printing by converting the input to
|
@@ -79,6 +82,9 @@ fn test_expr() {
|
79 | 82 | c2!(expr, [ [true,] ], "[true]", "[true,]");
|
80 | 83 | c1!(expr, [ [true, true] ], "[true, true]");
|
81 | 84 |
|
| 85 | + // ExprKind::ConstBlock |
| 86 | + // FIXME: todo |
| 87 | + |
82 | 88 | // ExprKind::Call
|
83 | 89 | c1!(expr, [ f() ], "f()");
|
84 | 90 | c2!(expr, [ f::<u8>() ], "f::<u8>()", "f :: < u8 > ()");
|
@@ -116,8 +122,10 @@ fn test_expr() {
|
116 | 122 | c1!(expr, [ expr as T ], "expr as T");
|
117 | 123 | c2!(expr, [ expr as T<u8> ], "expr as T<u8>", "expr as T < u8 >");
|
118 | 124 |
|
119 |
| - // ExprKind::Type |
120 |
| - // There is no syntax for type ascription. |
| 125 | + // ExprKind::Type: there is no syntax for type ascription. |
| 126 | + |
| 127 | + // ExprKind::Let |
| 128 | + c1!(expr, [ if let Some(a) = b { c } else { d } ], "if let Some(a) = b { c } else { d }"); |
121 | 129 |
|
122 | 130 | // ExprKind::If
|
123 | 131 | c1!(expr, [ if true {} ], "if true {}");
|
@@ -265,6 +273,9 @@ fn test_expr() {
|
265 | 273 | c2!(expr, [ lo..=hi ], "lo..=hi", "lo ..= hi");
|
266 | 274 | c2!(expr, [ -2..=-1 ], "-2..=-1", "- 2 ..= - 1");
|
267 | 275 |
|
| 276 | + // ExprKind::Underscore |
| 277 | + // FIXME: todo |
| 278 | + |
268 | 279 | // ExprKind::Path
|
269 | 280 | c1!(expr, [ thing ], "thing");
|
270 | 281 | c2!(expr, [ m::thing ], "m::thing", "m :: thing");
|
@@ -294,6 +305,10 @@ fn test_expr() {
|
294 | 305 | c1!(expr, [ return ], "return");
|
295 | 306 | c1!(expr, [ return true ], "return true");
|
296 | 307 |
|
| 308 | + // ExprKind::InlineAsm: untestable because this test works pre-expansion. |
| 309 | + |
| 310 | + // ExprKind::OffsetOf: untestable because this test works pre-expansion. |
| 311 | + |
297 | 312 | // ExprKind::MacCall
|
298 | 313 | c2!(expr, [ mac!(...) ], "mac!(...)", "mac! (...)");
|
299 | 314 | c2!(expr, [ mac![...] ], "mac![...]", "mac! [...]");
|
@@ -332,6 +347,20 @@ fn test_expr() {
|
332 | 347 | // ExprKind::Yield
|
333 | 348 | c1!(expr, [ yield ], "yield");
|
334 | 349 | c1!(expr, [ yield true ], "yield true");
|
| 350 | + |
| 351 | + // ExprKind::Yeet |
| 352 | + c1!(expr, [ do yeet ], "do yeet"); |
| 353 | + c1!(expr, [ do yeet 0 ], "do yeet 0"); |
| 354 | + |
| 355 | + // ExprKind::Become |
| 356 | + // FIXME: todo |
| 357 | + |
| 358 | + // ExprKind::IncludedBytes |
| 359 | + // FIXME: todo |
| 360 | + |
| 361 | + // ExprKind::FormatArgs: untestable because this test works pre-expansion. |
| 362 | + |
| 363 | + // ExprKind::Err: untestable. |
335 | 364 | }
|
336 | 365 |
|
337 | 366 | #[test]
|
@@ -386,6 +415,8 @@ fn test_item() {
|
386 | 415 | "unsafe extern \"C++\" {}"
|
387 | 416 | );
|
388 | 417 |
|
| 418 | + // ItemKind::GlobalAsm: untestable because this test works pre-expansion. |
| 419 | + |
389 | 420 | // ItemKind::TyAlias
|
390 | 421 | #[rustfmt::skip]
|
391 | 422 | c2!(item,
|
@@ -641,6 +672,7 @@ fn test_stmt() {
|
641 | 672 |
|
642 | 673 | // StmtKind::Item
|
643 | 674 | c2!(stmt, [ struct S; ], "struct S;", "struct S ;");
|
| 675 | + c1!(stmt, [ struct S {} ], "struct S {}"); |
644 | 676 |
|
645 | 677 | // StmtKind::Expr
|
646 | 678 | c1!(stmt, [ loop {} ], "loop {}");
|
@@ -692,6 +724,10 @@ fn test_ty() {
|
692 | 724 | c1!(ty, [ (T,) ], "(T,)");
|
693 | 725 | c1!(ty, [ (T, U) ], "(T, U)");
|
694 | 726 |
|
| 727 | + // TyKind::AnonStruct: untestable in isolation. |
| 728 | + |
| 729 | + // TyKind::AnonUnion: untestable in isolation. |
| 730 | + |
695 | 731 | // TyKind::Path
|
696 | 732 | c1!(ty, [ T ], "T");
|
697 | 733 | c2!(ty, [ Ref<'a> ], "Ref<'a>", "Ref < 'a >");
|
@@ -720,13 +756,22 @@ fn test_ty() {
|
720 | 756 | // TyKind::Paren
|
721 | 757 | c1!(ty, [ (T) ], "(T)");
|
722 | 758 |
|
| 759 | + // TyKind::Typeof: unused for now. |
| 760 | + |
723 | 761 | // TyKind::Infer
|
724 | 762 | c1!(ty, [ _ ], "_");
|
| 763 | + |
| 764 | + // TyKind::ImplicitSelf: there is no syntax for this. |
725 | 765 |
|
726 | 766 | // TyKind::MacCall
|
727 | 767 | c2!(ty, [ mac!(...) ], "mac!(...)", "mac! (...)");
|
728 | 768 | c2!(ty, [ mac![...] ], "mac![...]", "mac! [...]");
|
729 | 769 | c1!(ty, [ mac! { ... } ], "mac! { ... }");
|
| 770 | + |
| 771 | + // TyKind::Err: untestable. |
| 772 | + |
| 773 | + // TyKind::CVarArgs |
| 774 | + // FIXME: todo |
730 | 775 | }
|
731 | 776 |
|
732 | 777 | #[test]
|
|
0 commit comments