Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
f0a751d
std_detect: support detecting more features on aarch64 Windows
lilith Apr 27, 2026
89cfc22
Suggest const destruct bounds on `Drop` impls when they are missing
oli-obk Apr 25, 2026
61e876f
Suggest various missing trait bounds on `HostEffect` clauses not bein…
oli-obk Apr 27, 2026
8b3f6db
Update with new LLVM 22 target for `wasm32-wali-linux-target`
arjunr2 Apr 28, 2026
e743a4d
bootstrap: remap OUT_DIR paths to fix build script path leakage in ar…
paradoxicalguy Apr 28, 2026
26ce8a9
Apply suggestion from @bjorn3
paradoxicalguy Apr 28, 2026
fffc4b5
Update `opt_ast_lowering_delayed_lints` query to allow "stealing" lin…
GuillaumeGomez Apr 28, 2026
44b9251
use the new `//@ needs-asm-mnemonic: ret` more
folkertdev Apr 27, 2026
23c7bf0
Fix passing paths with space into dlltool
ChrisDenton Apr 28, 2026
6d20c98
Test that raw-dylib works with whitespace paths
ChrisDenton Apr 28, 2026
a940270
Make `FlatMapInPlaceVec` an unsafe trait.
nnethercote Apr 29, 2026
89e272c
privacy: share effective visibility initialization
SynapLink Apr 29, 2026
e5493ea
ci(free-disk-space): remove more tools and fix warnings
marcoieni Apr 29, 2026
ad7ddbc
simd_reduce_min/max: remove float support
RalfJung Apr 12, 2026
b784a1c
When archive format is wrong produce an error instead of ICE
cezarbbb Apr 29, 2026
b8314ae
Rollup merge of #155189 - RalfJung:reduce-minmax-float, r=petrochenkov
JonathanBrouwer Apr 29, 2026
8a15fe1
Rollup merge of #155721 - cezarbbb:fix-archive-ice-148217, r=bjorn3
JonathanBrouwer Apr 29, 2026
271cbc6
Rollup merge of #155794 - SynapLink:share-effective-vis-private-init,…
JonathanBrouwer Apr 29, 2026
6a43d3c
Rollup merge of #155856 - imazen:winarm-stable-features, r=Amanieu
JonathanBrouwer Apr 29, 2026
5eeb1c4
Rollup merge of #155861 - oli-obk:effect-bound-suggestions, r=jdonsze…
JonathanBrouwer Apr 29, 2026
4effc94
Rollup merge of #155899 - ChrisDenton:dlltool, r=mati865
JonathanBrouwer Apr 29, 2026
82afe0e
Rollup merge of #155916 - arjunr2:llvm-22-update, r=JohnTitor
JonathanBrouwer Apr 29, 2026
f738527
Rollup merge of #155935 - paradoxicalguy:fix-out-dir-remap, r=Urgau,
JonathanBrouwer Apr 29, 2026
3331aa7
Rollup merge of #155950 - folkertdev:needs-ret-mnemonic, r=chenyukang
JonathanBrouwer Apr 29, 2026
eb2d5a7
Rollup merge of #155958 - marcoieni:ci-remove-edge-chrome-and-more, r…
JonathanBrouwer Apr 29, 2026
74e2a9f
Rollup merge of #155949 - GuillaumeGomez:steal-lints, r=JonathanBrouw…
JonathanBrouwer Apr 29, 2026
212ddcd
Rollup merge of #155951 - nnethercote:unsafe-FlatMapInPlaceVec, r=kiv…
JonathanBrouwer Apr 29, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/rustc_ast_lowering/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
let mut bodies = std::mem::take(&mut self.bodies);
let define_opaque = std::mem::take(&mut self.define_opaque);
let trait_map = std::mem::take(&mut self.trait_map);
let delayed_lints = std::mem::take(&mut self.delayed_lints).into_boxed_slice();
let delayed_lints = Steal::new(std::mem::take(&mut self.delayed_lints).into_boxed_slice());

#[cfg(debug_assertions)]
for (id, attrs) in attrs.iter() {
Expand Down
57 changes: 0 additions & 57 deletions compiler/rustc_codegen_gcc/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2313,67 +2313,10 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
self.vector_extremum(a, b, ExtremumOperation::Min)
}

#[cfg(feature = "master")]
pub fn vector_reduce_fmin(&mut self, src: RValue<'gcc>) -> RValue<'gcc> {
let vector_type = src.get_type().unqualified().dyncast_vector().expect("vector type");
let element_count = vector_type.get_num_units();
let mut acc = self
.context
.new_vector_access(self.location, src, self.context.new_rvalue_zero(self.int_type))
.to_rvalue();
for i in 1..element_count {
let elem = self
.context
.new_vector_access(
self.location,
src,
self.context.new_rvalue_from_int(self.int_type, i as _),
)
.to_rvalue();
let cmp = self.context.new_comparison(self.location, ComparisonOp::LessThan, acc, elem);
acc = self.select(cmp, acc, elem);
}
acc
}

#[cfg(not(feature = "master"))]
pub fn vector_reduce_fmin(&mut self, _src: RValue<'gcc>) -> RValue<'gcc> {
unimplemented!();
}

pub fn vector_maximum_number_nsz(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
self.vector_extremum(a, b, ExtremumOperation::Max)
}

#[cfg(feature = "master")]
pub fn vector_reduce_fmax(&mut self, src: RValue<'gcc>) -> RValue<'gcc> {
let vector_type = src.get_type().unqualified().dyncast_vector().expect("vector type");
let element_count = vector_type.get_num_units();
let mut acc = self
.context
.new_vector_access(self.location, src, self.context.new_rvalue_zero(self.int_type))
.to_rvalue();
for i in 1..element_count {
let elem = self
.context
.new_vector_access(
self.location,
src,
self.context.new_rvalue_from_int(self.int_type, i as _),
)
.to_rvalue();
let cmp =
self.context.new_comparison(self.location, ComparisonOp::GreaterThan, acc, elem);
acc = self.select(cmp, acc, elem);
}
acc
}

#[cfg(not(feature = "master"))]
pub fn vector_reduce_fmax(&mut self, _src: RValue<'gcc>) -> RValue<'gcc> {
unimplemented!();
}

pub fn vector_select(
&mut self,
cond: RValue<'gcc>,
Expand Down
7 changes: 3 additions & 4 deletions compiler/rustc_codegen_gcc/src/intrinsic/simd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1422,15 +1422,14 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
);

macro_rules! minmax_red {
($name:ident: $int_red:ident, $float_red:ident) => {
($name:ident: $int_red:ident) => {
if name == sym::$name {
require!(
ret_ty == in_elem,
InvalidMonomorphization::ReturnType { span, name, in_elem, in_ty, ret_ty }
);
return match *in_elem.kind() {
ty::Int(_) | ty::Uint(_) => Ok(bx.$int_red(args[0].immediate())),
ty::Float(_) => Ok(bx.$float_red(args[0].immediate())),
_ => return_error!(InvalidMonomorphization::UnsupportedSymbol {
span,
name,
Expand All @@ -1444,8 +1443,8 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
};
}

minmax_red!(simd_reduce_min: vector_reduce_min, vector_reduce_fmin);
minmax_red!(simd_reduce_max: vector_reduce_max, vector_reduce_fmax);
minmax_red!(simd_reduce_min: vector_reduce_min);
minmax_red!(simd_reduce_max: vector_reduce_max);

macro_rules! bitwise_red {
($name:ident : $op:expr, $boolean:expr) => {
Expand Down
6 changes: 0 additions & 6 deletions compiler/rustc_codegen_llvm/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1668,12 +1668,6 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
pub(crate) fn vector_reduce_xor(&mut self, src: &'ll Value) -> &'ll Value {
self.call_intrinsic("llvm.vector.reduce.xor", &[self.val_ty(src)], &[src])
}
pub(crate) fn vector_reduce_fmin(&mut self, src: &'ll Value) -> &'ll Value {
self.call_intrinsic("llvm.vector.reduce.fmin", &[self.val_ty(src)], &[src])
}
pub(crate) fn vector_reduce_fmax(&mut self, src: &'ll Value) -> &'ll Value {
self.call_intrinsic("llvm.vector.reduce.fmax", &[self.val_ty(src)], &[src])
}
pub(crate) fn vector_reduce_min(&mut self, src: &'ll Value, is_signed: bool) -> &'ll Value {
self.call_intrinsic(
if is_signed { "llvm.vector.reduce.smin" } else { "llvm.vector.reduce.umin" },
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_codegen_llvm/src/intrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2922,7 +2922,7 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
);

macro_rules! minmax_red {
($name:ident: $int_red:ident, $float_red:ident) => {
($name:ident: $int_red:ident) => {
if name == sym::$name {
require!(
ret_ty == in_elem,
Expand All @@ -2931,7 +2931,6 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
return match in_elem.kind() {
ty::Int(_i) => Ok(bx.$int_red(args[0].immediate(), true)),
ty::Uint(_u) => Ok(bx.$int_red(args[0].immediate(), false)),
ty::Float(_f) => Ok(bx.$float_red(args[0].immediate())),
_ => return_error!(InvalidMonomorphization::UnsupportedSymbol {
span,
name,
Expand All @@ -2945,8 +2944,9 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
};
}

minmax_red!(simd_reduce_min: vector_reduce_min, vector_reduce_fmin);
minmax_red!(simd_reduce_max: vector_reduce_max, vector_reduce_fmax);
// Currently no support for float due to <https://github.com/llvm/llvm-project/issues/185827>.
minmax_red!(simd_reduce_min: vector_reduce_min);
minmax_red!(simd_reduce_max: vector_reduce_max);

macro_rules! bitwise_red {
($name:ident : $red:ident, $boolean:expr) => {
Expand Down
93 changes: 82 additions & 11 deletions compiler/rustc_codegen_ssa/src/back/archive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use ar_archive_writer::{
ArchiveKind, COFFShortExport, MachineTypes, NewArchiveMember, write_archive_to_stream,
};
pub use ar_archive_writer::{DEFAULT_OBJECT_READER, ObjectReader};
use object::read::archive::ArchiveFile;
use object::read::archive::{ArchiveFile, ArchiveKind as ObjectArchiveKind};
use object::read::macho::FatArch;
use rustc_data_structures::fx::FxIndexSet;
use rustc_data_structures::memmap::Mmap;
Expand Down Expand Up @@ -217,12 +217,10 @@ fn create_mingw_dll_import_lib(
// able to control the *exact* spelling of each of the symbols that are being imported:
// hence we don't want `dlltool` adding leading underscores automatically.
let dlltool = find_binutils_dlltool(sess);
let temp_prefix = {
let mut path = PathBuf::from(&output_path);
path.pop();
path.push(lib_name);
path
};
// temp_prefix doesn't handle paths with spaces so
// use a relative path and set the current working directory
let cwd = output_path.parent().unwrap_or(output_path);
let temp_prefix = lib_name;
// dlltool target architecture args from:
// https://github.com/llvm/llvm-project-release-prs/blob/llvmorg-15.0.6/llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp#L69
let (dlltool_target_arch, dlltool_target_bitness) = match &sess.target.arch {
Expand All @@ -246,7 +244,8 @@ fn create_mingw_dll_import_lib(
.arg(dlltool_target_bitness)
.arg("--no-leading-underscore")
.arg("--temp-prefix")
.arg(temp_prefix);
.arg(temp_prefix)
.current_dir(cwd);

match dlltool_cmd.output() {
Err(e) => {
Expand Down Expand Up @@ -320,6 +319,50 @@ pub trait ArchiveBuilder {
fn build(self: Box<Self>, output: &Path) -> bool;
}

fn target_archive_format_to_object_kind(format: &str) -> Option<ObjectArchiveKind> {
match format {
"gnu" => Some(ObjectArchiveKind::Gnu),
"bsd" => Some(ObjectArchiveKind::Bsd),
"darwin" => Some(ObjectArchiveKind::Bsd64),
"coff" => Some(ObjectArchiveKind::Coff),
"aix_big" => Some(ObjectArchiveKind::AixBig),
_ => None,
}
}

fn archive_kinds_compatible(actual: ObjectArchiveKind, expected: ObjectArchiveKind) -> bool {
if actual == expected {
return true;
}
matches!(
(actual, expected),
// An archive without long filenames or symbol table is detected as Unknown;
// this is compatible with any target format.
(ObjectArchiveKind::Unknown, _)
// 64-bit symbol table variants are compatible with their 32-bit counterparts
| (ObjectArchiveKind::Gnu64, ObjectArchiveKind::Gnu)
| (ObjectArchiveKind::Gnu, ObjectArchiveKind::Gnu64)
| (ObjectArchiveKind::Bsd64, ObjectArchiveKind::Bsd)
| (ObjectArchiveKind::Bsd, ObjectArchiveKind::Bsd64)
// GNU and COFF archives share the same magic and member header format;
// only the symbol table layout differs.
| (ObjectArchiveKind::Gnu, ObjectArchiveKind::Coff)
| (ObjectArchiveKind::Coff, ObjectArchiveKind::Gnu)
| (ObjectArchiveKind::Gnu64, ObjectArchiveKind::Coff)
)
}

fn archive_kind_display_name(kind: ObjectArchiveKind) -> String {
match kind {
ObjectArchiveKind::Gnu | ObjectArchiveKind::Gnu64 => "GNU".to_string(),
ObjectArchiveKind::Bsd => "BSD".to_string(),
ObjectArchiveKind::Bsd64 => "Darwin".to_string(),
ObjectArchiveKind::Coff => "COFF".to_string(),
ObjectArchiveKind::AixBig => "AIX big".to_string(),
_ => format!("{kind:?}"),
}
}

pub struct ArArchiveBuilderBuilder;

impl ArchiveBuilderBuilder for ArArchiveBuilderBuilder {
Expand Down Expand Up @@ -420,6 +463,19 @@ impl<'a> ArchiveBuilder for ArArchiveBuilder<'a> {
.map_err(|err| io::Error::new(io::ErrorKind::InvalidData, err))?;
let archive_index = self.src_archives.len();

if let Some(expected_kind) =
target_archive_format_to_object_kind(&self.sess.target.archive_format)
{
let actual_kind = archive.kind();
if !archive_kinds_compatible(actual_kind, expected_kind) {
self.sess.dcx().emit_warn(crate::errors::IncompatibleArchiveFormat {
path: archive_path.clone(),
actual: archive_kind_display_name(actual_kind),
expected: archive_kind_display_name(expected_kind),
});
}
}

for entry in archive.members() {
let entry = entry.map_err(|err| io::Error::new(io::ErrorKind::InvalidData, err))?;
let file_name = String::from_utf8(entry.name().to_vec())
Expand Down Expand Up @@ -482,9 +538,24 @@ impl<'a> ArArchiveBuilder<'a> {
match entry {
ArchiveEntry::FromArchive { archive_index, file_range } => {
let src_archive = &self.src_archives[archive_index];

let data = &src_archive.1
[file_range.0 as usize..file_range.0 as usize + file_range.1 as usize];
let archive_data = &src_archive.1;
let start = file_range.0 as usize;
let end = start + file_range.1 as usize;
let Some(data) = archive_data.get(start..end) else {
return Err(io_error_context(
"invalid archive member",
io::Error::new(
io::ErrorKind::InvalidData,
format!(
"archive member at offset {start} with size {} \
exceeds archive size {} in `{}`",
file_range.1,
archive_data.len(),
src_archive.0.display(),
),
),
));
};

Box::new(data) as Box<dyn AsRef<[u8]>>
}
Expand Down
12 changes: 12 additions & 0 deletions compiler/rustc_codegen_ssa/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,18 @@ pub(crate) struct UnknownArchiveKind<'a> {
pub kind: &'a str,
}

#[derive(Diagnostic)]
#[diag("archive `{$path}` was built as {$actual} format, but the target expects {$expected}")]
#[help(
"this often occurs when using BSD-format archive tools on a Linux target; \
rebuild the archive with the correct format for the target platform"
)]
pub(crate) struct IncompatibleArchiveFormat {
pub path: PathBuf,
pub actual: String,
pub expected: String,
}

#[derive(Diagnostic)]
#[diag("linking static libraries is not supported for BPF")]
pub(crate) struct BpfStaticlibNotSupported;
Expand Down
15 changes: 10 additions & 5 deletions compiler/rustc_data_structures/src/flat_map_in_place.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,13 @@ impl<V: FlatMapInPlaceVec> FlatMapInPlace<V::Elem> for V {
}
}

// A vec-like type must implement these operations to support `flat_map_in_place`.
pub trait FlatMapInPlaceVec {
/// A vec-like type must implement these operations to support `flat_map_in_place`.
///
/// # Safety
///
/// The memory safety of the unsafe block in `flat_map_in_place` relies on impls of this trait
/// implementing all the operations correctly.
pub unsafe trait FlatMapInPlaceVec {
type Elem;

fn len(&self) -> usize;
Expand All @@ -78,7 +83,7 @@ pub trait FlatMapInPlaceVec {
fn insert(&mut self, idx: usize, elem: Self::Elem);
}

impl<T> FlatMapInPlaceVec for Vec<T> {
unsafe impl<T> FlatMapInPlaceVec for Vec<T> {
type Elem = T;

fn len(&self) -> usize {
Expand All @@ -104,7 +109,7 @@ impl<T> FlatMapInPlaceVec for Vec<T> {
}
}

impl<T> FlatMapInPlaceVec for ThinVec<T> {
unsafe impl<T> FlatMapInPlaceVec for ThinVec<T> {
type Elem = T;

fn len(&self) -> usize {
Expand All @@ -130,7 +135,7 @@ impl<T> FlatMapInPlaceVec for ThinVec<T> {
}
}

impl<T, const N: usize> FlatMapInPlaceVec for SmallVec<[T; N]> {
unsafe impl<T, const N: usize> FlatMapInPlaceVec for SmallVec<[T; N]> {
type Elem = T;

fn len(&self) -> usize {
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_hir/src/hir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ pub use rustc_ast::{
};
use rustc_data_structures::fingerprint::Fingerprint;
use rustc_data_structures::sorted_map::SortedMap;
use rustc_data_structures::steal::Steal;
use rustc_data_structures::tagged_ptr::TaggedRef;
use rustc_error_messages::{DiagArgValue, IntoDiagArg};
use rustc_index::IndexVec;
Expand Down Expand Up @@ -1636,7 +1637,7 @@ pub struct OwnerInfo<'hir> {
/// WARNING: The delayed lints are not hashed as a part of the `OwnerInfo`, and therefore
/// should only be accessed in `eval_always` queries.
#[stable_hasher(ignore)]
pub delayed_lints: DelayedLints,
pub delayed_lints: Steal<DelayedLints>,
}

impl<'tcx> OwnerInfo<'tcx> {
Expand Down
18 changes: 14 additions & 4 deletions compiler/rustc_hir_analysis/src/check/always_applicable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,16 +217,26 @@ fn ensure_all_fields_are_const_destruct<'tcx>(
unreachable!()
};
let field_ty = eff.trait_ref.self_ty();
let diag = struct_span_code_err!(
let mut diag = struct_span_code_err!(
tcx.dcx(),
error.root_obligation.cause.span,
E0367,
"`{field_ty}` does not implement `[const] Destruct`",
)
.with_span_note(impl_span, "required for this `Drop` impl");
if field_ty.has_param() {
// FIXME: suggest adding `[const] Destruct` by teaching
// `suggest_restricting_param_bound` about const traits.
if field_ty.has_param()
&& let Some(generics) = tcx.hir_node_by_def_id(impl_def_id).generics()
{
let destruct_def_id = tcx.lang_items().destruct_trait();
ty::suggest_constraining_type_param(
tcx,
generics,
&mut diag,
&field_ty.to_string(),
"[const] Destruct",
destruct_def_id,
None,
);
}
Err(diag.emit())
})
Expand Down
Loading
Loading