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!(), } } }