mirror of
https://github.com/torvalds/linux.git
synced 2026-02-04 15:28:49 +08:00
Merge tag 'rust-fixes-6.19' of git://git.kernel.org/pub/scm/linux/kernel/git/ojeda/linux
Pull Rust fixes from Miguel Ojeda:
"Toolchain and infrastructure:
- Trigger rebuilds of the newly added 'proc-macro2' crate (and its
dependencies) when the Rust compiler version changes
- Fix error in '.rsi' targets (macro expanding single targets) under
'O=' pointing to an external (not subdir) folder
- Fix off-by-one line number in 'rustdoc' KUnit tests
- Add '-fdiagnostics-show-context' to GCC flags skipped by 'bindgen'
- Clean objtool warning by adding one more 'noreturn' function
- Clean 'libpin_init_internal.{so,dylib}' in 'mrproper'
'kernel' crate:
- Fix build error when using expressions in formatting arguments
- Mark 'num::Bounded::__new()' as unsafe and clean documentation
accordingly
- Always inline functions using 'build_assert' with arguments
- Fix 'rusttest' build error providing the right 'isize_atomic_repr'
type for the host
'macros' crate:
- Fix 'rusttest' build error by ignoring example
rust-analyzer:
- Remove assertion that was not true for distributions like NixOS
- Add missing dependency edges and fix editions for 'quote' and
sysroot crates to provide correct IDE support
DRM Tyr:
- Fix build error by adding missing dependency on 'CONFIG_COMMON_CLK'
Plus clean a few typos in docs and comments"
* tag 'rust-fixes-6.19' of git://git.kernel.org/pub/scm/linux/kernel/git/ojeda/linux: (28 commits)
rust: num: bounded: clean __new documentation and comments
scripts: generate_rust_analyzer: fix resolution of #[pin_data] macros
drm/tyr: depend on `COMMON_CLK` to fix build error
rust: sync: atomic: Provide stub for `rusttest` 32-bit hosts
kbuild: rust: clean libpin_init_internal in mrproper
rust: proc-macro2: rebuild if the version text changes
rust: num: bounded: add missing comment for always inlined function
rust: sync: refcount: always inline functions using build_assert with arguments
rust: bits: always inline functions using build_assert with arguments
scripts: generate_rust_analyzer: compile sysroot with correct edition
scripts: generate_rust_analyzer: compile quote with correct edition
scripts: generate_rust_analyzer: quote: treat `core` and `std` as dependencies
scripts: generate_rust_analyzer: syn: treat `std` as a dependency
scripts: generate_rust_analyzer: remove sysroot assertion
rust: kbuild: give `--config-path` to `rustfmt` in `.rsi` target
scripts: generate_rust_analyzer: Add pin_init_internal deps
scripts: generate_rust_analyzer: Add pin_init -> compiler_builtins dep
scripts: generate_rust_analyzer: Add compiler_builtins -> core dep
rust: macros: ignore example with module parameters
rust: num: bounded: mark __new as unsafe
...
This commit is contained in:
3
Makefile
3
Makefile
@@ -1624,7 +1624,8 @@ MRPROPER_FILES += include/config include/generated \
|
||||
certs/x509.genkey \
|
||||
vmlinux-gdb.py \
|
||||
rpmbuild \
|
||||
rust/libmacros.so rust/libmacros.dylib
|
||||
rust/libmacros.so rust/libmacros.dylib \
|
||||
rust/libpin_init_internal.so rust/libpin_init_internal.dylib
|
||||
|
||||
# clean - Delete most, but leave enough to build external modules
|
||||
#
|
||||
|
||||
@@ -6,6 +6,7 @@ config DRM_TYR
|
||||
depends on RUST
|
||||
depends on ARM || ARM64 || COMPILE_TEST
|
||||
depends on !GENERIC_ATOMIC64 # for IOMMU_IO_PGTABLE_LPAE
|
||||
depends on COMMON_CLK
|
||||
default n
|
||||
help
|
||||
Rust DRM driver for ARM Mali CSF-based GPUs.
|
||||
|
||||
@@ -383,6 +383,7 @@ bindgen_skip_c_flags := -mno-fp-ret-in-387 -mpreferred-stack-boundary=% \
|
||||
-fno-inline-functions-called-once -fsanitize=bounds-strict \
|
||||
-fstrict-flex-arrays=% -fmin-function-alignment=% \
|
||||
-fzero-init-padding-bits=% -mno-fdpic \
|
||||
-fdiagnostics-show-context -fdiagnostics-show-context=% \
|
||||
--param=% --param asan-% -fno-isolate-erroneous-paths-dereference
|
||||
|
||||
# Derived from `scripts/Makefile.clang`.
|
||||
|
||||
@@ -27,7 +27,8 @@ macro_rules! impl_bit_fn {
|
||||
///
|
||||
/// This version is the default and should be used if `n` is known at
|
||||
/// compile time.
|
||||
#[inline]
|
||||
// Always inline to optimize out error path of `build_assert`.
|
||||
#[inline(always)]
|
||||
pub const fn [<bit_ $ty>](n: u32) -> $ty {
|
||||
build_assert!(n < <$ty>::BITS);
|
||||
(1 as $ty) << n
|
||||
@@ -75,7 +76,8 @@ macro_rules! impl_genmask_fn {
|
||||
/// This version is the default and should be used if the range is known
|
||||
/// at compile time.
|
||||
$(#[$genmask_ex])*
|
||||
#[inline]
|
||||
// Always inline to optimize out error path of `build_assert`.
|
||||
#[inline(always)]
|
||||
pub const fn [<genmask_ $ty>](range: RangeInclusive<u32>) -> $ty {
|
||||
let start = *range.start();
|
||||
let end = *range.end();
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
pub use core::fmt::{Arguments, Debug, Error, Formatter, Result, Write};
|
||||
|
||||
/// Internal adapter used to route allow implementations of formatting traits for foreign types.
|
||||
/// Internal adapter used to route and allow implementations of formatting traits for foreign types.
|
||||
///
|
||||
/// It is inserted automatically by the [`fmt!`] macro and is not meant to be used directly.
|
||||
///
|
||||
|
||||
@@ -40,11 +40,11 @@ fn fits_within<T: Integer>(value: T, num_bits: u32) -> bool {
|
||||
fits_within!(value, T, num_bits)
|
||||
}
|
||||
|
||||
/// An integer value that requires only the `N` less significant bits of the wrapped type to be
|
||||
/// An integer value that requires only the `N` least significant bits of the wrapped type to be
|
||||
/// encoded.
|
||||
///
|
||||
/// This limits the number of usable bits in the wrapped integer type, and thus the stored value to
|
||||
/// a narrower range, which provides guarantees that can be useful when working with in e.g.
|
||||
/// a narrower range, which provides guarantees that can be useful when working within e.g.
|
||||
/// bitfields.
|
||||
///
|
||||
/// # Invariants
|
||||
@@ -56,7 +56,7 @@ fn fits_within<T: Integer>(value: T, num_bits: u32) -> bool {
|
||||
/// # Examples
|
||||
///
|
||||
/// The preferred way to create values is through constants and the [`Bounded::new`] family of
|
||||
/// constructors, as they trigger a build error if the type invariants cannot be withheld.
|
||||
/// constructors, as they trigger a build error if the type invariants cannot be upheld.
|
||||
///
|
||||
/// ```
|
||||
/// use kernel::num::Bounded;
|
||||
@@ -82,7 +82,7 @@ fn fits_within<T: Integer>(value: T, num_bits: u32) -> bool {
|
||||
/// ```
|
||||
/// use kernel::num::Bounded;
|
||||
///
|
||||
/// // This succeeds because `15` can be represented with 4 unsigned bits.
|
||||
/// // This succeeds because `15` can be represented with 4 unsigned bits.
|
||||
/// assert!(Bounded::<u8, 4>::try_new(15).is_some());
|
||||
///
|
||||
/// // This fails because `16` cannot be represented with 4 unsigned bits.
|
||||
@@ -221,7 +221,7 @@ fn fits_within<T: Integer>(value: T, num_bits: u32) -> bool {
|
||||
/// let v: Option<Bounded<u16, 8>> = 128u32.try_into_bounded();
|
||||
/// assert_eq!(v.as_deref().copied(), Some(128));
|
||||
///
|
||||
/// // Fails because `128` doesn't fits into 6 bits.
|
||||
/// // Fails because `128` doesn't fit into 6 bits.
|
||||
/// let v: Option<Bounded<u16, 6>> = 128u32.try_into_bounded();
|
||||
/// assert_eq!(v, None);
|
||||
/// ```
|
||||
@@ -259,9 +259,9 @@ macro_rules! impl_const_new {
|
||||
assert!(fits_within!(VALUE, $type, N));
|
||||
}
|
||||
|
||||
// INVARIANT: `fits_within` confirmed that `VALUE` can be represented within
|
||||
// SAFETY: `fits_within` confirmed that `VALUE` can be represented within
|
||||
// `N` bits.
|
||||
Self::__new(VALUE)
|
||||
unsafe { Self::__new(VALUE) }
|
||||
}
|
||||
}
|
||||
)*
|
||||
@@ -282,9 +282,10 @@ where
|
||||
/// All instances of [`Bounded`] must be created through this method as it enforces most of the
|
||||
/// type invariants.
|
||||
///
|
||||
/// The caller remains responsible for checking, either statically or dynamically, that `value`
|
||||
/// can be represented as a `T` using at most `N` bits.
|
||||
const fn __new(value: T) -> Self {
|
||||
/// # Safety
|
||||
///
|
||||
/// The caller must ensure that `value` can be represented within `N` bits.
|
||||
const unsafe fn __new(value: T) -> Self {
|
||||
// Enforce the type invariants.
|
||||
const {
|
||||
// `N` cannot be zero.
|
||||
@@ -293,6 +294,7 @@ where
|
||||
assert!(N <= T::BITS);
|
||||
}
|
||||
|
||||
// INVARIANT: The caller ensures `value` fits within `N` bits.
|
||||
Self(value)
|
||||
}
|
||||
|
||||
@@ -328,8 +330,8 @@ where
|
||||
/// ```
|
||||
pub fn try_new(value: T) -> Option<Self> {
|
||||
fits_within(value, N).then(|| {
|
||||
// INVARIANT: `fits_within` confirmed that `value` can be represented within `N` bits.
|
||||
Self::__new(value)
|
||||
// SAFETY: `fits_within` confirmed that `value` can be represented within `N` bits.
|
||||
unsafe { Self::__new(value) }
|
||||
})
|
||||
}
|
||||
|
||||
@@ -363,6 +365,7 @@ where
|
||||
/// assert_eq!(Bounded::<u8, 1>::from_expr(1).get(), 1);
|
||||
/// assert_eq!(Bounded::<u16, 8>::from_expr(0xff).get(), 0xff);
|
||||
/// ```
|
||||
// Always inline to optimize out error path of `build_assert`.
|
||||
#[inline(always)]
|
||||
pub fn from_expr(expr: T) -> Self {
|
||||
crate::build_assert!(
|
||||
@@ -370,8 +373,8 @@ where
|
||||
"Requested value larger than maximal representable value."
|
||||
);
|
||||
|
||||
// INVARIANT: `fits_within` confirmed that `expr` can be represented within `N` bits.
|
||||
Self::__new(expr)
|
||||
// SAFETY: `fits_within` confirmed that `expr` can be represented within `N` bits.
|
||||
unsafe { Self::__new(expr) }
|
||||
}
|
||||
|
||||
/// Returns the wrapped value as the backing type.
|
||||
@@ -410,9 +413,9 @@ where
|
||||
);
|
||||
}
|
||||
|
||||
// INVARIANT: The value did fit within `N` bits, so it will all the more fit within
|
||||
// SAFETY: The value did fit within `N` bits, so it will all the more fit within
|
||||
// the larger `M` bits.
|
||||
Bounded::__new(self.0)
|
||||
unsafe { Bounded::__new(self.0) }
|
||||
}
|
||||
|
||||
/// Attempts to shrink the number of bits usable for `self`.
|
||||
@@ -466,9 +469,9 @@ where
|
||||
// `U` and `T` have the same sign, hence this conversion cannot fail.
|
||||
let value = unsafe { U::try_from(self.get()).unwrap_unchecked() };
|
||||
|
||||
// INVARIANT: Although the backing type has changed, the value is still represented within
|
||||
// SAFETY: Although the backing type has changed, the value is still represented within
|
||||
// `N` bits, and with the same signedness.
|
||||
Bounded::__new(value)
|
||||
unsafe { Bounded::__new(value) }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -501,7 +504,7 @@ where
|
||||
/// let v: Option<Bounded<u16, 8>> = 128u32.try_into_bounded();
|
||||
/// assert_eq!(v.as_deref().copied(), Some(128));
|
||||
///
|
||||
/// // Fails because `128` doesn't fits into 6 bits.
|
||||
/// // Fails because `128` doesn't fit into 6 bits.
|
||||
/// let v: Option<Bounded<u16, 6>> = 128u32.try_into_bounded();
|
||||
/// assert_eq!(v, None);
|
||||
/// ```
|
||||
@@ -944,9 +947,9 @@ macro_rules! impl_from_primitive {
|
||||
Self: AtLeastXBits<{ <$type as Integer>::BITS as usize }>,
|
||||
{
|
||||
fn from(value: $type) -> Self {
|
||||
// INVARIANT: The trait bound on `Self` guarantees that `N` bits is
|
||||
// SAFETY: The trait bound on `Self` guarantees that `N` bits is
|
||||
// enough to hold any value of the source type.
|
||||
Self::__new(T::from(value))
|
||||
unsafe { Self::__new(T::from(value)) }
|
||||
}
|
||||
}
|
||||
)*
|
||||
@@ -1051,8 +1054,8 @@ where
|
||||
T: Integer + From<bool>,
|
||||
{
|
||||
fn from(value: bool) -> Self {
|
||||
// INVARIANT: A boolean can be represented using a single bit, and thus fits within any
|
||||
// SAFETY: A boolean can be represented using a single bit, and thus fits within any
|
||||
// integer type for any `N` > 0.
|
||||
Self::__new(T::from(value))
|
||||
unsafe { Self::__new(T::from(value)) }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -985,7 +985,7 @@ impl<'a, K, V> CursorMut<'a, K, V> {
|
||||
self.peek(Direction::Prev)
|
||||
}
|
||||
|
||||
/// Access the previous node without moving the cursor.
|
||||
/// Access the next node without moving the cursor.
|
||||
pub fn peek_next(&self) -> Option<(&K, &V)> {
|
||||
self.peek(Direction::Next)
|
||||
}
|
||||
@@ -1130,7 +1130,7 @@ pub struct IterMut<'a, K, V> {
|
||||
}
|
||||
|
||||
// SAFETY: The [`IterMut`] has exclusive access to both `K` and `V`, so it is sufficient to require them to be `Send`.
|
||||
// The iterator only gives out immutable references to the keys, but since the iterator has excusive access to those same
|
||||
// The iterator only gives out immutable references to the keys, but since the iterator has exclusive access to those same
|
||||
// keys, `Send` is sufficient. `Sync` would be okay, but it is more restrictive to the user.
|
||||
unsafe impl<'a, K: Send, V: Send> Send for IterMut<'a, K, V> {}
|
||||
|
||||
|
||||
@@ -35,12 +35,23 @@ unsafe impl super::AtomicAdd<i64> for i64 {
|
||||
// as `isize` and `usize`, and `isize` and `usize` are always bi-directional transmutable to
|
||||
// `isize_atomic_repr`, which also always implements `AtomicImpl`.
|
||||
#[allow(non_camel_case_types)]
|
||||
#[cfg(not(testlib))]
|
||||
#[cfg(not(CONFIG_64BIT))]
|
||||
type isize_atomic_repr = i32;
|
||||
#[allow(non_camel_case_types)]
|
||||
#[cfg(not(testlib))]
|
||||
#[cfg(CONFIG_64BIT)]
|
||||
type isize_atomic_repr = i64;
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
#[cfg(testlib)]
|
||||
#[cfg(target_pointer_width = "32")]
|
||||
type isize_atomic_repr = i32;
|
||||
#[allow(non_camel_case_types)]
|
||||
#[cfg(testlib)]
|
||||
#[cfg(target_pointer_width = "64")]
|
||||
type isize_atomic_repr = i64;
|
||||
|
||||
// Ensure size and alignment requirements are checked.
|
||||
static_assert!(size_of::<isize>() == size_of::<isize_atomic_repr>());
|
||||
static_assert!(align_of::<isize>() == align_of::<isize_atomic_repr>());
|
||||
|
||||
@@ -23,7 +23,8 @@ impl Refcount {
|
||||
/// Construct a new [`Refcount`] from an initial value.
|
||||
///
|
||||
/// The initial value should be non-saturated.
|
||||
#[inline]
|
||||
// Always inline to optimize out error path of `build_assert`.
|
||||
#[inline(always)]
|
||||
pub fn new(value: i32) -> Self {
|
||||
build_assert!(value >= 0, "initial value saturated");
|
||||
// SAFETY: There are no safety requirements for this FFI call.
|
||||
|
||||
@@ -67,7 +67,7 @@ pub(crate) fn fmt(input: TokenStream) -> TokenStream {
|
||||
}
|
||||
(None, acc)
|
||||
})();
|
||||
args.extend(quote_spanned!(first_span => #lhs #adapter(&#rhs)));
|
||||
args.extend(quote_spanned!(first_span => #lhs #adapter(&(#rhs))));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ use proc_macro::TokenStream;
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// ```ignore
|
||||
/// use kernel::prelude::*;
|
||||
///
|
||||
/// module!{
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
// SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
|
||||
// When fixdep scans this, it will find this string `CONFIG_RUSTC_VERSION_TEXT`
|
||||
// and thus add a dependency on `include/config/RUSTC_VERSION_TEXT`, which is
|
||||
// touched by Kconfig when the version string from the compiler changes.
|
||||
|
||||
//! [![github]](https://github.com/dtolnay/proc-macro2) [![crates-io]](https://crates.io/crates/proc-macro2) [![docs-rs]](crate)
|
||||
//!
|
||||
//! [github]: https://img.shields.io/badge/github-8da0cb?style=for-the-badge&labelColor=555555&logo=github
|
||||
|
||||
@@ -356,7 +356,7 @@ $(obj)/%.o: $(obj)/%.rs FORCE
|
||||
quiet_cmd_rustc_rsi_rs = $(RUSTC_OR_CLIPPY_QUIET) $(quiet_modtag) $@
|
||||
cmd_rustc_rsi_rs = \
|
||||
$(rust_common_cmd) -Zunpretty=expanded $< >$@; \
|
||||
command -v $(RUSTFMT) >/dev/null && $(RUSTFMT) $@
|
||||
command -v $(RUSTFMT) >/dev/null && $(RUSTFMT) --config-path $(srctree)/.rustfmt.toml $@
|
||||
|
||||
$(obj)/%.rsi: $(obj)/%.rs FORCE
|
||||
+$(call if_changed_dep,rustc_rsi_rs)
|
||||
|
||||
@@ -61,7 +61,6 @@ def generate_crates(srctree, objtree, sysroot_src, external_src, cfgs, core_edit
|
||||
display_name,
|
||||
deps,
|
||||
cfg=[],
|
||||
edition="2021",
|
||||
):
|
||||
append_crate(
|
||||
display_name,
|
||||
@@ -69,13 +68,37 @@ def generate_crates(srctree, objtree, sysroot_src, external_src, cfgs, core_edit
|
||||
deps,
|
||||
cfg,
|
||||
is_workspace_member=False,
|
||||
edition=edition,
|
||||
# Miguel Ojeda writes:
|
||||
#
|
||||
# > ... in principle even the sysroot crates may have different
|
||||
# > editions.
|
||||
# >
|
||||
# > For instance, in the move to 2024, it seems all happened at once
|
||||
# > in 1.87.0 in these upstream commits:
|
||||
# >
|
||||
# > 0e071c2c6a58 ("Migrate core to Rust 2024")
|
||||
# > f505d4e8e380 ("Migrate alloc to Rust 2024")
|
||||
# > 0b2489c226c3 ("Migrate proc_macro to Rust 2024")
|
||||
# > 993359e70112 ("Migrate std to Rust 2024")
|
||||
# >
|
||||
# > But in the previous move to 2021, `std` moved in 1.59.0, while
|
||||
# > the others in 1.60.0:
|
||||
# >
|
||||
# > b656384d8398 ("Update stdlib to the 2021 edition")
|
||||
# > 06a1c14d52a8 ("Switch all libraries to the 2021 edition")
|
||||
#
|
||||
# Link: https://lore.kernel.org/all/CANiq72kd9bHdKaAm=8xCUhSHMy2csyVed69bOc4dXyFAW4sfuw@mail.gmail.com/
|
||||
#
|
||||
# At the time of writing all rust versions we support build the
|
||||
# sysroot crates with the same edition. We may need to relax this
|
||||
# assumption if future edition moves span multiple rust versions.
|
||||
edition=core_edition,
|
||||
)
|
||||
|
||||
# NB: sysroot crates reexport items from one another so setting up our transitive dependencies
|
||||
# here is important for ensuring that rust-analyzer can resolve symbols. The sources of truth
|
||||
# for this dependency graph are `(sysroot_src / crate / "Cargo.toml" for crate in crates)`.
|
||||
append_sysroot_crate("core", [], cfg=crates_cfgs.get("core", []), edition=core_edition)
|
||||
append_sysroot_crate("core", [], cfg=crates_cfgs.get("core", []))
|
||||
append_sysroot_crate("alloc", ["core"])
|
||||
append_sysroot_crate("std", ["alloc", "core"])
|
||||
append_sysroot_crate("proc_macro", ["core", "std"])
|
||||
@@ -83,7 +106,7 @@ def generate_crates(srctree, objtree, sysroot_src, external_src, cfgs, core_edit
|
||||
append_crate(
|
||||
"compiler_builtins",
|
||||
srctree / "rust" / "compiler_builtins.rs",
|
||||
[],
|
||||
["core"],
|
||||
)
|
||||
|
||||
append_crate(
|
||||
@@ -96,14 +119,15 @@ def generate_crates(srctree, objtree, sysroot_src, external_src, cfgs, core_edit
|
||||
append_crate(
|
||||
"quote",
|
||||
srctree / "rust" / "quote" / "lib.rs",
|
||||
["alloc", "proc_macro", "proc_macro2"],
|
||||
["core", "alloc", "std", "proc_macro", "proc_macro2"],
|
||||
cfg=crates_cfgs["quote"],
|
||||
edition="2018",
|
||||
)
|
||||
|
||||
append_crate(
|
||||
"syn",
|
||||
srctree / "rust" / "syn" / "lib.rs",
|
||||
["proc_macro", "proc_macro2", "quote"],
|
||||
["std", "proc_macro", "proc_macro2", "quote"],
|
||||
cfg=crates_cfgs["syn"],
|
||||
)
|
||||
|
||||
@@ -123,7 +147,7 @@ def generate_crates(srctree, objtree, sysroot_src, external_src, cfgs, core_edit
|
||||
append_crate(
|
||||
"pin_init_internal",
|
||||
srctree / "rust" / "pin-init" / "internal" / "src" / "lib.rs",
|
||||
[],
|
||||
["std", "proc_macro"],
|
||||
cfg=["kernel"],
|
||||
is_proc_macro=True,
|
||||
)
|
||||
@@ -131,7 +155,7 @@ def generate_crates(srctree, objtree, sysroot_src, external_src, cfgs, core_edit
|
||||
append_crate(
|
||||
"pin_init",
|
||||
srctree / "rust" / "pin-init" / "src" / "lib.rs",
|
||||
["core", "pin_init_internal", "macros"],
|
||||
["core", "compiler_builtins", "pin_init_internal", "macros"],
|
||||
cfg=["kernel"],
|
||||
)
|
||||
|
||||
@@ -190,7 +214,7 @@ def generate_crates(srctree, objtree, sysroot_src, external_src, cfgs, core_edit
|
||||
append_crate(
|
||||
name,
|
||||
path,
|
||||
["core", "kernel"],
|
||||
["core", "kernel", "pin_init"],
|
||||
cfg=cfg,
|
||||
)
|
||||
|
||||
@@ -213,9 +237,6 @@ def main():
|
||||
level=logging.INFO if args.verbose else logging.WARNING
|
||||
)
|
||||
|
||||
# Making sure that the `sysroot` and `sysroot_src` belong to the same toolchain.
|
||||
assert args.sysroot in args.sysroot_src.parents
|
||||
|
||||
rust_project = {
|
||||
"crates": generate_crates(args.srctree, args.objtree, args.sysroot_src, args.exttree, args.cfgs, args.core_edition),
|
||||
"sysroot": str(args.sysroot),
|
||||
|
||||
@@ -206,7 +206,7 @@ pub extern "C" fn {kunit_name}(__kunit_test: *mut ::kernel::bindings::kunit) {{
|
||||
|
||||
/// The anchor where the test code body starts.
|
||||
#[allow(unused)]
|
||||
static __DOCTEST_ANCHOR: i32 = ::core::line!() as i32 + {body_offset} + 1;
|
||||
static __DOCTEST_ANCHOR: i32 = ::core::line!() as i32 + {body_offset} + 2;
|
||||
{{
|
||||
#![allow(unreachable_pub, clippy::disallowed_names)]
|
||||
{body}
|
||||
|
||||
@@ -197,7 +197,8 @@ static bool is_rust_noreturn(const struct symbol *func)
|
||||
* as well as changes to the source code itself between versions (since
|
||||
* these come from the Rust standard library).
|
||||
*/
|
||||
return str_ends_with(func->name, "_4core5sliceSp15copy_from_slice17len_mismatch_fail") ||
|
||||
return str_ends_with(func->name, "_4core3num22from_ascii_radix_panic") ||
|
||||
str_ends_with(func->name, "_4core5sliceSp15copy_from_slice17len_mismatch_fail") ||
|
||||
str_ends_with(func->name, "_4core6option13expect_failed") ||
|
||||
str_ends_with(func->name, "_4core6option13unwrap_failed") ||
|
||||
str_ends_with(func->name, "_4core6result13unwrap_failed") ||
|
||||
|
||||
Reference in New Issue
Block a user