@@ -12,7 +12,7 @@ use std::{
12
12
13
13
use intern:: Symbol ;
14
14
use proc_macro:: bridge:: { self , server} ;
15
- use span:: { Span , FIXUP_ERASED_FILE_AST_ID_MARKER } ;
15
+ use span:: { FileId , Span , FIXUP_ERASED_FILE_AST_ID_MARKER } ;
16
16
use tt:: { TextRange , TextSize } ;
17
17
18
18
use crate :: server_impl:: {
@@ -32,8 +32,10 @@ mod tt {
32
32
33
33
type TokenStream = crate :: server_impl:: TokenStream < Span > ;
34
34
35
- #[ derive( Clone ) ]
36
- pub struct SourceFile ;
35
+ #[ derive( Copy , Clone , PartialEq , Eq , Debug ) ]
36
+ pub struct SourceFile {
37
+ file_id : FileId ,
38
+ }
37
39
pub struct FreeFunctions ;
38
40
39
41
pub struct RaSpanServer {
@@ -291,9 +293,8 @@ impl server::TokenStream for RaSpanServer {
291
293
}
292
294
293
295
impl server:: SourceFile for RaSpanServer {
294
- fn eq ( & mut self , _file1 : & Self :: SourceFile , _file2 : & Self :: SourceFile ) -> bool {
295
- // FIXME
296
- true
296
+ fn eq ( & mut self , file1 : & Self :: SourceFile , file2 : & Self :: SourceFile ) -> bool {
297
+ file1 == file2
297
298
}
298
299
fn path ( & mut self , _file : & Self :: SourceFile ) -> String {
299
300
// FIXME
@@ -308,9 +309,8 @@ impl server::Span for RaSpanServer {
308
309
fn debug ( & mut self , span : Self :: Span ) -> String {
309
310
format ! ( "{:?}" , span)
310
311
}
311
- fn source_file ( & mut self , _span : Self :: Span ) -> Self :: SourceFile {
312
- // FIXME stub, requires db
313
- SourceFile { }
312
+ fn source_file ( & mut self , span : Self :: Span ) -> Self :: SourceFile {
313
+ SourceFile { file_id : span. anchor . file_id . file_id ( ) }
314
314
}
315
315
fn save_span ( & mut self , _span : Self :: Span ) -> usize {
316
316
// FIXME, quote is incompatible with third-party tools
0 commit comments