File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11use crate :: SourceProvider ;
22use crate :: internal:: span:: FileId ;
33use std:: fmt:: Debug ;
4- use std:: rc :: Rc ;
4+ use std:: sync :: Arc ;
55
66#[ derive( Debug , Default ) ]
77pub ( crate ) struct SourceSet {
8- sources : Vec < Rc < SourceFile > > ,
8+ sources : Vec < Arc < SourceFile > > ,
99}
1010
1111impl SourceSet {
@@ -17,14 +17,14 @@ impl SourceSet {
1717 & mut self ,
1818 path : String ,
1919 provider : & P ,
20- ) -> Result < Rc < SourceFile > , std:: io:: Error > {
20+ ) -> Result < Arc < SourceFile > , std:: io:: Error > {
2121 if let Some ( id) = self . sources . iter ( ) . position ( |source| source. path == path) {
2222 return Ok ( self . sources [ id] . clone ( ) ) ;
2323 }
2424
2525 let source = provider. load ( & path) ?;
2626 let file_id = FileId :: new ( self . sources . len ( ) ) ;
27- let source_file = Rc :: new ( SourceFile {
27+ let source_file = Arc :: new ( SourceFile {
2828 path,
2929 file_id,
3030 source,
@@ -33,7 +33,7 @@ impl SourceSet {
3333 Ok ( source_file)
3434 }
3535
36- pub fn get_source ( & self , file_id : FileId ) -> Option < & Rc < SourceFile > > {
36+ pub fn get_source ( & self , file_id : FileId ) -> Option < & Arc < SourceFile > > {
3737 self . sources . get ( file_id. 0 )
3838 }
3939}
You can’t perform that action at this time.
0 commit comments