Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
1d49df6
Stabilize `VecDeque::retain_back` from `truncate_front`
cammeresi Jan 19, 2026
3e6a43d
allow `Allocator`s to be used as `#[global_allocator]`s
joboet May 29, 2026
46939fa
std: implement `GlobalAllocator` for `System`
joboet May 29, 2026
6c2e9d5
bless UI tests
joboet May 31, 2026
5042010
core: allow zero-size checks to be optimized out for `GlobalAllocator`
joboet Jun 21, 2026
e3e20ed
Rename HAS_CT_PROJECTION to HAS_CONST_ALIASES
Shourya742 Jun 27, 2026
4d1093d
Do not inherit `ConstArgHasType` predicates when it is applied to con…
aerooneqq Jul 3, 2026
cc71d5c
simplify `Option::into_flat_iter` signature
WaffleLapkin Jul 3, 2026
b66097b
Move DuplicateEiiImpls to rustc_middle
qaijuang May 11, 2026
0c82287
Reject linked dylib EII default overrides
qaijuang May 11, 2026
53897bb
address a few nits
qaijuang May 28, 2026
f6ce3ba
preserve EII rlib-only aux builds
qaijuang May 28, 2026
9566dad
reproduction of miscompilation
dingxiangfei2009 Jun 30, 2026
401dc21
fix remapping in indexing and self-assignments
dingxiangfei2009 Jul 1, 2026
c7eb5e4
add test for wrong suggest of self receiver
chenyukang Jul 6, 2026
d09f7ca
correct the span for parameter suggestion
chenyukang Jul 6, 2026
eef7f2e
Add library support for `aarch64-unknown-linux-pauthtest`
jchlanda May 4, 2026
1a7135c
Use target_env = "musl" & target_abi = "pauthtest" instead of env
jchlanda May 11, 2026
d0b4c46
Update landing pad to use addr()
jchlanda Jun 3, 2026
038cb8d
Use rust_force_inline on sign_lpad function
jchlanda Jul 3, 2026
b749630
Set correct cfg_select for sign_lpad
jchlanda Jul 6, 2026
2d18054
tests: fix enum-match.rs to handle LLVM 23
durin42 Jul 6, 2026
6050294
Split unsafe fn ptr accesses into their own test
teor2345 Jul 1, 2026
0b6190f
Check arg errors then write splatted call info
teor2345 Jul 1, 2026
23eeafc
Avoid an unwrap using a u16 splat index
teor2345 Jul 1, 2026
1e3fca8
Remove a splat check arg only used for debugging
teor2345 Jul 1, 2026
baccb0c
Improve ICE diag for splatted FnPtrs
teor2345 Jul 1, 2026
6a68767
Ban splat on closures and rust-call
teor2345 Jul 1, 2026
14bb27e
add more tests for suggesting fn parameters
chenyukang Jul 7, 2026
2efdc66
Carry the `b_offset` inside `BackendRepr::ScalarPair`
scottmcm Jul 1, 2026
ad575fe
Oh yeah, clippy too
scottmcm Jul 1, 2026
ef6ad0d
Oh, miri for a different target
scottmcm Jul 1, 2026
017255b
Add new PGO config section to bootstrap
Kobzol Jul 7, 2026
33da2c8
Port LLVM PGO to the new PGO config section
Kobzol Jul 7, 2026
b576701
Use the new bootstrap PGO options in `opt-dist`
Kobzol Jul 7, 2026
9e394da
Update wasm-component-ld to 0.5.26
alexcrichton Jul 7, 2026
24fb2fb
add core test run with `-Zforce-intrinsic-fallback`
folkertdev Jul 7, 2026
7a28eed
wrapping_sh* methods: clarify underspecified reference
RalfJung Jul 7, 2026
5d96f17
Do not build the compiler when invoking `x perf compare`
Kobzol Jul 7, 2026
d2ee4ca
rustdoc: Represent `--output-format=json` coverage and ir differently
aDotInTheVoid Mar 27, 2026
d20d049
Reword splat arg index limit error for clarity
teor2345 Jul 8, 2026
f4db0a9
Emit the emscripten entry point as `__main_argc_argv`
guybedford Jul 8, 2026
6a9fb2d
Add regression test for CString::clone_into unwind safety
Vastargazing Jul 8, 2026
47a510b
Tweak `write_immediate_to_mplace_no_validate` to be more consistent w…
scottmcm Jul 7, 2026
67986af
allow mGCA const arguments to fall back to anon consts
khyperia Jul 8, 2026
1f6b1d5
Fix bootstrap example TOML
Kobzol Jul 7, 2026
fc267a6
Improve generic parameters handling for #[diagnostic::on_const]
rperier Jun 21, 2026
9fa33b1
add relnotes for 1.97.0
BoxyUwU Jul 8, 2026
8118399
Attempt to run parallel frontend CI
heinwol Jul 8, 2026
3378897
address suggestions
qaijuang Jul 8, 2026
41bdaed
address follow up nits
qaijuang Jul 8, 2026
15f9829
update comments
guybedford Jul 8, 2026
6573670
Allow BackwardIncompatibleDropHint in polonius legacy
KiChjang Jul 8, 2026
06ef82a
Rollup merge of #158871 - BoxyUwU:relnotes_1_97_0, r=mark-simulacrum
JonathanBrouwer Jul 8, 2026
71a1d23
Rollup merge of #154445 - aDotInTheVoid:better-enum, r=Urgau
JonathanBrouwer Jul 8, 2026
899f265
Rollup merge of #156370 - qaijuang:eii-dylib-default-override, r=bjorn3
JonathanBrouwer Jul 8, 2026
1a0ee3b
Rollup merge of #157153 - joboet:global_allocator, r=nia-e
JonathanBrouwer Jul 8, 2026
a75aefa
Rollup merge of #158495 - Shourya742:2026-06-27-rename-tflag, r=BoxyU…
JonathanBrouwer Jul 8, 2026
5ac2be5
Rollup merge of #158617 - khyperia:gca-syntax-flip, r=BoxyUwU
JonathanBrouwer Jul 8, 2026
a961881
Rollup merge of #158645 - teor2345:splat-fn-fixes, r=folkertdev
JonathanBrouwer Jul 8, 2026
2529dda
Rollup merge of #158655 - dingxiangfei2009:fix-remapping, r=cjgillot
JonathanBrouwer Jul 8, 2026
008c3ac
Rollup merge of #158666 - scottmcm:scalar-but-packed, r=workingjubilee
JonathanBrouwer Jul 8, 2026
23f721d
Rollup merge of #158912 - Kobzol:bootstrap-pgo-config, r=jieyouxu
JonathanBrouwer Jul 8, 2026
7daf963
Rollup merge of #158920 - alexcrichton:update-wasm-component-ld, r=lqd
JonathanBrouwer Jul 8, 2026
19aa0de
Rollup merge of #158926 - RalfJung:wrapping_sh, r=Darksonn
JonathanBrouwer Jul 8, 2026
d1e3437
Rollup merge of #158927 - folkertdev:test-fallback-bodies, r=folkertdev
JonathanBrouwer Jul 8, 2026
8627abd
Rollup merge of #158932 - Kobzol:x-compare-dont-build-rustc, r=clubby789
JonathanBrouwer Jul 8, 2026
0592061
Rollup merge of #158937 - guybedford:emscripten-pthread-main, r=bjorn3
JonathanBrouwer Jul 8, 2026
19290a1
Rollup merge of #151379 - cammeresi:20260119-trunc, r=clarfonthey
JonathanBrouwer Jul 8, 2026
91b1f80
Rollup merge of #156548 - jchlanda:jakub/pac_lib, r=davidtwco
JonathanBrouwer Jul 8, 2026
b21613b
Rollup merge of #158307 - heinwol:parallel-frontend-CI, r=jieyouxu
JonathanBrouwer Jul 8, 2026
3b2eef8
Rollup merge of #158347 - rperier:diagnostic_on_const_format_argument…
JonathanBrouwer Jul 8, 2026
1d1647e
Rollup merge of #158384 - KiChjang:allow-backward-incompat-drop-hint,…
JonathanBrouwer Jul 8, 2026
47e1484
Rollup merge of #158722 - aerooneqq:delegation-const-predicates-ice, …
JonathanBrouwer Jul 8, 2026
e2870eb
Rollup merge of #158741 - WaffleLapkin:into_flat_iter_noa, r=hanna-kr…
JonathanBrouwer Jul 8, 2026
50861f5
Rollup merge of #158807 - Vastargazing:tests/cstr-clone-into-alloc-er…
JonathanBrouwer Jul 8, 2026
3d5e49b
Rollup merge of #158862 - chenyukang:yukang-fix-131084-self-receiver-…
JonathanBrouwer Jul 8, 2026
c777bdf
Rollup merge of #158883 - durin42:llvm-23-instsimplify, r=nikic
JonathanBrouwer Jul 8, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 30 additions & 30 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6213,9 +6213,9 @@ dependencies = [

[[package]]
name = "wasi-preview1-component-adapter-provider"
version = "44.0.2"
version = "46.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2211ca2d69a88055eefb06bad741dde3180c9d4020f7e42fea72caba83f9c10c"
checksum = "1b6c48003fe59c201c97a7786ff55feabe6b6f83b598aa9ff5bcc4f94d940bf3"

[[package]]
name = "wasip2"
Expand Down Expand Up @@ -6282,9 +6282,9 @@ dependencies = [

[[package]]
name = "wasm-component-ld"
version = "0.5.25"
version = "0.5.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee72c06c556db23aca2d29e1e183d96efdffa7110b24915629a5091de600a894"
checksum = "51a12709376d4ce64f472699500db3b0e5902cc2bef16fb6ca3098bfdac032fa"
dependencies = [
"anyhow",
"clap",
Expand All @@ -6293,12 +6293,12 @@ dependencies = [
"libc",
"tempfile",
"wasi-preview1-component-adapter-provider",
"wasmparser 0.252.0",
"wasmparser 0.253.0",
"wat",
"windows-sys 0.61.2",
"winsplit",
"wit-component 0.252.0",
"wit-parser 0.252.0",
"wit-component 0.253.0",
"wit-parser 0.253.0",
]

[[package]]
Expand Down Expand Up @@ -6330,12 +6330,12 @@ dependencies = [

[[package]]
name = "wasm-encoder"
version = "0.252.0"
version = "0.253.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8185ae345fa5687c054626ff9a50e7089797a343d9904d1dc9820eb4c4d3196f"
checksum = "59972d6cd272259de647b7c1f1912e45e289c75ffd4be04e10695507cd7e1b59"
dependencies = [
"leb128fmt",
"wasmparser 0.252.0",
"wasmparser 0.253.0",
]

[[package]]
Expand All @@ -6352,14 +6352,14 @@ dependencies = [

[[package]]
name = "wasm-metadata"
version = "0.252.0"
version = "0.253.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b7e08e02a3cd55bf778009d4cd6faae50da011f293644daf78a531a32d6d142"
checksum = "b3f45816ef616806f48498bcd831377de578c4fa51db0c83ab8ceb78cc13523b"
dependencies = [
"anyhow",
"indexmap",
"wasm-encoder 0.252.0",
"wasmparser 0.252.0",
"wasm-encoder 0.253.0",
"wasmparser 0.253.0",
]

[[package]]
Expand Down Expand Up @@ -6396,9 +6396,9 @@ dependencies = [

[[package]]
name = "wasmparser"
version = "0.252.0"
version = "0.253.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3eb099dcadcde5be9eef55e3a337128efd4e44b4c93122487e4d2e4e1c6627c"
checksum = "19db11f87d2486580e1e8b6f494c54df7e0566b87d0b599db843c24019667339"
dependencies = [
"bitflags",
"hashbrown 0.17.0",
Expand All @@ -6409,22 +6409,22 @@ dependencies = [

[[package]]
name = "wast"
version = "252.0.0"
version = "253.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "942a3449d6a593fccc111a6241c8df52bda168af30e40bf9580d4394d7374c65"
checksum = "d3264542f8965c5d84fb1085d924bfba9a6314bb228eff13a2de14d7627664d0"
dependencies = [
"bumpalo",
"leb128fmt",
"memchr",
"unicode-width 0.2.2",
"wasm-encoder 0.252.0",
"wasm-encoder 0.253.0",
]

[[package]]
name = "wat"
version = "1.252.0"
version = "1.253.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c72a4ba7088f7bac94cf516e49882bdf97068904a563768cf249efc839ec42cb"
checksum = "4bfc5ce906144200c972ec617470aa35bd847472e170b26dde3e80541c674055"
dependencies = [
"wast",
]
Expand Down Expand Up @@ -6872,9 +6872,9 @@ dependencies = [

[[package]]
name = "wit-component"
version = "0.252.0"
version = "0.253.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "76db0662b590f45d33d0e363fa13539a5a1eecd35d5a12fe208c335461c1053d"
checksum = "dbbd2500ac3488489ee8c6e59b79d7e47e6da5bfb019efd35d5dca57b78af624"
dependencies = [
"anyhow",
"bitflags",
Expand All @@ -6883,10 +6883,10 @@ dependencies = [
"serde",
"serde_derive",
"serde_json",
"wasm-encoder 0.252.0",
"wasm-metadata 0.252.0",
"wasmparser 0.252.0",
"wit-parser 0.252.0",
"wasm-encoder 0.253.0",
"wasm-metadata 0.253.0",
"wasmparser 0.253.0",
"wit-parser 0.253.0",
]

[[package]]
Expand All @@ -6909,9 +6909,9 @@ dependencies = [

[[package]]
name = "wit-parser"
version = "0.252.0"
version = "0.253.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4266bea110371c620ccf3201c5023676046bc4556e5c7cfb5d500bda5ebc162d"
checksum = "4d997b8e5920fcbeec742b58e583325d6419a6aca617ae8075c406a61c65ba8a"
dependencies = [
"anyhow",
"hashbrown 0.17.0",
Expand All @@ -6923,7 +6923,7 @@ dependencies = [
"serde_derive",
"serde_json",
"unicode-ident",
"wasmparser 0.252.0",
"wasmparser 0.253.0",
]

[[package]]
Expand Down
90 changes: 90 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,93 @@
Version 1.97.0 (2026-07-09)
==========================

<a id="1.97.0-Language"></a>

Language
--------
- [Consider `Result<T, Uninhabited>` and `ControlFlow<Uninhabited, T>` to be equivalent to `T` for must use lint](https://github.com/rust-lang/rust/pull/148214)
- [Add allow-by-default `dead_code_pub_in_binary` lint for unused pub items in binary crates](https://github.com/rust-lang/rust/pull/149509)
- [Stabilize the `div32`, `lam-bh`, `lamcas`, `ld-seq-sa` and `scq` target features](https://github.com/rust-lang/rust/pull/154510)
- [Stabilize `cfg(target_has_atomic_primitive_alignment)`](https://github.com/rust-lang/rust/pull/155006)
- [Allow trailing `self` in imports in more cases](https://github.com/rust-lang/rust/pull/155137)


<a id="1.97.0-Platform-Support"></a>

Platform Support
----------------
- [nvptx64-nvidia-cuda: drop support for old architectures and old ISAs](https://github.com/rust-lang/rust/pull/152443)


Refer to Rust's [platform support page][platform-support-doc]
for more information on Rust's tiered platform support.

[platform-support-doc]: https://doc.rust-lang.org/rustc/platform-support.html


<a id="1.97.0-Stabilized-APIs"></a>

Stabilized APIs
---------------

- [`Default for RepeatN`](https://doc.rust-lang.org/stable/std/iter/struct.RepeatN.html#impl-Default-for-RepeatN%3CA%3E)
- [`Copy for ffi::FromBytesUntilNulError`](https://doc.rust-lang.org/stable/std/ffi/struct.FromBytesUntilNulError.html#impl-Copy-for-FromBytesUntilNulError)
- [`Send for std::fs::File` on UEFI](https://github.com/rust-lang/rust/pull/154003)
- [`<{integer}>::isolate_highest_one`](https://doc.rust-lang.org/stable/std/primitive.u32.html#method.isolate_highest_one)
- [`<{integer}>::isolate_lowest_one`](https://doc.rust-lang.org/stable/std/primitive.u32.html#method.isolate_lowest_one)
- [`<{integer}>::highest_one`](https://doc.rust-lang.org/stable/std/primitive.u32.html#method.highest_one)
- [`<{integer}>::lowest_one`](https://doc.rust-lang.org/stable/std/primitive.u32.html#method.lowest_one)
- [`<{integer}>::bit_width`](https://doc.rust-lang.org/stable/std/primitive.u32.html#method.bit_width)
- [`NonZero<{integer}>::isolate_highest_one`](https://doc.rust-lang.org/stable/std/num/struct.NonZero.html#method.isolate_highest_one)
- [`NonZero<{integer}>::isolate_lowest_one`](https://doc.rust-lang.org/stable/std/num/struct.NonZero.html#method.isolate_lowest_one)
- [`NonZero<{integer}>::highest_one`](https://doc.rust-lang.org/stable/std/num/struct.NonZero.html#method.highest_one)
- [`NonZero<{integer}>::lowest_one`](https://doc.rust-lang.org/stable/std/num/struct.NonZero.html#method.lowest_one)
- [`NonZero<{integer}>::bit_width`](https://doc.rust-lang.org/stable/std/num/struct.NonZero.html#method.bit_width)


These previously stable APIs are now stable in const contexts:

- [`char::is_control`](https://doc.rust-lang.org/stable/std/primitive.char.html#method.is_control)


<a id="1.97.0-Cargo"></a>

Cargo
-----
- [Stabilize `build.warnings` config.](https://github.com/rust-lang/cargo/pull/16796) This controls how lint warnings from local packages are treated. Useful for enforcing a warning-free build in CI, replacing `-Dwarnings`. [docs](https://doc.rust-lang.org/nightly/cargo/reference/config.html#buildwarnings)
- [Stabilize `resolver.lockfile-path` config.](https://github.com/rust-lang/cargo/pull/16694) This allows specifying the path to the lockfile to use when resolving dependencies. Useful when working with read-only source directories. [docs](https://doc.rust-lang.org/nightly/cargo/reference/config.html#resolverlockfile-path)
- [cargo-clean: Error when `--target-dir` doesn't look like a Cargo target directory.](https://github.com/rust-lang/cargo/pull/16712) This prevents accidental deletion of non-target directories.
- [Add `-m` shorthand for `--manifest-path`](https://github.com/rust-lang/cargo/pull/16858)
- [Remove `curl` dependency from `crates-io` crate](https://github.com/rust-lang/cargo/pull/16936)

<a id="1.97.0-Rustdoc"></a>

Rustdoc
-----
- [Stabilize `--emit` flag](https://github.com/rust-lang/rust/pull/146220)
- [Stabilize `--remap-path-prefix`](https://github.com/rust-lang/rust/pull/155307)


<a id="1.97.0-Compatibility-Notes"></a>

Compatibility Notes
-------------------
- [Emit a future-compatibility warning when relying on `f32: From<{float}>` to constrain `{float}`](https://github.com/rust-lang/rust/pull/139087)
- [Rust will use the v0 symbol mangling scheme by default.](https://github.com/rust-lang/rust/pull/151994) This may cause some tools (such as debuggers or profilers, especially with old versions) to fail to demangle symbols emitted by Rust. It may also cause the formatting of text in backtraces to change.
- [Prevent deref coercions in `pin!`, in order to prevent unsoundness.](https://github.com/rust-lang/rust/pull/153457) The most likely case where this might impact users is: writing `pin!(x)` where `x` has type `&mut T` will now always correctly produce a value of type `Pin<&mut &mut T>`, instead of sometimes allowing a coercion that produces a value of type `Pin<&mut T>`. This coercion was previously incorrectly allowed since Rust 1.88.0.
- [Deprecate `std::char` constants and functions](https://github.com/rust-lang/rust/pull/153873)
- [Warn on linker output by default](https://github.com/rust-lang/rust/pull/153968)
- [Remove hidden `f64` methods which have been deprecated since 1.0](https://github.com/rust-lang/rust/pull/153975)
- [report the `varargs_without_pattern` lint in deps](https://github.com/rust-lang/rust/pull/154599)
- [Forbid passing generic arguments to module path segments even if the module reexports a generic enum variant](https://github.com/rust-lang/rust/pull/154971)
- [Error on invalid macho `link_section` specifier](https://github.com/rust-lang/rust/pull/155065)
- The encoding of certain `enum`s [have changed](https://github.com/rust-lang/rust/pull/155473). This is not a breaking change, as it only applies to `enum`s without layout guarantees, but is noted here as we've seen people impacted from having made assumptions about the layout algorithm.
- [Error on `#[export_name = "..."]` where the name is empty](https://github.com/rust-lang/rust/pull/155515)
- [Syntactically reject tuple index shorthands in struct patterns](https://github.com/rust-lang/rust/pull/155698)
- [validate `#[link_name = "..."]` & `#[link(name = "...")]` parameters](https://github.com/rust-lang/rust/pull/155817)
- On Windows, after calling `shutdown` on a socket to shut down the write side, attempting to write to the socket will now produce a `BrokenPipe` error rather than `Other`. [Map `WSAESHUTDOWN` to `io::ErrorKind::BrokenPipe`](https://github.com/rust-lang/rust/pull/156063)


Version 1.96.1 (2026-06-30)
===========================

Expand Down
18 changes: 18 additions & 0 deletions bootstrap.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -973,6 +973,24 @@
#dist.vendor = if "is a tarball source" || "is a git repository" { true } else { false }


# =============================================================================
# Profile-guided optimization options
#
# Configure the PGO profile to be used for compilation, or a path where the
# profile will be written by an instrumented binary, for individual components
# =============================================================================

# Use the following profile to PGO optimize the Rust compiler.
#pgo.rustc.use = "/tmp/profiles/foo.profraw"
# Instrument the Rust compiler, so that when executed, it will gather profiles
# to this path.
#pgo.rustc.generate = "/tmp/profiles/foo.profraw"
# Use the following profile to PGO optimize LLVM.
#pgo.llvm.use = "/tmp/profiles/foo.profraw"
# Instrument LLVM, so that when executed, it will gather profiles
# Note: for LLVM specifically, this should be a directory, not a file path.
#pgo.llvm.generate = "/tmp/profiles"

# =============================================================================
# Options for specific targets
#
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_abi/src/callconv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ impl<'a, Ty> TyAndLayout<'a, Ty> {
unreachable!("`homogeneous_aggregate` should not be called for scalable vectors")
}

BackendRepr::ScalarPair(..) | BackendRepr::Memory { sized: true } => {
BackendRepr::ScalarPair { .. } | BackendRepr::Memory { sized: true } => {
// Helper for computing `homogeneous_aggregate`, allowing a custom
// starting offset (used below for handling variants).
let from_fields_at =
Expand Down
24 changes: 16 additions & 8 deletions compiler/rustc_abi/src/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
Err(AbiMismatch) | Ok(None) => BackendRepr::Memory { sized: true },
Ok(Some((repr, _))) => match repr {
// Mismatched alignment (e.g. union is #[repr(packed)]): disable opt
BackendRepr::Scalar(_) | BackendRepr::ScalarPair(_, _)
BackendRepr::Scalar(_) | BackendRepr::ScalarPair { .. }
if repr.scalar_platform_align(dl).unwrap() != align =>
{
BackendRepr::Memory { sized: true }
Expand All @@ -489,7 +489,7 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
}
// the alignment tests passed and we can use this
BackendRepr::Scalar(..)
| BackendRepr::ScalarPair(..)
| BackendRepr::ScalarPair { .. }
| BackendRepr::SimdVector { .. }
| BackendRepr::SimdScalableVector { .. }
| BackendRepr::Memory { .. } => repr,
Expand Down Expand Up @@ -558,7 +558,7 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
};
match &mut st.backend_repr {
BackendRepr::Scalar(scalar) => hide_niches(scalar),
BackendRepr::ScalarPair(a, b) => {
BackendRepr::ScalarPair { a, b, b_offset: _ } => {
hide_niches(a);
hide_niches(b);
}
Expand Down Expand Up @@ -701,13 +701,21 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
// When the total alignment and size match, we can use the
// same ABI as the scalar variant with the reserved niche.
BackendRepr::Scalar(_) => BackendRepr::Scalar(niche_scalar),
BackendRepr::ScalarPair(first, second) => {
BackendRepr::ScalarPair { a: first, b: second, b_offset } => {
// Only the niche is guaranteed to be initialised,
// so use union layouts for the other primitive.
if niche_offset == Size::ZERO {
BackendRepr::ScalarPair(niche_scalar, second.to_union())
BackendRepr::ScalarPair {
a: niche_scalar,
b: second.to_union(),
b_offset,
}
} else {
BackendRepr::ScalarPair(first.to_union(), niche_scalar)
BackendRepr::ScalarPair {
a: first.to_union(),
b: niche_scalar,
b_offset,
}
}
}
_ => BackendRepr::Memory { sized: true },
Expand Down Expand Up @@ -1037,7 +1045,7 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
// If we pick a "clever" (by-value) ABI, we might have to adjust the ABI of the
// variants to ensure they are consistent. This is because a downcast is
// semantically a NOP, and thus should not affect layout.
if matches!(abi, BackendRepr::Scalar(..) | BackendRepr::ScalarPair(..)) {
if matches!(abi, BackendRepr::Scalar(..) | BackendRepr::ScalarPair { .. }) {
for variant in &mut layout_variants {
// We only do this for variants with fields; the others are not accessed anyway.
// Also do not overwrite any already existing "clever" ABIs.
Expand Down Expand Up @@ -1354,7 +1362,7 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
}
// But scalar pairs are Rust-specific and get
// treated as aggregates by C ABIs anyway.
BackendRepr::ScalarPair(..) => {
BackendRepr::ScalarPair { .. } => {
abi = field.backend_repr;
}
_ => {}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_abi/src/layout/simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ impl<FieldIdx: Idx, VariantIdx: Idx> LayoutData<FieldIdx, VariantIdx> {
offsets: [Size::ZERO, b_offset].into(),
in_memory_order: [FieldIdx::new(0), FieldIdx::new(1)].into(),
},
backend_repr: BackendRepr::ScalarPair(a, b),
backend_repr: BackendRepr::ScalarPair { a, b, b_offset },
largest_niche,
uninhabited: false,
align: AbiAlign::new(align),
Expand Down
Loading
Loading