Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/base-db/src/span.rs')
-rw-r--r--crates/base-db/src/span.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/crates/base-db/src/span.rs b/crates/base-db/src/span.rs
index 370c732813..607b8027ca 100644
--- a/crates/base-db/src/span.rs
+++ b/crates/base-db/src/span.rs
@@ -33,10 +33,11 @@ impl SyntaxContext for SyntaxContextId {
impl SyntaxContextId {
// TODO: This is very much UB, salsa exposes no way to create an InternId in a const context
// currently (which kind of makes sense but we need it here!)
- pub const ROOT: Self = SyntaxContextId(unsafe { core::mem::transmute(1) });
+ pub const ROOT: Self = SyntaxContextId(unsafe { InternId::new_unchecked(0) });
// TODO: This is very much UB, salsa exposes no way to create an InternId in a const context
// currently (which kind of makes sense but we need it here!)
- pub const SELF_REF: Self = SyntaxContextId(unsafe { core::mem::transmute(!0u32) });
+ pub const SELF_REF: Self =
+ SyntaxContextId(unsafe { InternId::new_unchecked(InternId::MAX - 1) });
pub fn is_root(self) -> bool {
self == Self::ROOT
@@ -107,6 +108,7 @@ impl fmt::Debug for HirFileId {
pub struct MacroFileId {
pub macro_call_id: MacroCallId,
}
+
/// `MacroCallId` identifies a particular macro invocation, like
/// `println!("Hello, {}", world)`.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]