Skip to content

Commit

Permalink
Add sanity Drop impl.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjgillot committed Oct 1, 2022
1 parent 299e10d commit fec53fd
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions compiler/rustc_lint/src/levels.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`.");
}
}

Expand Down

0 comments on commit fec53fd

Please sign in to comment.