Special case fixup spans in server::Span impl, they are immutable

This commit is contained in:
Lukas Wirth 2023-12-22 09:39:55 +01:00
parent 2e52aa1615
commit 9e8e124269
6 changed files with 67 additions and 38 deletions

View file

@ -30,6 +30,13 @@ pub type ErasedFileAstId = la_arena::Idx<syntax::SyntaxNodePtr>;
pub const ROOT_ERASED_FILE_AST_ID: ErasedFileAstId =
la_arena::Idx::from_raw(la_arena::RawIdx::from_u32(0));
/// FileId used as the span for syntax node fixups. Any Span containing this file id is to be
/// considered fake.
pub const FIXUP_ERASED_FILE_AST_ID_MARKER: ErasedFileAstId =
// we pick the second to last for this in case we every consider making this a NonMaxU32, this
// is required to be stable for the proc-macro-server
la_arena::Idx::from_raw(la_arena::RawIdx::from_u32(!0 - 1));
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
pub struct SpanData<Ctx> {
/// The text range of this span, relative to the anchor.