{"record":{"id":"234f5166da904571","repo":"rust-lang/rust","slug":"only-one-of-skip-or-only-may-be-specified","errorCode":null,"errorMessage":"only one of `skip` or `only` may be specified","messagePattern":"only one of `skip` or `only` may be specified","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"library/compiler-builtins/crates/libm-macros/src/lib.rs","lineNumber":207,"sourceCode":"        .skip\n        .iter()\n        .chain(only_mentions)\n        .chain(attr_mentions)\n        .chain(fn_extra_mentions);\n\n    // Make sure that every function mentioned is a real function\n    for mentioned in all_mentioned_fns {\n        if !ALL_OPERATIONS.iter().any(|func| mentioned == func.name) {\n            let e = syn::Error::new(\n                mentioned.span(),\n                format!(\"unrecognized function name `{mentioned}`\"),\n            );\n            return Err(e);\n        }\n    }\n\n    if !input.skip.is_empty() && input.only.is_some() {\n        let e = syn::Error::new(\n            input.only_span.unwrap(),\n            \"only one of `skip` or `only` may be specified\",\n        );\n        return Err(e);\n    }\n\n    // Construct a list of what we intend to expand\n    let mut fn_list = Vec::new();\n    for func in ALL_OPERATIONS.iter() {\n        let fn_name = func.name;\n        // If we have an `only` list and it does _not_ contain this function name, skip it\n        if input\n            .only\n            .as_ref()\n            .is_some_and(|only| !only.iter().any(|o| o == fn_name))\n        {\n            continue;\n        }","sourceCodeStart":189,"sourceCodeEnd":225,"githubUrl":"https://github.com/rust-lang/rust/blob/7088e4b63a9516ebfbfe2ab2d999cf01a528ac14/library/compiler-builtins/crates/libm-macros/src/lib.rs#L189-L225","documentation":"Thrown by `for_each_function!`'s `validate` (lib.rs:207) when both `skip` and `only` are specified. These are mutually exclusive filters — `only` already fully determines the set, so `skip` is redundant and ambiguous.","triggerScenarios":"Writing a `for_each_function!` invocation that contains both a `skip: [...]` field and an `only: [...]` field.","commonSituations":"Incrementally adding an `only` list to narrow scope while forgetting to remove an earlier `skip`, or vice versa.","solutions":["Choose one filter: use `only: [...]` to include a specific set, or `skip: [...]` to exclude from the full set.","Remove whichever field is not intended."],"exampleFix":"// before\nlibm_macros::for_each_function! {\n    callback: cb,\n    skip: [sin],\n    only: [cos, sin],\n}\n\n// after\nlibm_macros::for_each_function! {\n    callback: cb,\n    only: [cos, sin],\n}","handlingStrategy":"validation","validationCode":"// Ensure at most one of skip/only is set in the macro invocation.\n// (Static check: if you template-generate the macro call, branch on which filter is needed.)\nlet (skip, only) = if let Some(set) = only_set {\n    (vec![], Some(set))      // use only\n} else {\n    (skip_set, None)         // use skip\n};","typeGuard":null,"tryCatchPattern":null,"preventionTips":["skip and only are mutually exclusive; never specify both.","When narrowing scope, replace skip with only rather than layering them."],"tags":["proc-macro","libm","for-each-function","validation"],"backgroundTag":null,"analyzedSha":"7088e4b63a9516ebfbfe2ab2d999cf01a528ac14","analyzedAt":"2026-08-10T14:17:03.603Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}