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 covered

View on GitHub (pinned to 7088e4b63a)

Solutions

  1. Use emit_types: all by itself.
  2. 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

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


AI-assisted analysis of rust-lang/rust@7088e4b63a (2026-08-10). Data as JSON: /api/errors/a6b5c8f4cc1eedc8. Report an issue: GitHub.