{"record":{"id":"22f62a1aab6deb3a","repo":"diesel-rs/diesel","slug":"unsupported-literal-for-auto-type-please-provide","errorCode":null,"errorMessage":"unsupported literal for auto_type, please provide a type hint","messagePattern":"unsupported literal for auto_type, please provide a type hint","errorType":"exception","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"dsl_auto_type/src/auto_type/expression_type_inference.rs","lineNumber":252,"sourceCode":"                                turbofish.as_ref(),\n                            )?,\n                        }])\n                        .collect(),\n                    leading_colon: None,\n                },\n                qself: None,\n                attrs: Vec::new(),\n            }),\n            (syn::Expr::Lit(syn::ExprLit { lit, .. }), None) => match lit {\n                syn::Lit::Str(_) => parse_quote_spanned!(lit.span()=> &'static str),\n                syn::Lit::ByteStr(_) => parse_quote_spanned!(lit.span()=> &'static [u8]),\n                syn::Lit::Byte(_) => parse_quote_spanned!(lit.span()=> u8),\n                syn::Lit::Char(_) => parse_quote_spanned!(lit.span()=> char),\n                syn::Lit::Int(lit_int) => literal_type(&lit_int.token())?,\n                syn::Lit::Float(lit_float) => literal_type(&lit_float.token())?,\n                syn::Lit::Bool(_) => parse_quote_spanned!(lit.span()=> bool),\n                _ => {\n                    return Err(syn::Error::new(\n                        lit.span(),\n                        \"unsupported literal for auto_type, please provide a type hint\",\n                    ));\n                }\n            },\n            (syn::Expr::Block(syn::ExprBlock { block, .. }), type_hint) => {\n                match block.stmts.last() {\n                    None\n                    | Some(\n                        syn::Stmt::Local(_) | syn::Stmt::Item(_) | syn::Stmt::Expr(_, Some(_)),\n                    ) => {\n                        // Empty blocks, local variables (`let`) and other item definition as last\n                        // statement, as well as expressions BUT with a semicolon, lead to the\n                        // block having unit type.\n                        match type_hint {\n                            Some(type_hint) => {\n                                // Prefer user-specified type hint to our own inference\n                                type_hint.clone()","sourceCodeStart":234,"sourceCodeEnd":270,"githubUrl":"https://github.com/diesel-rs/diesel/blob/6fa6ed01b24b24248ab2a611698d0a7c6a2e9120/dsl_auto_type/src/auto_type/expression_type_inference.rs#L234-L270","documentation":"Compile-time error from dsl_auto_type's type inference. try_infer_expression_type can infer types for string/byte-string/byte/int/float literals and method calls, but for other literal kinds (e.g. char or bool literals) it has no inference rule and reports that the user must provide an explicit type hint. Fix: annotate the item with an explicit type (via the type hint option of dsl_auto_type) or restructure the expression.","triggerScenarios":"Thrown at dsl_auto_type/src/auto_type/expression_type_inference.rs:252 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide an explicit type hint for the literal","Replace the literal with an expression whose type is known","Use a typed helper such as `TypedNumeric` or an `AsExpression` wrapper"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6fa6ed01b24b24248ab2a611698d0a7c6a2e9120","analyzedAt":"2026-09-07T01:50:13.074Z","contentChangedAt":"2026-09-07T01:50:13.074Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}