From 1c67a7dc14b8b046d1b5c05e21cd7dc63a3aba32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Tue, 22 Aug 2017 15:57:13 +0200 Subject: [PATCH] style: Ensure the flusher is completely consumed before getting dropped. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This will be necessary for future patches. MozReview-Commit-ID: FgWaoRCMdw2 Signed-off-by: Emilio Cobos Álvarez --- components/style/stylesheet_set.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/components/style/stylesheet_set.rs b/components/style/stylesheet_set.rs index 386cc31c99f..104ada57783 100644 --- a/components/style/stylesheet_set.rs +++ b/components/style/stylesheet_set.rs @@ -90,6 +90,20 @@ where } } +#[cfg(debug_assertions)] +impl<'a, 'b, S> Drop for StylesheetFlusher<'a, 'b, S> +where + 'b: 'a, + S: StylesheetInDocument + PartialEq + 'static, +{ + fn drop(&mut self) { + debug_assert!( + self.iter.next().is_none(), + "You're supposed to fully consume the flusher", + ); + } +} + impl<'a, 'b, S> Iterator for StylesheetFlusher<'a, 'b, S> where 'b: 'a,