{"record":{"id":"109185259b80688c","repo":"rust-lang/rust","slug":"fn-extra-no-default-pattern-specified-and-t","errorCode":null,"errorMessage":"`fn_extra`: no default `_` pattern specified and the following patterns are not covered: {fns_not_covered:#?}","messagePattern":"`fn_extra`: no default `_` pattern specified and the following patterns are not covered: (.+?)","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"library/compiler-builtins/crates/libm-macros/src/lib.rs","lineNumber":307,"sourceCode":"            let ident = Ident::new(ty, Span::call_site());\n            input.emit_types.push(ident);\n        }\n    }\n\n    if let Some(map) = &input.fn_extra\n        && !map.keys().any(|key| key == \"_\")\n    {\n        // No default provided; make sure every expected function is covered\n        let mut fns_not_covered = Vec::new();\n        for func in &fn_list {\n            if !map.keys().any(|key| key == func.name) {\n                // `name` was not mentioned in the `match` statement\n                fns_not_covered.push(func);\n            }\n        }\n\n        if !fns_not_covered.is_empty() {\n            let e = syn::Error::new(\n                input.fn_extra_span.unwrap(),\n                format!(\n                    \"`fn_extra`: no default `_` pattern specified and the following \\\n                     patterns are not covered: {fns_not_covered:#?}\"\n                ),\n            );\n            return Err(e);\n        }\n    };\n\n    Ok(fn_list)\n}\n\n/// Expand our structured macro input into invocations of the callback macro.\nfn expand(input: StructuredInput, fn_list: &[&MathOpInfo]) -> syn::Result<pm2::TokenStream> {\n    let mut out = pm2::TokenStream::new();\n    let default_ident = Ident::new(\"_\", Span::call_site());\n    let callback = input.callback;","sourceCodeStart":289,"sourceCodeEnd":325,"githubUrl":"https://github.com/rust-lang/rust/blob/7088e4b63a9516ebfbfe2ab2d999cf01a528ac14/library/compiler-builtins/crates/libm-macros/src/lib.rs#L289-L325","documentation":"The `fn_extra` field maps each function to a per-invocation expression via a `match MACRO_FN_NAME { ... }`. If no `_ =>` default arm is supplied, validate() requires every function in the expansion set to have an explicit arm (lib.rs:294-316); otherwise expansion would unwrap a missing map entry. The error lists the uncovered functions.","triggerScenarios":"Providing `fn_extra: match MACRO_FN_NAME { sin => ... }` with no `_ =>` arm while the macro expands for functions beyond `sin` (i.e. they are not all skipped or excluded via only).","commonSituations":"Editing skip/only so the expanded function set changes and the explicit arms no longer cover it; forgetting the default arm; renaming a function.","solutions":["Add a `_ => <expr>` default arm to the fn_extra match.","Add explicit arms for every function named in the error's fns_not_covered list.","Narrow the expansion with skip/only so only the functions you have arms for are emitted."],"exampleFix":"// before\nfn_extra: match MACRO_FN_NAME {\n    sin => |x| x.sin(),\n},\n// after\nfn_extra: match MACRO_FN_NAME {\n    sin => |x| x.sin(),\n    _ => |x| x,\n},","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always include a `_ =>` default arm unless you intentionally enumerate every function.","When changing skip/only, re-check that fn_extra arms still cover the expansion set."],"tags":["rust","proc-macro","libm","compile-time","validation"],"backgroundTag":null,"analyzedSha":"7088e4b63a9516ebfbfe2ab2d999cf01a528ac14","analyzedAt":"2026-08-10T14:17:03.603Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}