mirror of
https://github.com/torvalds/linux.git
synced 2026-12-02 03:22:37 +00:00
In Rust 1.80, the previously unstable `slice::flatten` family of methods have been stabilized and renamed to `slice::as_flattened`. This creates an issue as we want to use `as_flattened`, but need to support the MSRV (which at the moment is Rust 1.78) where it is named `flatten`. Solve this by enabling the `slice_flatten` feature, and providing an `as_flattened` implementation through an extension trait for compiler versions where it is not available. The trait is then exported from the prelude, making the `as_flattened` family of methods transparently available for all supported compiler versions. This extension trait can be removed once the MSRV passes 1.80. Suggested-by: Miguel Ojeda <[email protected]> Link: https://lore.kernel.org/all/CANiq72kK4pG=O35NwxPNoTO17oRcg1yfGcvr3==Fi4edr+sfmw@mail.gmail.com/ Acked-by: Danilo Krummrich <[email protected]> Acked-by: Miguel Ojeda <[email protected]> Reviewed-by: Alice Ryhl <[email protected]> Signed-off-by: Alexandre Courbot <[email protected]> Message-ID: <[email protected]> Message-ID: <[email protected]>