{"record":{"id":"99c2ad21f00f148a","repo":"bevyengine/bevy","slug":"consts-are-not-currently-supported-in-this-positio","errorCode":null,"errorMessage":"Consts are not currently supported in this position","messagePattern":"Consts are not currently supported in this position","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"crates/bevy_scene/macros/src/bsn/parse.rs","lineNumber":150,"sourceCode":"                            enum_variant,\n                            fields,\n                        };\n                        if is_template {\n                            BsnEntry::TemplatePatch(bsn_type)\n                        } else {\n                            BsnEntry::FromTemplatePatch(bsn_type)\n                        }\n                    }\n                }\n                PathType::TypeConst => {\n                    let const_ident = take_last_path_ident(&mut path).unwrap();\n                    BsnEntry::TemplateConst {\n                        type_path: path,\n                        const_ident,\n                    }\n                }\n                PathType::Const => {\n                    return Err(syn::Error::new(\n                        path.span(),\n                        \"Consts are not currently supported in this position\",\n                    ))\n                }\n                PathType::TypeFunction => {\n                    let function = take_last_path_ident(&mut path).unwrap();\n                    let args = input.parse::<BsnFnArgs>()?;\n                    let bsn_constructor = BsnConstructor {\n                        type_path: path,\n                        function,\n                        args,\n                    };\n                    if is_template {\n                        BsnEntry::TemplateConstructor(bsn_constructor)\n                    } else {\n                        BsnEntry::FromTemplateConstructor(bsn_constructor)\n                    }\n                }","sourceCodeStart":132,"sourceCodeEnd":168,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_scene/macros/src/bsn/parse.rs#L132-L168","documentation":"When a BSN entry is parsed as a plain path, PathType::new classifies it. A bare const path (PathType::Const — a lone identifier resolving to a constant, not associated with a type) is rejected in entry position with this compile-time syn::Error. Only types, enum variants, associated consts (Type::CONST, PathType::TypeConst) and functions are accepted there.","triggerScenarios":"Writing bsn!(MY_CONST) or bsn!(MY_PATH::CONST) where the last segment is a free-standing const (e.g. a crate-level constant), instead of an associated const on a type.","commonSituations":"Trying to reference pre-made component values as consts in BSN; confusing a module-level const with a type's associated const; name collisions where an uppercase identifier is actually a const.","solutions":["Use an associated const on a type: bsn!(MyType::MY_CONST) — PathType::TypeConst is supported as a template const","Or wrap the value in a component/scene-component form the macro supports (e.g. @MySceneComponent or a function call constructor MyType::new(args))"],"exampleFix":"// before\nconst PLAYER_SPAWN: Spawn = ...;\nbsn!(PLAYER_SPAWN); // PathType::Const -> error\n\n// after\nimpl Player { const SPAWN: Spawn = ...; }\nbsn!(Player::SPAWN); // PathType::TypeConst -> template const","handlingStrategy":"type-guard","validationCode":"// Before using a const in BSN, make it an associated const:\n// impl MyType { pub const VALUE: MyType = ...; }\n// then reference MyType::VALUE, which parses as PathType::TypeConst.","typeGuard":"fn is_associated_const(path: &str) -> bool {\n    path.split(\"::\").count() >= 2\n}","tryCatchPattern":null,"preventionTips":["Use Type::CONST (associated const) instead of free consts in BSN entries","Uppercase single-segment identifiers in BSN are treated as consts and rejected — prefer types or functions"],"tags":["bevy","bsn","proc-macro","const","compile-error"],"backgroundTag":"proc-macro-syntax-error","analyzedSha":"396ca727080776bd313bb892423b7d94e03b81b4","analyzedAt":"2026-08-20T16:12:39.808Z","contentChangedAt":"2026-08-20T16:12:39.808Z","schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}