On Wed, Mar 18, 2026 at 7:31 PM Joel Fernandes <[email protected]> wrote: > > Anyway, the fix is simple, just need to do // SAFETY*: as Miguel suggests > here, instead of // SAFETY: > https://lore.kernel.org/all/caniq72kendyupnwmzmhejytjioeijuk_c-yqjk77dpid89l...@mail.gmail.com/
So, to clarify, I suggested it as a temporary thing we could do if we want to use that "fake `unsafe` block in macro matcher" pattern more and more. i.e. if we plan to use the pattern more, then I am happy to ask upstream if it would make sense for Clippy to recognize it (or perhaps it is just a false negative instead of a false positive, given `impl_device_context_deref`), so that we don't need a hacked safety tag (Cc'ing Alejandra). But if we could put it outside, then we wouldn't need any of that. Unsafe macros support could help perhaps here, which I have had it in our wishlist too (https://github.com/Rust-for-Linux/linux/issues/354), but I guess the fake block could still be useful to make only certain macro arms unsafe? (Perhaps Rust could allow `unsafe` just at the start of each arm for that...). Cheers, Miguel
