mirror of
https://kernel.googlesource.com/pub/scm/linux/kernel/git/stable/linux-stable.git
synced 2025-09-28 17:40:21 +10:00
Starting with Rust 1.88.0 (expected 2025-06-26) [1][2], `rustc` may introduce a new lint that catches unnecessary transmutes, e.g.: error: unnecessary transmute --> rust/uapi/uapi_generated.rs:23242:18 | 23242 | unsafe { ::core::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace this with: `(self._bitfield_1.get(0usize, 1u8) as u8 == 1)` | = note: `-D unnecessary-transmutes` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(unnecessary_transmutes)]` There are a lot of them (at least 300), but luckily they are all in `bindgen`-generated code. Thus clean all up by allowing it there. Since unknown lints trigger a lint itself in older compilers, do it conditionally so that we can keep the `unknown_lints` lint enabled. Cc: stable@vger.kernel.org # Needed in 6.12.y and later (Rust is pinned in older LTSs). Link: https://github.com/rust-lang/rust/pull/136083 [1] Link: https://github.com/rust-lang/rust/issues/136067 [2] Reviewed-by: Alice Ryhl <aliceryhl@google.com> Link: https://lore.kernel.org/r/20250502140237.1659624-4-ojeda@kernel.org Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
35 lines
981 B
Rust
35 lines
981 B
Rust
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
//! UAPI Bindings.
|
|
//!
|
|
//! Contains the bindings generated by `bindgen` for UAPI interfaces.
|
|
//!
|
|
//! This crate may be used directly by drivers that need to interact with
|
|
//! userspace APIs.
|
|
|
|
#![no_std]
|
|
// See <https://github.com/rust-lang/rust-bindgen/issues/1651>.
|
|
#![cfg_attr(test, allow(deref_nullptr))]
|
|
#![cfg_attr(test, allow(unaligned_references))]
|
|
#![cfg_attr(test, allow(unsafe_op_in_unsafe_fn))]
|
|
#![allow(
|
|
clippy::all,
|
|
clippy::undocumented_unsafe_blocks,
|
|
dead_code,
|
|
missing_docs,
|
|
non_camel_case_types,
|
|
non_upper_case_globals,
|
|
non_snake_case,
|
|
improper_ctypes,
|
|
unreachable_pub,
|
|
unsafe_op_in_unsafe_fn
|
|
)]
|
|
#![cfg_attr(CONFIG_RUSTC_HAS_UNNECESSARY_TRANSMUTES, allow(unnecessary_transmutes))]
|
|
|
|
// Manual definition of blocklisted types.
|
|
type __kernel_size_t = usize;
|
|
type __kernel_ssize_t = isize;
|
|
type __kernel_ptrdiff_t = isize;
|
|
|
|
include!(concat!(env!("OBJTREE"), "/rust/uapi/uapi_generated.rs"));
|