66//! actual IO. See `vfs` and `project_model` in the `rust-analyzer` crate for how
77//! actual IO is done and lowered to input.
88
9- use std:: { fmt, mem, ops, str :: FromStr } ;
9+ use std:: { fmt, mem, ops} ;
1010
1111use cfg:: CfgOptions ;
1212use la_arena:: { Arena , Idx , RawIdx } ;
1313use rustc_hash:: { FxHashMap , FxHashSet } ;
14+ use span:: Edition ;
1415use syntax:: SmolStr ;
1516use triomphe:: Arc ;
1617use vfs:: { file_set:: FileSet , AbsPathBuf , AnchoredPath , FileId , VfsPath } ;
@@ -293,42 +294,11 @@ pub struct CrateData {
293294 pub is_proc_macro : bool ,
294295}
295296
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-
309297#[ derive( Default , Debug , Clone , PartialEq , Eq ) ]
310298pub struct Env {
311299 entries : FxHashMap < String , String > ,
312300}
313301
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-
332302#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
333303pub struct Dependency {
334304 pub crate_id : CrateId ,
@@ -670,32 +640,6 @@ impl CrateData {
670640 }
671641}
672642
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-
699643impl Extend < ( String , String ) > for Env {
700644 fn extend < T : IntoIterator < Item = ( String , String ) > > ( & mut self , iter : T ) {
701645 self . entries . extend ( iter) ;
@@ -722,19 +666,6 @@ impl Env {
722666 }
723667}
724668
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-
738669#[ derive( Debug ) ]
739670pub struct CyclicDependenciesError {
740671 path : Vec < ( CrateId , Option < CrateDisplayName > ) > ,
0 commit comments