Skip to content

Commit fec53fd

Browse files
committed
Add sanity Drop impl.
1 parent 299e10d commit fec53fd

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

compiler/rustc_lint/src/levels.rs

+8
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,14 @@ impl<'s> LintLevelsBuilder<'s, TopDown> {
494494
/// Called after `push` when the scope of a set of attributes are exited.
495495
pub(crate) fn pop(&mut self, push: BuilderPush) {
496496
self.provider.cur = push.prev;
497+
std::mem::forget(push);
498+
}
499+
}
500+
501+
#[cfg(debug_assertions)]
502+
impl Drop for BuilderPush {
503+
fn drop(&mut self) {
504+
panic!("Found a `push` without a `pop`.");
497505
}
498506
}
499507

0 commit comments

Comments
 (0)