Closed
Description
Consider the following.
macro_rules! foo(
() => {
unsafe { use std::cast; let () = cast::transmute(()); }
}
)
fn main() {
unsafe { foo!(); }
foo!();
}
This only does not emit a warning if the first line of code in main is removed. It would be nice to be able to squelch the unused unsafe warning that appears on the first invocation of foo!()
, whether automatically or by being able to use #[allow(unused_unsafe)]
inside the macro definition.
A workaround is to define a function in the macro that hides the unsafety and to call it.