-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.A-syntaxextArea: Syntax extensionsArea: Syntax extensions
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.
Metadata
Metadata
Assignees
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.A-syntaxextArea: Syntax extensionsArea: Syntax extensions