From 971d306fe255df7f60fe2b605cd6b6d760866320 Mon Sep 17 00:00:00 2001 From: Huon Wilson Date: Fri, 22 Nov 2013 22:23:04 +1100 Subject: [PATCH] test: test that the `unsafe_block` lint picks up `unsafe` blocks in macros. --- src/test/compile-fail/lint-unsafe-block.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/test/compile-fail/lint-unsafe-block.rs b/src/test/compile-fail/lint-unsafe-block.rs index a43bdd99c01..7f3075e90bc 100644 --- a/src/test/compile-fail/lint-unsafe-block.rs +++ b/src/test/compile-fail/lint-unsafe-block.rs @@ -10,11 +10,20 @@ #[allow(unused_unsafe)]; #[deny(unsafe_block)]; +#[feature(macro_rules)]; unsafe fn allowed() {} #[allow(unsafe_block)] fn also_allowed() { unsafe {} } +macro_rules! unsafe_in_macro { + () => { + unsafe {} //~ ERROR: usage of an `unsafe` block + } +} + fn main() { unsafe {} //~ ERROR: usage of an `unsafe` block + + unsafe_in_macro!() }