mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 04:19:13 +00:00
hygiene 2.0
This commit is contained in:
parent
e36b3f7b8c
commit
05f375eae2
43 changed files with 758 additions and 458 deletions
|
@ -17,9 +17,18 @@ pub struct SyntaxContextId(InternId);
|
|||
crate::impl_intern_key!(SyntaxContextId);
|
||||
|
||||
impl SyntaxContext for SyntaxContextId {
|
||||
const DUMMY: Self = Self::ROOT;
|
||||
// veykril(HACK): salsa doesn't allow us fetching the id of the current input to be allocated so
|
||||
// we need a special value that behaves as the current context.
|
||||
}
|
||||
// inherent trait impls please tyvm
|
||||
impl SyntaxContextId {
|
||||
// FIXME: 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!)
|
||||
const DUMMY: Self = SyntaxContextId(unsafe { core::mem::transmute(1) });
|
||||
pub const ROOT: Self = SyntaxContextId(unsafe { core::mem::transmute(1) });
|
||||
// FIXME: 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) });
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Hash)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue