Skip to content

Rollup of 15 pull requests #145599

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

Merged
merged 42 commits into from
Aug 19, 2025
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
c6ac515
fmt of non-decimals is always non-negative due to the two's-complemen…
pascaldekloe Jun 26, 2025
7704a39
fmt benchmarks for binary, octal and hex
pascaldekloe Jun 29, 2025
ad61b31
Correct some grammar in integer documentation
tgross35 Aug 1, 2025
4ad8606
fmt with table lookup for binary, octal and hex
pascaldekloe Jul 8, 2025
d85a645
Require approval from t-infra instead of t-release on tier bumps
Kobzol Aug 4, 2025
0246245
rustc_target: Add the `32s` target feature for LoongArch
heiher Aug 8, 2025
fb04c5e
dec2flt: Provide more valid inputs examples
jstasiak Aug 11, 2025
2f796d9
Make a James Bond reference
jstasiak Aug 11, 2025
0c8485f
suggest using `pub(crate)` for E0364
makai410 Aug 13, 2025
c855a2f
Hide docs for core::unicode
clarfonthey Aug 13, 2025
c3c2c23
Extend `QueryStability` to handle `IntoIterator` implementations
smoelius Apr 4, 2025
e31fed0
run spellcheck as a tidy extra check in ci
lolbinarycat Aug 6, 2025
1f77424
fmt::DisplayInt abstraction obsolete with better macro
pascaldekloe Jul 10, 2025
1cb4fd7
tidy now installs typos-cli as-needed via cargo
lolbinarycat Aug 8, 2025
6a51eef
tidy: run typos check in src root, not current dir
lolbinarycat Aug 9, 2025
d73e6b4
tidy: add better error reporting for if typos can't be run
lolbinarycat Aug 8, 2025
0d797d2
typos: allow moreso
lolbinarycat Aug 16, 2025
2050a3b
std: fix more typos
lolbinarycat Aug 16, 2025
3b0ff9c
Add `//@ ignore-stage1` to query_stability.rs test
smoelius Aug 17, 2025
1cd7080
Add -Zindirect-branch-cs-prefix (from draft PR)
Darksonn May 7, 2025
1a29d9c
Add `-Zindirect-branch-cs-prefix` option
ojeda May 7, 2025
75e0263
Rehome tests/ui/issues/ tests [5/?]
Oneirical Jul 13, 2025
f5e43d5
nll-relate: improve hr opaque types support
lcnr Jun 5, 2025
aa3008d
implement std::fs::set_permissions_nofollow on unix
lolbinarycat Jun 24, 2025
ece1397
interpret: fix in-place return place semantics when the return place …
RalfJung Aug 18, 2025
dc72692
Add tracing to various miscellaneous functions
Stypox Aug 12, 2025
7dfbc0a
miri: detect passing the same local twice as an in-place argument
RalfJung Aug 18, 2025
c1a1222
Rollup merge of #139345 - smoelius:into-iter-stability, r=lcnr
jieyouxu Aug 19, 2025
df01a87
Rollup merge of #140740 - ojeda:indirect-branch-cs-prefix, r=davidtwco
jieyouxu Aug 19, 2025
bd0e768
Rollup merge of #142079 - lcnr:opaque-types-universes, r=BoxyUwU
jieyouxu Aug 19, 2025
9c46cdb
Rollup merge of #142938 - lolbinarycat:std-set_permissions_nofollow, …
jieyouxu Aug 19, 2025
4327e69
Rollup merge of #143730 - pascaldekloe:fmt-radix-trim, r=tgross35
jieyouxu Aug 19, 2025
0b80d40
Rollup merge of #144767 - tgross35:doc-grammar, r=ibraheemdev
jieyouxu Aug 19, 2025
43f7789
Rollup merge of #144906 - Kobzol:infra-team-tier-bump, r=davidtwco
jieyouxu Aug 19, 2025
2d05870
Rollup merge of #144983 - Oneirical:uncountable-integer, r=jieyouxu
jieyouxu Aug 19, 2025
b4a88c8
Rollup merge of #145025 - lolbinarycat:ci-tidy-spellcheck, r=Kobzol
jieyouxu Aug 19, 2025
bdd3bc8
Rollup merge of #145099 - heiher:loong-32s, r=folkertdev
jieyouxu Aug 19, 2025
8568070
Rollup merge of #145166 - makai410:teach-pub-crate, r=lcnr
jieyouxu Aug 19, 2025
0b378a7
Rollup merge of #145255 - lune-climate:dec2flt-doc, r=ibraheemdev
jieyouxu Aug 19, 2025
ba20d77
Rollup merge of #145306 - Stypox:tracing-misc, r=RalfJung
jieyouxu Aug 19, 2025
5e979cb
Rollup merge of #145336 - clarfonthey:hidden-unicode, r=ibraheemdev
jieyouxu Aug 19, 2025
5d37e8e
Rollup merge of #145585 - RalfJung:miri-inplace-arg-checks, r=compile…
jieyouxu Aug 19, 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
9 changes: 7 additions & 2 deletions compiler/rustc_borrowck/src/type_check/relate_tys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,13 @@ impl<'a, 'b, 'tcx> NllTypeRelating<'a, 'b, 'tcx> {
// by using `ty_vid rel B` and then finally and end by equating `ty_vid` to
// the opaque.
let mut enable_subtyping = |ty, opaque_is_expected| {
let ty_vid = infcx.next_ty_var_id_in_universe(self.span(), ty::UniverseIndex::ROOT);

// We create the fresh inference variable in the highest universe.
// In theory we could limit it to the highest universe in the args of
// the opaque but that isn't really worth the effort.
//
// We'll make sure that the opaque type can actually name everything
// in its hidden type later on.
let ty_vid = infcx.next_ty_vid(self.span());
let variance = if opaque_is_expected {
self.ambient_variance
} else {
Expand Down
9 changes: 9 additions & 0 deletions compiler/rustc_codegen_llvm/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,15 @@ pub(crate) unsafe fn create_module<'ll>(
}
}

if sess.opts.unstable_opts.indirect_branch_cs_prefix {
llvm::add_module_flag_u32(
llmod,
llvm::ModuleFlagMergeBehavior::Override,
"indirect_branch_cs_prefix",
1,
);
}

match (sess.opts.unstable_opts.small_data_threshold, sess.target.small_data_threshold_support())
{
// Set up the small-data optimization limit for architectures that use
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_codegen_llvm/src/llvm_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ pub(crate) fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> Option<LLVMFea
{
None
}
("loongarch32" | "loongarch64", "32s") if get_version().0 < 21 => None,
// Filter out features that are not supported by the current LLVM version
("riscv32" | "riscv64", "zacas") if get_version().0 < 20 => None,
(
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_codegen_ssa/src/target_features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ fn parse_rust_feature_flag<'a>(
while let Some(new_feature) = new_features.pop() {
if features.insert(new_feature) {
if let Some(implied_features) = inverse_implied_features.get(&new_feature) {
#[allow(rustc::potential_query_instability)]
new_features.extend(implied_features)
}
}
Expand Down
12 changes: 9 additions & 3 deletions compiler/rustc_const_eval/src/interpret/call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ use crate::{enter_trace_span, fluent_generated as fluent};
pub enum FnArg<'tcx, Prov: Provenance = CtfeProvenance> {
/// Pass a copy of the given operand.
Copy(OpTy<'tcx, Prov>),
/// Allow for the argument to be passed in-place: destroy the value originally stored at that place and
/// make the place inaccessible for the duration of the function call.
/// Allow for the argument to be passed in-place: destroy the value originally stored at that
/// place and make the place inaccessible for the duration of the function call. This *must* be
/// an in-memory place so that we can do the proper alias checks.
InPlace(MPlaceTy<'tcx, Prov>),
}

Expand Down Expand Up @@ -379,6 +380,11 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
}
}

// *Before* pushing the new frame, determine whether the return destination is in memory.
// Need to use `place_to_op` to be *sure* we get the mplace if there is one.
let destination_mplace = self.place_to_op(destination)?.as_mplace_or_imm().left();

// Push the "raw" frame -- this leaves locals uninitialized.
self.push_stack_frame_raw(instance, body, destination, cont)?;

// If an error is raised here, pop the frame again to get an accurate backtrace.
Expand Down Expand Up @@ -496,7 +502,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {

// Protect return place for in-place return value passing.
// We only need to protect anything if this is actually an in-memory place.
if let Left(mplace) = destination.as_mplace_or_local() {
if let Some(mplace) = destination_mplace {
M::protect_in_place_function_argument(self, &mplace)?;
}

Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_const_eval/src/interpret/eval_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
let _trace = enter_trace_span!(
M,
"instantiate_from_frame_and_normalize_erasing_regions",
"{}",
frame.instance
%frame.instance
);
frame
.instance
Expand Down Expand Up @@ -583,6 +582,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
span: Span,
layout: Option<TyAndLayout<'tcx>>,
) -> InterpResult<'tcx, OpTy<'tcx, M::Provenance>> {
let _trace = enter_trace_span!(M, const_eval::eval_mir_constant, ?val);
let const_val = val.eval(*self.tcx, self.typing_env, span).map_err(|err| {
if M::ALL_CONSTS_ARE_PRECHECKED {
match err {
Expand Down
6 changes: 6 additions & 0 deletions compiler/rustc_const_eval/src/interpret/place.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,12 @@ impl<'tcx, Prov: Provenance> PlaceTy<'tcx, Prov> {
}

/// A place is either an mplace or some local.
///
/// Note that the return value can be different even for logically identical places!
/// Specifically, if a local is stored in-memory, this may return `Local` or `MPlaceTy`
/// depending on how the place was constructed. In other words, seeing `Local` here does *not*
/// imply that this place does not point to memory. Every caller must therefore always handle
/// both cases.
#[inline(always)]
pub fn as_mplace_or_local(
&self,
Expand Down
5 changes: 4 additions & 1 deletion compiler/rustc_const_eval/src/interpret/stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use super::{
MemoryKind, Operand, PlaceTy, Pointer, Provenance, ReturnAction, Scalar, from_known_layout,
interp_ok, throw_ub, throw_unsup,
};
use crate::errors;
use crate::{enter_trace_span, errors};

// The Phantomdata exists to prevent this type from being `Send`. If it were sent across a thread
// boundary and dropped in the other thread, it would exit the span in the other thread.
Expand Down Expand Up @@ -386,6 +386,9 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {

// Make sure all the constants required by this frame evaluate successfully (post-monomorphization check).
for &const_ in body.required_consts() {
// We can't use `eval_mir_constant` here as that assumes that all required consts have
// already been checked, so we need a separate tracing call.
let _trace = enter_trace_span!(M, const_eval::required_consts, ?const_.const_);
let c =
self.instantiate_from_current_frame_and_normalize_erasing_regions(const_.const_)?;
c.eval(*self.tcx, self.typing_env, const_.span).map_err(|err| {
Expand Down
65 changes: 45 additions & 20 deletions compiler/rustc_const_eval/src/interpret/step.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use either::Either;
use rustc_abi::{FIRST_VARIANT, FieldIdx};
use rustc_data_structures::fx::FxHashSet;
use rustc_index::IndexSlice;
use rustc_middle::ty::{self, Instance, Ty};
use rustc_middle::{bug, mir, span_bug};
Expand Down Expand Up @@ -389,8 +390,9 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {

/// Evaluate the arguments of a function call
fn eval_fn_call_argument(
&self,
&mut self,
op: &mir::Operand<'tcx>,
move_definitely_disjoint: bool,
) -> InterpResult<'tcx, FnArg<'tcx, M::Provenance>> {
interp_ok(match op {
mir::Operand::Copy(_) | mir::Operand::Constant(_) => {
Expand All @@ -399,24 +401,19 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
FnArg::Copy(op)
}
mir::Operand::Move(place) => {
// If this place lives in memory, preserve its location.
// We call `place_to_op` which will be an `MPlaceTy` whenever there exists
// an mplace for this place. (This is in contrast to `PlaceTy::as_mplace_or_local`
// which can return a local even if that has an mplace.)
let place = self.eval_place(*place)?;
let op = self.place_to_op(&place)?;

match op.as_mplace_or_imm() {
Either::Left(mplace) => FnArg::InPlace(mplace),
Either::Right(_imm) => {
// This argument doesn't live in memory, so there's no place
// to make inaccessible during the call.
// We rely on there not being any stray `PlaceTy` that would let the
// caller directly access this local!
// This is also crucial for tail calls, where we want the `FnArg` to
// stay valid when the old stack frame gets popped.
FnArg::Copy(op)
if move_definitely_disjoint {
// We still have to ensure that no *other* pointers are used to access this place,
// so *if* it is in memory then we have to treat it as `InPlace`.
// Use `place_to_op` to guarantee that we notice it being in memory.
let op = self.place_to_op(&place)?;
match op.as_mplace_or_imm() {
Either::Left(mplace) => FnArg::InPlace(mplace),
Either::Right(_imm) => FnArg::Copy(op),
}
} else {
// We have to force this into memory to detect aliasing among `Move` arguments.
FnArg::InPlace(self.force_allocation(&place)?)
}
}
})
Expand All @@ -425,18 +422,46 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
/// Shared part of `Call` and `TailCall` implementation — finding and evaluating all the
/// necessary information about callee and arguments to make a call.
fn eval_callee_and_args(
&self,
&mut self,
terminator: &mir::Terminator<'tcx>,
func: &mir::Operand<'tcx>,
args: &[Spanned<mir::Operand<'tcx>>],
) -> InterpResult<'tcx, EvaluatedCalleeAndArgs<'tcx, M>> {
let func = self.eval_operand(func, None)?;

// Evaluating function call arguments. The tricky part here is dealing with `Move`
// arguments: we have to ensure no two such arguments alias. This would be most easily done
// by just forcing them all into memory and then doing the usual in-place argument
// protection, but then we'd force *a lot* of arguments into memory. So we do some syntactic
// pre-processing here where if all `move` arguments are syntactically distinct local
// variables (and none is indirect), we can skip the in-memory forcing.
let move_definitely_disjoint = 'move_definitely_disjoint: {
let mut previous_locals = FxHashSet::<mir::Local>::default();
for arg in args {
let mir::Operand::Move(place) = arg.node else {
continue; // we can skip non-`Move` arguments.
};
if place.is_indirect_first_projection() {
// An indirect `Move` argument could alias with anything else...
break 'move_definitely_disjoint false;
}
if !previous_locals.insert(place.local) {
// This local is the base for two arguments! They might overlap.
break 'move_definitely_disjoint false;
}
}
// We found no violation so they are all definitely disjoint.
true
};
let args = args
.iter()
.map(|arg| self.eval_fn_call_argument(&arg.node))
.map(|arg| self.eval_fn_call_argument(&arg.node, move_definitely_disjoint))
.collect::<InterpResult<'tcx, Vec<_>>>()?;

let fn_sig_binder = func.layout.ty.fn_sig(*self.tcx);
let fn_sig_binder = {
let _trace = enter_trace_span!(M, "fn_sig", ty = ?func.layout.ty.kind());
func.layout.ty.fn_sig(*self.tcx)
};
let fn_sig = self.tcx.normalize_erasing_late_bound_regions(self.typing_env, fn_sig_binder);
let extra_args = &args[fn_sig.inputs().len()..];
let extra_args =
Expand Down
4 changes: 3 additions & 1 deletion compiler/rustc_const_eval/src/interpret/validity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1418,7 +1418,9 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
let _trace = enter_trace_span!(
M,
"validate_operand",
"recursive={recursive}, reset_provenance_and_padding={reset_provenance_and_padding}, val={val:?}"
recursive,
reset_provenance_and_padding,
?val,
);

// Note that we *could* actually be in CTFE here with `-Zextra-const-ub-checks`, but it's
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_errors/src/emitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use std::path::Path;
use std::sync::Arc;

use derive_setters::Setters;
use rustc_data_structures::fx::{FxHashMap, FxIndexMap, FxIndexSet};
use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
use rustc_data_structures::sync::{DynSend, IntoDynSyncSend};
use rustc_error_messages::{FluentArgs, SpanLabel};
use rustc_lexer;
Expand Down Expand Up @@ -1853,7 +1853,7 @@ impl HumanEmitter {
&& line_idx + 1 == annotated_file.lines.len(),
);

let mut to_add = FxHashMap::default();
let mut to_add = FxIndexMap::default();

for (depth, style) in depths {
// FIXME(#120456) - is `swap_remove` correct?
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_expand/src/mbe/macro_rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,7 @@ pub(super) fn try_match_macro_attr<'matcher, T: Tracker<'matcher>>(
match result {
Success(body_named_matches) => {
psess.gated_spans.merge(gated_spans_snapshot);
#[allow(rustc::potential_query_instability)]
named_matches.extend(body_named_matches);
return Ok((i, rule, named_matches));
}
Expand Down
22 changes: 15 additions & 7 deletions compiler/rustc_infer/src/infer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -782,22 +782,30 @@ impl<'tcx> InferCtxt<'tcx> {
self.inner.borrow_mut().type_variables().num_vars()
}

pub fn next_ty_var(&self, span: Span) -> Ty<'tcx> {
self.next_ty_var_with_origin(TypeVariableOrigin { span, param_def_id: None })
pub fn next_ty_vid(&self, span: Span) -> TyVid {
self.next_ty_vid_with_origin(TypeVariableOrigin { span, param_def_id: None })
}

pub fn next_ty_var_with_origin(&self, origin: TypeVariableOrigin) -> Ty<'tcx> {
let vid = self.inner.borrow_mut().type_variables().new_var(self.universe(), origin);
Ty::new_var(self.tcx, vid)
pub fn next_ty_vid_with_origin(&self, origin: TypeVariableOrigin) -> TyVid {
self.inner.borrow_mut().type_variables().new_var(self.universe(), origin)
}

pub fn next_ty_var_id_in_universe(&self, span: Span, universe: ty::UniverseIndex) -> TyVid {
pub fn next_ty_vid_in_universe(&self, span: Span, universe: ty::UniverseIndex) -> TyVid {
let origin = TypeVariableOrigin { span, param_def_id: None };
self.inner.borrow_mut().type_variables().new_var(universe, origin)
}

pub fn next_ty_var(&self, span: Span) -> Ty<'tcx> {
self.next_ty_var_with_origin(TypeVariableOrigin { span, param_def_id: None })
}

pub fn next_ty_var_with_origin(&self, origin: TypeVariableOrigin) -> Ty<'tcx> {
let vid = self.next_ty_vid_with_origin(origin);
Ty::new_var(self.tcx, vid)
}

pub fn next_ty_var_in_universe(&self, span: Span, universe: ty::UniverseIndex) -> Ty<'tcx> {
let vid = self.next_ty_var_id_in_universe(span, universe);
let vid = self.next_ty_vid_in_universe(span, universe);
Ty::new_var(self.tcx, vid)
}

Expand Down
4 changes: 3 additions & 1 deletion compiler/rustc_interface/src/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,9 @@ pub(crate) fn parse_check_cfg(dcx: DiagCtxtHandle<'_>, specs: Vec<String>) -> Ch
.expecteds
.entry(name.name)
.and_modify(|v| match v {
ExpectedValues::Some(v) if !values_any_specified => {
ExpectedValues::Some(v) if !values_any_specified =>
{
#[allow(rustc::potential_query_instability)]
v.extend(values.clone())
}
ExpectedValues::Some(_) => *v = ExpectedValues::Any,
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_interface/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -807,6 +807,7 @@ fn test_unstable_options_tracking_hash() {
tracked!(hint_mostly_unused, true);
tracked!(human_readable_cgu_names, true);
tracked!(incremental_ignore_spans, true);
tracked!(indirect_branch_cs_prefix, true);
tracked!(inline_mir, Some(true));
tracked!(inline_mir_hint_threshold, Some(123));
tracked!(inline_mir_threshold, Some(123));
Expand Down
Loading
Loading