Implement <RaSpanServer as SourceFile>::eq

This commit is contained in:
Lukas Wirth 2024-12-31 12:59:20 +01:00
parent d30bd5fbb5
commit 6b56af7688

View file

@ -12,7 +12,7 @@ use std::{
use intern::Symbol; use intern::Symbol;
use proc_macro::bridge::{self, server}; use proc_macro::bridge::{self, server};
use span::{Span, FIXUP_ERASED_FILE_AST_ID_MARKER}; use span::{FileId, Span, FIXUP_ERASED_FILE_AST_ID_MARKER};
use tt::{TextRange, TextSize}; use tt::{TextRange, TextSize};
use crate::server_impl::{ use crate::server_impl::{
@ -32,8 +32,10 @@ mod tt {
type TokenStream = crate::server_impl::TokenStream<Span>; type TokenStream = crate::server_impl::TokenStream<Span>;
#[derive(Clone)] #[derive(Copy, Clone, PartialEq, Eq, Debug)]
pub struct SourceFile; pub struct SourceFile {
file_id: FileId,
}
pub struct FreeFunctions; pub struct FreeFunctions;
pub struct RaSpanServer { pub struct RaSpanServer {
@ -291,9 +293,8 @@ impl server::TokenStream for RaSpanServer {
} }
impl server::SourceFile for RaSpanServer { impl server::SourceFile for RaSpanServer {
fn eq(&mut self, _file1: &Self::SourceFile, _file2: &Self::SourceFile) -> bool { fn eq(&mut self, file1: &Self::SourceFile, file2: &Self::SourceFile) -> bool {
// FIXME file1 == file2
true
} }
fn path(&mut self, _file: &Self::SourceFile) -> String { fn path(&mut self, _file: &Self::SourceFile) -> String {
// FIXME // FIXME
@ -308,9 +309,8 @@ impl server::Span for RaSpanServer {
fn debug(&mut self, span: Self::Span) -> String { fn debug(&mut self, span: Self::Span) -> String {
format!("{:?}", span) format!("{:?}", span)
} }
fn source_file(&mut self, _span: Self::Span) -> Self::SourceFile { fn source_file(&mut self, span: Self::Span) -> Self::SourceFile {
// FIXME stub, requires db SourceFile { file_id: span.anchor.file_id.file_id() }
SourceFile {}
} }
fn save_span(&mut self, _span: Self::Span) -> usize { fn save_span(&mut self, _span: Self::Span) -> usize {
// FIXME, quote is incompatible with third-party tools // FIXME, quote is incompatible with third-party tools