about summary refs log tree commit diff
path: root/src/tools/rust-analyzer/crates/proc-macro-api
diff options
context:
space:
mode:
authorLukas Wirth <lukastw97@gmail.com>2024-08-03 19:16:56 +0200
committerLukas Wirth <lukastw97@gmail.com>2024-08-05 13:46:47 +0200
commitcdee65f5ea9bfb20d2a0c8d44f805dd42c845938 (patch)
treef4e2f38aee50600ec79985f38188871599c031f0 /src/tools/rust-analyzer/crates/proc-macro-api
parent2e7db9c69ffeb58cb512e84a88ab5dced33abcf2 (diff)
Newtype ErasedFileAstId
Diffstat (limited to 'src/tools/rust-analyzer/crates/proc-macro-api')
-rw-r--r--src/tools/rust-analyzer/crates/proc-macro-api/Cargo.toml5
-rw-r--r--src/tools/rust-analyzer/crates/proc-macro-api/src/msg.rs6
-rw-r--r--src/tools/rust-analyzer/crates/proc-macro-api/src/msg/flat.rs8
3 files changed, 7 insertions, 12 deletions
diff --git a/src/tools/rust-analyzer/crates/proc-macro-api/Cargo.toml b/src/tools/rust-analyzer/crates/proc-macro-api/Cargo.toml
index 345fb9f8ae9..3e6f80878bd 100644
--- a/src/tools/rust-analyzer/crates/proc-macro-api/Cargo.toml
+++ b/src/tools/rust-analyzer/crates/proc-macro-api/Cargo.toml
@@ -22,12 +22,11 @@ indexmap.workspace = true
 paths = { workspace = true, features = ["serde1"] }
 tt.workspace = true
 stdx.workspace = true
-text-size.workspace = true
-span.workspace = true
 # Ideally this crate would not depend on salsa things, but we need span information here which wraps
 # InternIds for the syntax context
+span.workspace = true
+# only here due to the `Env` newtype :/
 base-db.workspace = true
-la-arena.workspace = true
 intern.workspace = true
 
 [lints]
diff --git a/src/tools/rust-analyzer/crates/proc-macro-api/src/msg.rs b/src/tools/rust-analyzer/crates/proc-macro-api/src/msg.rs
index 6a99b5ed1cc..883528558d9 100644
--- a/src/tools/rust-analyzer/crates/proc-macro-api/src/msg.rs
+++ b/src/tools/rust-analyzer/crates/proc-macro-api/src/msg.rs
@@ -158,9 +158,7 @@ type ProtocolWrite<W: Write> = for<'o, 'msg> fn(out: &'o mut W, msg: &'msg str)
 #[cfg(test)]
 mod tests {
     use intern::{sym, Symbol};
-    use la_arena::RawIdx;
-    use span::{ErasedFileAstId, Span, SpanAnchor, SyntaxContextId};
-    use text_size::{TextRange, TextSize};
+    use span::{ErasedFileAstId, Span, SpanAnchor, SyntaxContextId, TextRange, TextSize};
     use tt::{Delimiter, DelimiterKind, Ident, Leaf, Literal, Punct, Spacing, Subtree, TokenTree};
 
     use super::*;
@@ -171,7 +169,7 @@ mod tests {
                 span::FileId::from_raw(0xe4e4e),
                 span::Edition::CURRENT,
             ),
-            ast_id: ErasedFileAstId::from_raw(RawIdx::from(0)),
+            ast_id: ErasedFileAstId::from_raw(0),
         };
 
         let token_trees = Box::new([
diff --git a/src/tools/rust-analyzer/crates/proc-macro-api/src/msg/flat.rs b/src/tools/rust-analyzer/crates/proc-macro-api/src/msg/flat.rs
index a8661f59b28..88256e98b58 100644
--- a/src/tools/rust-analyzer/crates/proc-macro-api/src/msg/flat.rs
+++ b/src/tools/rust-analyzer/crates/proc-macro-api/src/msg/flat.rs
@@ -38,11 +38,9 @@
 use std::collections::VecDeque;
 
 use intern::Symbol;
-use la_arena::RawIdx;
 use rustc_hash::FxHashMap;
 use serde::{Deserialize, Serialize};
-use span::{EditionedFileId, ErasedFileAstId, Span, SpanAnchor, SyntaxContextId};
-use text_size::TextRange;
+use span::{EditionedFileId, ErasedFileAstId, Span, SpanAnchor, SyntaxContextId, TextRange};
 
 use crate::msg::{ENCODE_CLOSE_SPAN_VERSION, EXTENDED_LEAF_DATA};
 
@@ -54,7 +52,7 @@ pub fn serialize_span_data_index_map(map: &SpanDataIndexMap) -> Vec<u32> {
         .flat_map(|span| {
             [
                 span.anchor.file_id.as_u32(),
-                span.anchor.ast_id.into_raw().into_u32(),
+                span.anchor.ast_id.into_raw(),
                 span.range.start().into(),
                 span.range.end().into(),
                 span.ctx.into_u32(),
@@ -71,7 +69,7 @@ pub fn deserialize_span_data_index_map(map: &[u32]) -> SpanDataIndexMap {
             Span {
                 anchor: SpanAnchor {
                     file_id: EditionedFileId::from_raw(file_id),
-                    ast_id: ErasedFileAstId::from_raw(RawIdx::from_u32(ast_id)),
+                    ast_id: ErasedFileAstId::from_raw(ast_id),
                 },
                 range: TextRange::new(start.into(), end.into()),
                 ctx: SyntaxContextId::from_u32(e),