@@ -37,6 +37,7 @@ use crate::error::{Error, ErrorCollector, RichError, Span};
3737use crate :: parse:: { self , ParseFromStrWithErrors } ;
3838use crate :: resolution:: { DependencyMap , ResolvedUse } ;
3939use crate :: source:: { CanonPath , CanonSourceFile } ;
40+ use crate :: unstable:: UnstableFeatures ;
4041
4142/// The reserved identifier for the program's entry point.
4243pub ( crate ) const MAIN_STR : & str = "main" ;
@@ -179,6 +180,7 @@ impl DependencyGraph {
179180 dependency_map : Arc < DependencyMap > ,
180181 root_program : & parse:: Program ,
181182 handler : & mut ErrorCollector ,
183+ unstable_features : & UnstableFeatures ,
182184 ) -> Result < Option < Self > , String > {
183185 let mut graph = Self {
184186 modules : vec ! [ SourceModule {
@@ -227,6 +229,7 @@ impl DependencyGraph {
227229 invalid_imports : & mut invalid_imports,
228230 handler,
229231 queue : & mut queue,
232+ unstable_features,
230233 } ;
231234 graph. load_and_parse_dependencies ( & current, valid_imports, & mut ctx) ;
232235 }
@@ -247,6 +250,7 @@ impl DependencyGraph {
247250 importer_source : & CanonSourceFile ,
248251 span : Span ,
249252 handler : & mut ErrorCollector ,
253+ unstable_features : & UnstableFeatures ,
250254 ) -> Option < SourceModule > {
251255 let Ok ( content) = std:: fs:: read_to_string ( path. as_path ( ) ) else {
252256 let err = RichError :: new (
@@ -264,7 +268,11 @@ impl DependencyGraph {
264268 let mut error_handler = ErrorCollector :: new ( ) ;
265269 let source = CanonSourceFile :: new ( path. clone ( ) , Arc :: from ( content) ) ;
266270
267- let ast = parse:: Program :: parse_from_str_with_errors ( source. clone ( ) , & mut error_handler) ;
271+ let ast = parse:: Program :: parse_from_str_with_errors (
272+ source. clone ( ) ,
273+ unstable_features,
274+ & mut error_handler,
275+ ) ;
268276
269277 if error_handler. has_errors ( ) {
270278 handler. extend_with_handler ( source, & error_handler) ;
@@ -322,9 +330,13 @@ impl DependencyGraph {
322330 continue ;
323331 }
324332
325- let Some ( module) =
326- Self :: parse_and_get_source_module ( & path, & current. source , import_span, ctx. handler )
327- else {
333+ let Some ( module) = Self :: parse_and_get_source_module (
334+ & path,
335+ & current. source ,
336+ import_span,
337+ ctx. handler ,
338+ ctx. unstable_features ,
339+ ) else {
328340 // Safe to ignore output: previous `.contains` check prevents collisions.
329341 let _ = ctx. invalid_imports . insert ( path) ;
330342 continue ;
@@ -422,6 +434,7 @@ struct LoadContext<'a> {
422434 invalid_imports : & ' a mut HashSet < CanonPath > ,
423435 handler : & ' a mut ErrorCollector ,
424436 queue : & ' a mut VecDeque < usize > ,
437+ unstable_features : & ' a UnstableFeatures ,
425438}
426439
427440/// The currently processed module and its source, used for error reporting
@@ -494,15 +507,24 @@ pub(crate) mod tests {
494507 let root_p = root_file_path. expect ( "main.simf must be defined in file list" ) ;
495508 let main_canon_source = CanonSourceFile :: new ( root_p, Arc :: from ( root_content) ) ;
496509
497- let main_program_option =
498- parse:: Program :: parse_from_str_with_errors ( main_canon_source. clone ( ) , & mut handler) ;
510+ let main_program_option = parse:: Program :: parse_from_str_with_errors (
511+ main_canon_source. clone ( ) ,
512+ & UnstableFeatures :: all ( ) ,
513+ & mut handler,
514+ ) ;
499515
500516 let Some ( main_program) = main_program_option else {
501517 return ( None , HashMap :: new ( ) , ws, handler) ;
502518 } ;
503519
504- let graph_option =
505- DependencyGraph :: new ( main_canon_source, map, & main_program, & mut handler) . unwrap ( ) ;
520+ let graph_option = DependencyGraph :: new (
521+ main_canon_source,
522+ map,
523+ & main_program,
524+ & mut handler,
525+ & UnstableFeatures :: all ( ) ,
526+ )
527+ . unwrap ( ) ;
506528
507529 let mut file_ids = HashMap :: new ( ) ;
508530
0 commit comments