about summary refs log tree commit diff
path: root/tests/ui/macros/stringify.rs
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2023-10-20 09:55:29 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2023-10-24 16:00:45 +1100
commit2e2e7806ab3ad23eb71663e3845c9f2b483b8cc6 (patch)
tree706687085d2f8ffb739d020aa6665c8c19498ea4 /tests/ui/macros/stringify.rs
parentf0a2635960375598c377e10b3461a0231ad69b8e (diff)
downloadrust-2e2e7806ab3ad23eb71663e3845c9f2b483b8cc6.tar.gz
rust-2e2e7806ab3ad23eb71663e3845c9f2b483b8cc6.zip
Augment `stringify.rs` test.
By adding tests (or placeholders, or comments) for missing AST variants.
Diffstat (limited to 'tests/ui/macros/stringify.rs')
-rw-r--r--tests/ui/macros/stringify.rs49
1 files changed, 47 insertions, 2 deletions
diff --git a/tests/ui/macros/stringify.rs b/tests/ui/macros/stringify.rs
index 939b4ce299f..0d23cfba7fd 100644
--- a/tests/ui/macros/stringify.rs
+++ b/tests/ui/macros/stringify.rs
@@ -2,17 +2,20 @@
 // edition:2021
 // compile-flags: --test
 
+#![allow(incomplete_features)]
 #![feature(async_closure)]
 #![feature(auto_traits)]
 #![feature(box_patterns)]
 #![feature(const_trait_impl)]
 #![feature(decl_macro)]
 #![feature(coroutines)]
+#![feature(explicit_tail_calls)]
 #![feature(more_qualified_paths)]
 #![feature(raw_ref_op)]
 #![feature(trait_alias)]
 #![feature(try_blocks)]
 #![feature(type_ascription)]
+#![feature(yeet_expr)]
 #![deny(unused_macros)]
 
 // These macros force the use of AST pretty-printing by converting the input to
@@ -79,6 +82,9 @@ fn test_expr() {
     c2!(expr, [ [true,] ], "[true]", "[true,]");
     c1!(expr, [ [true, true] ], "[true, true]");
 
+    // ExprKind::ConstBlock
+    // FIXME: todo
+
     // ExprKind::Call
     c1!(expr, [ f() ], "f()");
     c2!(expr, [ f::<u8>() ], "f::<u8>()", "f :: < u8 > ()");
@@ -116,8 +122,10 @@ fn test_expr() {
     c1!(expr, [ expr as T ], "expr as T");
     c2!(expr, [ expr as T<u8> ], "expr as T<u8>", "expr as T < u8 >");
 
-    // ExprKind::Type
-    // There is no syntax for type ascription.
+    // ExprKind::Type: there is no syntax for type ascription.
+
+    // ExprKind::Let
+    c1!(expr, [ if let Some(a) = b { c } else { d } ], "if let Some(a) = b { c } else { d }");
 
     // ExprKind::If
     c1!(expr, [ if true {} ], "if true {}");
@@ -265,6 +273,9 @@ fn test_expr() {
     c2!(expr, [ lo..=hi ], "lo..=hi", "lo ..= hi");
     c2!(expr, [ -2..=-1 ], "-2..=-1", "- 2 ..= - 1");
 
+    // ExprKind::Underscore
+    // FIXME: todo
+
     // ExprKind::Path
     c1!(expr, [ thing ], "thing");
     c2!(expr, [ m::thing ], "m::thing", "m :: thing");
@@ -294,6 +305,10 @@ fn test_expr() {
     c1!(expr, [ return ], "return");
     c1!(expr, [ return true ], "return true");
 
+    // ExprKind::InlineAsm: untestable because this test works pre-expansion.
+
+    // ExprKind::OffsetOf: untestable because this test works pre-expansion.
+
     // ExprKind::MacCall
     c2!(expr, [ mac!(...) ], "mac!(...)", "mac! (...)");
     c2!(expr, [ mac![...] ], "mac![...]", "mac! [...]");
@@ -332,6 +347,20 @@ fn test_expr() {
     // ExprKind::Yield
     c1!(expr, [ yield ], "yield");
     c1!(expr, [ yield true ], "yield true");
+
+    // ExprKind::Yeet
+    c1!(expr, [ do yeet ], "do yeet");
+    c1!(expr, [ do yeet 0 ], "do yeet 0");
+
+    // ExprKind::Become
+    // FIXME: todo
+
+    // ExprKind::IncludedBytes
+    // FIXME: todo
+
+    // ExprKind::FormatArgs: untestable because this test works pre-expansion.
+
+    // ExprKind::Err: untestable.
 }
 
 #[test]
@@ -386,6 +415,8 @@ fn test_item() {
         "unsafe extern \"C++\" {}"
     );
 
+    // ItemKind::GlobalAsm: untestable because this test works pre-expansion.
+
     // ItemKind::TyAlias
     #[rustfmt::skip]
     c2!(item,
@@ -641,6 +672,7 @@ fn test_stmt() {
 
     // StmtKind::Item
     c2!(stmt, [ struct S; ], "struct S;", "struct S ;");
+    c1!(stmt, [ struct S {} ], "struct S {}");
 
     // StmtKind::Expr
     c1!(stmt, [ loop {} ], "loop {}");
@@ -692,6 +724,10 @@ fn test_ty() {
     c1!(ty, [ (T,) ], "(T,)");
     c1!(ty, [ (T, U) ], "(T, U)");
 
+    // TyKind::AnonStruct: untestable in isolation.
+
+    // TyKind::AnonUnion: untestable in isolation.
+
     // TyKind::Path
     c1!(ty, [ T ], "T");
     c2!(ty, [ Ref<'a> ], "Ref<'a>", "Ref < 'a >");
@@ -720,13 +756,22 @@ fn test_ty() {
     // TyKind::Paren
     c1!(ty, [ (T) ], "(T)");
 
+    // TyKind::Typeof: unused for now.
+
     // TyKind::Infer
     c1!(ty, [ _ ], "_");
+ 
+    // TyKind::ImplicitSelf: there is no syntax for this.
 
     // TyKind::MacCall
     c2!(ty, [ mac!(...) ], "mac!(...)", "mac! (...)");
     c2!(ty, [ mac![...] ], "mac![...]", "mac! [...]");
     c1!(ty, [ mac! { ... } ], "mac! { ... }");
+
+    // TyKind::Err: untestable.
+
+    // TyKind::CVarArgs
+    // FIXME: todo
 }
 
 #[test]