{"record":{"id":"3bcfbd7d2167c296","repo":"bevyengine/bevy","slug":"lifetimes-must-be-static","errorCode":null,"errorMessage":"Lifetimes must be 'static","messagePattern":"Lifetimes must be 'static","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/bevy_ecs/macro_logic/src/component.rs","lineNumber":194,"sourceCode":"        Ok(attrs)\n    }\n\n    /// Generates a new `Component` trait implementation from this specification.\n    ///\n    /// Note that this will add Send + Sync + 'static to the where clause\n    pub fn impl_component(\n        self,\n        ast: &mut DeriveInput,\n        bevy_ecs: &Path,\n        default_storage: StorageTy,\n    ) -> Result<TokenStream> {\n        // We want to raise a compile time error when the generic lifetimes\n        // are not bound to 'static lifetime\n        let non_static_lifetime_error = ast\n            .generics\n            .lifetimes()\n            .filter(|lifetime| !lifetime.bounds.iter().any(|bound| bound.ident == \"static\"))\n            .map(|param| syn::Error::new(param.span(), \"Lifetimes must be 'static\"))\n            .reduce(|mut err_acc, err| {\n                err_acc.combine(err);\n                err_acc\n            });\n        if let Some(err) = non_static_lifetime_error {\n            return Err(err);\n        }\n\n        let relationship = match self.derive_relationship(ast, bevy_ecs) {\n            Ok(value) => value,\n            Err(err) => Some(err.into_compile_error()),\n        };\n        let relationship_target = match self.derive_relationship_target(ast, bevy_ecs) {\n            Ok(value) => value,\n            Err(err) => Some(err.into_compile_error()),\n        };\n\n        let map_entities = map_entities(","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_ecs/macro_logic/src/component.rs#L176-L212","documentation":"Compile-time error from impl_component: the deriving type has generic lifetime parameters not bounded by 'static. Components must be 'static for storage in the ECS, so the derive adds a 'static requirement and fails when lifetimes cannot satisfy it.","triggerScenarios":"Thrown at crates/bevy_ecs/macro_logic/src/component.rs:194 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add a 'static bound to the component's lifetimes (usually by requiring T: 'static style bounds)","Use owned data (e.g. Box<str>, Arc) instead of borrowed lifetimes"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"396ca727080776bd313bb892423b7d94e03b81b4","analyzedAt":"2026-08-20T16:12:39.808Z","contentChangedAt":"2026-08-20T16:12:39.808Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}