@@ -351,11 +351,13 @@ impl<'sess> OnDiskCache<'sess> {
351351 /// Store a diagnostic emitted during the current compilation session.
352352 /// Anything stored like this will be available via `load_diagnostics` in
353353 /// the next compilation session.
354+ #[ inline( never) ]
355+ #[ cold]
354356 pub fn store_diagnostics ( & self ,
355357 dep_node_index : DepNodeIndex ,
356- diagnostics : Vec < Diagnostic > ) {
358+ diagnostics : Box < Vec < Diagnostic > > ) {
357359 let mut current_diagnostics = self . current_diagnostics . borrow_mut ( ) ;
358- let prev = current_diagnostics. insert ( dep_node_index, diagnostics) ;
360+ let prev = current_diagnostics. insert ( dep_node_index, * diagnostics) ;
359361 debug_assert ! ( prev. is_none( ) ) ;
360362 }
361363
@@ -377,13 +379,15 @@ impl<'sess> OnDiskCache<'sess> {
377379 /// Since many anonymous queries can share the same `DepNode`, we aggregate
378380 /// them -- as opposed to regular queries where we assume that there is a
379381 /// 1:1 relationship between query-key and `DepNode`.
382+ #[ inline( never) ]
383+ #[ cold]
380384 pub fn store_diagnostics_for_anon_node ( & self ,
381385 dep_node_index : DepNodeIndex ,
382- mut diagnostics : Vec < Diagnostic > ) {
386+ mut diagnostics : Box < Vec < Diagnostic > > ) {
383387 let mut current_diagnostics = self . current_diagnostics . borrow_mut ( ) ;
384388
385389 let x = current_diagnostics. entry ( dep_node_index) . or_insert_with ( || {
386- mem:: replace ( & mut diagnostics, Vec :: new ( ) )
390+ mem:: replace ( & mut * diagnostics, Vec :: new ( ) )
387391 } ) ;
388392
389393 x. extend ( diagnostics. into_iter ( ) ) ;
0 commit comments