mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 14:11:52 +00:00
Rust fixes for v6.11 (2nd)
Toolchain and infrastructure: - Fix builds for nightly compiler users now that 'new_uninit' was split into new features by using an alternative approach for the code that used what is now called the 'box_uninit_write' feature. - Allow the 'stable_features' lint to preempt upcoming warnings about them, since soon there will be unstable features that will become stable in nightly compilers. - Export bss symbols too. 'kernel' crate: - 'block' module: fix wrong usage of lockdep API. 'macros' crate: - Provide correct provenance when constructing 'THIS_MODULE'. Documentation: - Remove unintended indentation (blockquotes) in generated output. - Fix a couple typos. MAINTAINERS: - Remove Wedson as Rust maintainer. - Update Andreas' email. -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEPjU5OPd5QIZ9jqqOGXyLc2htIW0FAmbaIkMACgkQGXyLc2ht IW2PtQ//ZMLngRVmzOtek7oz3NfR7vAbMjwknC8uy9xKsBGGYpyI9LUdBziMB/SD +/moWfLacJwuFRRlgsPVjo6IcwCnMauO5V77cWWTbcH6dgigfD4fz/IpZlMuTdUA gQ8xAjr8jMK0uT3ME5v7QpXQYOE/1wvOHJpULO71On1l4JqxCbSRozxI4TTxFEmP mVRCV7c38NzX2YZyYkIzbkXNS8y0tbCTMC1HLCfROOrxbGh7eqjq/AZcHl2SkxHg C0u0Rc7BQtMkCQqtceEWPNloe2SlznbhqiJi6vOttM3LUFYCtS76zqrGnnqtFkMF zJuXYNpbjFDvZCfbOL50p0oYb5G/+FgZarK+TPXympPnyqoyWNufwS5N0Hn10wn8 5GbI3ZGrg6q5SE39Sf/wiC9tMP4h2dUTeLwabk2yuW7QVBAxw52SkEtpRIevSN2n b0IUExRHilXMBY0FmkP3x+Ot+qkydxWH0c/rpf9NldNfP7F6QY384hn47/cl8bMo LUygXBjAbDTtKage97JkZTfmOUeS6nrYrQjLL/kUu1H+AdnhOUndtaHv6W5zArQQ hFU751+izJFiEw8wqw1MoK2CcRL5QNMDdrj+kwXaCMNSv0Ie3p4jqXuWXSVUBoMz l0pJMgjE1Dc2QYTDV3Jq8ptiiBBM9Oyxen/doBA0OJiMm9S1drQ= =nJge -----END PGP SIGNATURE----- Merge tag 'rust-fixes-6.11-2' of https://github.com/Rust-for-Linux/linux Pull Rust fixes from Miguel Ojeda: "Toolchain and infrastructure: - Fix builds for nightly compiler users now that 'new_uninit' was split into new features by using an alternative approach for the code that used what is now called the 'box_uninit_write' feature - Allow the 'stable_features' lint to preempt upcoming warnings about them, since soon there will be unstable features that will become stable in nightly compilers - Export bss symbols too 'kernel' crate: - 'block' module: fix wrong usage of lockdep API 'macros' crate: - Provide correct provenance when constructing 'THIS_MODULE' Documentation: - Remove unintended indentation (blockquotes) in generated output - Fix a couple typos MAINTAINERS: - Remove Wedson as Rust maintainer - Update Andreas' email" * tag 'rust-fixes-6.11-2' of https://github.com/Rust-for-Linux/linux: MAINTAINERS: update Andreas Hindborg's email address MAINTAINERS: Remove Wedson as Rust maintainer rust: macros: provide correct provenance when constructing THIS_MODULE rust: allow `stable_features` lint docs: rust: remove unintended blockquote in Quick Start rust: alloc: eschew `Box<MaybeUninit<T>>::write` rust: kernel: fix typos in code comments docs: rust: remove unintended blockquote in Coding Guidelines rust: block: fix wrong usage of lockdep API rust: kbuild: fix export of bss symbols
This commit is contained in:
commit
6c5b3e30e5
1
.mailmap
1
.mailmap
@ -60,6 +60,7 @@ Amit Nischal <quic_anischal@quicinc.com> <anischal@codeaurora.org>
|
||||
Andi Kleen <ak@linux.intel.com> <ak@suse.de>
|
||||
Andi Shyti <andi@etezian.org> <andi.shyti@samsung.com>
|
||||
Andreas Herrmann <aherrman@de.ibm.com>
|
||||
Andreas Hindborg <a.hindborg@kernel.org> <a.hindborg@samsung.com>
|
||||
Andrej Shadura <andrew.shadura@collabora.co.uk>
|
||||
Andrej Shadura <andrew@shadura.me> <andrew@beldisplaytech.com>
|
||||
Andrew Morton <akpm@linux-foundation.org>
|
||||
|
@ -145,26 +145,26 @@ This is how a well-documented Rust function may look like:
|
||||
This example showcases a few ``rustdoc`` features and some conventions followed
|
||||
in the kernel:
|
||||
|
||||
- The first paragraph must be a single sentence briefly describing what
|
||||
- The first paragraph must be a single sentence briefly describing what
|
||||
the documented item does. Further explanations must go in extra paragraphs.
|
||||
|
||||
- Unsafe functions must document their safety preconditions under
|
||||
- Unsafe functions must document their safety preconditions under
|
||||
a ``# Safety`` section.
|
||||
|
||||
- While not shown here, if a function may panic, the conditions under which
|
||||
- While not shown here, if a function may panic, the conditions under which
|
||||
that happens must be described under a ``# Panics`` section.
|
||||
|
||||
Please note that panicking should be very rare and used only with a good
|
||||
reason. In almost all cases, a fallible approach should be used, typically
|
||||
returning a ``Result``.
|
||||
|
||||
- If providing examples of usage would help readers, they must be written in
|
||||
- If providing examples of usage would help readers, they must be written in
|
||||
a section called ``# Examples``.
|
||||
|
||||
- Rust items (functions, types, constants...) must be linked appropriately
|
||||
- Rust items (functions, types, constants...) must be linked appropriately
|
||||
(``rustdoc`` will create a link automatically).
|
||||
|
||||
- Any ``unsafe`` block must be preceded by a ``// SAFETY:`` comment
|
||||
- Any ``unsafe`` block must be preceded by a ``// SAFETY:`` comment
|
||||
describing why the code inside is sound.
|
||||
|
||||
While sometimes the reason might look trivial and therefore unneeded,
|
||||
|
@ -305,7 +305,7 @@ If GDB/Binutils is used and Rust symbols are not getting demangled, the reason
|
||||
is the toolchain does not support Rust's new v0 mangling scheme yet.
|
||||
There are a few ways out:
|
||||
|
||||
- Install a newer release (GDB >= 10.2, Binutils >= 2.36).
|
||||
- Install a newer release (GDB >= 10.2, Binutils >= 2.36).
|
||||
|
||||
- Some versions of GDB (e.g. vanilla GDB 10.1) are able to use
|
||||
- Some versions of GDB (e.g. vanilla GDB 10.1) are able to use
|
||||
the pre-demangled names embedded in the debug info (``CONFIG_DEBUG_INFO``).
|
||||
|
@ -3868,7 +3868,7 @@ F: kernel/trace/blktrace.c
|
||||
F: lib/sbitmap.c
|
||||
|
||||
BLOCK LAYER DEVICE DRIVER API [RUST]
|
||||
M: Andreas Hindborg <a.hindborg@samsung.com>
|
||||
M: Andreas Hindborg <a.hindborg@kernel.org>
|
||||
R: Boqun Feng <boqun.feng@gmail.com>
|
||||
L: linux-block@vger.kernel.org
|
||||
L: rust-for-linux@vger.kernel.org
|
||||
@ -19932,12 +19932,11 @@ F: tools/verification/
|
||||
RUST
|
||||
M: Miguel Ojeda <ojeda@kernel.org>
|
||||
M: Alex Gaynor <alex.gaynor@gmail.com>
|
||||
M: Wedson Almeida Filho <wedsonaf@gmail.com>
|
||||
R: Boqun Feng <boqun.feng@gmail.com>
|
||||
R: Gary Guo <gary@garyguo.net>
|
||||
R: Björn Roy Baron <bjorn3_gh@protonmail.com>
|
||||
R: Benno Lossin <benno.lossin@proton.me>
|
||||
R: Andreas Hindborg <a.hindborg@samsung.com>
|
||||
R: Andreas Hindborg <a.hindborg@kernel.org>
|
||||
R: Alice Ryhl <aliceryhl@google.com>
|
||||
L: rust-for-linux@vger.kernel.org
|
||||
S: Supported
|
||||
|
1
Makefile
1
Makefile
@ -445,6 +445,7 @@ KBUILD_USERLDFLAGS := $(USERLDFLAGS)
|
||||
# host programs.
|
||||
export rust_common_flags := --edition=2021 \
|
||||
-Zbinary_dep_depinfo=y \
|
||||
-Astable_features \
|
||||
-Dunsafe_op_in_unsafe_fn \
|
||||
-Dnon_ascii_idents \
|
||||
-Wrust_2018_idioms \
|
||||
|
@ -305,7 +305,7 @@ $(obj)/bindings/bindings_helpers_generated.rs: $(src)/helpers.c FORCE
|
||||
quiet_cmd_exports = EXPORTS $@
|
||||
cmd_exports = \
|
||||
$(NM) -p --defined-only $< \
|
||||
| awk '/ (T|R|D) / {printf "EXPORT_SYMBOL_RUST_GPL(%s);\n",$$3}' > $@
|
||||
| awk '/ (T|R|D|B) / {printf "EXPORT_SYMBOL_RUST_GPL(%s);\n",$$3}' > $@
|
||||
|
||||
$(obj)/exports_core_generated.h: $(obj)/core.o FORCE
|
||||
$(call if_changed,exports)
|
||||
|
@ -21,8 +21,10 @@ pub trait BoxExt<T>: Sized {
|
||||
|
||||
impl<T> BoxExt<T> for Box<T> {
|
||||
fn new(x: T, flags: Flags) -> Result<Self, AllocError> {
|
||||
let b = <Self as BoxExt<_>>::new_uninit(flags)?;
|
||||
Ok(Box::write(b, x))
|
||||
let mut b = <Self as BoxExt<_>>::new_uninit(flags)?;
|
||||
b.write(x);
|
||||
// SAFETY: We just wrote to it.
|
||||
Ok(unsafe { b.assume_init() })
|
||||
}
|
||||
|
||||
#[cfg(any(test, testlib))]
|
||||
|
@ -6,8 +6,8 @@
|
||||
//! C header: [`include/linux/blk_mq.h`](srctree/include/linux/blk_mq.h)
|
||||
|
||||
use crate::block::mq::{raw_writer::RawWriter, Operations, TagSet};
|
||||
use crate::error;
|
||||
use crate::{bindings, error::from_err_ptr, error::Result, sync::Arc};
|
||||
use crate::{error, static_lock_class};
|
||||
use core::fmt::{self, Write};
|
||||
|
||||
/// A builder for [`GenDisk`].
|
||||
@ -93,8 +93,6 @@ impl GenDiskBuilder {
|
||||
name: fmt::Arguments<'_>,
|
||||
tagset: Arc<TagSet<T>>,
|
||||
) -> Result<GenDisk<T>> {
|
||||
let lock_class_key = crate::sync::LockClassKey::new();
|
||||
|
||||
// SAFETY: `bindings::queue_limits` contain only fields that are valid when zeroed.
|
||||
let mut lim: bindings::queue_limits = unsafe { core::mem::zeroed() };
|
||||
|
||||
@ -110,7 +108,7 @@ impl GenDiskBuilder {
|
||||
tagset.raw_tag_set(),
|
||||
&mut lim,
|
||||
core::ptr::null_mut(),
|
||||
lock_class_key.as_ptr(),
|
||||
static_lock_class!().as_ptr(),
|
||||
)
|
||||
})?;
|
||||
|
||||
|
@ -145,7 +145,7 @@
|
||||
//! }
|
||||
//! }
|
||||
//! // Implement the internal `PinData` trait that marks the pin-data struct as a pin-data
|
||||
//! // struct. This is important to ensure that no user can implement a rouge `__pin_data`
|
||||
//! // struct. This is important to ensure that no user can implement a rogue `__pin_data`
|
||||
//! // function without using `unsafe`.
|
||||
//! unsafe impl<T> ::kernel::init::__internal::PinData for __ThePinData<T> {
|
||||
//! type Datee = Bar<T>;
|
||||
@ -156,7 +156,7 @@
|
||||
//! // case no such fields exist, hence this is almost empty. The two phantomdata fields exist
|
||||
//! // for two reasons:
|
||||
//! // - `__phantom`: every generic must be used, since we cannot really know which generics
|
||||
//! // are used, we declere all and then use everything here once.
|
||||
//! // are used, we declare all and then use everything here once.
|
||||
//! // - `__phantom_pin`: uses the `'__pin` lifetime and ensures that this struct is invariant
|
||||
//! // over it. The lifetime is needed to work around the limitation that trait bounds must
|
||||
//! // not be trivial, e.g. the user has a `#[pin] PhantomPinned` field -- this is
|
||||
|
@ -491,7 +491,7 @@ impl<T: Driver> Adapter<T> {
|
||||
pub struct DriverVTable(Opaque<bindings::phy_driver>);
|
||||
|
||||
// SAFETY: `DriverVTable` doesn't expose any &self method to access internal data, so it's safe to
|
||||
// share `&DriverVTable` across execution context boundries.
|
||||
// share `&DriverVTable` across execution context boundaries.
|
||||
unsafe impl Sync for DriverVTable {}
|
||||
|
||||
/// Creates a [`DriverVTable`] instance from [`Driver`].
|
||||
|
@ -217,7 +217,11 @@ pub(crate) fn module(ts: TokenStream) -> TokenStream {
|
||||
// freed until the module is unloaded.
|
||||
#[cfg(MODULE)]
|
||||
static THIS_MODULE: kernel::ThisModule = unsafe {{
|
||||
kernel::ThisModule::from_ptr(&kernel::bindings::__this_module as *const _ as *mut _)
|
||||
extern \"C\" {{
|
||||
static __this_module: kernel::types::Opaque<kernel::bindings::module>;
|
||||
}}
|
||||
|
||||
kernel::ThisModule::from_ptr(__this_module.get())
|
||||
}};
|
||||
#[cfg(not(MODULE))]
|
||||
static THIS_MODULE: kernel::ThisModule = unsafe {{
|
||||
|
Loading…
Reference in New Issue
Block a user