Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
1eb1cce
Remove duplicated fields between `Build` and `Config`
Kobzol Aug 24, 2026
a2b434c
Move stage0 rustc/cargo download out of Config parsing
Kobzol Aug 24, 2026
d23d95e
Gather sysroot and target libdir at once
Kobzol Aug 24, 2026
53a7686
Simplify `rustc_snapshot_sysroot`
Kobzol Aug 24, 2026
7448399
Rename `check_stage0_version` to `check_external_binary_version`
Kobzol Aug 24, 2026
78b1808
Add SVE-accelerated Vec::retain_mut for aarch64
ywxt Aug 25, 2026
5965328
interpret: ensure that calls via no-unwind ABIs do not unwind
RalfJung Aug 23, 2026
2304aed
Change `is_eligible_for_coverage` from a hook to a query
Zalathar Aug 26, 2026
2701241
borrowck: Normalize non-rigid aliases in NLL type relating
Dnreikronos Aug 26, 2026
5f2e58f
rustc_thread_pool: fix lint `cargo::manual_readme`
weihanglo Aug 26, 2026
e3af0b6
compiletest: remove unused unified-diff dep
weihanglo Aug 27, 2026
c4b4017
rustdoc: fix lint `cargo::non_kebab_case_bins`
weihanglo Aug 27, 2026
97a7674
Rollup merge of #161034 - ywxt:retian-sve, r=Amanieu
jhpratt Aug 27, 2026
5e6417b
Rollup merge of #161628 - RalfJung:no-unwind-abi-check, r=saethlin
jhpratt Aug 27, 2026
04eae11
Rollup merge of #161012 - Dnreikronos:borrowck/normalize_nll_aliases,…
jhpratt Aug 27, 2026
6ce1a99
Rollup merge of #161691 - Kobzol:config-session-separation, r=jieyouxu
jhpratt Aug 27, 2026
6cfd543
Rollup merge of #161813 - Zalathar:is-eligible, r=JonathanBrouwer
jhpratt Aug 27, 2026
5e67e2e
Rollup merge of #161842 - weihanglo:cargo-lints, r=jieyouxu
jhpratt Aug 27, 2026
1be27eb
Rollup merge of #161843 - weihanglo:rustdoc-cargo-lints, r=jieyouxu
jhpratt Aug 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
10 changes: 0 additions & 10 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,6 @@ dependencies = [
"shim_utils",
"tracing",
"tracing-subscriber",
"unified-diff",
"walkdir",
"windows 0.61.3",
]
Expand Down Expand Up @@ -6208,15 +6207,6 @@ version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853"

[[package]]
name = "unified-diff"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "496a3d395ed0c30f411ceace4a91f7d93b148fb5a9b383d5d4cff7850f048d5f"
dependencies = [
"diff",
]

[[package]]
name = "unit-prefix"
version = "0.5.2"
Expand Down
29 changes: 26 additions & 3 deletions compiler/rustc_borrowck/src/universal_regions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,19 @@ use rustc_hir::attrs::lang_items::LangItem;
use rustc_hir::def::DefKind;
use rustc_hir::def_id::{DefId, LocalDefId};
use rustc_index::IndexVec;
use rustc_infer::infer::NllRegionVariableOrigin;
use rustc_infer::infer::{NllRegionVariableOrigin, TyCtxtInferExt};
use rustc_infer::traits::ObligationCause;
use rustc_macros::extension;
use rustc_middle::mir::RETURN_PLACE;
use rustc_middle::ty::print::with_no_trimmed_paths;
use rustc_middle::ty::{
self, BoundVariableKind, GenericArgs, GenericArgsRef, InlineConstArgs, InlineConstArgsParts,
List, RegionExt, RegionVid, Ty, TyCtxt, TypeFoldable, TypeVisitableExt, fold_regions,
List, RegionExt, RegionVid, Ty, TyCtxt, TypeFoldable, TypeVisitableExt, TypingMode,
fold_regions,
};
use rustc_middle::{bug, span_bug};
use rustc_span::{ErrorGuaranteed, kw, sym};
use rustc_trait_selection::traits::ObligationCtxt;
use tracing::{debug, instrument};

use crate::BorrowckInferCtxt;
Expand Down Expand Up @@ -133,12 +136,32 @@ pub(crate) enum DefiningTy<'tcx> {
GlobalAsm(DefId),
}

fn normalized_type_of<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> Ty<'tcx> {
let ty = tcx.type_of(def_id).instantiate_identity();
if !tcx.next_trait_solver_globally() {
return ty.skip_normalization();
}

let typing_mode = if tcx.use_typing_mode_post_typeck_until_borrowck() {
TypingMode::borrowck(tcx, def_id)
} else {
TypingMode::analysis_in_body(tcx, def_id)
};
let infcx = tcx.infer_ctxt().build(typing_mode);
let ocx = ObligationCtxt::new(&infcx);
let span = tcx.def_span(def_id);
let cause = ObligationCause::misc(span, def_id);
ocx.deeply_normalize(&cause, tcx.param_env(def_id), ty).unwrap()
}

impl<'tcx> DefiningTy<'tcx> {
#[instrument(level = "debug", skip(tcx), ret)]
pub(crate) fn new(tcx: TyCtxt<'tcx>, body_def_id: LocalDefId) -> DefiningTy<'tcx> {
match tcx.hir_body_owner_kind(body_def_id) {
BodyOwnerKind::Closure | BodyOwnerKind::Fn => {
let defining_ty = tcx.type_of(body_def_id).instantiate_identity().skip_norm_wip();
// Normalize after instantiation so coroutine yield/resume
// types in the args are rigid under the next solver.
let defining_ty = normalized_type_of(tcx, body_def_id);
match *defining_ty.kind() {
ty::Closure(def_id, args) => DefiningTy::Closure(def_id, args),
ty::Coroutine(def_id, args) => DefiningTy::Coroutine(def_id, args),
Expand Down
12 changes: 10 additions & 2 deletions compiler/rustc_const_eval/src/interpret/call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -455,8 +455,10 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
// compile time.
M::check_fn_target_features(self, instance)?;

// If the signature says this cannot unwind, reflect this in the unwind destination so that
// we don't have to check this later. (`init_fn_call` already did this for the caller so
// here we only have to check the callee.)
if !callee_fn_abi.can_unwind {
// The callee cannot unwind, so force the `Unreachable` unwind handling.
match &mut cont {
ReturnContinuation::Stop { .. } => {}
ReturnContinuation::Goto { unwind, .. } => {
Expand Down Expand Up @@ -677,12 +679,18 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
with_caller_location: bool,
destination: &PlaceTy<'tcx, M::Provenance>,
target: Option<mir::BasicBlock>,
unwind: mir::UnwindAction,
mut unwind: mir::UnwindAction,
) -> InterpResult<'tcx> {
let _trace =
enter_trace_span!(M, step::init_fn_call, tracing_separate_thread = Empty, ?fn_val)
.or_if_tracing_disabled(|| trace!("init_fn_call: {:#?}", fn_val));

// If the signature says this cannot unwind, reflect this in the unwind destination
// so that we don't have to check this later.
if caller_fn_abi.is_some_and(|abi| !abi.can_unwind) {
unwind = mir::UnwindAction::Unreachable;
}

let instance = match fn_val {
FnVal::Instance(instance) => instance,
FnVal::Other(extra) => {
Expand Down
6 changes: 0 additions & 6 deletions compiler/rustc_middle/src/hooks/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,6 @@ declare_hooks! {
/// Getting a &core::panic::Location referring to a span.
hook const_caller_location(file: rustc_span::Symbol, line: u32, col: u32) -> mir::ConstValue;

/// Returns `true` if this def is a function-like thing that is eligible for
/// coverage instrumentation under `-Cinstrument-coverage`.
///
/// (Eligible functions might nevertheless be skipped for other reasons.)
hook is_eligible_for_coverage(key: LocalDefId) -> bool;

/// Imports all `SourceFile`s from the given crate into the current session.
/// This normally happens automatically when we decode a `Span` from
/// that crate's metadata - however, the incr comp cache needs
Expand Down
8 changes: 8 additions & 0 deletions compiler/rustc_middle/src/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,14 @@ rustc_queries! {
separate_provide_extern
}

/// Returns `true` if this def is a function-like thing that is eligible for
/// coverage instrumentation under `-Cinstrument-coverage`.
///
/// (Eligible functions might nevertheless be skipped for other reasons.)
query is_eligible_for_coverage(key: LocalDefId) -> bool {
desc { "checking whether `{}` is eligible for coverage", tcx.def_path_str(key) }
}

/// Checks for the nearest `#[coverage(off)]` or `#[coverage(on)]` on
/// this def and any enclosing defs, up to the crate root.
///
Expand Down
34 changes: 25 additions & 9 deletions compiler/rustc_mir_build/src/builder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,15 @@ use rustc_hir::{self as hir, BindingMode, ByRef, HirId, ItemLocalId, Node, find_
use rustc_index::bit_set::GrowableBitSet;
use rustc_index::{Idx, IndexSlice, IndexVec};
use rustc_infer::infer::{InferCtxt, TyCtxtInferExt};
use rustc_infer::traits::ObligationCause;
use rustc_middle::hir::place::PlaceBase as HirPlaceBase;
use rustc_middle::middle::region;
use rustc_middle::mir::*;
use rustc_middle::thir::{self, ExprId, LocalVarId, Param, ParamId, PatKind, Thir};
use rustc_middle::ty::{self, ScalarInt, Ty, TyCtxt, TypeVisitableExt, TypingMode};
use rustc_middle::{bug, span_bug};
use rustc_span::{Span, Symbol};
use rustc_trait_selection::traits::ObligationCtxt;

use crate::builder::expr::as_place::PlaceBuilder;
use crate::builder::scope::LintLevel;
Expand Down Expand Up @@ -477,15 +479,6 @@ fn construct_fn<'tcx>(
let arguments = &thir.params;

let return_ty = fn_sig.output();
let coroutine = match tcx.type_of(fn_def).instantiate_identity().skip_norm_wip().kind() {
ty::Coroutine(_, args) => Some(Box::new(CoroutineInfo::initial(
tcx.coroutine_kind(fn_def).unwrap(),
args.as_coroutine().yield_ty(),
args.as_coroutine().resume_ty(),
))),
ty::Closure(..) | ty::CoroutineClosure(..) | ty::FnDef(..) => None,
ty => span_bug!(span_with_body, "unexpected type of body: {ty:?}"),
};

if let Some((dialect, phase)) =
find_attr!(tcx, fn_id, CustomMir(dialect, phase) => (dialect, phase))
Expand Down Expand Up @@ -514,6 +507,17 @@ fn construct_fn<'tcx>(
};

let infcx = tcx.infer_ctxt().build(typing_mode);

let coroutine = match normalized_type_of(&infcx, fn_def).kind() {
ty::Coroutine(_, args) => Some(Box::new(CoroutineInfo::initial(
tcx.coroutine_kind(fn_def).unwrap(),
args.as_coroutine().yield_ty(),
args.as_coroutine().resume_ty(),
))),
ty::Closure(..) | ty::CoroutineClosure(..) | ty::FnDef(..) => None,
ty => span_bug!(span_with_body, "unexpected type of body: {ty:?}"),
};

let mut builder = Builder::new(
thir,
infcx,
Expand Down Expand Up @@ -562,6 +566,18 @@ fn construct_fn<'tcx>(
body
}

fn normalized_type_of<'tcx>(infcx: &InferCtxt<'tcx>, def_id: LocalDefId) -> Ty<'tcx> {
let tcx = infcx.tcx;
let ty = tcx.type_of(def_id).instantiate_identity();
if !infcx.next_trait_solver() {
return ty.skip_normalization();
}

let ocx = ObligationCtxt::new(infcx);
let cause = ObligationCause::misc(tcx.def_span(def_id), def_id);
ocx.deeply_normalize(&cause, tcx.param_env(def_id), ty).unwrap()
}

fn construct_const<'a, 'tcx>(
tcx: TyCtxt<'tcx>,
def: LocalDefId,
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_mir_transform/src/coverage/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ use crate::coverage::counters::{CoverageCounters, transcribe_counters};

/// Registers query/hook implementations related to coverage.
pub(crate) fn provide(providers: &mut Providers) {
providers.hooks.is_eligible_for_coverage = is_eligible_for_coverage;
providers.queries.is_eligible_for_coverage = is_eligible_for_coverage;
providers.queries.coverage_attr_on = coverage_attr_on;
providers.queries.coverage_ids_info = coverage_ids_info;
}

/// Hook implementation for [`TyCtxt::is_eligible_for_coverage`].
/// Query implementation for [`TyCtxt::is_eligible_for_coverage`].
fn is_eligible_for_coverage(tcx: TyCtxt<'_>, def_id: LocalDefId) -> bool {
// Only instrument functions, methods, and closures (not constants since they are evaluated
// at compile time by Miri).
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_thread_pool/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ authors = [
description = "Core APIs for Rayon - fork for rustc"
license = "MIT OR Apache-2.0"
edition = "2021"
readme = "README.md"
keywords = ["parallel", "thread", "concurrency", "join", "performance"]
categories = ["concurrency"]

Expand Down
19 changes: 19 additions & 0 deletions library/alloc/src/vec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@ use self::spec_extend::SpecExtend;
#[cfg(not(no_global_oom_handling))]
mod spec_extend;

#[cfg(all(target_arch = "aarch64", target_feature = "sve"))]
mod sve_retain;

/// A contiguous growable array type, written as `Vec<T>`, short for 'vector'.
///
/// # Examples
Expand Down Expand Up @@ -2514,6 +2517,22 @@ impl<T, A: Allocator> Vec<T, A> {
return;
}

#[cfg(all(target_arch = "aarch64", target_feature = "sve"))]
{
let long_enough = match mem::size_of::<T>() {
1 => original_len >= sve_retain::MIN_SVE_SIZE_1,
2 => original_len >= sve_retain::MIN_SVE_SIZE_2,
4 => original_len >= sve_retain::MIN_SVE_SIZE_4,
8 => original_len >= sve_retain::MIN_SVE_SIZE_8,
_ => false,
};
if long_enough {
// SAFETY: size_of::<T>() is 1, 2, 4 or 8, matching
// the kernel lane widths.
return unsafe { sve_retain::chunked_retain(self, f) };
}
}

// Vec: [Kept, Kept, Hole, Hole, Hole, Hole, Unchecked, Unchecked]
// | ^- write ^- read |
// |<- original_len ->|
Expand Down
Loading
Loading