@@ -61,7 +61,7 @@ use std::{fmt, mem::ManuallyDrop};
6161
6262use base_db:: {
6363 CrateGraphBuilder , CratesMap , FileSourceRootInput , FileText , Files , Nonce , SourceDatabase ,
64- SourceRoot , SourceRootId , SourceRootInput , query_group , set_all_crates_with_durability,
64+ SourceRoot , SourceRootId , SourceRootInput , set_all_crates_with_durability,
6565} ;
6666use hir:: {
6767 FilePositionWrapper , FileRangeWrapper ,
@@ -252,15 +252,20 @@ impl RootDatabase {
252252 }
253253}
254254
255- #[ query_group:: query_group]
256- pub trait LineIndexDatabase : base_db:: SourceDatabase {
257- #[ salsa:: invoke_interned( line_index) ]
258- fn line_index ( & self , file_id : FileId ) -> Arc < LineIndex > ;
259- }
260-
261- fn line_index ( db : & dyn LineIndexDatabase , file_id : FileId ) -> Arc < LineIndex > {
262- let text = db. file_text ( file_id) . text ( db) ;
263- Arc :: new ( LineIndex :: new ( text) )
255+ pub fn line_index ( db : & dyn SourceDatabase , file_id : FileId ) -> & Arc < LineIndex > {
256+ #[ salsa:: interned]
257+ pub struct InternedFileId {
258+ id : FileId ,
259+ }
260+ #[ salsa:: tracked( returns( ref) ) ]
261+ fn line_index < ' db > (
262+ db : & ' db dyn SourceDatabase ,
263+ file_id : InternedFileId < ' db > ,
264+ ) -> Arc < LineIndex > {
265+ let text = db. file_text ( file_id. id ( db) ) . text ( db) ;
266+ Arc :: new ( LineIndex :: new ( text) )
267+ }
268+ line_index ( db, InternedFileId :: new ( db, file_id) )
264269}
265270
266271#[ derive( Debug , Clone , Copy , PartialEq , Eq , Hash , PartialOrd , Ord ) ]
0 commit comments