mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 20:42:04 +00:00
fix: Syntax fixup now removes subtrees with fake spans
This commit is contained in:
parent
96f660813c
commit
4c45d23948
5 changed files with 54 additions and 14 deletions
|
@ -61,13 +61,17 @@ pub use paths::{AbsPath, AbsPathBuf};
|
|||
/// Most functions in rust-analyzer use this when they need to refer to a file.
|
||||
#[derive(Copy, Clone, Debug, Ord, PartialOrd, Eq, PartialEq, Hash)]
|
||||
pub struct FileId(u32);
|
||||
// pub struct FileId(NonMaxU32);
|
||||
|
||||
impl FileId {
|
||||
/// Think twice about using this outside of tests. If this ends up in a wrong place it will cause panics!
|
||||
// FIXME: To be removed once we get rid of all `SpanData::DUMMY` usages.
|
||||
pub const BOGUS: FileId = FileId(0xe4e4e);
|
||||
pub const MAX_FILE_ID: u32 = 0x7fff_ffff;
|
||||
|
||||
#[inline]
|
||||
pub fn from_raw(raw: u32) -> FileId {
|
||||
pub const fn from_raw(raw: u32) -> FileId {
|
||||
assert!(raw <= Self::MAX_FILE_ID);
|
||||
FileId(raw)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue