Skip to content

Commit b178f22

Browse files
authored
Merge pull request rust-lang#4220 from rust-lang/rustup-2025-03-06
Automatic Rustup
2 parents 14cfc3a + f80cac7 commit b178f22

File tree

883 files changed

+20481
-17861
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

883 files changed

+20481
-17861
lines changed

.github/workflows/ci.yml

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# This file defines our primary CI workflow that runs on pull requests
22
# and also on pushes to special branches (auto, try).
33
#
4-
# The actual definition of the executed jobs is calculated by a Python
5-
# script located at src/ci/github-actions/ci.py, which
4+
# The actual definition of the executed jobs is calculated by the
5+
# `src/ci/citool` crate, which
66
# uses job definition data from src/ci/github-actions/jobs.yml.
77
# You should primarily modify the `jobs.yml` file if you want to modify
88
# what jobs are executed in CI.
@@ -56,7 +56,10 @@ jobs:
5656
- name: Calculate the CI job matrix
5757
env:
5858
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
59-
run: python3 src/ci/github-actions/ci.py calculate-job-matrix >> $GITHUB_OUTPUT
59+
run: |
60+
cd src/ci/citool
61+
CARGO_INCREMENTAL=0 cargo test
62+
CARGO_INCREMENTAL=0 cargo run calculate-job-matrix >> $GITHUB_OUTPUT
6063
id: jobs
6164
job:
6265
name: ${{ matrix.full_name }}
@@ -179,19 +182,12 @@ jobs:
179182
- name: show the current environment
180183
run: src/ci/scripts/dump-environment.sh
181184

182-
# Temporary fix to unblock CI
183-
# Remove the latest Windows SDK for 32-bit Windows MSVC builds.
184-
# See issue https://github.com/rust-lang/rust/issues/137733 for more details.
185-
- name: Remove Windows SDK 10.0.26100.0
186-
shell: powershell
187-
if: ${{ matrix.name == 'i686-msvc-1' || matrix.name == 'i686-msvc-2' || matrix.name == 'dist-i686-msvc' }}
185+
# Pre-build citool before the following step uninstalls rustup
186+
# Build it into the build directory, to avoid modifying sources
187+
- name: build citool
188188
run: |
189-
$kits = (Get-ItemProperty -path 'HKLM:\SOFTWARE\Microsoft\Windows Kits\Installed Roots').KitsRoot10
190-
$sdk_version = "10.0.26100.0"
191-
192-
foreach ($kind in 'Bin', 'Lib', 'Include') {
193-
Remove-Item -Force -Recurse $kits\$kind\$sdk_version -ErrorAction Continue
194-
}
189+
cd src/ci/citool
190+
CARGO_INCREMENTAL=0 CARGO_TARGET_DIR=../../../build/citool cargo build
195191
196192
- name: run the build
197193
# Redirect stderr to stdout to avoid reordering the two streams in the GHA logs.
@@ -229,16 +225,22 @@ jobs:
229225
# erroring about invalid credentials instead.
230226
if: github.event_name == 'push' || env.DEPLOY == '1' || env.DEPLOY_ALT == '1'
231227

228+
- name: postprocess metrics into the summary
229+
run: |
230+
if [ -f build/metrics.json ]; then
231+
./build/citool/debug/citool postprocess-metrics build/metrics.json ${GITHUB_STEP_SUMMARY}
232+
elif [ -f obj/build/metrics.json ]; then
233+
./build/citool/debug/citool postprocess-metrics obj/build/metrics.json ${GITHUB_STEP_SUMMARY}
234+
else
235+
echo "No metrics.json found"
236+
fi
237+
232238
- name: upload job metrics to DataDog
233239
if: needs.calculate_matrix.outputs.run_type != 'pr'
234240
env:
235-
DATADOG_SITE: datadoghq.com
236241
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }}
237242
DD_GITHUB_JOB_NAME: ${{ matrix.full_name }}
238-
run: |
239-
cd src/ci
240-
npm ci
241-
python3 scripts/upload-build-metrics.py ../../build/cpu-usage.csv
243+
run: ./build/citool/debug/citool upload-build-metrics build/cpu-usage.csv
242244

243245
# This job isused to tell bors the final status of the build, as there is no practical way to detect
244246
# when a workflow is successful listening to webhooks only in our current bors implementation (homu).

.mailmap

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,9 @@ James Hinshelwood <jameshinshelwood1@gmail.com> <james.hinshelwood@bigpayme.com>
292292
James Miller <bladeon@gmail.com> <james@aatch.net>
293293
James Perry <james.austin.perry@gmail.com>
294294
James Sanderson <zofrex@gmail.com>
295+
Jana Dönszelmann <jana@donsz.nl>
296+
Jana Dönszelmann <jana@donsz.nl> <jonathan@donsz.nl>
297+
Jana Dönszelmann <jana@donsz.nl> <jonabent@gmail.com>
295298
Jan-Erik Rediger <janerik@fnordig.de> <badboy@archlinux.us>
296299
Jaro Fietz <jaro.fietz@gmx.de>
297300
Jason Fager <jfager@gmail.com>

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ For submodules, changes need to be made against the repository corresponding the
1818
submodule, and not the main `rust-lang/rust` repository.
1919

2020
For subtrees, prefer sending a PR against the subtree's repository if it does
21-
not need to be made against the main `rust-lang/rust` repostory (e.g. a
21+
not need to be made against the main `rust-lang/rust` repository (e.g. a
2222
rustc-dev-guide change that does not accompany a compiler change).
2323

2424
## About the [rustc-dev-guide]

INSTALL.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,13 @@ itself back on after some time).
210210

211211
### MSVC
212212

213-
MSVC builds of Rust additionally require an installation of Visual Studio 2017
214-
(or later) so `rustc` can use its linker. The simplest way is to get
215-
[Visual Studio], check the "C++ build tools" and "Windows 10 SDK" workload.
213+
MSVC builds of Rust additionally requires an installation of:
214+
215+
- Visual Studio 2022 (or later) build tools so `rustc` can use its linker. Older
216+
Visual Studio versions such as 2019 *may* work but aren't actively tested.
217+
- A recent Windows 10 or 11 SDK.
218+
219+
The simplest way is to get [Visual Studio], check the "C++ build tools".
216220

217221
[Visual Studio]: https://visualstudio.microsoft.com/downloads/
218222

compiler/rustc_abi/src/extern_abi.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,17 @@ impl StableOrd for ExternAbi {
191191
}
192192

193193
impl ExternAbi {
194+
/// An ABI "like Rust"
195+
///
196+
/// These ABIs are fully controlled by the Rust compiler, which means they
197+
/// - support unwinding with `-Cpanic=unwind`, unlike `extern "C"`
198+
/// - often diverge from the C ABI
199+
/// - are subject to change between compiler versions
200+
pub fn is_rustic_abi(self) -> bool {
201+
use ExternAbi::*;
202+
matches!(self, Rust | RustCall | RustIntrinsic | RustCold)
203+
}
204+
194205
pub fn supports_varargs(self) -> bool {
195206
// * C and Cdecl obviously support varargs.
196207
// * C can be based on Aapcs, SysV64 or Win64, so they must support varargs.

compiler/rustc_ast/src/ast.rs

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,19 @@ impl Path {
124124
self.segments.first().is_some_and(|segment| segment.ident.name == kw::PathRoot)
125125
}
126126

127-
/// If this path is a single identifier with no arguments, does not ensure
128-
/// that the path resolves to a const param, the caller should check this.
129-
pub fn is_potential_trivial_const_arg(&self) -> bool {
130-
matches!(self.segments[..], [PathSegment { args: None, .. }])
127+
/// Check if this path is potentially a trivial const arg, i.e., one that can _potentially_
128+
/// be represented without an anon const in the HIR.
129+
///
130+
/// If `allow_mgca_arg` is true (as should be the case in most situations when
131+
/// `#![feature(min_generic_const_args)]` is enabled), then this always returns true
132+
/// because all paths are valid.
133+
///
134+
/// Otherwise, it returns true iff the path has exactly one segment, and it has no generic args
135+
/// (i.e., it is _potentially_ a const parameter).
136+
#[tracing::instrument(level = "debug", ret)]
137+
pub fn is_potential_trivial_const_arg(&self, allow_mgca_arg: bool) -> bool {
138+
allow_mgca_arg
139+
|| self.segments.len() == 1 && self.segments.iter().all(|seg| seg.args.is_none())
131140
}
132141
}
133142

@@ -417,9 +426,11 @@ impl WhereClause {
417426
/// A single predicate in a where-clause.
418427
#[derive(Clone, Encodable, Decodable, Debug)]
419428
pub struct WherePredicate {
429+
pub attrs: AttrVec,
420430
pub kind: WherePredicateKind,
421431
pub id: NodeId,
422432
pub span: Span,
433+
pub is_placeholder: bool,
423434
}
424435

425436
/// Predicate kind in where-clause.
@@ -1206,22 +1217,31 @@ pub struct Expr {
12061217
}
12071218

12081219
impl Expr {
1209-
/// Could this expr be either `N`, or `{ N }`, where `N` is a const parameter.
1220+
/// Check if this expression is potentially a trivial const arg, i.e., one that can _potentially_
1221+
/// be represented without an anon const in the HIR.
1222+
///
1223+
/// This will unwrap at most one block level (curly braces). After that, if the expression
1224+
/// is a path, it mostly dispatches to [`Path::is_potential_trivial_const_arg`].
1225+
/// See there for more info about `allow_mgca_arg`.
12101226
///
1211-
/// If this is not the case, name resolution does not resolve `N` when using
1212-
/// `min_const_generics` as more complex expressions are not supported.
1227+
/// The only additional thing to note is that when `allow_mgca_arg` is false, this function
1228+
/// will only allow paths with no qself, before dispatching to the `Path` function of
1229+
/// the same name.
12131230
///
1214-
/// Does not ensure that the path resolves to a const param, the caller should check this.
1231+
/// Does not ensure that the path resolves to a const param/item, the caller should check this.
12151232
/// This also does not consider macros, so it's only correct after macro-expansion.
1216-
pub fn is_potential_trivial_const_arg(&self) -> bool {
1233+
pub fn is_potential_trivial_const_arg(&self, allow_mgca_arg: bool) -> bool {
12171234
let this = self.maybe_unwrap_block();
1218-
1219-
if let ExprKind::Path(None, path) = &this.kind
1220-
&& path.is_potential_trivial_const_arg()
1221-
{
1222-
true
1235+
if allow_mgca_arg {
1236+
matches!(this.kind, ExprKind::Path(..))
12231237
} else {
1224-
false
1238+
if let ExprKind::Path(None, path) = &this.kind
1239+
&& path.is_potential_trivial_const_arg(allow_mgca_arg)
1240+
{
1241+
true
1242+
} else {
1243+
false
1244+
}
12251245
}
12261246
}
12271247

compiler/rustc_ast/src/ast_traits.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use crate::tokenstream::LazyAttrTokenStream;
1111
use crate::{
1212
Arm, AssocItem, AttrItem, AttrKind, AttrVec, Attribute, Block, Crate, Expr, ExprField,
1313
FieldDef, ForeignItem, GenericParam, Item, NodeId, Param, Pat, PatField, Path, Stmt, StmtKind,
14-
Ty, Variant, Visibility,
14+
Ty, Variant, Visibility, WherePredicate,
1515
};
1616

1717
/// A utility trait to reduce boilerplate.
@@ -79,6 +79,7 @@ impl_has_node_id!(
7979
Stmt,
8080
Ty,
8181
Variant,
82+
WherePredicate,
8283
);
8384

8485
impl<T: AstDeref<Target: HasNodeId>> HasNodeId for T {
@@ -127,7 +128,16 @@ macro_rules! impl_has_tokens_none {
127128
}
128129

129130
impl_has_tokens!(AssocItem, AttrItem, Block, Expr, ForeignItem, Item, Pat, Path, Ty, Visibility);
130-
impl_has_tokens_none!(Arm, ExprField, FieldDef, GenericParam, Param, PatField, Variant);
131+
impl_has_tokens_none!(
132+
Arm,
133+
ExprField,
134+
FieldDef,
135+
GenericParam,
136+
Param,
137+
PatField,
138+
Variant,
139+
WherePredicate
140+
);
131141

132142
impl<T: AstDeref<Target: HasTokens>> HasTokens for T {
133143
fn tokens(&self) -> Option<&LazyAttrTokenStream> {
@@ -279,6 +289,7 @@ impl_has_attrs!(
279289
Param,
280290
PatField,
281291
Variant,
292+
WherePredicate,
282293
);
283294
impl_has_attrs_none!(Attribute, AttrItem, Block, Pat, Path, Ty, Visibility);
284295

compiler/rustc_ast/src/mut_visit.rs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,11 @@ pub trait MutVisitor: Sized {
338338
walk_where_clause(self, where_clause);
339339
}
340340

341-
fn visit_where_predicate(&mut self, where_predicate: &mut WherePredicate) {
342-
walk_where_predicate(self, where_predicate)
341+
fn flat_map_where_predicate(
342+
&mut self,
343+
where_predicate: WherePredicate,
344+
) -> SmallVec<[WherePredicate; 1]> {
345+
walk_flat_map_where_predicate(self, where_predicate)
343346
}
344347

345348
fn visit_where_predicate_kind(&mut self, kind: &mut WherePredicateKind) {
@@ -1097,15 +1100,20 @@ fn walk_ty_alias_where_clauses<T: MutVisitor>(vis: &mut T, tawcs: &mut TyAliasWh
10971100

10981101
fn walk_where_clause<T: MutVisitor>(vis: &mut T, wc: &mut WhereClause) {
10991102
let WhereClause { has_where_token: _, predicates, span } = wc;
1100-
visit_thin_vec(predicates, |predicate| vis.visit_where_predicate(predicate));
1103+
predicates.flat_map_in_place(|predicate| vis.flat_map_where_predicate(predicate));
11011104
vis.visit_span(span);
11021105
}
11031106

1104-
pub fn walk_where_predicate<T: MutVisitor>(vis: &mut T, pred: &mut WherePredicate) {
1105-
let WherePredicate { kind, id, span } = pred;
1107+
pub fn walk_flat_map_where_predicate<T: MutVisitor>(
1108+
vis: &mut T,
1109+
mut pred: WherePredicate,
1110+
) -> SmallVec<[WherePredicate; 1]> {
1111+
let WherePredicate { attrs, kind, id, span, is_placeholder: _ } = &mut pred;
11061112
vis.visit_id(id);
1113+
visit_attrs(vis, attrs);
11071114
vis.visit_where_predicate_kind(kind);
11081115
vis.visit_span(span);
1116+
smallvec![pred]
11091117
}
11101118

11111119
pub fn walk_where_predicate_kind<T: MutVisitor>(vis: &mut T, kind: &mut WherePredicateKind) {

0 commit comments

Comments
 (0)