Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
1d49df6
Stabilize `VecDeque::retain_back` from `truncate_front`
cammeresi Jan 19, 2026
9566dad
reproduction of miscompilation
dingxiangfei2009 Jun 30, 2026
401dc21
fix remapping in indexing and self-assignments
dingxiangfei2009 Jul 1, 2026
4f42df7
Move `std::io::default_write_vectored` to `core::io`
bushrat011899 May 21, 2026
a50fd17
Move `std::io::cursor`internals to `core::io`
bushrat011899 May 22, 2026
aa35981
Move `WriteThroughCursor` internals to `alloc::io`
bushrat011899 Jul 3, 2026
4f0c3b7
Move `std::io::Write` to `core::io`
bushrat011899 Jul 3, 2026
9dc5fd5
Fix documentation links to `Write`
bushrat011899 May 22, 2026
25fb674
Add documentation to `core::io` internal methods
bushrat011899 Jul 7, 2026
63d6ab3
Reduce visibility of `core::io::write::default_write_fmt`
bushrat011899 Jul 7, 2026
65f6190
Add `Vec::try_extend_from_slice_of_bytes`
bushrat011899 Jul 7, 2026
6b205c6
Update `browser-ui-test` version to `0.24.1`
GuillaumeGomez Jul 7, 2026
9e394da
Update wasm-component-ld to 0.5.26
alexcrichton Jul 7, 2026
ab783ad
accept extern calls to compiler-builtin functions
folkertdev Jun 23, 2026
47acba7
remove `-Zmiri-force-intrinsic-fallback` test run
folkertdev Jul 4, 2026
63bec90
intrinsics: Add a fallback for non-const libm float functions
tgross35 Jan 10, 2026
7a28eed
wrapping_sh* methods: clarify underspecified reference
RalfJung Jul 7, 2026
594e737
std: support real fd methods on Emscripten
guybedford Jul 8, 2026
3bf8728
Rollup merge of #158541 - bushrat011899:core_io_write, r=clarfonthey
jhpratt Jul 8, 2026
6144b60
Rollup merge of #150946 - tgross35:float-intrinsic-fallback, r=RalfJu…
jhpratt Jul 8, 2026
f37ba49
Rollup merge of #158655 - dingxiangfei2009:fix-remapping, r=cjgillot
jhpratt Jul 8, 2026
b818543
Rollup merge of #158920 - alexcrichton:update-wasm-component-ld, r=lqd
jhpratt Jul 8, 2026
5e2c38f
Rollup merge of #158926 - RalfJung:wrapping_sh, r=Darksonn
jhpratt Jul 8, 2026
5b65eb3
Rollup merge of #151379 - cammeresi:20260119-trunc, r=clarfonthey
jhpratt Jul 8, 2026
22d15e1
Rollup merge of #158913 - GuillaumeGomez:update-browser-ui-test, r=ji…
jhpratt Jul 8, 2026
c8b1773
Rollup merge of #158935 - guybedford:emscripten-owned-fd, r=jhpratt
jhpratt Jul 8, 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
60 changes: 30 additions & 30 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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",
Expand All @@ -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]]
Expand Down Expand Up @@ -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]]
Expand All @@ -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]]
Expand Down Expand Up @@ -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",
Expand All @@ -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",
]
Expand Down Expand Up @@ -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",
Expand All @@ -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]]
Expand All @@ -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",
Expand All @@ -6923,7 +6923,7 @@ dependencies = [
"serde_derive",
"serde_json",
"unicode-ident",
"wasmparser 0.252.0",
"wasmparser 0.253.0",
]

[[package]]
Expand Down
16 changes: 14 additions & 2 deletions compiler/rustc_codegen_ssa/src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -877,12 +877,16 @@ pub fn codegen_crate<
/// Returns whether a call from the current crate to the [`Instance`] would produce a call
/// from `compiler_builtins` to a symbol the linker must resolve.
///
/// Such calls from `compiler_bultins` are effectively impossible for the linker to handle. Some
/// Such calls from `compiler_builtins` are effectively impossible for the linker to handle. Some
/// linkers will optimize such that dead calls to unresolved symbols are not an error, but this is
/// not guaranteed. So we used this function in codegen backends to ensure we do not generate any
/// not guaranteed. So we use this function in codegen backends to ensure we do not generate any
/// unlinkable calls.
///
/// Note that calls to LLVM intrinsics are uniquely okay because they won't make it to the linker.
/// Note also that calls to foreign items that are actually exported by the local crate are also
/// okay. This situation arises because compiler-builtins calls functions in core that are
/// `#[inline]` wrappers for `extern "C"` declarations in core, which resolve to a symbol exported
/// by compiler-builtins.
pub fn is_call_from_compiler_builtins_to_upstream_monomorphization<'tcx>(
tcx: TyCtxt<'tcx>,
instance: Instance<'tcx>,
Expand All @@ -895,11 +899,19 @@ pub fn is_call_from_compiler_builtins_to_upstream_monomorphization<'tcx>(
}
}

fn is_extern_call_to_local_crate<'tcx>(tcx: TyCtxt<'tcx>, instance: Instance<'tcx>) -> bool {
tcx.is_foreign_item(instance.def_id())
&& tcx.exported_non_generic_symbols(LOCAL_CRATE).iter().any(|(sym, _info)| {
sym.symbol_name_for_local_instance(tcx) == tcx.symbol_name(instance)
})
}

let def_id = instance.def_id();
!def_id.is_local()
&& tcx.is_compiler_builtins(LOCAL_CRATE)
&& !is_llvm_intrinsic(tcx, def_id)
&& !tcx.should_codegen_locally(instance)
&& !is_extern_call_to_local_crate(tcx, instance)
}

impl CrateInfo {
Expand Down
26 changes: 24 additions & 2 deletions compiler/rustc_mir_dataflow/src/impls/storage_liveness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ impl<'tcx> Analysis<'tcx> for MaybeRequiresStorage<'_, 'tcx> {
match &stmt.kind {
StatementKind::StorageDead(l) => state.kill(*l),

// If a place is assigned to in a statement, it needs storage for that statement.
StatementKind::Assign((place, _)) => {
state.gen_(place.local);
}
Expand All @@ -180,12 +179,35 @@ impl<'tcx> Analysis<'tcx> for MaybeRequiresStorage<'_, 'tcx> {
fn apply_primary_statement_effect(
&self,
state: &mut Self::Domain,
_: &Statement<'tcx>,
stmt: &Statement<'tcx>,
loc: Location,
) {
// If we move from a place then it only stops needing storage *after*
// that statement.
self.check_for_move(state, loc);

match &stmt.kind {
// If a place is assigned to in a statement, it needs storage after that statement.
// Even if the place was moved from in the rvalue (e.g. `x = x + 1` or `x = f(move x)`),
// the assignment restores a valid value into the place.
StatementKind::Assign((place, _)) => {
state.gen_(place.local);
}
StatementKind::SetDiscriminant { place, .. } => {
state.gen_(place.local);
}

StatementKind::StorageDead(_)
| StatementKind::AscribeUserType(..)
| StatementKind::PlaceMention(..)
| StatementKind::Coverage(..)
| StatementKind::FakeRead(..)
| StatementKind::ConstEvalCounter
| StatementKind::Nop
| StatementKind::Intrinsic(..)
| StatementKind::BackwardIncompatibleDropHint { .. }
| StatementKind::StorageLive(..) => {}
}
}

fn apply_early_terminator_effect(
Expand Down
47 changes: 46 additions & 1 deletion compiler/rustc_mir_transform/src/coroutine/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ use rustc_span::def_id::DefId;
use tracing::{debug, instrument};

use crate::deref_separator::deref_finder;
use crate::patch::MirPatch;
use crate::{abort_unwinding_calls, pass_manager as pm, simplify};

pub(super) struct StateTransform;
Expand Down Expand Up @@ -199,6 +200,8 @@ struct TransformVisitor<'tcx> {
old_yield_ty: Ty<'tcx>,

old_ret_ty: Ty<'tcx>,

patch: Option<MirPatch<'tcx>>,
}

impl<'tcx> TransformVisitor<'tcx> {
Expand Down Expand Up @@ -408,11 +411,51 @@ impl<'tcx> MutVisitor<'tcx> for TransformVisitor<'tcx> {
}

#[tracing::instrument(level = "trace", skip(self), ret)]
fn visit_place(&mut self, place: &mut Place<'tcx>, _: PlaceContext, _location: Location) {
fn visit_place(&mut self, place: &mut Place<'tcx>, _: PlaceContext, location: Location) {
// Replace an Local in the remap with a coroutine struct access
if let Some(&Some((ty, variant_index, idx))) = self.remap.get(place.local) {
replace_base(place, self.make_field(variant_index, idx, ty), self.tcx);
}
if let Some(new_projection) = self.process_projection(&place.projection, location) {
place.projection = self.tcx.mk_place_elems(&new_projection);
}
}

fn process_projection_elem(
&mut self,
elem: PlaceElem<'tcx>,
location: Location,
) -> Option<PlaceElem<'tcx>> {
match elem {
PlaceElem::Index(local) => {
if let Some(&Some((ty, variant, idx))) = self.remap.get(local) {
// `PlaceElem::Index` only accepts a `Local`, not an arbitrary `Place`.
// If the local in indexing was saved across a yield point and remapped to a
// coroutine struct field, we cannot inline the struct field access into
// the index projection.
// For example, an local storing the counter to track which element to drop in
// an array is one such case.
//
// Instead, we inject an assignment before this location to restore the
// saved local from the coroutine struct (`local = copy $projection`),
// and leave the `PlaceElem::Index(local)` projection unchanged.
let field = self.make_field(variant, idx, ty);
self.patch.as_mut().unwrap().add_assign(
location,
Place::from(local),
Rvalue::Use(Operand::Copy(field), WithRetag::No),
);
}
None
}
PlaceElem::Field(..)
| PlaceElem::OpaqueCast(..)
| PlaceElem::UnwrapUnsafeBinder(..)
| PlaceElem::Deref
| PlaceElem::ConstantIndex { .. }
| PlaceElem::Subslice { .. }
| PlaceElem::Downcast(..) => None,
}
}

#[tracing::instrument(level = "trace", skip(self, stmt), ret)]
Expand Down Expand Up @@ -1096,6 +1139,7 @@ impl<'tcx> crate::MirPass<'tcx> for StateTransform {
new_ret_local,
old_ret_ty,
old_yield_ty,
patch: Some(MirPatch::new(body)),
};
transform.visit_body(body);

Expand All @@ -1116,6 +1160,7 @@ impl<'tcx> crate::MirPass<'tcx> for StateTransform {
Some(Statement::new(source_info, assign))
}),
);
transform.patch.take().unwrap().apply(body);

// Remove the context argument within generator bodies.
if matches!(coroutine_kind, CoroutineKind::Desugared(CoroutineDesugaring::Gen, _)) {
Expand Down
9 changes: 5 additions & 4 deletions library/alloc/src/collections/vec_deque/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1430,6 +1430,7 @@ impl<T, A: Allocator> VecDeque<T, A> {
/// buf.truncate(1);
/// assert_eq!(buf, [5]);
/// ```
#[doc(alias = "retain_front")]
#[stable(feature = "deque_extras", since = "1.16.0")]
pub fn truncate(&mut self, len: usize) {
/// Runs the destructor for all items in the slice when it gets dropped (normally or
Expand Down Expand Up @@ -1484,7 +1485,6 @@ impl<T, A: Allocator> VecDeque<T, A> {
/// # Examples
///
/// ```
/// # #![feature(vec_deque_truncate_front)]
/// use std::collections::VecDeque;
///
/// let mut buf = VecDeque::new();
Expand All @@ -1493,11 +1493,12 @@ impl<T, A: Allocator> VecDeque<T, A> {
/// buf.push_front(15);
/// assert_eq!(buf, [15, 10, 5]);
/// assert_eq!(buf.as_slices(), (&[15, 10, 5][..], &[][..]));
/// buf.truncate_front(1);
/// buf.retain_back(1);
/// assert_eq!(buf.as_slices(), (&[5][..], &[][..]));
/// ```
#[unstable(feature = "vec_deque_truncate_front", issue = "140667")]
pub fn truncate_front(&mut self, len: usize) {
#[doc(alias = "truncate_front")]
#[stable(feature = "vec_deque_truncate_front", since = "CURRENT_RUSTC_VERSION")]
pub fn retain_back(&mut self, len: usize) {
/// Runs the destructor for all items in the slice when it gets dropped (normally or
/// during unwinding).
struct Dropper<'a, T>(&'a mut [T]);
Expand Down
Loading
Loading