Skip to content

Commit 8bab26f

Browse files
committed
Auto merge of #159288 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum
[stable] 1.97.1 release This backports: * #159106 * #159047 Currently not approved: * #159039 - thread is trending towards a decline of backport
2 parents 2d8144b + 979b2d3 commit 8bab26f

6 files changed

Lines changed: 63 additions & 9 deletions

File tree

RELEASES.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
Version 1.97.1 (2026-07-16)
2+
==========================
3+
4+
<a id="1.97.1"></a>
5+
6+
- [rustc: Fix miscompilation in LLVM optimization](https://github.com/rust-lang/rust/issues/159035)
7+
This backports an LLVM submodule bump to include the LLVM-side fix and a
8+
revert of the rustc change that is one known trigger for the bug. The rustc
9+
side revert should not be strictly necessary but is done out of abundance of caution.
10+
111
Version 1.97.0 (2026-07-09)
212
==========================
313

@@ -35,14 +45,14 @@ Stabilized APIs
3545
- [`Send for std::fs::File` on UEFI](https://github.com/rust-lang/rust/pull/154003)
3646
- [`<{integer}>::isolate_highest_one`](https://doc.rust-lang.org/stable/std/primitive.u32.html#method.isolate_highest_one)
3747
- [`<{integer}>::isolate_lowest_one`](https://doc.rust-lang.org/stable/std/primitive.u32.html#method.isolate_lowest_one)
48+
- [`<{integer}>::highest_one`](https://doc.rust-lang.org/stable/std/primitive.u32.html#method.highest_one)
49+
- [`<{integer}>::lowest_one`](https://doc.rust-lang.org/stable/std/primitive.u32.html#method.lowest_one)
50+
- [`<{integer}>::bit_width`](https://doc.rust-lang.org/stable/std/primitive.u32.html#method.bit_width)
3851
- [`NonZero<{integer}>::isolate_highest_one`](https://doc.rust-lang.org/stable/std/num/struct.NonZero.html#method.isolate_highest_one)
3952
- [`NonZero<{integer}>::isolate_lowest_one`](https://doc.rust-lang.org/stable/std/num/struct.NonZero.html#method.isolate_lowest_one)
40-
- [`<{integer}>::bit_width`](https://doc.rust-lang.org/stable/std/primitive.u32.html#method.bit_width)
41-
- [`<{integer}>::lowest_one`](https://doc.rust-lang.org/stable/std/primitive.u32.html#method.lowest_one)
42-
- [`<{integer}>::highest_one`](https://doc.rust-lang.org/stable/std/primitive.u32.html#method.highest_one)
43-
- [`NonZero<{integer}>::bit_width`](https://doc.rust-lang.org/stable/std/num/struct.NonZero.html#method.bit_width)
4453
- [`NonZero<{integer}>::highest_one`](https://doc.rust-lang.org/stable/std/num/struct.NonZero.html#method.highest_one)
4554
- [`NonZero<{integer}>::lowest_one`](https://doc.rust-lang.org/stable/std/num/struct.NonZero.html#method.lowest_one)
55+
- [`NonZero<{integer}>::bit_width`](https://doc.rust-lang.org/stable/std/num/struct.NonZero.html#method.bit_width)
4656

4757

4858
These previously stable APIs are now stable in const contexts:
@@ -66,6 +76,8 @@ Rustdoc
6676
-----
6777
- [Stabilize `--emit` flag](https://github.com/rust-lang/rust/pull/146220)
6878
- [Stabilize `--remap-path-prefix`](https://github.com/rust-lang/rust/pull/155307)
79+
80+
6981
<a id="1.97.0-Compatibility-Notes"></a>
7082

7183
Compatibility Notes

compiler/rustc_abi/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2063,8 +2063,7 @@ impl Niche {
20632063
let distance_end_zero = max_value - v.end;
20642064
// FIXME: this ought to work for `bool` too, but that seems to be hitting a miscompilation
20652065
// <https://github.com/rust-lang/rust/pull/155473#issuecomment-4302036343>
2066-
let is_bool = size.bytes() == 1 && v == WrappingRange { start: 0, end: 1 };
2067-
if count == 1 && !is_bool {
2066+
if count == 1 && v != (WrappingRange { start: 0, end: 1 }) {
20682067
// We only need one, so just pick the one closest to zero.
20692068
// Not only does that obviously use zero if it's possible, but it also
20702069
// simplifies testing things like `Option<char>`, since looking for `-1`

src/version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.97.0
1+
1.97.1

tests/codegen-llvm/function-arguments.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ pub fn return_slice(x: &[u16]) -> &[u16] {
282282
x
283283
}
284284

285-
// CHECK: { i16, i16 } @enum_id_1(i16 noundef{{( range\(i16 -1, 2\))?}} %x.0, i16 %x.1)
285+
// CHECK: { i16, i16 } @enum_id_1(i16 noundef{{( range\(i16 0, 3\))?}} %x.0, i16 %x.1)
286286
#[no_mangle]
287287
pub fn enum_id_1(x: Option<Result<u16, u16>>) -> Option<Result<u16, u16>> {
288288
x
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
//@ run-pass
2+
3+
// Bad regression test for https://github.com/rust-lang/rust/issues/159035
4+
// This should probably be replaced with a codegen test, though that might need to be in LLVM,
5+
// as it seems that the miscompilation may occur on correct IR misoptimized by SimplifyCFG.
6+
7+
#![allow(dead_code)]
8+
9+
enum Inner {
10+
A(u32),
11+
B(u32),
12+
}
13+
struct Big {
14+
_pad: u64,
15+
inner: Inner,
16+
}
17+
struct Small {
18+
a: u16,
19+
b: u16,
20+
_f: fn(),
21+
}
22+
enum Checksum {
23+
X(Big),
24+
Y(Small),
25+
}
26+
impl Checksum {
27+
fn finalize(self) -> u32 {
28+
match self {
29+
Checksum::X(h) => match h.inner {
30+
Inner::A(s) => s,
31+
Inner::B(s) => s,
32+
},
33+
Checksum::Y(s) => (u32::from(s.b) << 16) | u32::from(s.a),
34+
}
35+
}
36+
}
37+
#[inline(never)]
38+
fn run(c: Option<Checksum>) -> Option<u32> {
39+
c.map(|c| c.finalize())
40+
}
41+
fn main() {
42+
println!("{:?}", run(std::hint::black_box(None)));
43+
}

0 commit comments

Comments
 (0)