File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,12 @@ impl<T> OwnedStore<T> {
2626 }
2727}
2828
29+ impl < T > Drop for OwnedStore < T > {
30+ fn drop ( & mut self ) {
31+ assert ! ( self . data. is_empty( ) , "{} `proc_macro` handles were leaked" , self . data. len( ) ) ;
32+ }
33+ }
34+
2935impl < T > OwnedStore < T > {
3036 pub ( super ) fn alloc ( & mut self , x : T ) -> Handle {
3137 let counter = self . counter . fetch_add ( 1 , Ordering :: SeqCst ) ;
@@ -63,6 +69,13 @@ pub(super) struct InternedStore<T: 'static> {
6369 interner : HashMap < T , Handle > ,
6470}
6571
72+ impl < T > Drop for InternedStore < T > {
73+ fn drop ( & mut self ) {
74+ // HACK(eddyb) turn off the leak-checking for interned handles.
75+ self . owned . data . clear ( ) ;
76+ }
77+ }
78+
6679impl < T : Copy + Eq + Hash > InternedStore < T > {
6780 pub ( super ) fn new ( counter : & ' static AtomicUsize ) -> Self {
6881 InternedStore {
You can’t perform that action at this time.
0 commit comments