Commit acc0bac1 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull Rust fixes from Miguel Ojeda:
 "Toolchain and infrastructure:

   - Fix build and modpost confusion for the upcoming Rust 1.89.0
     release

   - Clean objtool warning for the upcoming Rust 1.89.0 release by
     adding one more noreturn function

  'kernel' crate:

   - Fix build error when using generics in the 'try_{,pin_}init!'
     macros"

* tag 'rust-fixes-6.16-2' of git://git.kernel.org/pub/scm/linux/kernel/git/ojeda/linux:
  rust: use `#[used(compiler)]` to fix build and `modpost` with Rust >= 1.89.0
  objtool/rust: add one more `noreturn` Rust function for Rust 1.89.0
  rust: init: Fix generics in *_init! macros
parents 1c6aa112 74981592
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -194,6 +194,7 @@ quiet_cmd_rustdoc_test = RUSTDOC T $<
	RUST_MODFILE=test.rs \
	OBJTREE=$(abspath $(objtree)) \
	$(RUSTDOC) --test $(rust_common_flags) \
		-Zcrate-attr='feature(used_with_arg)' \
		@$(objtree)/include/generated/rustc_cfg \
		$(rustc_target_flags) $(rustdoc_test_target_flags) \
		$(rustdoc_test_quiet) \
+1 −1
Original line number Diff line number Diff line
@@ -202,7 +202,7 @@ macro_rules! module_firmware {
            };

            #[link_section = ".modinfo"]
            #[used]
            #[used(compiler)]
            static __MODULE_FIRMWARE: [u8; $($builder)*::create(__MODULE_FIRMWARE_PREFIX)
                .build_length()] = $($builder)*::create(__MODULE_FIRMWARE_PREFIX).build();
        };
+4 −4
Original line number Diff line number Diff line
@@ -231,14 +231,14 @@ macro_rules! try_init {
    ($(&$this:ident in)? $t:ident $(::<$($generics:ty),* $(,)?>)? {
        $($fields:tt)*
    }) => {
        ::pin_init::try_init!($(&$this in)? $t $(::<$($generics),* $(,)?>)? {
        ::pin_init::try_init!($(&$this in)? $t $(::<$($generics),*>)? {
            $($fields)*
        }? $crate::error::Error)
    };
    ($(&$this:ident in)? $t:ident $(::<$($generics:ty),* $(,)?>)? {
        $($fields:tt)*
    }? $err:ty) => {
        ::pin_init::try_init!($(&$this in)? $t $(::<$($generics),* $(,)?>)? {
        ::pin_init::try_init!($(&$this in)? $t $(::<$($generics),*>)? {
            $($fields)*
        }? $err)
    };
@@ -291,14 +291,14 @@ macro_rules! try_pin_init {
    ($(&$this:ident in)? $t:ident $(::<$($generics:ty),* $(,)?>)? {
        $($fields:tt)*
    }) => {
        ::pin_init::try_pin_init!($(&$this in)? $t $(::<$($generics),* $(,)?>)? {
        ::pin_init::try_pin_init!($(&$this in)? $t $(::<$($generics),*>)? {
            $($fields)*
        }? $crate::error::Error)
    };
    ($(&$this:ident in)? $t:ident $(::<$($generics:ty),* $(,)?>)? {
        $($fields:tt)*
    }? $err:ty) => {
        ::pin_init::try_pin_init!($(&$this in)? $t $(::<$($generics),* $(,)?>)? {
        ::pin_init::try_pin_init!($(&$this in)? $t $(::<$($generics),*>)? {
            $($fields)*
        }? $err)
    };
+1 −1
Original line number Diff line number Diff line
@@ -302,7 +302,7 @@ macro_rules! kunit_unsafe_test_suite {
                    is_init: false,
                };

            #[used]
            #[used(compiler)]
            #[allow(unused_unsafe)]
            #[cfg_attr(not(target_os = "macos"), link_section = ".kunit_test_suites")]
            static mut KUNIT_TEST_SUITE_ENTRY: *const ::kernel::bindings::kunit_suite =
+3 −0
Original line number Diff line number Diff line
@@ -34,6 +34,9 @@
// Expected to become stable.
#![feature(arbitrary_self_types)]
//
// To be determined.
#![feature(used_with_arg)]
//
// `feature(derive_coerce_pointee)` is expected to become stable. Before Rust
// 1.84.0, it did not exist, so enable the predecessor features.
#![cfg_attr(CONFIG_RUSTC_HAS_COERCE_POINTEE, feature(derive_coerce_pointee))]
Loading