Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
8c92dc8
Expand `OptionFlatten`'s iterator methods
cuviper Feb 25, 2026
fe9d6fe
test that even ZST references prevent deallocation via child pointers
RalfJung Jun 3, 2026
e5c59b3
libc: Minimal support for `mprotect` and `madvise`
foonathan May 25, 2026
6a53473
add minimal NetBSD support
joboet Jun 18, 2026
9f27f6d
[Priroda] Add structured locals output
moabo3li Jun 17, 2026
e418127
[Priroda] Add type strings to locals output
moabo3li Jun 19, 2026
c2c6cb4
Fix too-short variance slice in `variances_of` cycle recovery
xmakro Jun 20, 2026
cc45b69
Prepare for merging from rust-lang/rust
Jun 22, 2026
e1e5e25
Merge ref '942ac9ce4116' from rust-lang/rust
Jun 22, 2026
9969ff0
Merge pull request #5119 from moabo3li/restructured_locals
oli-obk Jun 22, 2026
4b7eb68
Merge pull request #5123 from rust-lang/rustup-2026-06-22
RalfJung Jun 22, 2026
b973eb9
Allow unstable attribute on foreign types and add stability test
kantnero Jun 22, 2026
8d2cf93
Update `cargo miri --help` to point to README.md.
eswartz Jun 18, 2026
aa5792a
reformat pointers to README
RalfJung Jun 23, 2026
88fa4bf
Merge pull request #5113 from eswartz/expose-readme-md-info
RalfJung Jun 23, 2026
90231c7
Merge pull request #5114 from joboet/min-netbsd
RalfJung Jun 23, 2026
0cf893e
dont ICE on generic no_mangle items
RalfJung Jun 24, 2026
dc5b1a9
test-cargo-miri: test all workspace members
RalfJung Jun 24, 2026
01a12a4
add ui test for no mangle generic
HerrCai0907 Mar 29, 2026
1545b13
Merge pull request #5129 from RalfJung/no-mangle-generic
RalfJung Jun 24, 2026
135a0f7
Merge pull request #5063 from foonathan/master
RalfJung Jun 24, 2026
eca4b5b
move nextest section up and mark it more clearly as such
RalfJung Jun 25, 2026
d6d568b
Merge pull request #5131 from RalfJung/nextest
RalfJung Jun 25, 2026
2337590
add some more errno_result
RalfJung Jun 25, 2026
d2c6980
rename read_split_slice → read_partial
RalfJung Jun 25, 2026
5445de0
remove dangling comment
RalfJung Jun 25, 2026
b0d28dc
Merge pull request #5132 from RalfJung/errno-result
RalfJung Jun 25, 2026
ab88669
replace cfg_if with cfg_select
hkBst Jun 25, 2026
37ffa9a
run some more tests natively
RalfJung Jun 25, 2026
528bd23
update lockfile
RalfJung Jun 25, 2026
dfb71b7
Merge pull request #5134 from hkBst/cfg-select
RalfJung Jun 25, 2026
4a2d36a
Prepare for merging from rust-lang/rust
Jun 26, 2026
9beed1d
Merge ref '40557f6225e3' from rust-lang/rust
Jun 26, 2026
fb9fa4e
Merge pull request #5136 from rust-lang/rustup-2026-06-26
RalfJung Jun 26, 2026
3c00af9
Add supertrait item shadowing for type-level path resolution
Amanieu Feb 5, 2026
1efd5a6
Address review feedback
Amanieu Jun 3, 2026
e4ef1cf
Move supertrait shadowing tests to tests/ui/supertrait-shadowing
Amanieu Jun 3, 2026
af3eaee
Address review feedback for tests
Amanieu Jun 4, 2026
2592b41
Add test to confirm usage of unstable foreign type error
kantnero Jun 26, 2026
d69c87a
Upgrade `jsonsocck` and `jsondoclint` to edition 2024.
obi1kenobi Jun 27, 2026
f9a88c6
Prepare for merging from rust-lang/rust
Jun 27, 2026
b3c27e5
Merge ref '16761606d606' from rust-lang/rust
Jun 27, 2026
972dd17
Merge pull request #5139 from rust-lang/rustup-2026-06-27
oli-obk Jun 27, 2026
c3864be
rustdoc: show impl Trait<Box<Local>> for Foreign, etc on Local's docs
sunshowers Jun 27, 2026
2e08805
fix: keep readable readiness when socket read end is closed
WhySoBad Jun 13, 2026
80f8d1c
avoid Windows quirk, and make write test consistent with read test
RalfJung Jun 27, 2026
f67abfb
Merge pull request #5106 from WhySoBad/network-sockets-stay-readable-…
RalfJung Jun 27, 2026
29643cf
Merge pull request #5088 from RalfJung/dealloc-protected
RalfJung Jun 27, 2026
290b370
Merge pull request #5133 from RalfJung/native
RalfJung Jun 27, 2026
9ab5135
Upgrade `rustdoc-json-types` to 2024 edition.
obi1kenobi Jun 27, 2026
aac0746
run x86 intrinsic tests natively
RalfJung Jun 27, 2026
a672666
run aarch64 intrinsic tests natively
RalfJung Jun 27, 2026
21dfe67
fix bug in `mpsadbw`
folkertdev Jun 27, 2026
18c10cd
Adds RmetaLinkCache a per-link cache that uses path as the key of dec…
mehdiakiki Jun 20, 2026
94888f0
update bless output
kantnero Jun 27, 2026
f734a15
Merge pull request #5140 from RalfJung/arch-intrinsic-native
RalfJung Jun 27, 2026
075f549
add `vqdmulh*` aarch64 intrinsics
folkertdev Jun 22, 2026
8e4a0e1
Merge pull request #5125 from folkertdev/vqdmulh
RalfJung Jun 27, 2026
96bf9d6
Revert "LLVM 23: Adapt codegen test to moved assume"
saethlin Jun 27, 2026
39b11c0
Rollup merge of #158502 - saethlin:revert-flaky-codegen-test-fix, r=J…
JonathanBrouwer Jun 27, 2026
5b5b95c
Rollup merge of #152225 - Amanieu:type-supertrait-shadowing, r=jackh726
JonathanBrouwer Jun 27, 2026
e94b37d
Rollup merge of #158194 - mehdiakiki:rlib-link-meta-cache, r=petroche…
JonathanBrouwer Jun 27, 2026
8d660f2
Rollup merge of #158466 - sunshowers:nested-fundamental, r=notriddle
JonathanBrouwer Jun 27, 2026
e9c2951
Rollup merge of #158501 - RalfJung:miri, r=RalfJung
JonathanBrouwer Jun 27, 2026
359a7d2
Rollup merge of #153097 - cuviper:expand-into_flat_iter, r=joboet
JonathanBrouwer Jun 27, 2026
4acfd37
Rollup merge of #158163 - xmakro:fix-variances-cycle-recovery-count, …
JonathanBrouwer Jun 27, 2026
6bc2492
Rollup merge of #158233 - kantnero:allow-unstable-attr-on-target, r=J…
JonathanBrouwer Jun 27, 2026
29bc320
Rollup merge of #158470 - obi1kenobi:pg/upgrade-json-tool-editions, r…
JonathanBrouwer Jun 27, 2026
8696dfa
Rollup merge of #158488 - obi1kenobi:pg/upgrade-rustdoc-json-types-ed…
JonathanBrouwer Jun 27, 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
1 change: 1 addition & 0 deletions compiler/rustc_attr_parsing/src/attributes/stability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowList(&[
Allow(Target::Static),
Allow(Target::ForeignFn),
Allow(Target::ForeignStatic),
Allow(Target::ForeignTy),
Allow(Target::ExternCrate),
]);

Expand Down
26 changes: 18 additions & 8 deletions compiler/rustc_codegen_ssa/src/back/archive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use rustc_target::spec::Arch;
use tracing::trace;

use super::metadata::{create_compressed_metadata_file, search_for_section};
use super::rmeta_link;
use super::rmeta_link::{self, RmetaLinkCache};
use super::symbol_edit::{apply_edits, collect_internal_names};
use crate::common;
// Public for ArchiveBuilderBuilder::extract_bundled_libs
Expand Down Expand Up @@ -311,7 +311,7 @@ fn find_binutils_dlltool(sess: &Session) -> OsString {
}

pub enum AddArchiveKind<'a> {
Rlib(/*skip*/ &'a dyn Fn(&str, ArchiveEntryKind) -> bool),
Rlib(&'a mut RmetaLinkCache, /*skip*/ &'a dyn Fn(&str, ArchiveEntryKind) -> bool),
Other,
}

Expand Down Expand Up @@ -466,7 +466,11 @@ pub fn try_extract_macho_fat_archive(
}

impl<'a> ArchiveBuilder for ArArchiveBuilder<'a> {
fn add_archive(&mut self, archive_path: &Path, ar_kind: AddArchiveKind<'_>) -> io::Result<()> {
fn add_archive(
&mut self,
archive_path: &Path,
mut ar_kind: AddArchiveKind<'_>,
) -> io::Result<()> {
let mut archive_path = archive_path.to_path_buf();
if self.sess.target.llvm_target.contains("-apple-macosx")
&& let Some(new_archive_path) = try_extract_macho_fat_archive(self.sess, &archive_path)?
Expand All @@ -481,8 +485,14 @@ impl<'a> ArchiveBuilder for ArArchiveBuilder<'a> {
let archive_map = unsafe { Mmap::map(File::open(&archive_path)?)? };
let archive = ArchiveFile::parse(&*archive_map)
.map_err(|err| io::Error::new(io::ErrorKind::InvalidData, err))?;
let metadata_link = match ar_kind {
AddArchiveKind::Rlib(..) => rmeta_link::read(&archive, &archive_map, &archive_path),
let skip = match &ar_kind {
AddArchiveKind::Rlib(_, skip) => Some(*skip),
AddArchiveKind::Other => None,
};
let metadata_link = match &mut ar_kind {
AddArchiveKind::Rlib(cache, _) => cache.get_or_insert_with(&archive_path, || {
rmeta_link::read(&archive, &archive_map, &archive_path)
}),
AddArchiveKind::Other => None,
};
let archive_index = self.src_archives.len();
Expand Down Expand Up @@ -512,9 +522,9 @@ impl<'a> ArchiveBuilder for ArArchiveBuilder<'a> {
} else {
ArchiveEntryKind::Other
};
let drop = match ar_kind {
AddArchiveKind::Rlib(skip) => skip(&file_name, kind),
AddArchiveKind::Other => false,
let drop = match skip {
Some(skip) => skip(&file_name, kind),
None => false,
};
if !drop {
let source = if entry.is_thin() {
Expand Down
16 changes: 14 additions & 2 deletions compiler/rustc_codegen_ssa/src/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ use super::archive::{
use super::command::Command;
use super::linker::{self, Linker};
use super::metadata::{MetadataPosition, create_wrapper_file};
use super::rmeta_link::RmetaLinkCache;
use super::rpath::{self, RPathConfig};
use super::{apple, rmeta_link, versioned_llvm_target};
use crate::base::needs_allocator_shim_for_linking;
Expand Down Expand Up @@ -86,6 +87,7 @@ pub fn link_binary(
let _timer = sess.timer("link_binary");
let output_metadata = sess.opts.output_types.contains_key(&OutputType::Metadata);
let mut tempfiles_for_stdout_output: Vec<PathBuf> = Vec::new();
let mut rmeta_link_cache = RmetaLinkCache::default();
for &crate_type in &crate_info.crate_types {
// Ignore executable crates if we have -Z no-codegen, as they will error.
if (sess.opts.unstable_opts.no_codegen || !sess.opts.output_types.should_codegen())
Expand Down Expand Up @@ -139,6 +141,7 @@ pub fn link_binary(
link_staticlib(
sess,
archive_builder_builder,
&mut rmeta_link_cache,
&compiled_modules,
&crate_info,
&metadata,
Expand All @@ -150,6 +153,7 @@ pub fn link_binary(
link_natively(
sess,
archive_builder_builder,
&mut rmeta_link_cache,
crate_type,
&out_filename,
&compiled_modules,
Expand Down Expand Up @@ -502,6 +506,7 @@ fn link_rlib<'a>(
fn link_staticlib(
sess: &Session,
archive_builder_builder: &dyn ArchiveBuilderBuilder,
rmeta_link_cache: &mut RmetaLinkCache,
compiled_modules: &CompiledModules,
crate_info: &CrateInfo,
metadata: &EncodedMetadata,
Expand Down Expand Up @@ -531,7 +536,7 @@ fn link_staticlib(
let bundled_libs: FxIndexSet<_> = native_libs.filter_map(|lib| lib.filename).collect();
ab.add_archive(
path,
AddArchiveKind::Rlib(&|fname: &str, entry_kind| {
AddArchiveKind::Rlib(rmeta_link_cache, &|fname: &str, entry_kind| {
// Ignore metadata and rmeta-link files.
if fname == METADATA_FILENAME || fname == rmeta_link::FILENAME {
return true;
Expand Down Expand Up @@ -939,6 +944,7 @@ fn report_linker_output(
fn link_natively(
sess: &Session,
archive_builder_builder: &dyn ArchiveBuilderBuilder,
rmeta_link_cache: &mut RmetaLinkCache,
crate_type: CrateType,
out_filename: &Path,
compiled_modules: &CompiledModules,
Expand All @@ -965,6 +971,7 @@ fn link_natively(
flavor,
sess,
archive_builder_builder,
rmeta_link_cache,
crate_type,
tmpdir,
temp_filename,
Expand Down Expand Up @@ -2562,6 +2569,7 @@ fn linker_with_args(
flavor: LinkerFlavor,
sess: &Session,
archive_builder_builder: &dyn ArchiveBuilderBuilder,
rmeta_link_cache: &mut RmetaLinkCache,
crate_type: CrateType,
tmpdir: &Path,
out_filename: &Path,
Expand Down Expand Up @@ -2690,6 +2698,7 @@ fn linker_with_args(
cmd,
sess,
archive_builder_builder,
rmeta_link_cache,
crate_info,
crate_type,
tmpdir,
Expand Down Expand Up @@ -3126,6 +3135,7 @@ fn add_upstream_rust_crates(
cmd: &mut dyn Linker,
sess: &Session,
archive_builder_builder: &dyn ArchiveBuilderBuilder,
rmeta_link_cache: &mut RmetaLinkCache,
crate_info: &CrateInfo,
crate_type: CrateType,
tmpdir: &Path,
Expand Down Expand Up @@ -3178,6 +3188,7 @@ fn add_upstream_rust_crates(
cmd,
sess,
archive_builder_builder,
rmeta_link_cache,
crate_info,
tmpdir,
cnum,
Expand Down Expand Up @@ -3309,6 +3320,7 @@ fn add_static_crate(
cmd: &mut dyn Linker,
sess: &Session,
archive_builder_builder: &dyn ArchiveBuilderBuilder,
rmeta_link_cache: &mut RmetaLinkCache,
crate_info: &CrateInfo,
tmpdir: &Path,
cnum: CrateNum,
Expand Down Expand Up @@ -3339,7 +3351,7 @@ fn add_static_crate(
let mut archive = archive_builder_builder.new_archive_builder(sess);
if let Err(error) = archive.add_archive(
cratepath,
AddArchiveKind::Rlib(&|f, entry_kind| {
AddArchiveKind::Rlib(rmeta_link_cache, &|f, entry_kind| {
if f == METADATA_FILENAME || f == rmeta_link::FILENAME {
return true;
}
Expand Down
18 changes: 17 additions & 1 deletion compiler/rustc_codegen_ssa/src/back/rmeta_link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
//! and potentially other data collected and used when building or linking a rlib.
//! See <https://github.com/rust-lang/rust/issues/138243>.

use std::path::Path;
use std::path::{Path, PathBuf};

use object::read::archive::ArchiveFile;
use rustc_data_structures::fx::FxHashMap;
use rustc_serialize::opaque::mem_encoder::MemEncoder;
use rustc_serialize::opaque::{MAGIC_END_BYTES, MemDecoder};
use rustc_serialize::{Decodable, Encodable};
Expand Down Expand Up @@ -54,3 +55,18 @@ pub fn read_from_data(archive_data: &[u8], rlib_path: &Path) -> Option<RmetaLink
let archive = ArchiveFile::parse(archive_data).ok()?;
read(&archive, archive_data, rlib_path)
}

#[derive(Default)]
pub struct RmetaLinkCache {
cache: FxHashMap<PathBuf, Option<RmetaLink>>,
}

impl RmetaLinkCache {
pub fn get_or_insert_with(
&mut self,
rlib_path: &Path,
load: impl FnOnce() -> Option<RmetaLink>,
) -> Option<&RmetaLink> {
self.cache.entry(rlib_path.to_path_buf()).or_insert_with(load).as_ref()
}
}
6 changes: 2 additions & 4 deletions compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,9 +409,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {

pub(super) fn report_ambiguous_assoc_item(
&self,
bound1: ty::PolyTraitRef<'tcx>,
bound2: ty::PolyTraitRef<'tcx>,
matching_candidates: impl Iterator<Item = ty::PolyTraitRef<'tcx>>,
matching_candidates: &[ty::PolyTraitRef<'tcx>],
qself: AssocItemQSelf,
assoc_tag: ty::AssocTag,
assoc_ident: Ident,
Expand Down Expand Up @@ -443,7 +441,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
// predicates!).
// FIXME: Turn this into a structured, translatable & more actionable suggestion.
let mut where_bounds = vec![];
for bound in [bound1, bound2].into_iter().chain(matching_candidates) {
for &bound in matching_candidates {
let bound_id = bound.def_id();
let assoc_item = tcx.associated_items(bound_id).find_by_ident_and_kind(
tcx,
Expand Down
80 changes: 77 additions & 3 deletions compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ use std::{assert_matches, slice};
use rustc_abi::FIRST_VARIANT;
use rustc_ast::LitKind;
use rustc_data_structures::fx::{FxHashSet, FxIndexMap, FxIndexSet};
use rustc_data_structures::sso::SsoHashSet;
use rustc_errors::codes::*;
use rustc_errors::{
Applicability, Diag, DiagCtxtHandle, ErrorGuaranteed, FatalError, StashKey,
Expand Down Expand Up @@ -1262,6 +1263,74 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
)
}

/// When there are multiple traits which contain an identically named
/// associated item, this function eliminates any traits which are a
/// supertrait of another candidate trait.
///
/// This is the type-level analogue of
/// `rustc_hir_typeck::method::probe::ProbeContext::collapse_candidates_to_subtrait_pick`;
/// keep both implementations in sync.
///
/// This implements RFC #3624.
fn collapse_candidates_to_subtrait_pick(
&self,
matching_candidates: &[ty::PolyTraitRef<'tcx>],
) -> Option<ty::PolyTraitRef<'tcx>> {
if !self.tcx().features().supertrait_item_shadowing() {
return None;
}

let mut child_trait = matching_candidates[0];
let mut supertraits: SsoHashSet<_> =
traits::supertrait_def_ids(self.tcx(), child_trait.def_id()).collect();

let mut remaining_candidates: Vec<_> = matching_candidates[1..].iter().copied().collect();
while !remaining_candidates.is_empty() {
let mut made_progress = false;
let mut next_round = vec![];

for remaining_trait in remaining_candidates {
if supertraits.contains(&remaining_trait.def_id()) {
made_progress = true;
continue;
}

// This candidate is not a supertrait of the `child_trait`.
// Check if it's a subtrait of the `child_trait`, instead.
// If it is, then it must have been a subtrait of every
// other pick we've eliminated at this point. It will
// take over at this point.
let remaining_trait_supertraits: SsoHashSet<_> =
traits::supertrait_def_ids(self.tcx(), remaining_trait.def_id()).collect();
if remaining_trait_supertraits.contains(&child_trait.def_id()) {
child_trait = remaining_trait;
supertraits = remaining_trait_supertraits;
made_progress = true;
continue;
}

// Neither `child_trait` or the current candidate are
// supertraits of each other.
// Don't bail here, since we may be comparing two supertraits
// of a common subtrait. These two supertraits won't be related
// at all, but we will pick them up next round when we find their
// child as we continue iterating in this round.
next_round.push(remaining_trait);
}

if made_progress {
// If we've made progress, iterate again.
remaining_candidates = next_round;
} else {
// Otherwise, we must have at least two candidates which
// are not related to each other at all.
return None;
}
}

Some(child_trait)
}

/// Search for a single trait bound whose trait defines the associated item given by
/// `assoc_ident`.
///
Expand Down Expand Up @@ -1296,10 +1365,15 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
};

if let Some(bound2) = matching_candidates.next() {
let all_matching_candidates: Vec<_> =
[bound1, bound2].into_iter().chain(matching_candidates).collect();
if let Some(bound) = self.collapse_candidates_to_subtrait_pick(&all_matching_candidates)
{
return Ok(bound);
}

return Err(self.report_ambiguous_assoc_item(
bound1,
bound2,
matching_candidates,
&all_matching_candidates,
qself,
assoc_tag,
assoc_ident,
Expand Down
4 changes: 4 additions & 0 deletions compiler/rustc_hir_typeck/src/method/probe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2359,6 +2359,10 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
/// multiple conflicting picks if there is one pick whose trait container is a subtrait
/// of the trait containers of all of the other picks.
///
/// This is the method-probe analogue of
/// `rustc_hir_analysis::hir_ty_lowering::HirTyLowerer::collapse_candidates_to_subtrait_pick`;
/// keep both implementations in sync.
///
/// This implements RFC #3624.
fn collapse_candidates_to_subtrait_pick(
&self,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_query_impl/src/handle_cycle_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ pub(crate) fn variances_of<'tcx>(
err: Diag<'_>,
) -> &'tcx [ty::Variance] {
let _guar = err.delay_as_bug();
let n = tcx.generics_of(def_id).own_params.len();
let n = tcx.generics_of(def_id).count();
tcx.arena.alloc_from_iter(iter::repeat_n(ty::Bivariant, n))
}

Expand Down
Loading
Loading