File tree 3 files changed +9
-6
lines changed
rustc_query_system/src/query
3 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -380,8 +380,6 @@ impl<'sess> OnDiskCache<'sess> {
380
380
/// Stores a `QuerySideEffects` emitted during the current compilation session.
381
381
/// Anything stored like this will be available via `load_side_effects` in
382
382
/// the next compilation session.
383
- #[ inline( never) ]
384
- #[ cold]
385
383
pub fn store_side_effects ( & self , dep_node_index : DepNodeIndex , side_effects : QuerySideEffects ) {
386
384
let mut current_side_effects = self . current_side_effects . borrow_mut ( ) ;
387
385
let prev = current_side_effects. insert ( dep_node_index, side_effects) ;
@@ -405,8 +403,6 @@ impl<'sess> OnDiskCache<'sess> {
405
403
/// Since many anonymous queries can share the same `DepNode`, we aggregate
406
404
/// them -- as opposed to regular queries where we assume that there is a
407
405
/// 1:1 relationship between query-key and `DepNode`.
408
- #[ inline( never) ]
409
- #[ cold]
410
406
pub fn store_side_effects_for_anon_node (
411
407
& self ,
412
408
dep_node_index : DepNodeIndex ,
Original file line number Diff line number Diff line change @@ -79,12 +79,16 @@ impl QueryContext for QueryCtxt<'_> {
79
79
. unwrap_or_default ( )
80
80
}
81
81
82
+ #[ inline( never) ]
83
+ #[ cold]
82
84
fn store_side_effects ( self , dep_node_index : DepNodeIndex , side_effects : QuerySideEffects ) {
83
85
if let Some ( c) = self . queries . on_disk_cache . as_ref ( ) {
84
86
c. store_side_effects ( dep_node_index, side_effects)
85
87
}
86
88
}
87
89
90
+ #[ inline( never) ]
91
+ #[ cold]
88
92
fn store_side_effects_for_anon_node (
89
93
self ,
90
94
dep_node_index : DepNodeIndex ,
Original file line number Diff line number Diff line change @@ -464,15 +464,18 @@ where
464
464
465
465
prof_timer. finish_with_query_invocation_id ( dep_node_index. into ( ) ) ;
466
466
467
- let diagnostics = diagnostics. into_inner ( ) ;
468
- let side_effects = QuerySideEffects { diagnostics } ;
467
+ let side_effects = QuerySideEffects { diagnostics : diagnostics. into_inner ( ) } ;
469
468
470
469
if std:: intrinsics:: unlikely ( !side_effects. is_empty ( ) ) {
471
470
if Q :: ANON {
472
471
qcx. store_side_effects_for_anon_node ( dep_node_index, side_effects) ;
473
472
} else {
474
473
qcx. store_side_effects ( dep_node_index, side_effects) ;
475
474
}
475
+ } else {
476
+ // Avoid generating code for the destructor here. This does not leak memory since
477
+ // `QuerySideEffects` only owns memory if it's non-empty.
478
+ mem:: forget ( side_effects) ;
476
479
}
477
480
478
481
( result, dep_node_index)
You can’t perform that action at this time.
0 commit comments