@@ -21,6 +21,7 @@ use ruff_db::system::{SystemPath, SystemPathBuf};
2121use salsa:: Durability ;
2222use salsa:: Setter ;
2323use std:: backtrace:: BacktraceStatus ;
24+ use std:: collections:: BTreeSet ;
2425use std:: iter:: FusedIterator ;
2526use std:: panic:: { AssertUnwindSafe , UnwindSafe } ;
2627use std:: sync:: Arc ;
@@ -55,7 +56,7 @@ pub struct Project {
5556 /// The files that are open in the project, [`None`] if there are no open files.
5657 #[ returns( ref) ]
5758 #[ default]
58- open_fileset : FxHashSet < File > ,
59+ open_fileset : BTreeSet < File > ,
5960
6061 /// The first-party files of this project.
6162 #[ default]
@@ -398,25 +399,25 @@ impl Project {
398399 }
399400
400401 /// Returns the open files in the project or `None` if there are no open files.
401- pub fn open_files ( self , db : & dyn Db ) -> & FxHashSet < File > {
402+ pub fn open_files ( self , db : & dyn Db ) -> & BTreeSet < File > {
402403 self . open_fileset ( db)
403404 }
404405
405406 /// Sets the open files in the project.
406407 #[ tracing:: instrument( level = "debug" , skip( self , db) ) ]
407- pub fn set_open_files ( self , db : & mut dyn Db , open_files : FxHashSet < File > ) {
408+ pub fn set_open_files ( self , db : & mut dyn Db , open_files : BTreeSet < File > ) {
408409 tracing:: debug!( "Set open project files (count: {})" , open_files. len( ) ) ;
409410
410411 self . set_open_fileset ( db) . to ( open_files) ;
411412 }
412413
413414 /// This takes the open files from the project and returns them.
414- fn take_open_files ( self , db : & mut dyn Db ) -> FxHashSet < File > {
415+ fn take_open_files ( self , db : & mut dyn Db ) -> BTreeSet < File > {
415416 tracing:: debug!( "Take open project files" ) ;
416417
417418 // Salsa will cancel any pending queries and remove its own reference to `open_files`
418419 // so that the reference counter to `open_files` now drops to 1.
419- self . set_open_fileset ( db) . to ( FxHashSet :: default ( ) )
420+ self . set_open_fileset ( db) . to ( BTreeSet :: default ( ) )
420421 }
421422
422423 /// Returns `true` if the file should be checked.
@@ -586,7 +587,7 @@ pub(crate) fn check_file_impl(db: &dyn Db, file: File) -> Result<Box<[Diagnostic
586587
587588#[ derive( Debug ) ]
588589enum ProjectFiles < ' a > {
589- OpenFiles ( & ' a FxHashSet < File > ) ,
590+ OpenFiles ( & ' a BTreeSet < File > ) ,
590591 Indexed ( files:: Indexed < ' a > ) ,
591592}
592593
@@ -619,14 +620,14 @@ impl<'a> IntoIterator for &'a ProjectFiles<'a> {
619620
620621 fn into_iter ( self ) -> Self :: IntoIter {
621622 match self {
622- ProjectFiles :: OpenFiles ( files) => ProjectFilesIter :: OpenFiles ( files. unstable_iter ( ) ) ,
623+ ProjectFiles :: OpenFiles ( files) => ProjectFilesIter :: OpenFiles ( files. iter ( ) ) ,
623624 ProjectFiles :: Indexed ( files) => ProjectFilesIter :: Indexed ( files. into_iter ( ) ) ,
624625 }
625626 }
626627}
627628
628629enum ProjectFilesIter < ' db > {
629- OpenFiles ( std:: collections:: hash_set :: Iter < ' db , File > ) ,
630+ OpenFiles ( std:: collections:: btree_set :: Iter < ' db , File > ) ,
630631 Indexed ( files:: IndexedIter < ' db > ) ,
631632}
632633
0 commit comments