diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2022-10-01 09:49:52 +0200 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2022-10-01 16:24:44 +0200 |
| commit | fec53fd9db276d34d8d17701aeb3e81576d761fe (patch) | |
| tree | 01f5b0c290e5e6a6711e4ec93b074ddf64d9f95d | |
| parent | 299e10d7ad2601b24bbd5556de402be10cd46fe0 (diff) | |
| download | rust-fec53fd9db276d34d8d17701aeb3e81576d761fe.tar.gz rust-fec53fd9db276d34d8d17701aeb3e81576d761fe.zip | |
Add sanity Drop impl.
| -rw-r--r-- | compiler/rustc_lint/src/levels.rs | 8 |
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`."); } } |
