diff --git a/Cargo.lock b/Cargo.lock
index 873182dde9102..9d5d0f2d403f9 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -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"
@@ -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",
@@ -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]]
@@ -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]]
@@ -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]]
@@ -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",
@@ -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",
]
@@ -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",
@@ -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]]
@@ -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",
@@ -6923,7 +6923,7 @@ dependencies = [
"serde_derive",
"serde_json",
"unicode-ident",
- "wasmparser 0.252.0",
+ "wasmparser 0.253.0",
]
[[package]]
diff --git a/RELEASES.md b/RELEASES.md
index 2fa271401fbb3..3146bdeb1b118 100644
--- a/RELEASES.md
+++ b/RELEASES.md
@@ -1,3 +1,93 @@
+Version 1.97.0 (2026-07-09)
+==========================
+
+
+
+Language
+--------
+- [Consider `Result` and `ControlFlow` 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)
+
+
+
+
+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
+
+
+
+
+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)
+
+
+
+
+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)
+
+
+
+Rustdoc
+-----
+- [Stabilize `--emit` flag](https://github.com/rust-lang/rust/pull/146220)
+- [Stabilize `--remap-path-prefix`](https://github.com/rust-lang/rust/pull/155307)
+
+
+
+
+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)
===========================
diff --git a/compiler/rustc_abi/src/callconv.rs b/compiler/rustc_abi/src/callconv.rs
index 41e87caf40c7d..4fda4735b613c 100644
--- a/compiler/rustc_abi/src/callconv.rs
+++ b/compiler/rustc_abi/src/callconv.rs
@@ -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 =
diff --git a/compiler/rustc_abi/src/layout.rs b/compiler/rustc_abi/src/layout.rs
index 003e811dc7855..ad48e14430952 100644
--- a/compiler/rustc_abi/src/layout.rs
+++ b/compiler/rustc_abi/src/layout.rs
@@ -476,7 +476,7 @@ impl LayoutCalculator {
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 }
@@ -489,7 +489,7 @@ impl LayoutCalculator {
}
// the alignment tests passed and we can use this
BackendRepr::Scalar(..)
- | BackendRepr::ScalarPair(..)
+ | BackendRepr::ScalarPair { .. }
| BackendRepr::SimdVector { .. }
| BackendRepr::SimdScalableVector { .. }
| BackendRepr::Memory { .. } => repr,
@@ -558,7 +558,7 @@ impl LayoutCalculator {
};
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);
}
@@ -701,13 +701,21 @@ impl LayoutCalculator {
// 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 },
@@ -1037,7 +1045,7 @@ impl LayoutCalculator {
// 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.
@@ -1354,7 +1362,7 @@ impl LayoutCalculator {
}
// But scalar pairs are Rust-specific and get
// treated as aggregates by C ABIs anyway.
- BackendRepr::ScalarPair(..) => {
+ BackendRepr::ScalarPair { .. } => {
abi = field.backend_repr;
}
_ => {}
diff --git a/compiler/rustc_abi/src/layout/simple.rs b/compiler/rustc_abi/src/layout/simple.rs
index 5fd504def384a..1fffb84ec21cb 100644
--- a/compiler/rustc_abi/src/layout/simple.rs
+++ b/compiler/rustc_abi/src/layout/simple.rs
@@ -110,7 +110,7 @@ impl LayoutData {
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),
diff --git a/compiler/rustc_abi/src/lib.rs b/compiler/rustc_abi/src/lib.rs
index c2069432e6f8e..b8cd152e30288 100644
--- a/compiler/rustc_abi/src/lib.rs
+++ b/compiler/rustc_abi/src/lib.rs
@@ -1796,14 +1796,18 @@ impl IntoDiagArg for NumScalableVectors {
pub enum BackendRepr {
Scalar(Scalar),
/// The data contained in this type can be entirely represented by two scalars.
- /// The two scalars are listed in *memory* order, so the first is at offset zero
- /// and the second at a non-zero offset.
+ /// The two scalars are listed in *memory* order, so `a` is at offset zero
+ /// and `b` is at non-zero offset `b_offset`.
/// These need not be `FieldIdx(0)` and `FieldIdx(1)`.
///
- /// As of June 2026 the offset to the second scalar is the size of the first
- /// scalar rounded up to the platform alignment of the second scalar.
+ /// As of June 2026 the `b_offset` is always the size of the `a`
+ /// scalar rounded up to the platform alignment of the `b` scalar.
/// That may soon change, however; see MCP#1007.
- ScalarPair(Scalar, Scalar),
+ ScalarPair {
+ a: Scalar,
+ b: Scalar,
+ b_offset: Size,
+ },
SimdScalableVector {
element: Scalar,
count: u64,
@@ -1826,7 +1830,7 @@ impl BackendRepr {
pub fn is_unsized(&self) -> bool {
match *self {
BackendRepr::Scalar(_)
- | BackendRepr::ScalarPair(..)
+ | BackendRepr::ScalarPair { .. }
// FIXME(rustc_scalable_vector): Scalable vectors are `Sized` while the
// `sized_hierarchy` feature is not yet fully implemented. After `sized_hierarchy` is
// fully implemented, scalable vectors will remain `Sized`, they just won't be
@@ -1875,7 +1879,7 @@ impl BackendRepr {
pub fn scalar_platform_align(&self, cx: &C) -> Option {
match *self {
BackendRepr::Scalar(s) => Some(s.default_align(cx).abi),
- BackendRepr::ScalarPair(s1, s2) => {
+ BackendRepr::ScalarPair { a: s1, b: s2, b_offset: _ } => {
Some(s1.default_align(cx).max(s2.default_align(cx)).abi)
}
// The align of a Vector can vary in surprising ways
@@ -1893,8 +1897,7 @@ impl BackendRepr {
// No padding in scalars.
BackendRepr::Scalar(s) => Some(s.size(cx)),
// May have some padding between the pair.
- BackendRepr::ScalarPair(s1, s2) => {
- let field2_offset = s1.size(cx).align_to(s2.default_align(cx).abi);
+ BackendRepr::ScalarPair { a: _, b: s2, b_offset: field2_offset } => {
let size = (field2_offset + s2.size(cx)).align_to(
self.scalar_platform_align(cx)
// We absolutely must have an answer here or everything is FUBAR.
@@ -1913,8 +1916,8 @@ impl BackendRepr {
pub fn to_union(&self) -> Self {
match *self {
BackendRepr::Scalar(s) => BackendRepr::Scalar(s.to_union()),
- BackendRepr::ScalarPair(s1, s2) => {
- BackendRepr::ScalarPair(s1.to_union(), s2.to_union())
+ BackendRepr::ScalarPair { a: s1, b: s2, b_offset } => {
+ BackendRepr::ScalarPair { a: s1.to_union(), b: s2.to_union(), b_offset }
}
BackendRepr::SimdVector { element, count } => {
BackendRepr::SimdVector { element: element.to_union(), count }
@@ -1939,8 +1942,13 @@ impl BackendRepr {
BackendRepr::SimdVector { element: element_l, count: count_l },
BackendRepr::SimdVector { element: element_r, count: count_r },
) => element_l.primitive() == element_r.primitive() && count_l == count_r,
- (BackendRepr::ScalarPair(l1, l2), BackendRepr::ScalarPair(r1, r2)) => {
- l1.primitive() == r1.primitive() && l2.primitive() == r2.primitive()
+ (
+ BackendRepr::ScalarPair { a: l1, b: l2, b_offset: l_offset },
+ BackendRepr::ScalarPair { a: r1, b: r2, b_offset: r_offset },
+ ) => {
+ l1.primitive() == r1.primitive()
+ && l2.primitive() == r2.primitive()
+ && l_offset == r_offset
}
// Everything else must be strictly identical.
_ => self == other,
@@ -2180,7 +2188,7 @@ impl LayoutData {
BackendRepr::Scalar(_)
| BackendRepr::SimdVector { .. }
| BackendRepr::SimdScalableVector { .. } => false,
- BackendRepr::ScalarPair(..) | BackendRepr::Memory { .. } => true,
+ BackendRepr::ScalarPair { .. } | BackendRepr::Memory { .. } => true,
}
}
@@ -2294,7 +2302,7 @@ impl LayoutData {
pub fn is_zst(&self) -> bool {
match self.backend_repr {
BackendRepr::Scalar(_)
- | BackendRepr::ScalarPair(..)
+ | BackendRepr::ScalarPair { .. }
| BackendRepr::SimdScalableVector { .. }
| BackendRepr::SimdVector { .. } => false,
BackendRepr::Memory { sized } => sized && self.size.bytes() == 0,
diff --git a/compiler/rustc_codegen_cranelift/src/abi/mod.rs b/compiler/rustc_codegen_cranelift/src/abi/mod.rs
index 012951098fa15..ec17e72900dfb 100644
--- a/compiler/rustc_codegen_cranelift/src/abi/mod.rs
+++ b/compiler/rustc_codegen_cranelift/src/abi/mod.rs
@@ -220,7 +220,7 @@ fn make_local_place<'tcx>(
);
}
let place = if is_ssa {
- if let BackendRepr::ScalarPair(_, _) = layout.backend_repr {
+ if let BackendRepr::ScalarPair { a: _, b: _, b_offset: _ } = layout.backend_repr {
CPlace::new_var_pair(fx, local, layout)
} else {
CPlace::new_var(fx, local, layout)
diff --git a/compiler/rustc_codegen_cranelift/src/abi/pass_mode.rs b/compiler/rustc_codegen_cranelift/src/abi/pass_mode.rs
index 612f89e6a4217..75d7e4d9fd500 100644
--- a/compiler/rustc_codegen_cranelift/src/abi/pass_mode.rs
+++ b/compiler/rustc_codegen_cranelift/src/abi/pass_mode.rs
@@ -112,7 +112,7 @@ impl<'tcx> ArgAbiExt<'tcx> for ArgAbi<'tcx, Ty<'tcx>> {
_ => unreachable!("{:?}", self.layout.backend_repr),
},
PassMode::Pair(attrs_a, attrs_b) => match self.layout.backend_repr {
- BackendRepr::ScalarPair(a, b) => {
+ BackendRepr::ScalarPair { a, b, b_offset: _ } => {
let a = scalar_to_clif_type(tcx, a);
let b = scalar_to_clif_type(tcx, b);
smallvec![
@@ -167,7 +167,7 @@ impl<'tcx> ArgAbiExt<'tcx> for ArgAbi<'tcx, Ty<'tcx>> {
_ => unreachable!("{:?}", self.layout.backend_repr),
},
PassMode::Pair(attrs_a, attrs_b) => match self.layout.backend_repr {
- BackendRepr::ScalarPair(a, b) => {
+ BackendRepr::ScalarPair { a, b, b_offset: _ } => {
let a = scalar_to_clif_type(tcx, a);
let b = scalar_to_clif_type(tcx, b);
(
diff --git a/compiler/rustc_codegen_cranelift/src/base.rs b/compiler/rustc_codegen_cranelift/src/base.rs
index b37fb213d945a..bf6a98866cd12 100644
--- a/compiler/rustc_codegen_cranelift/src/base.rs
+++ b/compiler/rustc_codegen_cranelift/src/base.rs
@@ -695,7 +695,7 @@ fn codegen_stmt<'tcx>(fx: &mut FunctionCx<'_, '_, 'tcx>, cur_block: Block, stmt:
}
UnOp::PtrMetadata => match layout.backend_repr {
BackendRepr::Scalar(_) => CValue::zst(dest_layout),
- BackendRepr::ScalarPair(_, _) => {
+ BackendRepr::ScalarPair { a: _, b: _, b_offset: _ } => {
CValue::by_val(operand.load_scalar_pair(fx).1, dest_layout)
}
_ => bug!("Unexpected `PtrToMetadata` operand: {operand:?}"),
diff --git a/compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs b/compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs
index e6b8c537d8451..d4bb8bd019331 100644
--- a/compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs
+++ b/compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs
@@ -572,7 +572,9 @@ fn codegen_regular_intrinsic_call<'tcx>(
let layout = fx.layout_of(generic_args.type_at(0));
// Note: Can't use is_unsized here as truly unsized types need to take the fixed size
// branch
- let meta = if let BackendRepr::ScalarPair(_, _) = ptr.layout().backend_repr {
+ let meta = if let BackendRepr::ScalarPair { a: _, b: _, b_offset: _ } =
+ ptr.layout().backend_repr
+ {
Some(ptr.load_scalar_pair(fx).1)
} else {
None
@@ -586,7 +588,9 @@ fn codegen_regular_intrinsic_call<'tcx>(
let layout = fx.layout_of(generic_args.type_at(0));
// Note: Can't use is_unsized here as truly unsized types need to take the fixed size
// branch
- let meta = if let BackendRepr::ScalarPair(_, _) = ptr.layout().backend_repr {
+ let meta = if let BackendRepr::ScalarPair { a: _, b: _, b_offset: _ } =
+ ptr.layout().backend_repr
+ {
Some(ptr.load_scalar_pair(fx).1)
} else {
None
diff --git a/compiler/rustc_codegen_cranelift/src/value_and_place.rs b/compiler/rustc_codegen_cranelift/src/value_and_place.rs
index 995a70f24240b..d7248acfafef1 100644
--- a/compiler/rustc_codegen_cranelift/src/value_and_place.rs
+++ b/compiler/rustc_codegen_cranelift/src/value_and_place.rs
@@ -55,8 +55,7 @@ fn codegen_field<'tcx>(
}
}
-fn scalar_pair_calculate_b_offset(tcx: TyCtxt<'_>, a_scalar: Scalar, b_scalar: Scalar) -> Offset32 {
- let b_offset = a_scalar.size(&tcx).align_to(b_scalar.default_align(&tcx).abi);
+fn scalar_pair_convert_b_offset(b_offset: Size) -> Offset32 {
Offset32::new(b_offset.bytes().try_into().unwrap())
}
@@ -159,11 +158,11 @@ impl<'tcx> CValue<'tcx> {
let layout = self.1;
match self.0 {
CValueInner::ByRef(ptr, None) => {
- let (a_scalar, b_scalar) = match layout.backend_repr {
- BackendRepr::ScalarPair(a, b) => (a, b),
+ let (a_scalar, b_scalar, b_offset) = match layout.backend_repr {
+ BackendRepr::ScalarPair { a, b, b_offset } => (a, b, b_offset),
_ => unreachable!("load_scalar_pair({:?})", self),
};
- let b_offset = scalar_pair_calculate_b_offset(fx.tcx, a_scalar, b_scalar);
+ let b_offset = scalar_pair_convert_b_offset(b_offset);
let clif_ty1 = scalar_to_clif_type(fx.tcx, a_scalar);
let clif_ty2 = scalar_to_clif_type(fx.tcx, b_scalar);
let mut flags = MemFlags::new();
@@ -189,7 +188,7 @@ impl<'tcx> CValue<'tcx> {
match self.0 {
CValueInner::ByVal(_) => unreachable!(),
CValueInner::ByValPair(val1, val2) => match layout.backend_repr {
- BackendRepr::ScalarPair(_, _) => {
+ BackendRepr::ScalarPair { a: _, b: _, b_offset: _ } => {
let val = match field.as_u32() {
0 => val1,
1 => val2,
@@ -580,7 +579,7 @@ impl<'tcx> CPlace<'tcx> {
}
CPlaceInner::VarPair(_local, var1, var2) => {
let (data1, data2) = match from.1.backend_repr {
- BackendRepr::ScalarPair(_, _) => {
+ BackendRepr::ScalarPair { a: _, b: _, b_offset: _ } => {
CValue(from.0, dst_layout).load_scalar_pair(fx)
}
_ => {
@@ -607,9 +606,8 @@ impl<'tcx> CPlace<'tcx> {
to_ptr.store(fx, val, flags);
}
CValueInner::ByValPair(val1, val2) => match from.layout().backend_repr {
- BackendRepr::ScalarPair(a_scalar, b_scalar) => {
- let b_offset =
- scalar_pair_calculate_b_offset(fx.tcx, a_scalar, b_scalar);
+ BackendRepr::ScalarPair { a: _, b: _, b_offset } => {
+ let b_offset = scalar_pair_convert_b_offset(b_offset);
to_ptr.store(fx, val1, flags);
to_ptr.offset(fx, b_offset).store(fx, val2, flags);
}
@@ -627,9 +625,8 @@ impl<'tcx> CPlace<'tcx> {
to_ptr.store(fx, val, flags);
return;
}
- BackendRepr::ScalarPair(a_scalar, b_scalar) => {
- let b_offset =
- scalar_pair_calculate_b_offset(fx.tcx, a_scalar, b_scalar);
+ BackendRepr::ScalarPair { a: _, b: _, b_offset } => {
+ let b_offset = scalar_pair_convert_b_offset(b_offset);
let (val1, val2) = from.load_scalar_pair(fx);
to_ptr.store(fx, val1, flags);
to_ptr.offset(fx, b_offset).store(fx, val2, flags);
diff --git a/compiler/rustc_codegen_cranelift/src/vtable.rs b/compiler/rustc_codegen_cranelift/src/vtable.rs
index b5d241d8f39f2..3310e4e3a2228 100644
--- a/compiler/rustc_codegen_cranelift/src/vtable.rs
+++ b/compiler/rustc_codegen_cranelift/src/vtable.rs
@@ -56,13 +56,14 @@ pub(crate) fn get_ptr_and_method_ref<'tcx>(
}
}
- let (ptr, vtable) = if let BackendRepr::ScalarPair(_, _) = arg.layout().backend_repr {
- let (ptr, vtable) = arg.load_scalar_pair(fx);
- (Pointer::new(ptr), vtable)
- } else {
- let (ptr, vtable) = arg.try_to_ptr().unwrap();
- (ptr, vtable.unwrap())
- };
+ let (ptr, vtable) =
+ if let BackendRepr::ScalarPair { a: _, b: _, b_offset: _ } = arg.layout().backend_repr {
+ let (ptr, vtable) = arg.load_scalar_pair(fx);
+ (Pointer::new(ptr), vtable)
+ } else {
+ let (ptr, vtable) = arg.try_to_ptr().unwrap();
+ (ptr, vtable.unwrap())
+ };
let usize_size = fx.layout_of(fx.tcx.types.usize).size.bytes();
let func_ref = fx.bcx.ins().load(
diff --git a/compiler/rustc_codegen_gcc/src/builder.rs b/compiler/rustc_codegen_gcc/src/builder.rs
index f9358872299b7..0bef86b1ae8c1 100644
--- a/compiler/rustc_codegen_gcc/src/builder.rs
+++ b/compiler/rustc_codegen_gcc/src/builder.rs
@@ -1064,9 +1064,9 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
load
},
)
- } else if let abi::BackendRepr::ScalarPair(ref a, ref b) = place.layout.backend_repr {
- let b_offset = a.size(self).align_to(b.default_align(self).abi);
-
+ } else if let abi::BackendRepr::ScalarPair { ref a, ref b, b_offset } =
+ place.layout.backend_repr
+ {
let mut load = |i, scalar: &abi::Scalar, align| {
let ptr = if i == 0 {
place.val.llval
diff --git a/compiler/rustc_codegen_gcc/src/intrinsic/mod.rs b/compiler/rustc_codegen_gcc/src/intrinsic/mod.rs
index 78a4c7e88c895..a5b8068e0f018 100644
--- a/compiler/rustc_codegen_gcc/src/intrinsic/mod.rs
+++ b/compiler/rustc_codegen_gcc/src/intrinsic/mod.rs
@@ -485,7 +485,7 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tc
let tp_ty = fn_args.type_at(0);
let layout = self.layout_of(tp_ty).layout;
let _use_integer_compare = match layout.backend_repr() {
- Scalar(_) | ScalarPair(_, _) => true,
+ Scalar(_) | ScalarPair { a: _, b: _, b_offset: _ } => true,
SimdVector { .. } | SimdScalableVector { .. } => false,
Memory { .. } => {
// For rusty ABIs, small aggregates are actually passed
diff --git a/compiler/rustc_codegen_gcc/src/type_of.rs b/compiler/rustc_codegen_gcc/src/type_of.rs
index 9807a84c0788d..227b513c0ff30 100644
--- a/compiler/rustc_codegen_gcc/src/type_of.rs
+++ b/compiler/rustc_codegen_gcc/src/type_of.rs
@@ -75,7 +75,7 @@ fn uncached_gcc_type<'gcc, 'tcx>(
};
return cx.context.new_vector_type(element, count);
}
- BackendRepr::ScalarPair(..) => {
+ BackendRepr::ScalarPair { .. } => {
return cx.type_struct(
&[
layout.scalar_pair_element_gcc_type(cx, 0),
@@ -182,13 +182,13 @@ impl<'tcx> LayoutGccExt<'tcx> for TyAndLayout<'tcx> {
BackendRepr::Scalar(_) | BackendRepr::SimdVector { .. } => true,
// FIXME(rustc_scalable_vector): Not yet implemented in rustc_codegen_gcc.
BackendRepr::SimdScalableVector { .. } => todo!(),
- BackendRepr::ScalarPair(..) | BackendRepr::Memory { .. } => false,
+ BackendRepr::ScalarPair { .. } | BackendRepr::Memory { .. } => false,
}
}
fn is_gcc_scalar_pair(&self) -> bool {
match self.backend_repr {
- BackendRepr::ScalarPair(..) => true,
+ BackendRepr::ScalarPair { .. } => true,
BackendRepr::Scalar(_)
| BackendRepr::SimdVector { .. }
| BackendRepr::SimdScalableVector { .. }
@@ -308,8 +308,8 @@ impl<'tcx> LayoutGccExt<'tcx> for TyAndLayout<'tcx> {
// This must produce the same result for `repr(transparent)` wrappers as for the inner type!
// In other words, this should generally not look at the type at all, but only at the
// layout.
- let (a, b) = match self.backend_repr {
- BackendRepr::ScalarPair(ref a, ref b) => (a, b),
+ let (a, b, b_offset) = match self.backend_repr {
+ BackendRepr::ScalarPair { ref a, ref b, b_offset } => (a, b, b_offset),
_ => bug!("TyAndLayout::scalar_pair_element_llty({:?}): not applicable", self),
};
let scalar = [a, b][index];
@@ -325,8 +325,7 @@ impl<'tcx> LayoutGccExt<'tcx> for TyAndLayout<'tcx> {
return cx.type_i1();
}
- let offset =
- if index == 0 { Size::ZERO } else { a.size(cx).align_to(b.default_align(cx).abi) };
+ let offset = if index == 0 { Size::ZERO } else { b_offset };
self.scalar_gcc_type_at(cx, scalar, offset)
}
diff --git a/compiler/rustc_codegen_llvm/src/abi.rs b/compiler/rustc_codegen_llvm/src/abi.rs
index bdaf72cb17ce6..65bb32ee666f2 100644
--- a/compiler/rustc_codegen_llvm/src/abi.rs
+++ b/compiler/rustc_codegen_llvm/src/abi.rs
@@ -551,7 +551,9 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
PassMode::Pair(a, b) => {
let i = apply(a);
let ii = apply(b);
- if let BackendRepr::ScalarPair(scalar_a, scalar_b) = arg.layout.backend_repr {
+ if let BackendRepr::ScalarPair { a: scalar_a, b: scalar_b, b_offset: _ } =
+ arg.layout.backend_repr
+ {
apply_range_attr(llvm::AttributePlace::Argument(i), scalar_a);
let primitive_b = scalar_b.primitive();
let scalar_b = if let rustc_abi::Primitive::Int(int, false) = primitive_b
diff --git a/compiler/rustc_codegen_llvm/src/builder.rs b/compiler/rustc_codegen_llvm/src/builder.rs
index 23cf01a84f7fd..e753fff61aa41 100644
--- a/compiler/rustc_codegen_llvm/src/builder.rs
+++ b/compiler/rustc_codegen_llvm/src/builder.rs
@@ -793,9 +793,7 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
}
});
OperandValue::Immediate(llval)
- } else if let abi::BackendRepr::ScalarPair(a, b) = place.layout.backend_repr {
- let b_offset = a.size(self).align_to(b.default_align(self).abi);
-
+ } else if let abi::BackendRepr::ScalarPair { a, b, b_offset } = place.layout.backend_repr {
let mut load = |i, scalar: abi::Scalar, layout, align, offset| {
let llptr = if i == 0 {
place.val.llval
diff --git a/compiler/rustc_codegen_llvm/src/builder/autodiff.rs b/compiler/rustc_codegen_llvm/src/builder/autodiff.rs
index 10e152a7c8c63..b0ac5c096efdf 100644
--- a/compiler/rustc_codegen_llvm/src/builder/autodiff.rs
+++ b/compiler/rustc_codegen_llvm/src/builder/autodiff.rs
@@ -118,7 +118,9 @@ pub(crate) fn adjust_activity_to_abi<'tcx>(
// If the argument is lowered as a `ScalarPair`, we need to duplicate its activity.
// Otherwise, the number of activities won't match the number of LLVM arguments and
// this will lead to errors when verifying the Enzyme call.
- if let rustc_abi::BackendRepr::ScalarPair(_, _) = layout.backend_repr() {
+ if let rustc_abi::BackendRepr::ScalarPair { a: _, b: _, b_offset: _ } =
+ layout.backend_repr()
+ {
new_activities.push(da[i].clone());
new_positions.push(i + 1 - del_activities);
}
diff --git a/compiler/rustc_codegen_llvm/src/intrinsic.rs b/compiler/rustc_codegen_llvm/src/intrinsic.rs
index bd7a4cfe38d48..54456ddea620b 100644
--- a/compiler/rustc_codegen_llvm/src/intrinsic.rs
+++ b/compiler/rustc_codegen_llvm/src/intrinsic.rs
@@ -574,7 +574,7 @@ impl<'ll, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
let tp_ty = fn_args.type_at(0);
let layout = self.layout_of(tp_ty).layout;
let use_integer_compare = match layout.backend_repr() {
- Scalar(_) | ScalarPair(_, _) => true,
+ Scalar(_) | ScalarPair { a: _, b: _, b_offset: _ } => true,
SimdVector { .. } => false,
SimdScalableVector { .. } => {
let err = tcx.dcx().emit_err(InvalidMonomorphization::NonScalableType {
diff --git a/compiler/rustc_codegen_llvm/src/type_of.rs b/compiler/rustc_codegen_llvm/src/type_of.rs
index 6d0490e4a1f79..d1c2e1d567e40 100644
--- a/compiler/rustc_codegen_llvm/src/type_of.rs
+++ b/compiler/rustc_codegen_llvm/src/type_of.rs
@@ -73,7 +73,7 @@ fn uncached_llvm_type<'a, 'tcx>(
_ => bug!("`#[rustc_scalable_vector]` tuple struct with too many fields"),
};
}
- BackendRepr::Memory { .. } | BackendRepr::ScalarPair(..) => {}
+ BackendRepr::Memory { .. } | BackendRepr::ScalarPair { .. } => {}
}
let name = match layout.ty.kind() {
@@ -228,13 +228,13 @@ impl<'tcx> LayoutLlvmExt<'tcx> for TyAndLayout<'tcx> {
BackendRepr::Scalar(_)
| BackendRepr::SimdVector { .. }
| BackendRepr::SimdScalableVector { .. } => true,
- BackendRepr::ScalarPair(..) | BackendRepr::Memory { .. } => false,
+ BackendRepr::ScalarPair { .. } | BackendRepr::Memory { .. } => false,
}
}
fn is_llvm_scalar_pair(&self) -> bool {
match self.backend_repr {
- BackendRepr::ScalarPair(..) => true,
+ BackendRepr::ScalarPair { .. } => true,
BackendRepr::Scalar(_)
| BackendRepr::SimdVector { .. }
| BackendRepr::SimdScalableVector { .. }
@@ -313,7 +313,7 @@ impl<'tcx> LayoutLlvmExt<'tcx> for TyAndLayout<'tcx> {
return cx.type_i1();
}
}
- BackendRepr::ScalarPair(..) => {
+ BackendRepr::ScalarPair { .. } => {
// An immediate pair always contains just the two elements, without any padding
// filler, as it should never be stored to memory.
return cx.type_struct(
@@ -346,7 +346,7 @@ impl<'tcx> LayoutLlvmExt<'tcx> for TyAndLayout<'tcx> {
// This must produce the same result for `repr(transparent)` wrappers as for the inner type!
// In other words, this should generally not look at the type at all, but only at the
// layout.
- let BackendRepr::ScalarPair(a, b) = self.backend_repr else {
+ let BackendRepr::ScalarPair { a, b, b_offset: _ } = self.backend_repr else {
bug!("TyAndLayout::scalar_pair_element_llty({:?}): not applicable", self);
};
let scalar = [a, b][index];
diff --git a/compiler/rustc_codegen_llvm/src/va_arg.rs b/compiler/rustc_codegen_llvm/src/va_arg.rs
index b8d1cd3504517..d2583f94cf80c 100644
--- a/compiler/rustc_codegen_llvm/src/va_arg.rs
+++ b/compiler/rustc_codegen_llvm/src/va_arg.rs
@@ -564,7 +564,7 @@ fn emit_x86_64_sysv64_va_arg<'ll, 'tcx>(
BackendRepr::Scalar(scalar) => {
registers_for_primitive(scalar.primitive());
}
- BackendRepr::ScalarPair(scalar1, scalar2) => {
+ BackendRepr::ScalarPair { a: scalar1, b: scalar2, b_offset: _ } => {
registers_for_primitive(scalar1.primitive());
registers_for_primitive(scalar2.primitive());
}
@@ -641,7 +641,7 @@ fn emit_x86_64_sysv64_va_arg<'ll, 'tcx>(
}
Primitive::Float(_) => bx.inbounds_ptradd(reg_save_area_v, fp_offset_v),
},
- BackendRepr::ScalarPair(scalar1, scalar2) => {
+ BackendRepr::ScalarPair { a: scalar1, b: scalar2, b_offset: offset } => {
let ty_lo = bx.cx().scalar_pair_element_backend_type(layout, 0, false);
let ty_hi = bx.cx().scalar_pair_element_backend_type(layout, 1, false);
@@ -665,9 +665,8 @@ fn emit_x86_64_sysv64_va_arg<'ll, 'tcx>(
let reg_lo = bx.load(ty_lo, reg_lo_addr, align_lo);
let reg_hi = bx.load(ty_hi, reg_hi_addr, align_hi);
- let offset = scalar1.size(bx.cx).align_to(align_hi).bytes();
let field0 = tmp;
- let field1 = bx.inbounds_ptradd(tmp, bx.const_u32(offset as u32));
+ let field1 = bx.inbounds_ptradd(tmp, bx.const_u32(offset.bytes() as u32));
bx.store(reg_lo, field0, align);
bx.store(reg_hi, field1, align);
@@ -688,9 +687,8 @@ fn emit_x86_64_sysv64_va_arg<'ll, 'tcx>(
let reg_lo = bx.load(ty_lo, reg_lo_addr, align_lo);
let reg_hi = bx.load(ty_hi, reg_hi_addr, align_hi);
- let offset = scalar1.size(bx.cx).align_to(align_hi).bytes();
let field0 = tmp;
- let field1 = bx.inbounds_ptradd(tmp, bx.const_u32(offset as u32));
+ let field1 = bx.inbounds_ptradd(tmp, bx.const_u32(offset.bytes() as u32));
bx.store(reg_lo, field0, align_lo);
bx.store(reg_hi, field1, align_hi);
diff --git a/compiler/rustc_codegen_ssa/src/back/linker.rs b/compiler/rustc_codegen_ssa/src/back/linker.rs
index 8c20db5791774..e24e7bad2b945 100644
--- a/compiler/rustc_codegen_ssa/src/back/linker.rs
+++ b/compiler/rustc_codegen_ssa/src/back/linker.rs
@@ -1286,9 +1286,24 @@ impl<'a> Linker for EmLinker<'a> {
self.cc_arg("-s");
+ // Emscripten exposes the program entry point under the JS name `_main`
+ // regardless of the underlying wasm symbol (which is `__main_argc_argv`
+ // per the wasm C ABI in the tool-conventions BasicCABI spec), bridging
+ // the two internally. So the entry symbol must be requested as `_main`
+ // here rather than as a `_`-prefixed form of its wasm name.
+ let entry_name = self.sess.target.entry_name.as_ref();
let mut arg = OsString::from("EXPORTED_FUNCTIONS=");
let encoded = serde_json::to_string(
- &symbols.iter().map(|sym| "_".to_owned() + &sym.name).collect::>(),
+ &symbols
+ .iter()
+ .map(|sym| {
+ if sym.name == entry_name {
+ "_main".to_owned()
+ } else {
+ "_".to_owned() + &sym.name
+ }
+ })
+ .collect::>(),
)
.unwrap();
debug!("{encoded}");
diff --git a/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs b/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs
index 71315acc4e5db..c586b8080ef30 100644
--- a/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs
+++ b/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs
@@ -611,7 +611,9 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
// be marked as a `LocalVariable` for MSVC debuggers to visualize
// their data correctly. (See #81894 & #88625)
let var_ty_layout = self.cx.layout_of(var_ty);
- if let BackendRepr::ScalarPair(_, _) = var_ty_layout.backend_repr {
+ if let BackendRepr::ScalarPair { a: _, b: _, b_offset: _ } =
+ var_ty_layout.backend_repr
+ {
VariableKind::LocalVariable
} else {
VariableKind::ArgumentVariable(arg_index)
diff --git a/compiler/rustc_codegen_ssa/src/mir/naked_asm.rs b/compiler/rustc_codegen_ssa/src/mir/naked_asm.rs
index 0b00b22b1a992..9ce8e6e48bbd1 100644
--- a/compiler/rustc_codegen_ssa/src/mir/naked_asm.rs
+++ b/compiler/rustc_codegen_ssa/src/mir/naked_asm.rs
@@ -441,7 +441,7 @@ fn wasm_type<'tcx>(signature: &mut String, arg_abi: &ArgAbi<'_, Ty<'tcx>>, ptr_t
signature.push_str(direct_type);
}
PassMode::Pair(_, _) => match arg_abi.layout.backend_repr {
- BackendRepr::ScalarPair(a, b) => {
+ BackendRepr::ScalarPair { a, b, b_offset: _ } => {
signature.push_str(wasm_primitive(a.primitive(), ptr_type));
signature.push_str(", ");
signature.push_str(wasm_primitive(b.primitive(), ptr_type));
diff --git a/compiler/rustc_codegen_ssa/src/mir/operand.rs b/compiler/rustc_codegen_ssa/src/mir/operand.rs
index 0246da3f27829..f2594b712d8cd 100644
--- a/compiler/rustc_codegen_ssa/src/mir/operand.rs
+++ b/compiler/rustc_codegen_ssa/src/mir/operand.rs
@@ -168,7 +168,9 @@ impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> {
}
ConstValue::ZeroSized => return OperandRef::zero_sized(layout),
ConstValue::Slice { alloc_id, meta } => {
- let BackendRepr::ScalarPair(a_scalar, _) = layout.backend_repr else {
+ let BackendRepr::ScalarPair { a: a_scalar, b: _, b_offset: _ } =
+ layout.backend_repr
+ else {
bug!("from_const: invalid ScalarPair layout: {:#?}", layout);
};
let a = Scalar::from_pointer(Pointer::new(alloc_id.into(), Size::ZERO), &bx.tcx());
@@ -222,12 +224,12 @@ impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> {
let val = read_scalar(offset, size, s, bx.immediate_backend_type(layout));
OperandRef { val: OperandValue::Immediate(val), layout, move_annotation: None }
}
- BackendRepr::ScalarPair(
- a @ abi::Scalar::Initialized { .. },
- b @ abi::Scalar::Initialized { .. },
- ) => {
+ BackendRepr::ScalarPair {
+ a: a @ abi::Scalar::Initialized { .. },
+ b: b @ abi::Scalar::Initialized { .. },
+ b_offset,
+ } => {
let (a_size, b_size) = (a.size(bx), b.size(bx));
- let b_offset = (offset + a_size).align_to(b.default_align(bx).abi);
assert!(b_offset.bytes() > 0);
let a_val = read_scalar(
offset,
@@ -345,7 +347,7 @@ impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> {
llval: V,
layout: TyAndLayout<'tcx>,
) -> Self {
- let val = if let BackendRepr::ScalarPair(..) = layout.backend_repr {
+ let val = if let BackendRepr::ScalarPair { .. } = layout.backend_repr {
debug!("Operand::from_immediate_or_packed_pair: unpacking {:?} @ {:?}", llval, layout);
// Deconstruct the immediate aggregate.
@@ -383,12 +385,15 @@ impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> {
} else {
let (in_scalar, imm) = match (self.val, self.layout.backend_repr) {
// Extract a scalar component from a pair.
- (OperandValue::Pair(a_llval, b_llval), BackendRepr::ScalarPair(a, b)) => {
+ (
+ OperandValue::Pair(a_llval, b_llval),
+ BackendRepr::ScalarPair { a, b, b_offset },
+ ) => {
if offset.bytes() == 0 {
assert_eq!(field.size, a.size(bx.cx()));
(Some(a), a_llval)
} else {
- assert_eq!(offset, a.size(bx.cx()).align_to(b.default_align(bx.cx()).abi));
+ assert_eq!(offset, b_offset);
assert_eq!(field.size, b.size(bx.cx()));
(Some(b), b_llval)
}
@@ -419,7 +424,7 @@ impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> {
imm
}
}
- BackendRepr::ScalarPair(_, _)
+ BackendRepr::ScalarPair { a: _, b: _, b_offset: _ }
| BackendRepr::Memory { .. }
| BackendRepr::SimdScalableVector { .. } => bug!(),
})
@@ -705,7 +710,7 @@ impl<'a, 'tcx, V: CodegenObject> OperandRefBuilder<'tcx, V> {
let val = match layout.backend_repr {
BackendRepr::Memory { .. } if layout.is_zst() => OperandValueBuilder::ZeroSized,
BackendRepr::Scalar(s) => OperandValueBuilder::Immediate(Either::Right(s)),
- BackendRepr::ScalarPair(a, b) => {
+ BackendRepr::ScalarPair { a, b, b_offset: _ } => {
OperandValueBuilder::Pair(Either::Right(a), Either::Right(b))
}
BackendRepr::SimdVector { .. } | BackendRepr::SimdScalableVector { .. } => {
@@ -733,7 +738,7 @@ impl<'a, 'tcx, V: CodegenObject> OperandRefBuilder<'tcx, V> {
(OperandValue::Immediate(v), BackendRepr::SimdVector { .. }) => {
OperandValueBuilder::Vector(Either::Left(v))
}
- (OperandValue::Pair(a, b), BackendRepr::ScalarPair(_, _)) => {
+ (OperandValue::Pair(a, b), BackendRepr::ScalarPair { a: _, b: _, b_offset: _ }) => {
OperandValueBuilder::Pair(Either::Left(a), Either::Left(b))
}
(_, BackendRepr::Memory { .. }) => {
@@ -810,17 +815,18 @@ impl<'a, 'tcx, V: CodegenObject> OperandRefBuilder<'tcx, V> {
bug!("Tried to insert {field_operand:?} into {variant:?}.{field:?} of {self:?}")
}
},
- (OperandValue::Pair(a, b), BackendRepr::ScalarPair(from_sa, from_sb)) => {
- match &mut self.val {
- OperandValueBuilder::Pair(fst @ Either::Right(_), snd @ Either::Right(_)) => {
- update(fst, a, from_sa);
- update(snd, b, from_sb);
- }
- _ => bug!(
- "Tried to insert {field_operand:?} into {variant:?}.{field:?} of {self:?}"
- ),
+ (
+ OperandValue::Pair(a, b),
+ BackendRepr::ScalarPair { a: from_sa, b: from_sb, b_offset: _ },
+ ) => match &mut self.val {
+ OperandValueBuilder::Pair(fst @ Either::Right(_), snd @ Either::Right(_)) => {
+ update(fst, a, from_sa);
+ update(snd, b, from_sb);
}
- }
+ _ => {
+ bug!("Tried to insert {field_operand:?} into {variant:?}.{field:?} of {self:?}")
+ }
+ },
(OperandValue::Ref(place), BackendRepr::Memory { .. }) => match &mut self.val {
OperandValueBuilder::Vector(val @ Either::Right(())) => {
let ibty = bx.cx().immediate_backend_type(self.layout);
@@ -1008,10 +1014,10 @@ impl<'a, 'tcx, V: CodegenObject> OperandValue {
bx.store_with_flags(val, dest.val.llval, dest.val.align, flags);
}
OperandValue::Pair(a, b) => {
- let BackendRepr::ScalarPair(a_scalar, b_scalar) = dest.layout.backend_repr else {
+ let BackendRepr::ScalarPair { a: _, b: _, b_offset } = dest.layout.backend_repr
+ else {
bug!("store_with_flags: invalid ScalarPair layout: {:#?}", dest.layout);
};
- let b_offset = a_scalar.size(bx).align_to(b_scalar.default_align(bx).abi);
let val = bx.from_immediate(a);
let align = dest.val.align;
diff --git a/compiler/rustc_codegen_ssa/src/mir/rvalue.rs b/compiler/rustc_codegen_ssa/src/mir/rvalue.rs
index 49f03fe1376e2..f417dfba746f1 100644
--- a/compiler/rustc_codegen_ssa/src/mir/rvalue.rs
+++ b/compiler/rustc_codegen_ssa/src/mir/rvalue.rs
@@ -36,7 +36,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
// semantics regarding when assignment operators allow overlap of LHS and RHS.
if matches!(
cg_operand.layout.backend_repr,
- BackendRepr::Scalar(..) | BackendRepr::ScalarPair(..),
+ BackendRepr::Scalar(..) | BackendRepr::ScalarPair { .. },
) {
debug_assert!(!matches!(cg_operand.val, OperandValue::Ref(..)));
}
@@ -323,9 +323,12 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
}
(
OperandValue::Pair(imm_a, imm_b),
- abi::BackendRepr::ScalarPair(in_a, in_b),
- abi::BackendRepr::ScalarPair(out_a, out_b),
- ) if in_a.size(cx) == out_a.size(cx) && in_b.size(cx) == out_b.size(cx) => {
+ abi::BackendRepr::ScalarPair { a: in_a, b: in_b, b_offset: in_offset },
+ abi::BackendRepr::ScalarPair { a: out_a, b: out_b, b_offset: out_offset },
+ ) if in_a.size(cx) == out_a.size(cx)
+ && in_b.size(cx) == out_b.size(cx)
+ && in_offset == out_offset =>
+ {
OperandValue::Pair(
transmute_scalar(bx, imm_a, in_a, out_a),
transmute_scalar(bx, imm_b, in_b, out_b),
diff --git a/compiler/rustc_const_eval/src/const_eval/valtrees.rs b/compiler/rustc_const_eval/src/const_eval/valtrees.rs
index 1b6c948657e0d..7295df0ab2210 100644
--- a/compiler/rustc_const_eval/src/const_eval/valtrees.rs
+++ b/compiler/rustc_const_eval/src/const_eval/valtrees.rs
@@ -136,7 +136,7 @@ fn const_to_valtree_inner<'tcx>(
let val = ecx.read_immediate(place).report_err()?;
// We could allow wide raw pointers where both sides are integers in the future,
// but for now we reject them.
- if matches!(val.layout.backend_repr, BackendRepr::ScalarPair(..)) {
+ if matches!(val.layout.backend_repr, BackendRepr::ScalarPair { .. }) {
Err(ValTreeCreationError::NonSupportedType(ty))
} else {
let val = val.to_scalar();
diff --git a/compiler/rustc_const_eval/src/interpret/operand.rs b/compiler/rustc_const_eval/src/interpret/operand.rs
index 1f67b896fc8ec..0c1e171c0edc9 100644
--- a/compiler/rustc_const_eval/src/interpret/operand.rs
+++ b/compiler/rustc_const_eval/src/interpret/operand.rs
@@ -84,7 +84,7 @@ impl Immediate {
pub fn to_scalar(self) -> Scalar {
match self {
Immediate::Scalar(val) => val,
- Immediate::ScalarPair(..) => bug!("Got a scalar pair where a scalar was expected"),
+ Immediate::ScalarPair { .. } => bug!("Got a scalar pair where a scalar was expected"),
Immediate::Uninit => bug!("Got uninit where a scalar was expected"),
}
}
@@ -129,7 +129,10 @@ impl Immediate {
);
}
}
- (Immediate::ScalarPair(a_val, b_val), BackendRepr::ScalarPair(a, b)) => {
+ (
+ Immediate::ScalarPair(a_val, b_val),
+ BackendRepr::ScalarPair { a, b, b_offset: _ },
+ ) => {
assert_eq!(
a_val.size(),
a.size(cx),
@@ -263,7 +266,7 @@ impl<'tcx, Prov: Provenance> ImmTy<'tcx, Prov> {
#[inline]
pub fn from_scalar_pair(a: Scalar, b: Scalar, layout: TyAndLayout<'tcx>) -> Self {
debug_assert!(
- matches!(layout.backend_repr, BackendRepr::ScalarPair(..)),
+ matches!(layout.backend_repr, BackendRepr::ScalarPair { .. }),
"`ImmTy::from_scalar_pair` on non-scalar-pair layout"
);
let imm = Immediate::ScalarPair(a, b);
@@ -276,7 +279,7 @@ impl<'tcx, Prov: Provenance> ImmTy<'tcx, Prov> {
debug_assert!(
match (imm, layout.backend_repr) {
(Immediate::Scalar(..), BackendRepr::Scalar(..)) => true,
- (Immediate::ScalarPair(..), BackendRepr::ScalarPair(..)) => true,
+ (Immediate::ScalarPair { .. }, BackendRepr::ScalarPair { .. }) => true,
(Immediate::Uninit, _) if layout.is_sized() => true,
_ => false,
},
@@ -415,14 +418,15 @@ impl<'tcx, Prov: Provenance> ImmTy<'tcx, Prov> {
**self
}
// extract fields from types with `ScalarPair` ABI
- (Immediate::ScalarPair(a_val, b_val), BackendRepr::ScalarPair(a, b)) => {
- Immediate::from(if offset.bytes() == 0 {
- a_val
- } else {
- assert_eq!(offset, a.size(cx).align_to(b.default_align(cx).abi));
- b_val
- })
- }
+ (
+ Immediate::ScalarPair(a_val, b_val),
+ BackendRepr::ScalarPair { a: _, b: _, b_offset },
+ ) => Immediate::from(if offset.bytes() == 0 {
+ a_val
+ } else {
+ assert_eq!(offset, b_offset);
+ b_val
+ }),
// everything else is a bug
_ => bug!(
"invalid field access on immediate {} at offset {}, original layout {:#?}",
@@ -606,15 +610,15 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
)?;
Some(ImmTy::from_scalar(scalar, mplace.layout))
}
- BackendRepr::ScalarPair(
- abi::Scalar::Initialized { value: a, .. },
- abi::Scalar::Initialized { value: b, .. },
- ) => {
+ BackendRepr::ScalarPair {
+ a: abi::Scalar::Initialized { value: a, .. },
+ b: abi::Scalar::Initialized { value: b, .. },
+ b_offset,
+ } => {
// We checked `ptr_align` above, so all fields will have the alignment they need.
// We would anyway check against `ptr_align.restrict_for_offset(b_offset)`,
// which `ptr.offset(b_offset)` cannot possibly fail to satisfy.
let (a_size, b_size) = (a.size(self), b.size(self));
- let b_offset = a_size.align_to(b.default_align(self).abi);
assert!(b_offset.bytes() > 0); // in `operand_field` we use the offset to tell apart the fields
let a_val = alloc.read_scalar(
alloc_range(Size::ZERO, a_size),
@@ -668,10 +672,11 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
if !matches!(
op.layout().backend_repr,
BackendRepr::Scalar(abi::Scalar::Initialized { .. })
- | BackendRepr::ScalarPair(
- abi::Scalar::Initialized { .. },
- abi::Scalar::Initialized { .. }
- )
+ | BackendRepr::ScalarPair {
+ a: abi::Scalar::Initialized { .. },
+ b: abi::Scalar::Initialized { .. },
+ b_offset: _,
+ }
) {
span_bug!(self.cur_span(), "primitive read not possible for type: {}", op.layout().ty);
}
diff --git a/compiler/rustc_const_eval/src/interpret/place.rs b/compiler/rustc_const_eval/src/interpret/place.rs
index d6d73b2d8da81..0c786c5831676 100644
--- a/compiler/rustc_const_eval/src/interpret/place.rs
+++ b/compiler/rustc_const_eval/src/interpret/place.rs
@@ -713,7 +713,6 @@ where
// to handle padding properly, which is only correct if we never look at this data with the
// wrong type.
- let tcx = *self.tcx;
let will_later_validate = M::enforce_validity(self, layout);
let Some(mut alloc) = self.get_place_alloc_mut(&MPlaceTy { mplace: dest, layout })? else {
// zero-sized access
@@ -725,7 +724,7 @@ where
alloc.write_scalar(alloc_range(Size::ZERO, scalar.size()), scalar)?;
}
Immediate::ScalarPair(a_val, b_val) => {
- let BackendRepr::ScalarPair(_a, b) = layout.backend_repr else {
+ let BackendRepr::ScalarPair { a: _, b: _, b_offset } = layout.backend_repr else {
span_bug!(
self.cur_span(),
"write_immediate_to_mplace: invalid ScalarPair layout: {:#?}",
@@ -733,7 +732,7 @@ where
)
};
let a_size = a_val.size();
- let b_offset = a_size.align_to(b.default_align(&tcx).abi);
+ let b_size = b_val.size();
assert!(b_offset.bytes() > 0); // in `operand_field` we use the offset to tell apart the fields
// It is tempting to verify `b_offset` against `layout.fields.offset(1)`,
@@ -744,12 +743,12 @@ where
// destination now to ensure that no stray pointer fragments are being
// preserved (see ).
// We can skip this if there is no padding (e.g. for wide pointers).
- if !will_later_validate && a_size + b_val.size() != layout.size {
+ if !will_later_validate && a_size + b_size != layout.size {
alloc.write_uninit_full();
}
alloc.write_scalar(alloc_range(Size::ZERO, a_size), a_val)?;
- alloc.write_scalar(alloc_range(b_offset, b_val.size()), b_val)?;
+ alloc.write_scalar(alloc_range(b_offset, b_size), b_val)?;
}
Immediate::Uninit => alloc.write_uninit_full(),
}
@@ -902,17 +901,19 @@ where
// padding in the target independent of layout choices.
let src_has_padding = match src.layout().backend_repr {
BackendRepr::Scalar(_) => false,
- BackendRepr::ScalarPair(left, right)
+ BackendRepr::ScalarPair { a: left, b: right, b_offset: _ }
if matches!(src.layout().ty.kind(), ty::Ref(..) | ty::RawPtr(..)) =>
{
// Wide pointers never have padding, so we can avoid calling `size()`.
debug_assert_eq!(left.size(self) + right.size(self), src.layout().size);
false
}
- BackendRepr::ScalarPair(left, right) => {
+ BackendRepr::ScalarPair { a: left, b: right, b_offset: _ } => {
let left_size = left.size(self);
let right_size = right.size(self);
// We have padding if the sizes don't add up to the total.
+ // (Why don't we need to check the offset? The scalars don't overlap so no padding
+ // implies `b_offset == left_size`, which would be superfluous to check explicitly.)
left_size + right_size != src.layout().size
}
// Everything else can only exist in memory anyway, so it doesn't matter.
diff --git a/compiler/rustc_const_eval/src/interpret/validity.rs b/compiler/rustc_const_eval/src/interpret/validity.rs
index 262ef6ba74ed0..2d412e1124e5a 100644
--- a/compiler/rustc_const_eval/src/interpret/validity.rs
+++ b/compiler/rustc_const_eval/src/interpret/validity.rs
@@ -1397,7 +1397,7 @@ impl<'rt, 'tcx, M: Machine<'tcx>> ValueVisitor<'tcx, M> for ValidityVisitor<'rt,
self.path,
Uninit { expected }
),
- Immediate::Scalar(..) | Immediate::ScalarPair(..) =>
+ Immediate::Scalar(..) | Immediate::ScalarPair { .. } =>
bug!("arrays/slices can never have Scalar/ScalarPair layout"),
}
};
@@ -1486,7 +1486,7 @@ impl<'rt, 'tcx, M: Machine<'tcx>> ValueVisitor<'tcx, M> for ValidityVisitor<'rt,
self.visit_scalar(scalar, scalar_layout)?;
}
}
- BackendRepr::ScalarPair(a_layout, b_layout) => {
+ BackendRepr::ScalarPair { a: a_layout, b: b_layout, b_offset: _ } => {
// We can only proceed if *both* scalars need to be initialized.
// FIXME: find a way to also check ScalarPair when one side can be uninit but
// the other must be init.
@@ -1545,7 +1545,7 @@ impl<'rt, 'tcx, M: Machine<'tcx>> ValueVisitor<'tcx, M> for ValidityVisitor<'rt,
.expect("the above checks should have fully handled this situation");
}
}
- BackendRepr::ScalarPair(a_layout, b_layout) => {
+ BackendRepr::ScalarPair { a: a_layout, b: b_layout, b_offset: _ } => {
// We can only proceed if *both* scalars need to be initialized.
// FIXME: find a way to also check ScalarPair when one side can be uninit but
// the other must be init.
diff --git a/compiler/rustc_const_eval/src/util/check_validity_requirement.rs b/compiler/rustc_const_eval/src/util/check_validity_requirement.rs
index 00835a3cc990a..64688f56fe763 100644
--- a/compiler/rustc_const_eval/src/util/check_validity_requirement.rs
+++ b/compiler/rustc_const_eval/src/util/check_validity_requirement.rs
@@ -121,7 +121,7 @@ fn check_validity_requirement_lax<'tcx>(
let valid = !this.is_uninhabited() // definitely UB if uninhabited
&& match this.backend_repr {
BackendRepr::Scalar(s) => scalar_allows_raw_init(s),
- BackendRepr::ScalarPair(s1, s2) => {
+ BackendRepr::ScalarPair { a: s1, b: s2, b_offset: _ } => {
scalar_allows_raw_init(s1) && scalar_allows_raw_init(s2)
}
BackendRepr::SimdVector { element: s, count } => count == 0 || scalar_allows_raw_init(s),
diff --git a/compiler/rustc_expand/src/mbe/macro_parser.rs b/compiler/rustc_expand/src/mbe/macro_parser.rs
index 8bded7662f423..641c50b620ff5 100644
--- a/compiler/rustc_expand/src/mbe/macro_parser.rs
+++ b/compiler/rustc_expand/src/mbe/macro_parser.rs
@@ -696,11 +696,15 @@ impl TtParser {
}
fn ambiguity_error<'matcher, T: Tracker<'matcher>>(
- &self,
+ &mut self,
parser: &Parser<'_>,
matcher: &'matcher [MatcherLoc],
track: &mut T,
) -> NamedParseResult {
+ // Use a reasonable and deterministic ordering for data in the error message.
+ self.bb_mps.sort_unstable_by_key(|mp| mp.idx);
+ self.next_mps.sort_unstable_by_key(|mp| mp.idx);
+
let bb_locs = self.bb_mps.iter().map(|mp| &matcher[mp.idx]);
let next_locs = self.next_mps.iter().map(|mp| &matcher[mp.idx]);
track.ambiguity(parser, bb_locs, next_locs);
diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs
index 383023aa24457..ea0f8f22ab187 100644
--- a/compiler/rustc_lint/src/builtin.rs
+++ b/compiler/rustc_lint/src/builtin.rs
@@ -1325,7 +1325,7 @@ impl<'tcx> LateLintPass<'tcx> for TypeAliasBounds {
// FIXME(generic_const_exprs): Revisit this before stabilization.
// See also `tests/ui/const-generics/generic_const_exprs/type-alias-bounds.rs`.
let ty = cx.tcx.type_of(item.owner_id).instantiate_identity().skip_norm_wip();
- if ty.has_type_flags(ty::TypeFlags::HAS_CT_PROJECTION)
+ if ty.has_type_flags(ty::TypeFlags::HAS_CONST_ALIAS)
&& cx.tcx.features().generic_const_exprs()
{
return;
@@ -2438,7 +2438,7 @@ impl<'tcx> LateLintPass<'tcx> for InvalidValue {
// Check if this ADT has a constrained layout (like `NonNull` and friends).
if let Ok(layout) = cx.tcx.layout_of(cx.typing_env().as_query_input(ty)) {
- if let BackendRepr::Scalar(scalar) | BackendRepr::ScalarPair(scalar, _) =
+ if let BackendRepr::Scalar(scalar) | BackendRepr::ScalarPair { a: scalar, .. } =
&layout.backend_repr
{
let range = scalar.valid_range(cx);
diff --git a/compiler/rustc_middle/src/ty/abstract_const.rs b/compiler/rustc_middle/src/ty/abstract_const.rs
index 43ed22927da56..f0692817fb60b 100644
--- a/compiler/rustc_middle/src/ty/abstract_const.rs
+++ b/compiler/rustc_middle/src/ty/abstract_const.rs
@@ -44,7 +44,7 @@ impl<'tcx> TyCtxt<'tcx> {
self.tcx
}
fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
- if ty.has_type_flags(ty::TypeFlags::HAS_CT_PROJECTION) {
+ if ty.has_type_flags(ty::TypeFlags::HAS_CONST_ALIAS) {
ty.super_fold_with(self)
} else {
ty
diff --git a/compiler/rustc_middle/src/ty/offload_meta.rs b/compiler/rustc_middle/src/ty/offload_meta.rs
index 9d0fcc50ef224..a58e517e05f61 100644
--- a/compiler/rustc_middle/src/ty/offload_meta.rs
+++ b/compiler/rustc_middle/src/ty/offload_meta.rs
@@ -76,7 +76,7 @@ impl OffloadMetadata {
Ty<'tcx>: TyAbiInterface<'tcx, C>,
{
match arg_abi.layout.backend_repr {
- BackendRepr::ScalarPair(_, _) => (0..2)
+ BackendRepr::ScalarPair { a: _, b: _, b_offset: _ } => (0..2)
.map(|i| {
let ty = arg_abi.layout.field(cx, i).ty;
(OffloadMetadata::from_ty(tcx, ty), ty)
diff --git a/compiler/rustc_mir_transform/src/dataflow_const_prop.rs b/compiler/rustc_mir_transform/src/dataflow_const_prop.rs
index c7d18bd1cc92f..7e128ad72454e 100644
--- a/compiler/rustc_mir_transform/src/dataflow_const_prop.rs
+++ b/compiler/rustc_mir_transform/src/dataflow_const_prop.rs
@@ -647,7 +647,7 @@ impl<'a, 'tcx> ConstAnalysis<'a, 'tcx> {
// a pair and sometimes not. But as a hack we always return a pair
// and just make the 2nd component `Bottom` when it does not exist.
Some(val) => {
- if matches!(val.layout.backend_repr, BackendRepr::ScalarPair(..)) {
+ if matches!(val.layout.backend_repr, BackendRepr::ScalarPair { .. }) {
let (val, overflow) = val.to_scalar_pair();
(FlatSet::Elem(val), FlatSet::Elem(overflow))
} else {
@@ -814,7 +814,7 @@ impl<'a, 'tcx> Collector<'a, 'tcx> {
return Some(Const::Val(ConstValue::Scalar(value), ty));
}
- if matches!(layout.backend_repr, BackendRepr::Scalar(..) | BackendRepr::ScalarPair(..)) {
+ if matches!(layout.backend_repr, BackendRepr::Scalar(..) | BackendRepr::ScalarPair { .. }) {
let alloc_id = ecx
.intern_with_temp_alloc(layout, |ecx, dest| {
try_write_constant(ecx, dest, place, ty, state, map)
diff --git a/compiler/rustc_mir_transform/src/gvn.rs b/compiler/rustc_mir_transform/src/gvn.rs
index 2db4502ecc6b6..f00dd3fde5aac 100644
--- a/compiler/rustc_mir_transform/src/gvn.rs
+++ b/compiler/rustc_mir_transform/src/gvn.rs
@@ -608,7 +608,7 @@ impl<'body, 'a, 'tcx> VnState<'body, 'a, 'tcx> {
let fields =
fields.iter().map(|&f| self.eval_to_const(f)).collect::