Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
4276604
Merge pull request #2562 from ali90h/rustdoc-ci-frontends-note
GuillaumeGomez Sep 24, 2025
7861388
Merge pull request #2570 from rust-lang/tshepang/branch-rename
marcoieni Sep 30, 2025
76d6566
Merge ref '4fa824bb7831' from rust-lang/rust
invalid-email-address Oct 6, 2025
591060e
Merge pull request #2604 from rust-lang/rustc-pull
tshepang Oct 6, 2025
bad6405
Merge pull request #2613 from Enselic/bitcode
Noratrieb Oct 20, 2025
f056043
Merge ref '4068bafedd8b' from rust-lang/rust
invalid-email-address Oct 20, 2025
cc6cea7
Merge pull request #2614 from rust-lang/rustc-pull
tshepang Oct 20, 2025
07b9f40
Merge ref 'b1b464d6f61e' from rust-lang/rust
invalid-email-address Oct 27, 2025
a859b1e
Merge pull request #2583 from rust-lang/tshepang-patch-4
tshepang Oct 27, 2025
19c099b
Merge pull request #2617 from rust-lang/rustc-pull
tshepang Oct 27, 2025
80bd03f
Merge pull request #2623 from rust-lang/autodiff-typo
Noratrieb Oct 29, 2025
09ea699
Merge pull request #2622 from rust-lang/master
jieyouxu Nov 1, 2025
4aeb087
Merge ref 'c5dabe8cf798' from rust-lang/rust
invalid-email-address Nov 3, 2025
3c746ce
Merge ref 'c5dabe8cf798' from rust-lang/rust
invalid-email-address Nov 3, 2025
7b242ea
Merge pull request #2625 from rust-lang/rustc-pull
tshepang Nov 3, 2025
bbe6cb3
Add alignment parameter to `simd_masked_{load,store}`
sayantn Oct 8, 2025
dcf69bc
Add implementation of the alignment parameter in Miri
sayantn Oct 9, 2025
761361d
Merge pull request #20960 from rust-lang/rustc-pull
lnicola Nov 4, 2025
88d08b1
Auto merge of #148471 - lnicola:sync-from-ra, r=lnicola
bors Nov 4, 2025
8692a99
Auto merge of #145314 - estebank:issue-135589-all, r=Nadrieril
bors Nov 4, 2025
4c0bc8f
Rollup merge of #147355 - sayantn:masked-loads, r=RalfJung,bjorn3
Zalathar Nov 4, 2025
75aea41
Rollup merge of #147925 - fneddy:fix_big_endian_GVN_tests, r=saethlin
Zalathar Nov 4, 2025
d944f79
Rollup merge of #148341 - jyn514:feature-unification, r=BoxyUwU
Zalathar Nov 4, 2025
f6c777b
Rollup merge of #148371 - yotamofek:pr/dogfood-trim-prefix-suffix, r=…
Zalathar Nov 4, 2025
20358f2
Rollup merge of #148495 - ChrisDenton:path_is_empty, r=workingjubilee
Zalathar Nov 4, 2025
b0bc79c
Rollup merge of #148502 - tshepang:rdg-sync, r=tshepang
Zalathar Nov 4, 2025
d5f0054
rustc_target: introduce Arch
tamird Oct 13, 2025
e381171
rustc_target: allow unenumerated architectures
tamird Oct 28, 2025
77d99d7
Auto merge of #147645 - tamird:arch-enum, r=nnethercote
bors Nov 5, 2025
7b7af4c
Auto merge of #148507 - Zalathar:rollup-vvz4knr, r=Zalathar
bors Nov 5, 2025
a2bf824
Auto merge of #148492 - pmur:murp/ppc-relax-r29-inlineasm, r=Amanieu
bors Nov 5, 2025
0131130
Auto merge of #148516 - bjorn3:target_feature_parsing_improvements, r…
bors Nov 5, 2025
0ab3c22
Rollup merge of #147994 - jdonszelmann:duplicate-warning-struct, r=pe…
matthiaskrgr Nov 5, 2025
80f9490
Rollup merge of #148501 - tgross35:triagebot-libs-backports, r=Amanieu
matthiaskrgr Nov 5, 2025
8eac38a
Rollup merge of #148517 - bjorn3:lint_cleanup, r=joboet
matthiaskrgr Nov 5, 2025
f582f3c
Rollup merge of #148523 - RalfJung:miri, r=RalfJung
matthiaskrgr Nov 5, 2025
ea64600
Rollup merge of #148525 - chenyukang:yukang-fix-148515, r=wesleywiser
matthiaskrgr Nov 5, 2025
cc4b245
Rollup merge of #148534 - WaffleLapkin:push_within_capacity_now_with_…
matthiaskrgr Nov 5, 2025
1bd47ec
Auto merge of #148544 - matthiaskrgr:rollup-n9dqgwc, r=matthiaskrgr
bors Nov 5, 2025
aeb9b35
Prepare for merging from rust-lang/rust
Nov 6, 2025
bc0eb42
Merge ref '401ae5542752' from rust-lang/rust
Nov 6, 2025
53c54b5
fmt
Nov 6, 2025
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
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5f9dd05862d2e4bceb3be1031b6c936e35671501
401ae55427522984e4a89c37cff6562a4ddcf6b7
7 changes: 4 additions & 3 deletions src/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ use rustc_span::def_id::{CrateNum, DefId};
use rustc_span::{Span, SpanData, Symbol};
use rustc_symbol_mangling::mangle_internal_symbol;
use rustc_target::callconv::FnAbi;
use rustc_target::spec::Arch;

use crate::alloc_addresses::EvalContextExt;
use crate::concurrency::cpu_affinity::{self, CpuAffinityMask};
Expand Down Expand Up @@ -710,9 +711,9 @@ impl<'tcx> MiriMachine<'tcx> {
page_size
} else {
let target = &tcx.sess.target;
match target.arch.as_ref() {
"wasm32" | "wasm64" => 64 * 1024, // https://webassembly.github.io/spec/core/exec/runtime.html#memory-instances
"aarch64" => {
match target.arch {
Arch::Wasm32 | Arch::Wasm64 => 64 * 1024, // https://webassembly.github.io/spec/core/exec/runtime.html#memory-instances
Arch::AArch64 => {
if target.options.vendor.as_ref() == "apple" {
// No "definitive" source, but see:
// https://www.wwdcnotes.com/notes/wwdc20/10214/
Expand Down
44 changes: 36 additions & 8 deletions src/shims/alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use rustc_ast::expand::allocator::SpecialAllocatorMethod;
use rustc_middle::ty::Ty;
use rustc_span::Symbol;
use rustc_target::callconv::FnAbi;
use rustc_target::spec::Arch;

use crate::*;

Expand All @@ -19,14 +20,41 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
// `library/std/src/sys/alloc/mod.rs` (where this is called `MIN_ALIGN`) and should
// be kept in sync.
let os = this.tcx.sess.target.os.as_ref();
let max_fundamental_align = match this.tcx.sess.target.arch.as_ref() {
"riscv32" if matches!(os, "espidf" | "zkvm") => 4,
"xtensa" if matches!(os, "espidf") => 4,
"x86" | "arm" | "m68k" | "csky" | "loongarch32" | "mips" | "mips32r6" | "powerpc"
| "powerpc64" | "sparc" | "wasm32" | "hexagon" | "riscv32" | "xtensa" => 8,
"x86_64" | "aarch64" | "arm64ec" | "loongarch64" | "mips64" | "mips64r6" | "s390x"
| "sparc64" | "riscv64" | "wasm64" => 16,
arch => bug!("unsupported target architecture for malloc: `{}`", arch),
let max_fundamental_align = match &this.tcx.sess.target.arch {
Arch::RiscV32 if matches!(os, "espidf" | "zkvm") => 4,
Arch::Xtensa if matches!(os, "espidf") => 4,
Arch::X86
| Arch::Arm
| Arch::M68k
| Arch::CSky
| Arch::LoongArch32
| Arch::Mips
| Arch::Mips32r6
| Arch::PowerPC
| Arch::PowerPC64
| Arch::Sparc
| Arch::Wasm32
| Arch::Hexagon
| Arch::RiscV32
| Arch::Xtensa => 8,
Arch::X86_64
| Arch::AArch64
| Arch::Arm64EC
| Arch::LoongArch64
| Arch::Mips64
| Arch::Mips64r6
| Arch::S390x
| Arch::Sparc64
| Arch::RiscV64
| Arch::Wasm64 => 16,
arch @ (Arch::AmdGpu
| Arch::Avr
| Arch::Bpf
| Arch::Msp430
| Arch::Nvptx64
| Arch::PowerPC64LE
| Arch::SpirV
| Arch::Unknown(_)) => bug!("unsupported target architecture for malloc: `{arch}`"),
};
// The C standard only requires sufficient alignment for any *type* with size less than or
// equal to the size requested. Types one can define in standard C seem to never have an alignment
Expand Down
10 changes: 6 additions & 4 deletions src/shims/foreign_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use rustc_middle::{mir, ty};
use rustc_session::config::OomStrategy;
use rustc_span::Symbol;
use rustc_target::callconv::FnAbi;
use rustc_target::spec::Arch;

use super::alloc::EvalContextExt as _;
use super::backtrace::EvalContextExt as _;
Expand Down Expand Up @@ -799,20 +800,21 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {

// Target-specific shims
name if name.starts_with("llvm.x86.")
&& (this.tcx.sess.target.arch == "x86"
|| this.tcx.sess.target.arch == "x86_64") =>
&& matches!(this.tcx.sess.target.arch, Arch::X86 | Arch::X86_64) =>
{
return shims::x86::EvalContextExt::emulate_x86_intrinsic(
this, link_name, abi, args, dest,
);
}
name if name.starts_with("llvm.aarch64.") && this.tcx.sess.target.arch == "aarch64" => {
name if name.starts_with("llvm.aarch64.")
&& this.tcx.sess.target.arch == Arch::AArch64 =>
{
return shims::aarch64::EvalContextExt::emulate_aarch64_intrinsic(
this, link_name, abi, args, dest,
);
}
// FIXME: Move this to an `arm` submodule.
"llvm.arm.hint" if this.tcx.sess.target.arch == "arm" => {
"llvm.arm.hint" if this.tcx.sess.target.arch == Arch::Arm => {
let [arg] = this.check_shim_sig_lenient(abi, CanonAbi::C, link_name, args)?;
let arg = this.read_scalar(arg)?.to_i32()?;
// Note that different arguments might have different target feature requirements.
Expand Down
3 changes: 2 additions & 1 deletion src/shims/windows/foreign_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use rustc_abi::{Align, CanonAbi, Size, X86Call};
use rustc_middle::ty::Ty;
use rustc_span::Symbol;
use rustc_target::callconv::FnAbi;
use rustc_target::spec::Arch;

use self::shims::windows::handle::{Handle, PseudoHandle};
use crate::shims::os_str::bytes_to_os_str;
Expand Down Expand Up @@ -140,7 +141,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
// https://github.com/rust-lang/rust/blob/fb00adbdb69266f10df95a4527b767b0ad35ea48/compiler/rustc_target/src/spec/mod.rs#L2766-L2768,
// x86-32 Windows uses a different calling convention than other Windows targets
// for the "system" ABI.
let sys_conv = if this.tcx.sess.target.arch == "x86" {
let sys_conv = if this.tcx.sess.target.arch == Arch::X86 {
CanonAbi::X86(X86Call::Stdcall)
} else {
CanonAbi::C
Expand Down
3 changes: 2 additions & 1 deletion src/shims/x86/bmi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use rustc_abi::CanonAbi;
use rustc_middle::ty::Ty;
use rustc_span::Symbol;
use rustc_target::callconv::FnAbi;
use rustc_target::spec::Arch;

use crate::*;

Expand Down Expand Up @@ -31,7 +32,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
let target_feature = if unprefixed_name == "bextr" { "bmi1" } else { "bmi2" };
this.expect_target_feature_for_intrinsic(link_name, target_feature)?;

if is_64_bit && this.tcx.sess.target.arch != "x86_64" {
if is_64_bit && this.tcx.sess.target.arch != Arch::X86_64 {
return interp_ok(EmulateItemResult::NotSupported);
}

Expand Down
5 changes: 3 additions & 2 deletions src/shims/x86/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use rustc_middle::ty::Ty;
use rustc_middle::{mir, ty};
use rustc_span::Symbol;
use rustc_target::callconv::FnAbi;
use rustc_target::spec::Arch;

use self::helpers::bool_to_simd_element;
use crate::*;
Expand Down Expand Up @@ -41,7 +42,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
// https://www.intel.com/content/www/us/en/docs/cpp-compiler/developer-guide-reference/2021-8/addcarry-u32-addcarry-u64.html
// https://www.intel.com/content/www/us/en/docs/cpp-compiler/developer-guide-reference/2021-8/subborrow-u32-subborrow-u64.html
"addcarry.32" | "addcarry.64" | "subborrow.32" | "subborrow.64" => {
if unprefixed_name.ends_with("64") && this.tcx.sess.target.arch != "x86_64" {
if unprefixed_name.ends_with("64") && this.tcx.sess.target.arch != Arch::X86_64 {
return interp_ok(EmulateItemResult::NotSupported);
}

Expand All @@ -65,7 +66,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
this.expect_target_feature_for_intrinsic(link_name, "adx")?;

let is_u64 = unprefixed_name.ends_with("64");
if is_u64 && this.tcx.sess.target.arch != "x86_64" {
if is_u64 && this.tcx.sess.target.arch != Arch::X86_64 {
return interp_ok(EmulateItemResult::NotSupported);
}
let [c_in, a, b, out] =
Expand Down
3 changes: 2 additions & 1 deletion src/shims/x86/sse42.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use rustc_middle::mir;
use rustc_middle::ty::Ty;
use rustc_span::Symbol;
use rustc_target::callconv::FnAbi;
use rustc_target::spec::Arch;

use crate::*;

Expand Down Expand Up @@ -431,7 +432,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
_ => unreachable!(),
};

if bit_size == 64 && this.tcx.sess.target.arch != "x86_64" {
if bit_size == 64 && this.tcx.sess.target.arch != Arch::X86_64 {
return interp_ok(EmulateItemResult::NotSupported);
}

Expand Down
17 changes: 17 additions & 0 deletions tests/fail/intrinsics/simd_masked_load_element_misaligned.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#![feature(core_intrinsics, portable_simd)]

use std::intrinsics::simd::*;
use std::simd::*;

fn main() {
unsafe {
let buf = [0u32; 5];
//~v ERROR: accessing memory with alignment
simd_masked_load::<_, _, _, { SimdAlign::Element }>(
i32x4::splat(-1),
// This is not i32-aligned
buf.as_ptr().byte_offset(1),
i32x4::splat(0),
);
}
}
18 changes: 18 additions & 0 deletions tests/fail/intrinsics/simd_masked_load_element_misaligned.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
error: Undefined Behavior: accessing memory with alignment ALIGN, but alignment ALIGN is required
--> tests/fail/intrinsics/simd_masked_load_element_misaligned.rs:LL:CC
|
LL | / simd_masked_load::<_, _, _, { SimdAlign::Element }>(
LL | | i32x4::splat(-1),
LL | | // This is not i32-aligned
LL | | buf.as_ptr().byte_offset(1),
LL | | i32x4::splat(0),
LL | | );
| |_________^ Undefined Behavior occurred here
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

error: aborting due to 1 previous error

17 changes: 17 additions & 0 deletions tests/fail/intrinsics/simd_masked_load_vector_misaligned.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#![feature(core_intrinsics, portable_simd)]

use std::intrinsics::simd::*;
use std::simd::*;

fn main() {
unsafe {
let buf = Simd::<i32, 8>::splat(0);
//~v ERROR: accessing memory with alignment
simd_masked_load::<_, _, _, { SimdAlign::Vector }>(
i32x4::splat(-1),
// This is i32-aligned but not i32x4-aligned.
buf.as_array()[1..].as_ptr(),
i32x4::splat(0),
);
}
}
18 changes: 18 additions & 0 deletions tests/fail/intrinsics/simd_masked_load_vector_misaligned.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
error: Undefined Behavior: accessing memory with alignment ALIGN, but alignment ALIGN is required
--> tests/fail/intrinsics/simd_masked_load_vector_misaligned.rs:LL:CC
|
LL | / simd_masked_load::<_, _, _, { SimdAlign::Vector }>(
LL | | i32x4::splat(-1),
LL | | // This is i32-aligned but not i32x4-aligned.
LL | | buf.as_array()[1..].as_ptr(),
LL | | i32x4::splat(0),
LL | | );
| |_________^ Undefined Behavior occurred here
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

error: aborting due to 1 previous error

17 changes: 17 additions & 0 deletions tests/fail/intrinsics/simd_masked_store_element_misaligned.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#![feature(core_intrinsics, portable_simd)]

use std::intrinsics::simd::*;
use std::simd::*;

fn main() {
unsafe {
let mut buf = [0u32; 5];
//~v ERROR: accessing memory with alignment
simd_masked_store::<_, _, _, { SimdAlign::Element }>(
i32x4::splat(-1),
// This is not i32-aligned
buf.as_mut_ptr().byte_offset(1),
i32x4::splat(0),
);
}
}
18 changes: 18 additions & 0 deletions tests/fail/intrinsics/simd_masked_store_element_misaligned.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
error: Undefined Behavior: accessing memory with alignment ALIGN, but alignment ALIGN is required
--> tests/fail/intrinsics/simd_masked_store_element_misaligned.rs:LL:CC
|
LL | / simd_masked_store::<_, _, _, { SimdAlign::Element }>(
LL | | i32x4::splat(-1),
LL | | // This is not i32-aligned
LL | | buf.as_mut_ptr().byte_offset(1),
LL | | i32x4::splat(0),
LL | | );
| |_________^ Undefined Behavior occurred here
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

error: aborting due to 1 previous error

17 changes: 17 additions & 0 deletions tests/fail/intrinsics/simd_masked_store_vector_misaligned.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#![feature(core_intrinsics, portable_simd)]

use std::intrinsics::simd::*;
use std::simd::*;

fn main() {
unsafe {
let mut buf = Simd::<i32, 8>::splat(0);
//~v ERROR: accessing memory with alignment
simd_masked_store::<_, _, _, { SimdAlign::Vector }>(
i32x4::splat(-1),
// This is i32-aligned but not i32x4-aligned.
buf.as_mut_array()[1..].as_mut_ptr(),
i32x4::splat(0),
);
}
}
18 changes: 18 additions & 0 deletions tests/fail/intrinsics/simd_masked_store_vector_misaligned.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
error: Undefined Behavior: accessing memory with alignment ALIGN, but alignment ALIGN is required
--> tests/fail/intrinsics/simd_masked_store_vector_misaligned.rs:LL:CC
|
LL | / simd_masked_store::<_, _, _, { SimdAlign::Vector }>(
LL | | i32x4::splat(-1),
LL | | // This is i32-aligned but not i32x4-aligned.
LL | | buf.as_mut_array()[1..].as_mut_ptr(),
LL | | i32x4::splat(0),
LL | | );
| |_________^ Undefined Behavior occurred here
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

error: aborting due to 1 previous error

Loading