{"record":{"id":"62148f569780b6c1","repo":"rust-lang/rust-analyzer","slug":"attempted-to-serialize-value-that-set-persist-to","errorCode":null,"errorMessage":"attempted to serialize value that set `PERSIST` to false","messagePattern":"attempted to serialize value that set `PERSIST` to false","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/span/src/hygiene.rs","lineNumber":122,"sourceCode":"        }\n    }\n\n    // SAFETY: `Self::Fields`, i.e. `SyntaxContextData`, doesn't contain any lifetimes.\n    unsafe impl zalsa_struct_::Configuration for SyntaxContext {\n        const LOCATION: salsa::plumbing::Location =\n            salsa::plumbing::Location { file: file!(), line: line!() };\n        const DEBUG_NAME: &'static str = \"SyntaxContextData\";\n        const REVISIONS: std::num::NonZeroUsize = std::num::NonZeroUsize::MAX;\n        const PERSIST: bool = false;\n\n        type Fields<'a> = SyntaxContextData;\n        type Struct<'a> = SyntaxContext;\n\n        fn serialize<S>(_: &Self::Fields<'_>, _: S) -> Result<S::Ok, S::Error>\n        where\n            S: zalsa_::serde::Serializer,\n        {\n            unimplemented!(\"attempted to serialize value that set `PERSIST` to false\")\n        }\n\n        fn deserialize<'de, D>(_: D) -> Result<Self::Fields<'static>, D::Error>\n        where\n            D: zalsa_::serde::Deserializer<'de>,\n        {\n            unimplemented!(\"attempted to deserialize value that cannot set `PERSIST` to false\");\n        }\n    }\n\n    impl SyntaxContext {\n        pub fn ingredient(zalsa: &zalsa_::Zalsa) -> &zalsa_struct_::IngredientImpl<Self> {\n            static CACHE: zalsa_::IngredientCache<zalsa_struct_::IngredientImpl<SyntaxContext>> =\n                zalsa_::IngredientCache::new();\n\n            // SAFETY: The ingredient at offset 0 in `JarImpl<SyntaxContext>` has type\n            // `IngredientImpl<SyntaxContext>`.\n            unsafe { CACHE.get_or_create::<zalsa_struct_::JarImpl<SyntaxContext>, 0>(zalsa) }","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/rust-lang/rust-analyzer/blob/e8f7e90aa3e7b26aa9a000200f606c1078da99ec/crates/span/src/hygiene.rs#L104-L140","documentation":"A deliberate `unimplemented!()` sentinel in the salsa `Configuration::serialize` impl for `SyntaxContext`: the struct sets `PERSIST = false`, so salsa never persists it to the database and serialization is never expected to be called. Seeing this panic means some code path asked salsa to serialize a `SyntaxContext` even though the configuration declared it non-persistent.","triggerScenarios":"Thrown at crates/span/src/hygiene.rs:122 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Audit how the serialization request reached a PERSIST=false struct; the caller is misconfigured (e.g. marking a dependent struct as persistent without opting fields out)","If serialization of this type genuinely becomes required, implement a real serializer instead of the `unimplemented!()` stub","Keep PERSIST=false types out of any query inputs/outputs that get serialized by construction"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e8f7e90aa3e7b26aa9a000200f606c1078da99ec","analyzedAt":"2026-09-03T21:08:06.959Z","contentChangedAt":"2026-09-03T21:08:06.959Z","schemaVersion":2},"datasetVersion":"2026-09-11T07:07:21.782Z"}