{"record":{"id":"cc447b4a35380277","repo":"swc-project/swc","slug":"derive-merge-does-not-support-a-unit-struct","errorCode":null,"errorMessage":"derive(Merge) does not support a unit struct","messagePattern":"derive\\(Merge\\) does not support a unit struct","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/swc_config_macro/src/merge.rs","lineNumber":51,"sourceCode":"        parse_quote!(swc_config::merge::Merge::merge(&mut #l, #r))\n    }\n\n    match fields {\n        Fields::Named(fs) => fs\n            .named\n            .iter()\n            .enumerate()\n            .map(|(idx, f)| call_merge(obj, idx, f))\n            .map(|expr| Stmt::Expr(expr, Some(Token![;](fs.brace_token.span.join()))))\n            .collect(),\n        Fields::Unnamed(fs) => fs\n            .unnamed\n            .iter()\n            .enumerate()\n            .map(|(idx, f)| call_merge(obj, idx, f))\n            .map(|expr| Stmt::Expr(expr, Some(Token![;](fs.paren_token.span.join()))))\n            .collect(),\n        Fields::Unit => unimplemented!(\"derive(Merge) does not support a unit struct\"),\n    }\n}\n","sourceCodeStart":33,"sourceCodeEnd":54,"githubUrl":"https://github.com/swc-project/swc/blob/5176682b65416c6b5de6b47379ae1588ea3ecb3f/crates/swc_config_macro/src/merge.rs#L33-L54","documentation":"A derive-macro validation abort in call_merge_for_fields (swc_config_macro merge.rs:51). The helper generates merge calls for named, unnamed, and no-field cases; when the Fields value is a unit struct (Fields::Unit), there are no fields to merge and the codegen path panics with 'derive(Merge) does not support a unit struct'. The unit struct annotated with #[derive(Merge)] is the input at fault.","triggerScenarios":"Thrown at crates/swc_config_macro/src/merge.rs:51 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add meaningful fields to the struct, or drop the Merge derive if the type has nothing to merge","Implement an empty merge body for Fields::Unit (it is trivially a no-op) and remove the panic","Report the unsupported shape with a spanned compile_error! naming the struct"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5176682b65416c6b5de6b47379ae1588ea3ecb3f","analyzedAt":"2026-08-17T16:16:52.067Z","contentChangedAt":"2026-08-17T16:16:52.067Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}