rust-lang/rust · error · syn::Error
unrecognized function name `{mentioned}`
Error message
unrecognized function name `{mentioned}` What it means
Thrown by the `for_each_function!` macro's `validate` (lib.rs:198) when a function name mentioned in `skip`, `only`, `attributes`, or `fn_extra` does not match any entry in the global `ALL_OPERATIONS` list. Every referenced name must be a real libm operation.
Source
Thrown at library/compiler-builtins/crates/libm-macros/src/lib.rs:198
.flat_map(|map_list| map_list.iter())
.flat_map(|attr_map| attr_map.names.iter());
let only_mentions = input.only.iter().flat_map(|only_list| only_list.iter());
let fn_extra_mentions = input
.fn_extra
.iter()
.flat_map(|v| v.keys())
.filter(|name| *name != "_");
let all_mentioned_fns = input
.skip
.iter()
.chain(only_mentions)
.chain(attr_mentions)
.chain(fn_extra_mentions);
// Make sure that every function mentioned is a real function
for mentioned in all_mentioned_fns {
if !ALL_OPERATIONS.iter().any(|func| mentioned == func.name) {
let e = syn::Error::new(
mentioned.span(),
format!("unrecognized function name `{mentioned}`"),
);
return Err(e);
}
}
if !input.skip.is_empty() && input.only.is_some() {
let e = syn::Error::new(
input.only_span.unwrap(),
"only one of `skip` or `only` may be specified",
);
return Err(e);
}
// Construct a list of what we intend to expand
let mut fn_list = Vec::new();
for func in ALL_OPERATIONS.iter() {View on GitHub (pinned to 7088e4b63a)
Solutions
- Check the name against the current `ALL_OPERATIONS` list (or the crate's exported symbols).
- Remove or correct the misspelled name.
- Use the magic matchers (`ALL_F32`, `ALL_F64`, etc.) instead of listing names to avoid typos.
Example fix
// before
libm_macros::for_each_function! {
callback: cb,
skip: [nonexistent_fn],
}
// after
libm_macros::for_each_function! {
callback: cb,
skip: [sin],
} Defensive patterns
Strategy: validation
Validate before calling
// Before adding a name to skip/only/attributes/fn_extra, confirm it is a real operation.
// (The authoritative list is api_list_common::ALL_OPERATIONS; cross-check the symbol export list.)
fn is_known(name: &str) -> bool {
ALL_OPERATIONS.iter().any(|op| op.name == name)
} Prevention
- Cross-check every function name against ALL_OPERATIONS / the exported symbol list.
- Prefer ALL_F32/ALL_F64/etc. group matchers over listing names manually.
When it happens
Trigger: Typing a non-existent function in `skip: [xyz]`, `only: [foo]`, an `attributes` block, or an `fn_extra` match arm — any name not present in `ALL_OPERATIONS`.
Common situations: Renaming/removing a libm symbol upstream; typos; referencing a function by a C name that differs from its registered operation name.
Related errors
- only one of `skip` or `only` may be specified
- expected one attribute
- expected an identifier
- unexpected token after identifier
- no attributes expected
AI-assisted analysis of rust-lang/rust@7088e4b63a (2026-08-10).
Data as JSON: /api/errors/8678b49bf07d6273.
Report an issue: GitHub.