3 ms·
> There is no debate about this. Of course there is, for example, the offset_of! macro was unsound for a long time: * https://internals.rust-lang.org/t/pre-r
by fluffything 6y ago
> There is no debate about this.
Of course there is, for example, the offset_of! macro was unsound for a long time:
* https://internals.rust-lang.org/t/pre-rfc-add-a-new-offset-of-macro-to-core-mem/9273/10 https://internals.rust-lang.org/t/pre-rfc-add-a-new-offset-o...
* https://github.com/rust-lang/unsafe-code-guidelines/issues/158 https://github.com/rust-lang/unsafe-code-guidelines/issues/1...
* https://github.com/rust-lang/unsafe-code-guidelines/issues/243 https://github.com/rust-lang/unsafe-code-guidelines/issues/2...
* https://github.com/rust-lang/rust-memory-model/issues/35 https://github.com/rust-lang/rust-memory-model/issues/35
> You didn't really answer my question.
I literally wrote "No.". To your follow up questions starting with "If so ..." i did not reply, because the assumption these questions were based on (that I would reply to the previous question with "yes") did not hold.
To expand on this. Rust does not have "unsafe macros", so all exported macros must be sound. Whether a macro is sound or not is orthogonal to whether the macro itself uses `unsafe` (and your original claim was whether I thought that macros containing unsafe should be rejected by the compiler, to which I replied "No.", `pin_mut!` is an example of a macro that uses `unsafe` and is sound).