]> git.lizzy.rs Git - rust.git/commitdiff
test: test that the `unsafe_block` lint picks up `unsafe` blocks in
authorHuon Wilson <dbau.pp+github@gmail.com>
Fri, 22 Nov 2013 11:23:04 +0000 (22:23 +1100)
committerHuon Wilson <dbau.pp+github@gmail.com>
Fri, 22 Nov 2013 11:23:04 +0000 (22:23 +1100)
macros.

src/test/compile-fail/lint-unsafe-block.rs

index a43bdd99c014f425ab3aa2b4599ad4b135415af3..7f3075e90bc7b6b268dbf240c6fd24dfd570adc8 100644 (file)
 
 #[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!()
 }