linux-stable/rust
Gary Guo 60d8db49ef rust: compile libcore with edition 2024 for 1.87+
commit f4daa80d6b upstream.

Rust 1.87 (released on 2025-05-15) compiles core library with edition
2024 instead of 2021 [1]. Ensure that the edition matches libcore's
expectation to avoid potential breakage.

[ J3m3 reported in Zulip [2] that the `rust-analyzer` target was
  broken after this patch -- indeed, we need to avoid `core-cfgs`
  since those are passed to the `rust-analyzer` target.

  So, instead, I tweaked the patch to create a new `core-edition`
  variable and explicitly mention the `--edition` flag instead of
  reusing `core-cfg`s.

  In addition, pass a new argument using this new variable to
  `generate_rust_analyzer.py` so that we set the right edition there.

  By the way, for future reference: the `filter-out` change is needed
  for Rust < 1.87, since otherwise we would skip the `--edition=2021`
  we just added, ending up with no edition flag, and thus the compiler
  would default to the 2015 one.

  [2] https://rust-for-linux.zulipchat.com/#narrow/channel/291565/topic/x/near/520206547

    - Miguel ]

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/138162 [1]
Reported-by: est31 <est31@protonmail.com>
Closes: https://github.com/Rust-for-Linux/linux/issues/1163
Signed-off-by: Gary Guo <gary@garyguo.net>
Link: https://lore.kernel.org/r/20250517085600.2857460-1-gary@garyguo.net
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
[ Solved conflicts for 6.12.y backport. - Miguel ]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-06-27 11:11:40 +01:00
..
bindings rust: clean Rust 1.88.0's unnecessary_transmutes lint 2025-05-18 08:24:51 +02:00
helpers rust: alloc: implement KVmalloc allocator 2025-03-13 13:01:44 +01:00
kernel rust: alloc: add missing invariant in Vec::set_len() 2025-06-19 15:32:09 +02:00
macros rust: clean Rust 1.88.0's clippy::uninlined_format_args lint 2025-05-18 08:24:57 +02:00
uapi rust: clean Rust 1.88.0's unnecessary_transmutes lint 2025-05-18 08:24:51 +02:00
.gitignore
bindgen_parameters rust: map __kernel_size_t and friends also to usize/isize 2025-03-13 13:01:48 +01:00
build_error.rs
compiler_builtins.rs
exports.c kbuild: rust: remove the alloc crate and GlobalAlloc 2025-03-13 13:01:47 +01:00
ffi.rs rust: map long to isize and char to u8 2025-03-13 13:02:13 +01:00
Makefile rust: compile libcore with edition 2024 for 1.87+ 2025-06-27 11:11:40 +01:00