@@ -59,12 +59,12 @@ impl MockDatabase {
5959 pub fn set_crate_graph_from_fixture ( & mut self , graph : CrateGraphFixture ) {
6060 let mut ids = FxHashMap :: default ( ) ;
6161 let mut crate_graph = CrateGraph :: default ( ) ;
62- for ( crate_name, ( crate_root, _) ) in graph. 0 . iter ( ) {
62+ for ( crate_name, ( crate_root, edition , _) ) in graph. 0 . iter ( ) {
6363 let crate_root = self . file_id_of ( & crate_root) ;
64- let crate_id = crate_graph. add_crate_root ( crate_root, Edition :: Edition2018 ) ;
64+ let crate_id = crate_graph. add_crate_root ( crate_root, * edition ) ;
6565 ids. insert ( crate_name, crate_id) ;
6666 }
67- for ( crate_name, ( _, deps) ) in graph. 0 . iter ( ) {
67+ for ( crate_name, ( _, _ , deps) ) in graph. 0 . iter ( ) {
6868 let from = ids[ crate_name] ;
6969 for dep in deps {
7070 let to = ids[ dep] ;
@@ -233,16 +233,19 @@ impl MockDatabase {
233233}
234234
235235#[ derive( Default ) ]
236- pub struct CrateGraphFixture ( pub FxHashMap < String , ( String , Vec < String > ) > ) ;
236+ pub struct CrateGraphFixture ( pub FxHashMap < String , ( String , Edition , Vec < String > ) > ) ;
237237
238238#[ macro_export]
239239macro_rules! crate_graph {
240- ( $( $crate_name: literal: ( $crate_path: literal, [ $( $dep: literal) ,* ] ) , ) * ) => { {
240+ ( $( $crate_name: literal: ( $crate_path: literal, $ ( $edition : literal , ) ? [ $( $dep: literal) ,* ] ) , ) * ) => { {
241241 let mut res = $crate:: mock:: CrateGraphFixture :: default ( ) ;
242242 $(
243+ #[ allow( unused_mut, unused_assignments) ]
244+ let mut edition = ra_db:: Edition :: Edition2018 ;
245+ $( edition = ra_db:: Edition :: from_string( $edition) ; ) ?
243246 res. 0 . insert(
244247 $crate_name. to_string( ) ,
245- ( $crate_path. to_string( ) , vec![ $( $dep. to_string( ) ) ,* ] )
248+ ( $crate_path. to_string( ) , edition , vec![ $( $dep. to_string( ) ) ,* ] )
246249 ) ;
247250 ) *
248251 res
0 commit comments