Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/proc-macro-srv/src/lib.rs')
| -rw-r--r-- | crates/proc-macro-srv/src/lib.rs | 39 |
1 files changed, 12 insertions, 27 deletions
diff --git a/crates/proc-macro-srv/src/lib.rs b/crates/proc-macro-srv/src/lib.rs index a96cf2bdb2..93319df824 100644 --- a/crates/proc-macro-srv/src/lib.rs +++ b/crates/proc-macro-srv/src/lib.rs @@ -56,7 +56,7 @@ pub use proc_macro::Delimiter; pub use crate::bridge::*; pub use crate::server_impl::literal_from_str; -pub use crate::token_stream::{TokenStream, literal_to_string}; +pub use crate::token_stream::{TokenStream, TokenStreamIter, literal_to_string}; #[derive(Copy, Clone, Eq, PartialEq, Debug)] pub enum ProcMacroKind { @@ -83,31 +83,10 @@ impl<'env> ProcMacroSrv<'env> { } pub fn join_spans(&self, first: Span, second: Span) -> Option<Span> { - // We can't modify the span range for fixup spans, those are meaningful to fixup, so just - // prefer the non-fixup span. - if first.anchor.ast_id == span::FIXUP_ERASED_FILE_AST_ID_MARKER { - return Some(second); - } - if second.anchor.ast_id == span::FIXUP_ERASED_FILE_AST_ID_MARKER { - return Some(first); - } - // FIXME: Once we can talk back to the client, implement a "long join" request for anchors - // that differ in [AstId]s as joining those spans requires resolving the AstIds. - if first.anchor != second.anchor { - return None; - } - // Differing context, we can't merge these so prefer the one that's root - if first.ctx != second.ctx { - if first.ctx.is_root() { - return Some(second); - } else if second.ctx.is_root() { - return Some(first); - } - } - Some(Span { - range: first.range.cover(second.range), - anchor: second.anchor, - ctx: second.ctx, + first.join(second, |_, _| { + // FIXME: Once we can talk back to the client, implement a "long join" request for anchors + // that differ in [AstId]s as joining those spans requires resolving the AstIds. + None }) } } @@ -198,7 +177,13 @@ impl ProcMacroSrvSpan for SpanId { type Server = server_impl::token_id::SpanIdServer; fn make_server(call_site: Self, def_site: Self, mixed_site: Self) -> Self::Server { - Self::Server { call_site, def_site, mixed_site } + Self::Server { + call_site, + def_site, + mixed_site, + tracked_env_vars: Default::default(), + tracked_paths: Default::default(), + } } } impl ProcMacroSrvSpan for Span { |