We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 201e52e commit 1754dcdCopy full SHA for 1754dcd
src/libproc_macro/bridge/handle.rs
@@ -26,6 +26,12 @@ impl<T> OwnedStore<T> {
26
}
27
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
+
35
impl<T> OwnedStore<T> {
36
pub(super) fn alloc(&mut self, x: T) -> Handle {
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
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 {
0 commit comments