rust-lang/rust · error · syn::Error
if `all` is specified, no other type identifiers may be give
Error message
if `all` is specified, no other type identifiers may be given
What it means
`emit_types` accepts either the single keyword `all` or an explicit list of type identifiers (lib.rs:258-284). When `all` appears, validate() sets add_all_types and then asserts emit_types has length 1; any companion identifier makes the request ambiguous and is rejected.
Source
Thrown at library/compiler-builtins/crates/libm-macros/src/lib.rs:279
if ty_name == "all" {
add_all_types = true;
continue;
}
// Check that all requested types are valid
if !KNOWN_TYPES.contains(&ty_name.as_str()) {
let e = syn::Error::new(
ty_name.span(),
format!("unrecognized type identifier `{ty_name}`"),
);
return Err(e);
}
}
if add_all_types {
// Ensure that if `all` was specified that nothing else was
if input.emit_types.len() > 1 {
let e = syn::Error::new(
input.emit_types_span.unwrap(),
"if `all` is specified, no other type identifiers may be given",
);
return Err(e);
}
// ...and then add all types
input.emit_types.clear();
for ty in KNOWN_TYPES {
let ident = Ident::new(ty, Span::call_site());
input.emit_types.push(ident);
}
}
if let Some(map) = &input.fn_extra
&& !map.keys().any(|key| key == "_")
{
// No default provided; make sure every expected function is coveredView on GitHub (pinned to 7088e4b63a)
Solutions
- Use emit_types: all by itself.
- Or drop `all` and list each of the seven known types explicitly.
Example fix
// before emit_types: [all, CFn], // after emit_types: all,
Defensive patterns
Strategy: validation
Prevention
- Treat `all` as mutually exclusive with every other emit_types entry.
- If you need to document which types `all` expands to, put that in a comment, not in the list.
When it happens
Trigger: Writing `emit_types: [all, CFn]`, `emit_types: [CFn, all]`, or otherwise mixing the `all` keyword with other type identifiers.
Common situations: Appending a type to an existing `all` entry, or trying to be explicit alongside `all` for clarity.
Related errors
- unrecognized type identifier `{ty_name}`
- `fn_extra`: no default `_` pattern specified and the followi
- unrecognized meta expression `{s}`
- unexpected fields {map:?}
- `fn_extra` expects a match expression
AI-assisted analysis of rust-lang/rust@7088e4b63a (2026-08-10).
Data as JSON: /api/errors/a6b5c8f4cc1eedc8.
Report an issue: GitHub.