6
6
//! actual IO. See `vfs` and `project_model` in the `rust-analyzer` crate for how
7
7
//! actual IO is done and lowered to input.
8
8
9
- use std:: { fmt, mem, ops, str :: FromStr } ;
9
+ use std:: { fmt, mem, ops} ;
10
10
11
11
use cfg:: CfgOptions ;
12
12
use la_arena:: { Arena , Idx , RawIdx } ;
13
13
use rustc_hash:: { FxHashMap , FxHashSet } ;
14
+ use span:: Edition ;
14
15
use syntax:: SmolStr ;
15
16
use triomphe:: Arc ;
16
17
use vfs:: { file_set:: FileSet , AbsPathBuf , AnchoredPath , FileId , VfsPath } ;
@@ -293,42 +294,11 @@ pub struct CrateData {
293
294
pub is_proc_macro : bool ,
294
295
}
295
296
296
- #[ derive( Debug , Clone , Copy , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
297
- pub enum Edition {
298
- Edition2015 ,
299
- Edition2018 ,
300
- Edition2021 ,
301
- Edition2024 ,
302
- }
303
-
304
- impl Edition {
305
- pub const CURRENT : Edition = Edition :: Edition2021 ;
306
- pub const DEFAULT : Edition = Edition :: Edition2015 ;
307
- }
308
-
309
297
#[ derive( Default , Debug , Clone , PartialEq , Eq ) ]
310
298
pub struct Env {
311
299
entries : FxHashMap < String , String > ,
312
300
}
313
301
314
- impl Env {
315
- pub fn new_for_test_fixture ( ) -> Self {
316
- Env {
317
- entries : FxHashMap :: from_iter ( [ (
318
- String :: from ( "__ra_is_test_fixture" ) ,
319
- String :: from ( "__ra_is_test_fixture" ) ,
320
- ) ] ) ,
321
- }
322
- }
323
- }
324
-
325
- #[ derive( Debug , Copy , Clone , PartialEq , Eq , Hash ) ]
326
- pub enum DependencyKind {
327
- Normal ,
328
- Dev ,
329
- Build ,
330
- }
331
-
332
302
#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
333
303
pub struct Dependency {
334
304
pub crate_id : CrateId ,
@@ -670,32 +640,6 @@ impl CrateData {
670
640
}
671
641
}
672
642
673
- impl FromStr for Edition {
674
- type Err = ParseEditionError ;
675
-
676
- fn from_str ( s : & str ) -> Result < Self , Self :: Err > {
677
- let res = match s {
678
- "2015" => Edition :: Edition2015 ,
679
- "2018" => Edition :: Edition2018 ,
680
- "2021" => Edition :: Edition2021 ,
681
- "2024" => Edition :: Edition2024 ,
682
- _ => return Err ( ParseEditionError { invalid_input : s. to_owned ( ) } ) ,
683
- } ;
684
- Ok ( res)
685
- }
686
- }
687
-
688
- impl fmt:: Display for Edition {
689
- fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
690
- f. write_str ( match self {
691
- Edition :: Edition2015 => "2015" ,
692
- Edition :: Edition2018 => "2018" ,
693
- Edition :: Edition2021 => "2021" ,
694
- Edition :: Edition2024 => "2024" ,
695
- } )
696
- }
697
- }
698
-
699
643
impl Extend < ( String , String ) > for Env {
700
644
fn extend < T : IntoIterator < Item = ( String , String ) > > ( & mut self , iter : T ) {
701
645
self . entries . extend ( iter) ;
@@ -722,19 +666,6 @@ impl Env {
722
666
}
723
667
}
724
668
725
- #[ derive( Debug ) ]
726
- pub struct ParseEditionError {
727
- invalid_input : String ,
728
- }
729
-
730
- impl fmt:: Display for ParseEditionError {
731
- fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
732
- write ! ( f, "invalid edition: {:?}" , self . invalid_input)
733
- }
734
- }
735
-
736
- impl std:: error:: Error for ParseEditionError { }
737
-
738
669
#[ derive( Debug ) ]
739
670
pub struct CyclicDependenciesError {
740
671
path : Vec < ( CrateId , Option < CrateDisplayName > ) > ,
0 commit comments