We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e16e8cd commit cf6bb2aCopy full SHA for cf6bb2a
1 file changed
impl/src/types/fmt/mod.rs
@@ -287,4 +287,19 @@ mod tests {
287
"expected `display` to be a list attribute: `#[display(\"template...\")]`"
288
);
289
}
290
+
291
+ #[test]
292
+ fn union_type_is_rejected() {
293
+ let derive_input = syn::parse2::<DeriveInput>(
294
+ quote! { union CustomType { f1: u32, f2: f32 } },
295
+ )
296
+ .expect("malformed test stream");
297
+ let err = FormatData::new(&derive_input).expect_err(
298
+ "stream with union type was parsed successfully as FormatData",
299
+ );
300
+ assert_eq!(
301
+ err.to_string(),
302
+ "`#[derive(Error)]` only supports structs and enums"
303
304
+ }
305
0 commit comments