about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2022-10-01 09:49:52 +0200
committerCamille GILLOT <gillot.camille@gmail.com>2022-10-01 16:24:44 +0200
commitfec53fd9db276d34d8d17701aeb3e81576d761fe (patch)
tree01f5b0c290e5e6a6711e4ec93b074ddf64d9f95d
parent299e10d7ad2601b24bbd5556de402be10cd46fe0 (diff)
downloadrust-fec53fd9db276d34d8d17701aeb3e81576d761fe.tar.gz
rust-fec53fd9db276d34d8d17701aeb3e81576d761fe.zip
Add sanity Drop impl.
-rw-r--r--compiler/rustc_lint/src/levels.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/rustc_lint/src/levels.rs b/compiler/rustc_lint/src/levels.rs
index 7b7831bd019..be1d7d98aa6 100644
--- a/compiler/rustc_lint/src/levels.rs
+++ b/compiler/rustc_lint/src/levels.rs
@@ -494,6 +494,14 @@ impl<'s> LintLevelsBuilder<'s, TopDown> {
     /// Called after `push` when the scope of a set of attributes are exited.
     pub(crate) fn pop(&mut self, push: BuilderPush) {
         self.provider.cur = push.prev;
+        std::mem::forget(push);
+    }
+}
+
+#[cfg(debug_assertions)]
+impl Drop for BuilderPush {
+    fn drop(&mut self) {
+        panic!("Found a `push` without a `pop`.");
     }
 }