Free some memory instead of just dropping elements
This commit is contained in:
parent
55f76628ee
commit
ab3f37ec43
2 changed files with 6 additions and 3 deletions
|
@ -3789,14 +3789,16 @@ impl<'tcx> TraitObligation<'tcx> {
|
|||
}
|
||||
|
||||
impl<'tcx> SelectionCache<'tcx> {
|
||||
/// Actually frees the underlying memory in contrast to what stdlib containers do on `clear`
|
||||
pub fn clear(&self) {
|
||||
self.hashmap.borrow_mut().clear();
|
||||
*self.hashmap.borrow_mut() = Default::default();
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> EvaluationCache<'tcx> {
|
||||
/// Actually frees the underlying memory in contrast to what stdlib containers do on `clear`
|
||||
pub fn clear(&self) {
|
||||
self.hashmap.borrow_mut().clear();
|
||||
*self.hashmap.borrow_mut() = Default::default();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -398,7 +398,8 @@ impl Handler {
|
|||
/// tools that want to reuse a `Parser` cleaning the previously emitted diagnostics as well as
|
||||
/// the overall count of emitted error diagnostics.
|
||||
pub fn reset_err_count(&self) {
|
||||
self.emitted_diagnostics.borrow_mut().clear();
|
||||
// actually frees the underlying memory (which `clear` would not do)
|
||||
*self.emitted_diagnostics.borrow_mut() = Default::default();
|
||||
self.err_count.store(0, SeqCst);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue