Messages in this thread |  | | From | Miguel Ojeda <> | | Date | Wed, 18 Mar 2026 19:57:14 +0100 | | Subject | Re: [PATCH v13 1/1] rust: interop: Add list module for C linked list interface |
| |
On Wed, Mar 18, 2026 at 7:31 PM Joel Fernandes <joelagnelf@nvidia.com> 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-yQJk77dPid89LExw@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
|  |