From 012b1729a03d4a4393b3c30fa4317f6d40f96bb7 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Mon, 30 Jan 2023 10:01:13 -0800 Subject: [PATCH] Make Lit enum non-exhaustive --- src/lit.rs | 1 + syn.json | 3 ++- tests/debug/gen.rs | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lit.rs b/src/lit.rs index acade49413..45776b1187 100644 --- a/src/lit.rs +++ b/src/lit.rs @@ -19,6 +19,7 @@ ast_enum_of_structs! { /// This type is a [syntax tree enum]. /// /// [syntax tree enum]: crate::Expr#syntax-tree-enums + #[non_exhaustive] pub enum Lit { /// A UTF-8 string literal: `"foo"`. Str(LitStr), diff --git a/syn.json b/syn.json index 1b470cd421..d46b3ed6de 100644 --- a/syn.json +++ b/syn.json @@ -3381,7 +3381,8 @@ "proc_macro2": "Literal" } ] - } + }, + "exhaustive": false }, { "ident": "LitBool", diff --git a/tests/debug/gen.rs b/tests/debug/gen.rs index ac9cc7d457..3af6f33f12 100644 --- a/tests/debug/gen.rs +++ b/tests/debug/gen.rs @@ -3589,6 +3589,7 @@ impl Debug for Lite { formatter.write_str("`)")?; Ok(()) } + _ => unreachable!(), } } }