File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -422,6 +422,18 @@ impl CodeGenerator for Module {
422
422
let mut found_any = false ;
423
423
let inner_items = result. inner ( |result| {
424
424
result. push ( root_import ( ctx, item) ) ;
425
+
426
+ let path = item. namespace_aware_canonical_path ( ctx) . join ( "::" ) ;
427
+ if let Some ( raw_lines) = ctx. options ( ) . module_lines . get ( & path) {
428
+ for raw_line in raw_lines {
429
+ found_any = true ;
430
+ // FIXME(emilio): The use of `Term` is an abuse, but we abuse it
431
+ // in a bunch more places.
432
+ let line = Term :: new ( raw_line, Span :: call_site ( ) ) ;
433
+ result. push ( quote ! { #line } ) ;
434
+ }
435
+ }
436
+
425
437
codegen_self ( result, & mut found_any) ;
426
438
} ) ;
427
439
@@ -431,16 +443,15 @@ impl CodeGenerator for Module {
431
443
}
432
444
433
445
let name = item. canonical_name ( ctx) ;
434
-
435
- result. push ( if name == "root" {
446
+ let ident = ctx . rust_ident ( name ) ;
447
+ result. push ( if item . id ( ) == ctx . root_module ( ) {
436
448
quote ! {
437
449
#[ allow( non_snake_case, non_camel_case_types, non_upper_case_globals) ]
438
- pub mod root {
450
+ pub mod #ident {
439
451
#( #inner_items ) *
440
452
}
441
453
}
442
454
} else {
443
- let ident = ctx. rust_ident ( name) ;
444
455
quote ! {
445
456
pub mod #ident {
446
457
#( #inner_items ) *
You can’t perform that action at this time.
0 commit comments