Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/proc-macro-api/src/msg/flat.rs')
-rw-r--r--crates/proc-macro-api/src/msg/flat.rs31
1 files changed, 18 insertions, 13 deletions
diff --git a/crates/proc-macro-api/src/msg/flat.rs b/crates/proc-macro-api/src/msg/flat.rs
index bfb3213a25..22d9f3952c 100644
--- a/crates/proc-macro-api/src/msg/flat.rs
+++ b/crates/proc-macro-api/src/msg/flat.rs
@@ -39,7 +39,7 @@ use std::collections::{HashMap, VecDeque};
use serde::{Deserialize, Serialize};
use text_size::TextRange;
-use tt::Span;
+use tt::{Span, SyntaxContext};
use crate::msg::{ENCODE_CLOSE_SPAN_VERSION, VARIABLE_SIZED_SPANS};
@@ -47,25 +47,30 @@ pub trait SerializableSpan<const L: usize>: Span {
fn into_u32(self) -> [u32; L];
fn from_u32(input: [u32; L]) -> Self;
}
-impl SerializableSpan<1> for tt::TokenId {
- fn into_u32(self) -> [u32; 1] {
- [self.0]
- }
- fn from_u32([input]: [u32; 1]) -> Self {
- tt::TokenId(input)
- }
-}
-
-impl<FileId> SerializableSpan<3> for tt::SpanData<FileId>
+// impl SerializableSpan<1> for tt::TokenId {
+// fn into_u32(self) -> [u32; 1] {
+// [self.0]
+// }
+// fn from_u32([input]: [u32; 1]) -> Self {
+// tt::TokenId(input)
+// }
+// }
+
+impl<Anchor, Ctx> SerializableSpan<3> for tt::SpanData<Anchor, Ctx>
where
- FileId: From<u32> + Into<u32>,
+ Anchor: From<u32> + Into<u32>,
Self: Span,
+ Ctx: SyntaxContext,
{
fn into_u32(self) -> [u32; 3] {
[self.anchor.into(), self.range.start().into(), self.range.end().into()]
}
fn from_u32([file_id, start, end]: [u32; 3]) -> Self {
- tt::SpanData { anchor: file_id.into(), range: TextRange::new(start.into(), end.into()) }
+ tt::SpanData {
+ anchor: file_id.into(),
+ range: TextRange::new(start.into(), end.into()),
+ ctx: Ctx::DUMMY,
+ }
}
}