Adjust for salsa::Id::from_u32() being unsafe

This impacts our manual `salsa::Id` wrappers. I refactored them a bit to improve safety.
This commit is contained in:
Chayim Refael Friedman 2025-04-14 00:55:27 +03:00
parent 2bba385dda
commit db72e2ff41
5 changed files with 80 additions and 183 deletions

View file

@ -72,7 +72,9 @@ pub fn deserialize_span_data_index_map(map: &[u32]) -> SpanDataIndexMap {
ast_id: ErasedFileAstId::from_raw(ast_id),
},
range: TextRange::new(start.into(), end.into()),
ctx: SyntaxContext::from_u32(e),
// SAFETY: We only receive spans from the server. If someone mess up the communication UB can happen,
// but that will be their problem.
ctx: unsafe { SyntaxContext::from_u32(e) },
}
})
.collect()