diesel-rs/diesel · error

only `true` is accepted in this position. If you want to…

Error message

only `true` is accepted in this position. If you want to enable these checks, just skip the attribute entirely

What it means

After `disable`, only the literal `true` is accepted. The offending input is the boolean literal supplied in the attribute; `false` is meaningless because omitting the attribute already enables the checks.

Solutions

  1. Use `disable = true`
  2. Remove the attribute entirely to keep checks enabled
  3. Do not supply `false` in this position
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at diesel_attribute_parser/src/lib.rs:463 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of diesel-rs/diesel@6fa6ed01b2 (2026-09-07). Data as JSON: /api/errors/e8ee75beb0d51fe8. Report an issue: GitHub.

Appendix: source

Thrown at diesel_attribute_parser/src/lib.rs:463

    Ok(out)
}

struct DisabledCheckForBackend {
    value: LitBool,
}

impl syn::parse::Parse for DisabledCheckForBackend {
    fn parse(input: ParseStream) -> Result<Self> {
        let ident = input.parse::<Ident>()?;
        if ident != "disable" {
            return Err(syn::Error::new(
                ident.span(),
                format!("expected `disable`, but got `{ident}`"),
            ));
        }
        let lit = parse_eq::<LitBool>(input, "")?;
        if !lit.value {
            return Err(syn::Error::new(
                lit.span(),
                "only `true` is accepted in this position. \
                 If you want to enable these checks, just skip the attribute entirely",
            ));
        }
        Ok(Self { value: lit })
    }
}

#[derive(Debug, Clone, Copy)]
#[allow(clippy::enum_variant_names)]
pub enum RenameVariants {
    LowerCase,
    UpperCase,
    PascalCase,
    CamelCase,
    SnakeCase,
    ScreamingSnakeCase,

View on GitHub (pinned to 6fa6ed01b2)