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> {
26
26
}
27
27
}
28
28
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
+
29
35
impl < T > OwnedStore < T > {
30
36
pub ( super ) fn alloc ( & mut self , x : T ) -> Handle {
31
37
let counter = self . counter . fetch_add ( 1 , Ordering :: SeqCst ) ;
@@ -63,6 +69,13 @@ pub(super) struct InternedStore<T: 'static> {
63
69
interner : HashMap < T , Handle > ,
64
70
}
65
71
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
+
66
79
impl < T : Copy + Eq + Hash > InternedStore < T > {
67
80
pub ( super ) fn new ( counter : & ' static AtomicUsize ) -> Self {
68
81
InternedStore {
You can’t perform that action at this time.
0 commit comments