Skip to content

Rollup of 13 pull requests #144202

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 38 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
47b138b
Make aliases search support partial matching
GuillaumeGomez Jul 15, 2025
b0bf51f
Update rustdoc search tester to new alias output
GuillaumeGomez Jul 15, 2025
c079c96
Add test for aliases partial match
GuillaumeGomez Jul 15, 2025
10762d5
Fix debuginfo-lto-alloc.rs test
bjorn3 Jul 17, 2025
63e1074
Update AMDGPU data layout
nikic Jul 9, 2025
12b19be
Pass wasm exception model to TargetOptions
nikic Jul 11, 2025
a65563e
Make emit-arity-indicator.rs a no_core test
nikic Jul 14, 2025
ff1fdff
Make bit ops traits const
oli-obk Jul 18, 2025
15acb0e
unicode-table-gen: clippy fixes
hkBst Jul 18, 2025
0959305
unicode-table-gen: edition 2024
hkBst Jul 18, 2025
b0073d9
unicode-table-gen: more clippy fixes
hkBst Jul 18, 2025
8a8717e
fix: don't panic on volatile access to null
LuigiPiucco Apr 20, 2025
4cebbab
Add implicit sized bound to trait ascription types
compiler-errors Jul 18, 2025
e6f2830
Remove pretty print hack for async blocks
compiler-errors Jul 18, 2025
7672e4e
interpret: fix TypeId pointers being considered data pointers
RalfJung Jul 19, 2025
ca01e7d
Stabilize `const_float_round_methods`
nxsaken Jul 7, 2025
caf4f11
Add `#[rustc_intrinsic_const_stable_indirect]` to float rounding
nxsaken Jul 7, 2025
2f14d0a
Add code comment explaining better what `Row.name` is for doc aliases
GuillaumeGomez Jul 19, 2025
61bfc09
So many test updates x_x
scottmcm Jul 12, 2025
2e959f0
...and wasm tests too
scottmcm Jul 19, 2025
67c87c9
Update cranelift tests
scottmcm Jul 13, 2025
d0d1a12
Update Miri Tests
scottmcm Jul 13, 2025
cc5f3f2
Ban projecting into SIMD types [MCP838]
scottmcm Mar 7, 2025
db1449a
Initialize mingw for the runner's user
ChrisDenton Jul 19, 2025
5628885
Remove deprecated MaybeUninit slice methods
clarfonthey Jul 18, 2025
5af58ad
Rollup merge of #141260 - LuigiPiucco:volatile-null, r=RalfJung
jhpratt Jul 20, 2025
efc7e4b
Rollup merge of #143604 - nxsaken:const_float_round_methods, r=RalfJung
jhpratt Jul 20, 2025
2e2fce9
Rollup merge of #143833 - scottmcm:final-mcp-838, r=compiler-errors
jhpratt Jul 20, 2025
dd0b175
Rollup merge of #143988 - GuillaumeGomez:alias-inexact, r=lolbinarycat
jhpratt Jul 20, 2025
464d57b
Rollup merge of #144078 - bjorn3:fix_test, r=compiler-errors
jhpratt Jul 20, 2025
5beec02
Rollup merge of #144111 - clarfonthey:maybe-uninit-deprecated, r=jhpratt
jhpratt Jul 20, 2025
f5e27aa
Rollup merge of #144116 - nikic:llvm-21-fixes, r=dianqk
jhpratt Jul 20, 2025
5a90c19
Rollup merge of #144120 - oli-obk:const-bitops, r=fee1-dead
jhpratt Jul 20, 2025
5ad429d
Rollup merge of #144134 - hkBst:cleanup-unicode-table-gen, r=Mark-Sim…
jhpratt Jul 20, 2025
aca16bf
Rollup merge of #144142 - compiler-errors:itib, r=fmease
jhpratt Jul 20, 2025
9111b89
Rollup merge of #144148 - compiler-errors:async-print-hack, r=lqd
jhpratt Jul 20, 2025
a8ea93a
Rollup merge of #144169 - RalfJung:type-id-fix, r=oli-obk
jhpratt Jul 20, 2025
43f7387
Rollup merge of #144196 - ChrisDenton:init-mingw, r=mati865
jhpratt Jul 20, 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
5 changes: 0 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,6 @@ jobs:
- name: install MinGW
run: src/ci/scripts/install-mingw.sh

# Workaround for spurious ci failures after mingw install
# see https://rust-lang.zulipchat.com/#narrow/channel/242791-t-infra/topic/Spurious.20bors.20CI.20failures/near/528915775
- name: ensure home dir exists
run: mkdir -p ~

- name: install ninja
run: src/ci/scripts/install-ninja.sh

Expand Down
22 changes: 14 additions & 8 deletions compiler/rustc_codegen_cranelift/example/float-minmax-pass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
#[derive(Copy, Clone, PartialEq, Debug)]
struct f32x4(pub [f32; 4]);

impl f32x4 {
fn into_array(self) -> [f32; 4] {
unsafe { std::mem::transmute(self) }
}
}

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

fn main() {
Expand All @@ -29,22 +35,22 @@ fn main() {
unsafe {
let min0 = simd_fmin(x, y);
let min1 = simd_fmin(y, x);
assert_eq!(min0, min1);
assert_eq!(min0.into_array(), min1.into_array());
let e = f32x4([1.0, 1.0, 3.0, 3.0]);
assert_eq!(min0, e);
assert_eq!(min0.into_array(), e.into_array());
let minn = simd_fmin(x, n);
assert_eq!(minn, x);
assert_eq!(minn.into_array(), x.into_array());
let minn = simd_fmin(y, n);
assert_eq!(minn, y);
assert_eq!(minn.into_array(), y.into_array());

let max0 = simd_fmax(x, y);
let max1 = simd_fmax(y, x);
assert_eq!(max0, max1);
assert_eq!(max0.into_array(), max1.into_array());
let e = f32x4([2.0, 2.0, 4.0, 4.0]);
assert_eq!(max0, e);
assert_eq!(max0.into_array(), e.into_array());
let maxn = simd_fmax(x, n);
assert_eq!(maxn, x);
assert_eq!(maxn.into_array(), x.into_array());
let maxn = simd_fmax(y, n);
assert_eq!(maxn, y);
assert_eq!(maxn.into_array(), y.into_array());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,8 @@ fn main() {
struct V([f64; 2]);

let f = V([0.0, 1.0]);
let _a = f.0[0];
let fp = (&raw const f) as *const [f64; 2];
let _a = (unsafe { &*fp })[0];

stack_val_align();
}
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_codegen_llvm/src/back/owned_target_machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ impl OwnedTargetMachine {
debug_info_compression: &CStr,
use_emulated_tls: bool,
args_cstr_buff: &[u8],
use_wasm_eh: bool,
) -> Result<Self, LlvmError<'static>> {
assert!(args_cstr_buff.len() > 0);
assert!(
Expand Down Expand Up @@ -72,6 +73,7 @@ impl OwnedTargetMachine {
use_emulated_tls,
args_cstr_buff.as_ptr() as *const c_char,
args_cstr_buff.len(),
use_wasm_eh,
)
};

Expand Down
4 changes: 4 additions & 0 deletions compiler/rustc_codegen_llvm/src/back/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use rustc_codegen_ssa::back::write::{
BitcodeSection, CodegenContext, EmitObj, ModuleConfig, TargetMachineFactoryConfig,
TargetMachineFactoryFn,
};
use rustc_codegen_ssa::base::wants_wasm_eh;
use rustc_codegen_ssa::traits::*;
use rustc_codegen_ssa::{CompiledModule, ModuleCodegen, ModuleKind};
use rustc_data_structures::profiling::SelfProfilerRef;
Expand Down Expand Up @@ -285,6 +286,8 @@ pub(crate) fn target_machine_factory(
let file_name_display_preference =
sess.filename_display_preference(RemapPathScopeComponents::DEBUGINFO);

let use_wasm_eh = wants_wasm_eh(sess);

Arc::new(move |config: TargetMachineFactoryConfig| {
let path_to_cstring_helper = |path: Option<PathBuf>| -> CString {
let path = path.unwrap_or_default();
Expand Down Expand Up @@ -321,6 +324,7 @@ pub(crate) fn target_machine_factory(
&debuginfo_compression,
use_emulated_tls,
&args_cstr_buff,
use_wasm_eh,
)
})
}
Expand Down
5 changes: 5 additions & 0 deletions compiler/rustc_codegen_llvm/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,11 @@ pub(crate) unsafe fn create_module<'ll>(
// LLVM 21 updated the default layout on nvptx: https://github.com/llvm/llvm-project/pull/124961
target_data_layout = target_data_layout.replace("e-p6:32:32-i64", "e-i64");
}
if sess.target.arch == "amdgpu" {
// LLVM 21 adds the address width for address space 8.
// See https://github.com/llvm/llvm-project/pull/139419
target_data_layout = target_data_layout.replace("p8:128:128:128:48", "p8:128:128")
}
}

// Ensure the data-layout values hardcoded remain the defaults.
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_codegen_llvm/src/llvm/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2425,6 +2425,7 @@ unsafe extern "C" {
UseEmulatedTls: bool,
ArgsCstrBuff: *const c_char,
ArgsCstrBuffLen: usize,
UseWasmEH: bool,
) -> *mut TargetMachine;

pub(crate) fn LLVMRustDisposeTargetMachine(T: *mut TargetMachine);
Expand Down
19 changes: 5 additions & 14 deletions compiler/rustc_codegen_ssa/src/mir/operand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,20 +329,11 @@ impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> {
let offset = self.layout.fields.offset(i);

if !bx.is_backend_ref(self.layout) && bx.is_backend_ref(field) {
if let BackendRepr::SimdVector { count, .. } = self.layout.backend_repr
&& let BackendRepr::Memory { sized: true } = field.backend_repr
&& count.is_power_of_two()
{
assert_eq!(field.size, self.layout.size);
// This is being deprecated, but for now stdarch still needs it for
// Newtype vector of array, e.g. #[repr(simd)] struct S([i32; 4]);
let place = PlaceRef::alloca(bx, field);
self.val.store(bx, place.val.with_type(self.layout));
return bx.load_operand(place);
} else {
// Part of https://github.com/rust-lang/compiler-team/issues/838
bug!("Non-ref type {self:?} cannot project to ref field type {field:?}");
}
// Part of https://github.com/rust-lang/compiler-team/issues/838
span_bug!(
fx.mir.span,
"Non-ref type {self:?} cannot project to ref field type {field:?}",
);
}

let val = if field.is_zst() {
Expand Down
10 changes: 4 additions & 6 deletions compiler/rustc_const_eval/src/interpret/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ pub enum AllocKind {
LiveData,
/// A function allocation (that fn ptrs point to).
Function,
/// A (symbolic) vtable allocation.
VTable,
/// A "virtual" allocation, used for vtables and TypeId.
Virtual,
/// A dead allocation.
Dead,
}
Expand Down Expand Up @@ -950,11 +950,9 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
let (size, align) = global_alloc.size_and_align(*self.tcx, self.typing_env);
let mutbl = global_alloc.mutability(*self.tcx, self.typing_env);
let kind = match global_alloc {
GlobalAlloc::TypeId { .. }
| GlobalAlloc::Static { .. }
| GlobalAlloc::Memory { .. } => AllocKind::LiveData,
GlobalAlloc::Static { .. } | GlobalAlloc::Memory { .. } => AllocKind::LiveData,
GlobalAlloc::Function { .. } => bug!("We already checked function pointers above"),
GlobalAlloc::VTable { .. } => AllocKind::VTable,
GlobalAlloc::VTable { .. } | GlobalAlloc::TypeId { .. } => AllocKind::Virtual,
};
return AllocInfo::new(size, align, kind, mutbl);
}
Expand Down
8 changes: 8 additions & 0 deletions compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2495,6 +2495,14 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
ty::List::empty(),
PredicateFilter::All,
);
self.add_sizedness_bounds(
&mut bounds,
self_ty,
hir_bounds,
None,
None,
hir_ty.span,
);
self.register_trait_ascription_bounds(bounds, hir_ty.hir_id, hir_ty.span);
self_ty
}
Expand Down
4 changes: 1 addition & 3 deletions compiler/rustc_lint/src/ptr_nulls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,10 @@ impl<'tcx> LateLintPass<'tcx> for PtrNullChecks {
let (arg_indices, are_zsts_allowed): (&[_], _) = match diag_name {
sym::ptr_read
| sym::ptr_read_unaligned
| sym::ptr_read_volatile
| sym::ptr_replace
| sym::ptr_write
| sym::ptr_write_bytes
| sym::ptr_write_unaligned
| sym::ptr_write_volatile => (&[0], true),
| sym::ptr_write_unaligned => (&[0], true),
sym::slice_from_raw_parts | sym::slice_from_raw_parts_mut => (&[0], false),
sym::ptr_copy
| sym::ptr_copy_nonoverlapping
Expand Down
5 changes: 4 additions & 1 deletion compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine(
bool EmitStackSizeSection, bool RelaxELFRelocations, bool UseInitArray,
const char *SplitDwarfFile, const char *OutputObjFile,
const char *DebugInfoCompression, bool UseEmulatedTls,
const char *ArgsCstrBuff, size_t ArgsCstrBuffLen) {
const char *ArgsCstrBuff, size_t ArgsCstrBuffLen, bool UseWasmEH) {

auto OptLevel = fromRust(RustOptLevel);
auto RM = fromRust(RustReloc);
Expand Down Expand Up @@ -462,6 +462,9 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine(
Options.ThreadModel = ThreadModel::Single;
}

if (UseWasmEH)
Options.ExceptionModel = ExceptionHandling::Wasm;

Options.EmitStackSizeSection = EmitStackSizeSection;

if (ArgsCstrBuff != nullptr) {
Expand Down
26 changes: 1 addition & 25 deletions compiler/rustc_middle/src/ty/print/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1210,30 +1210,6 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
}

for (assoc_item_def_id, term) in assoc_items {
// Skip printing `<{coroutine@} as Coroutine<_>>::Return` from async blocks,
// unless we can find out what coroutine return type it comes from.
let term = if let Some(ty) = term.skip_binder().as_type()
&& let ty::Alias(ty::Projection, proj) = ty.kind()
&& let Some(assoc) = tcx.opt_associated_item(proj.def_id)
&& assoc
.trait_container(tcx)
.is_some_and(|def_id| tcx.is_lang_item(def_id, LangItem::Coroutine))
&& assoc.opt_name() == Some(rustc_span::sym::Return)
{
if let ty::Coroutine(_, args) = args.type_at(0).kind() {
let return_ty = args.as_coroutine().return_ty();
if !return_ty.is_ty_var() {
return_ty.into()
} else {
continue;
}
} else {
continue;
}
} else {
term.skip_binder()
};

if first {
p!("<");
first = false;
Expand All @@ -1243,7 +1219,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {

p!(write("{} = ", tcx.associated_item(assoc_item_def_id).name()));

match term.kind() {
match term.skip_binder().kind() {
TermKind::Ty(ty) => p!(print(ty)),
TermKind::Const(c) => p!(print(c)),
};
Expand Down
9 changes: 9 additions & 0 deletions compiler/rustc_mir_transform/src/validate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,15 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
);
}

if adt_def.repr().simd() {
self.fail(
location,
format!(
"Projecting into SIMD type {adt_def:?} is banned by MCP#838"
),
);
}

let var = parent_ty.variant_index.unwrap_or(FIRST_VARIANT);
let Some(field) = adt_def.variant(var).fields.get(f) else {
fail_out_of_bounds(self, location);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, Target, TargetMetadata,
pub(crate) fn target() -> Target {
Target {
arch: "amdgpu".into(),
data_layout: "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-p7:160:256:256:32-p8:128:128-p9:192:256:256:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-G1-ni:7:8:9".into(),
data_layout: "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-p7:160:256:256:32-p8:128:128:128:48-p9:192:256:256:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-G1-ni:7:8:9".into(),
llvm_target: "amdgcn-amd-amdhsa".into(),
metadata: TargetMetadata {
description: Some("AMD GPU".into()),
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/any.rs
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ impl TypeId {

// This is a provenance-stripping memcpy.
for (i, chunk) in self.data.iter().copied().enumerate() {
let chunk = chunk.expose_provenance().to_ne_bytes();
let chunk = chunk.addr().to_ne_bytes();
let start = i * chunk.len();
bytes[start..(start + chunk.len())].copy_from_slice(&chunk);
}
Expand Down
Loading