Explicitly marking unsafe macro expressions

How is this being in a macro any worse that it being in a function?

Compare the macro example with this:

unsafe fn unsafe_operation() -> u8 {
	1
}

fn value_equals_unsafe_operation<T: PartialEq>(a: T) -> bool {
    unsafe {
        a == unsafe_operation()
    }
}

So overall this feels more like “I want to know if crates I’m using use unsafe”, not something specific to macros.

1 Like