File tree 1 file changed +8
-3
lines changed
1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -342,14 +342,12 @@ pub fn run_compiler(
342
342
}
343
343
344
344
if sess. opts . debugging_opts . save_analysis {
345
- let expanded_crate = compiler. expansion ( ) ?. take ( ) . 0 ;
346
-
345
+ let expanded_crate = & compiler. expansion ( ) ?. peek ( ) . 0 ;
347
346
let crate_name = compiler. crate_name ( ) ?. peek ( ) . clone ( ) ;
348
347
compiler. global_ctxt ( ) ?. peek_mut ( ) . enter ( |tcx| {
349
348
let result = tcx. analysis ( LOCAL_CRATE ) ;
350
349
351
350
time ( sess, "save analysis" , || {
352
- // FIXME: Should this run even with analysis errors?
353
351
save:: process_crate (
354
352
tcx,
355
353
& expanded_crate,
@@ -361,17 +359,24 @@ pub fn run_compiler(
361
359
} ) ;
362
360
363
361
result
362
+ // AST will be dropped *after* the `after_analysis` callback
363
+ // (needed by the RLS)
364
364
} ) ?;
365
365
} else {
366
366
// Drop AST after creating GlobalCtxt to free memory
367
367
mem:: drop ( compiler. expansion ( ) ?. take ( ) ) ;
368
368
}
369
+
369
370
compiler. global_ctxt ( ) ?. peek_mut ( ) . enter ( |tcx| tcx. analysis ( LOCAL_CRATE ) ) ?;
370
371
371
372
if !callbacks. after_analysis ( compiler) {
372
373
return sess. compile_status ( ) ;
373
374
}
374
375
376
+ if sess. opts . debugging_opts . save_analysis {
377
+ mem:: drop ( compiler. expansion ( ) ?. take ( ) ) ;
378
+ }
379
+
375
380
compiler. ongoing_codegen ( ) ?;
376
381
377
382
// Drop GlobalCtxt after starting codegen to free memory
You can’t perform that action at this time.
0 commit comments