[PATCH] rust: zerocopy-derive: Remove the BoolExt trait

Elouan Da Costa Peixoto posted 1 patch 1 month ago
rust/zerocopy-derive/util.rs | 16 ----------------
1 file changed, 16 deletions(-)
[PATCH] rust: zerocopy-derive: Remove the BoolExt trait
Posted by Elouan Da Costa Peixoto 1 month ago
FIXME comment was saying that this needed to
be removed once the MSRV >= 1.62.
The current MSRV is 1.85.0 obtained by using:
`scripts/min-tool-version.sh rustc` command.

Signed-off-by: Elouan Da Costa Peixoto <elouandacostapeixoto@gmail.com>
---
 rust/zerocopy-derive/util.rs | 16 ----------------
 1 file changed, 16 deletions(-)

diff --git a/rust/zerocopy-derive/util.rs b/rust/zerocopy-derive/util.rs
index 5c5e9d3bdcb8..47aa9f78bd4a 100644
--- a/rust/zerocopy-derive/util.rs
+++ b/rust/zerocopy-derive/util.rs
@@ -713,22 +713,6 @@ fn only_derive_is_allowed_to_implement_this_trait() {}
 // The `#[allow(unused)]` is necessary because, on sufficiently recent toolchain
 // versions, `b.then_some(...)` resolves to the inherent method rather than to
 // this trait, and so this trait is considered unused.
-//
-// FIXME(#67): Remove this once our MSRV is >= 1.62.
-#[allow(unused)]
-trait BoolExt {
-    fn then_some<T>(self, t: T) -> Option<T>;
-}
-
-impl BoolExt for bool {
-    fn then_some<T>(self, t: T) -> Option<T> {
-        if self {
-            Some(t)
-        } else {
-            None
-        }
-    }
-}
 
 pub(crate) fn const_block(items: impl IntoIterator<Item = Option<TokenStream>>) -> TokenStream {
     let items = items.into_iter().flatten();
-- 
2.55.0
Re: [PATCH] rust: zerocopy-derive: Remove the BoolExt trait
Posted by Miguel Ojeda 1 month ago
On Wed, Aug 26, 2026 at 4:58 PM Elouan Da Costa Peixoto
<elouandacostapeixoto@gmail.com> wrote:
>
> FIXME comment was saying that this needed to
> be removed once the MSRV >= 1.62.
> The current MSRV is 1.85.0 obtained by using:
> `scripts/min-tool-version.sh rustc` command.
>
> Signed-off-by: Elouan Da Costa Peixoto <elouandacostapeixoto@gmail.com>

Thanks for the patch!

This code comes from upstream, i.e. it is intended to be vendored
as-is, so if this were to be taken, then it should be submitted
upstream instead.

Having said that, their MSRV is different than ours:

  https://github.com/google/zerocopy/blob/main/zerocopy/POLICIES.md#msrv

Cheers,
Miguel
Re: [PATCH] rust: zerocopy-derive: Remove the BoolExt trait
Posted by Miguel Ojeda 1 month ago
On Wed, Aug 26, 2026 at 5:02 PM Miguel Ojeda
<miguel.ojeda.sandonis@gmail.com> wrote:
>
> On Wed, Aug 26, 2026 at 4:58 PM Elouan Da Costa Peixoto
> <elouandacostapeixoto@gmail.com> wrote:
> >
> > FIXME comment was saying that this needed to
> > be removed once the MSRV >= 1.62.
> > The current MSRV is 1.85.0 obtained by using:
> > `scripts/min-tool-version.sh rustc` command.
> >
> > Signed-off-by: Elouan Da Costa Peixoto <elouandacostapeixoto@gmail.com>
>
> Thanks for the patch!
>
> This code comes from upstream, i.e. it is intended to be vendored
> as-is, so if this were to be taken, then it should be submitted
> upstream instead.
>
> Having said that, their MSRV is different than ours:
>
>   https://github.com/google/zerocopy/blob/main/zerocopy/POLICIES.md#msrv

Cc'ing Joshua and Jack for completeness -- the full thread in case you
are curious is at:

  https://lore.kernel.org/rust-for-linux/20260826145832.42387-1-elouandacostapeixoto@gmail.com/

And I see Sashiko doesn't know about our vendoring -- we could add a
hint to the prompt.

Cheers,
Miguel