about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2023-01-15 22:36:46 +0000
committerEsteban Küber <esteban@kuber.com.ar>2023-01-17 01:58:32 +0000
commit2791cc37e6f882f8ab7fa6c234885be652f930c5 (patch)
tree4c6c8e325f6578884532e7c6880f28099dc8c3de
parent19c2286d5c0fe45765cb6bd182b32722173b0942 (diff)
downloadrust-2791cc37e6f882f8ab7fa6c234885be652f930c5.tar.gz
rust-2791cc37e6f882f8ab7fa6c234885be652f930c5.zip
Teach parser to understand fake anonymous enum syntax
Parse `-> Ty | OtherTy`.
Parse type ascription in top level patterns.
-rw-r--r--src/types.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/types.rs b/src/types.rs
index c1991e8d2c8..f065ec680d7 100644
--- a/src/types.rs
+++ b/src/types.rs
@@ -839,7 +839,9 @@ impl Rewrite for ast::Ty {
                 })
             }
             ast::TyKind::CVarArgs => Some("...".to_owned()),
-            ast::TyKind::Err => Some(context.snippet(self.span).to_owned()),
+            ast::TyKind::AnonEnum(_) | ast::TyKind::Err => {
+                Some(context.snippet(self.span).to_owned())
+            }
             ast::TyKind::Typeof(ref anon_const) => rewrite_call(
                 context,
                 "typeof",