Newtype ErasedFileAstId

This commit is contained in:
Lukas Wirth 2024-08-03 19:16:56 +02:00
parent fcb88832de
commit 188c577855
13 changed files with 52 additions and 39 deletions

View file

@ -21,15 +21,14 @@ pub use vfs::FileId;
/// The root ast id always points to the encompassing file, using this in spans is discouraged as
/// any range relative to it will be effectively absolute, ruining the entire point of anchored
/// relative text ranges.
pub const ROOT_ERASED_FILE_AST_ID: ErasedFileAstId =
la_arena::Idx::from_raw(la_arena::RawIdx::from_u32(0));
pub const ROOT_ERASED_FILE_AST_ID: ErasedFileAstId = ErasedFileAstId::from_raw(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
// we pick the second to last for this in case we ever 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));
ErasedFileAstId::from_raw(!0 - 1);
pub type Span = SpanData<SyntaxContextId>;