Skip to content

Commit 49a99cb

Browse files
authored
Merge pull request #4360 from rust-lang/rustup-2025-05-31
Automatic Rustup
2 parents 8c0f859 + 449ec7b commit 49a99cb

File tree

206 files changed

+3621
-2184
lines changed

Some content is hidden

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

206 files changed

+3621
-2184
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ concurrency:
3434
# For a given workflow, if we push to the same branch, cancel all previous builds on that branch.
3535
# We add an exception for try builds (try branch) and unrolled rollup builds (try-perf), which
3636
# are all triggered on the same branch, but which should be able to run concurrently.
37-
group: ${{ github.workflow }}-${{ ((github.ref == 'refs/heads/try' || github.ref == 'refs/heads/try-perf') && github.sha) || github.ref }}
37+
group: ${{ github.workflow }}-${{ ((github.ref == 'refs/heads/try' || github.ref == 'refs/heads/try-perf' || github.ref == 'refs/heads/automation/bors/try') && github.sha) || github.ref }}
3838
cancel-in-progress: true
3939
env:
4040
TOOLSTATE_REPO: "https://github.com/rust-lang-nursery/rust-toolstate"
@@ -46,7 +46,7 @@ jobs:
4646
# If you want to modify CI jobs, take a look at src/ci/github-actions/jobs.yml.
4747
calculate_matrix:
4848
name: Calculate job matrix
49-
runs-on: ubuntu-24.04
49+
runs-on: ubuntu-24.04-arm
5050
outputs:
5151
jobs: ${{ steps.jobs.outputs.jobs }}
5252
run_type: ${{ steps.jobs.outputs.run_type }}
@@ -80,7 +80,7 @@ jobs:
8080
# access the environment.
8181
#
8282
# We only enable the environment for the rust-lang/rust repository, so that CI works on forks.
83-
environment: ${{ ((github.repository == 'rust-lang/rust' && (github.ref == 'refs/heads/try' || github.ref == 'refs/heads/try-perf' || github.ref == 'refs/heads/auto')) && 'bors') || '' }}
83+
environment: ${{ ((github.repository == 'rust-lang/rust' && (github.ref == 'refs/heads/try' || github.ref == 'refs/heads/try-perf' || github.ref == 'refs/heads/automation/bors/try' || github.ref == 'refs/heads/auto')) && 'bors') || '' }}
8484
env:
8585
CI_JOB_NAME: ${{ matrix.name }}
8686
CI_JOB_DOC_URL: ${{ matrix.doc_url }}

Cargo.lock

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2171,6 +2171,7 @@ dependencies = [
21712171
name = "lint-docs"
21722172
version = "0.1.0"
21732173
dependencies = [
2174+
"rustc-literal-escaper",
21742175
"serde_json",
21752176
"tempfile",
21762177
"walkdir",
@@ -3445,6 +3446,7 @@ dependencies = [
34453446
"rustc_macros",
34463447
"rustc_parse",
34473448
"rustc_parse_format",
3449+
"rustc_proc_macro",
34483450
"rustc_session",
34493451
"rustc_span",
34503452
"rustc_target",
@@ -3734,6 +3736,7 @@ dependencies = [
37343736
"rustc_lint_defs",
37353737
"rustc_macros",
37363738
"rustc_parse",
3739+
"rustc_proc_macro",
37373740
"rustc_serialize",
37383741
"rustc_session",
37393742
"rustc_span",
@@ -4082,6 +4085,7 @@ dependencies = [
40824085
"rustc_index",
40834086
"rustc_macros",
40844087
"rustc_middle",
4088+
"rustc_proc_macro",
40854089
"rustc_serialize",
40864090
"rustc_session",
40874091
"rustc_span",
@@ -4338,6 +4342,13 @@ dependencies = [
43384342
"tracing",
43394343
]
43404344

4345+
[[package]]
4346+
name = "rustc_proc_macro"
4347+
version = "0.0.0"
4348+
dependencies = [
4349+
"rustc-literal-escaper",
4350+
]
4351+
43414352
[[package]]
43424353
name = "rustc_query_impl"
43434354
version = "0.0.0"

compiler/rustc_ast/src/ast.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ use rustc_data_structures::tagged_ptr::Tag;
3232
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
3333
pub use rustc_span::AttrId;
3434
use rustc_span::source_map::{Spanned, respan};
35-
use rustc_span::{ErrorGuaranteed, Ident, Span, Symbol, kw, sym};
35+
use rustc_span::{DUMMY_SP, ErrorGuaranteed, Ident, Span, Symbol, kw, sym};
3636
use thin_vec::{ThinVec, thin_vec};
3737

3838
pub use crate::format::*;
@@ -1526,6 +1526,19 @@ impl Expr {
15261526
| ExprKind::Struct(_)
15271527
)
15281528
}
1529+
1530+
/// Creates a dummy `P<Expr>`.
1531+
///
1532+
/// Should only be used when it will be replaced afterwards or as a return value when an error was encountered.
1533+
pub fn dummy() -> P<Expr> {
1534+
P(Expr {
1535+
id: DUMMY_NODE_ID,
1536+
kind: ExprKind::Dummy,
1537+
span: DUMMY_SP,
1538+
attrs: ThinVec::new(),
1539+
tokens: None,
1540+
})
1541+
}
15291542
}
15301543

15311544
#[derive(Clone, Encodable, Decodable, Debug)]

compiler/rustc_ast/src/ast_traits.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,7 @@ impl HasAttrs for Stmt {
304304
}
305305

306306
/// A newtype around an AST node that implements the traits above if the node implements them.
307+
#[repr(transparent)]
307308
pub struct AstNodeWrapper<Wrapped, Tag> {
308309
pub wrapped: Wrapped,
309310
pub tag: PhantomData<Tag>,
@@ -313,6 +314,11 @@ impl<Wrapped, Tag> AstNodeWrapper<Wrapped, Tag> {
313314
pub fn new(wrapped: Wrapped, _tag: Tag) -> AstNodeWrapper<Wrapped, Tag> {
314315
AstNodeWrapper { wrapped, tag: Default::default() }
315316
}
317+
318+
pub fn from_mut(wrapped: &mut Wrapped, _tag: Tag) -> &mut AstNodeWrapper<Wrapped, Tag> {
319+
// SAFETY: `AstNodeWrapper` is `repr(transparent)` w.r.t `Wrapped`
320+
unsafe { &mut *<*mut Wrapped>::cast(wrapped) }
321+
}
316322
}
317323

318324
impl<Wrapped: HasNodeId, Tag> HasNodeId for AstNodeWrapper<Wrapped, Tag> {

compiler/rustc_ast/src/mut_visit.rs

Lines changed: 22 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,15 @@ pub trait MutVisitor: Sized {
7777
walk_use_tree(self, use_tree);
7878
}
7979

80-
fn visit_foreign_item(&mut self, ni: &mut P<ForeignItem>) {
80+
fn visit_foreign_item(&mut self, ni: &mut ForeignItem) {
8181
walk_item(self, ni);
8282
}
8383

8484
fn flat_map_foreign_item(&mut self, ni: P<ForeignItem>) -> SmallVec<[P<ForeignItem>; 1]> {
8585
walk_flat_map_foreign_item(self, ni)
8686
}
8787

88-
fn visit_item(&mut self, i: &mut P<Item>) {
88+
fn visit_item(&mut self, i: &mut Item) {
8989
walk_item(self, i);
9090
}
9191

@@ -105,7 +105,7 @@ pub trait MutVisitor: Sized {
105105
walk_flat_map_field_def(self, fd)
106106
}
107107

108-
fn visit_assoc_item(&mut self, i: &mut P<AssocItem>, ctxt: AssocCtxt) {
108+
fn visit_assoc_item(&mut self, i: &mut AssocItem, ctxt: AssocCtxt) {
109109
walk_assoc_item(self, i, ctxt)
110110
}
111111

@@ -117,11 +117,11 @@ pub trait MutVisitor: Sized {
117117
walk_flat_map_assoc_item(self, i, ctxt)
118118
}
119119

120-
fn visit_contract(&mut self, c: &mut P<FnContract>) {
120+
fn visit_contract(&mut self, c: &mut FnContract) {
121121
walk_contract(self, c);
122122
}
123123

124-
fn visit_fn_decl(&mut self, d: &mut P<FnDecl>) {
124+
fn visit_fn_decl(&mut self, d: &mut FnDecl) {
125125
walk_fn_decl(self, d);
126126
}
127127

@@ -138,7 +138,7 @@ pub trait MutVisitor: Sized {
138138
walk_closure_binder(self, b);
139139
}
140140

141-
fn visit_block(&mut self, b: &mut P<Block>) {
141+
fn visit_block(&mut self, b: &mut Block) {
142142
walk_block(self, b);
143143
}
144144

@@ -184,7 +184,7 @@ pub trait MutVisitor: Sized {
184184
walk_ty(self, t);
185185
}
186186

187-
fn visit_ty_pat(&mut self, t: &mut P<TyPat>) {
187+
fn visit_ty_pat(&mut self, t: &mut TyPat) {
188188
walk_ty_pat(self, t);
189189
}
190190

@@ -240,7 +240,7 @@ pub trait MutVisitor: Sized {
240240
walk_parenthesized_parameter_data(self, p);
241241
}
242242

243-
fn visit_local(&mut self, l: &mut P<Local>) {
243+
fn visit_local(&mut self, l: &mut Local) {
244244
walk_local(self, l);
245245
}
246246

@@ -368,14 +368,6 @@ pub trait MutVisitor: Sized {
368368

369369
super::common_visitor_and_walkers!((mut) MutVisitor);
370370

371-
/// Use a map-style function (`FnOnce(T) -> T`) to overwrite a `&mut T`. Useful
372-
/// when using a `flat_map_*` or `filter_map_*` method within a `visit_`
373-
/// method.
374-
pub fn visit_clobber<T: DummyAstNode>(t: &mut T, f: impl FnOnce(T) -> T) {
375-
let old_t = std::mem::replace(t, T::dummy());
376-
*t = f(old_t);
377-
}
378-
379371
#[inline]
380372
fn visit_vec<T, F>(elems: &mut Vec<T>, mut visit_elem: F)
381373
where
@@ -507,8 +499,8 @@ fn walk_assoc_item_constraint<T: MutVisitor>(
507499
vis.visit_span(span);
508500
}
509501

510-
pub fn walk_ty<T: MutVisitor>(vis: &mut T, ty: &mut P<Ty>) {
511-
let Ty { id, kind, span, tokens: _ } = ty.deref_mut();
502+
pub fn walk_ty<T: MutVisitor>(vis: &mut T, ty: &mut Ty) {
503+
let Ty { id, kind, span, tokens: _ } = ty;
512504
vis.visit_id(id);
513505
match kind {
514506
TyKind::Err(_guar) => {}
@@ -559,8 +551,8 @@ pub fn walk_ty<T: MutVisitor>(vis: &mut T, ty: &mut P<Ty>) {
559551
vis.visit_span(span);
560552
}
561553

562-
pub fn walk_ty_pat<T: MutVisitor>(vis: &mut T, ty: &mut P<TyPat>) {
563-
let TyPat { id, kind, span, tokens: _ } = ty.deref_mut();
554+
pub fn walk_ty_pat<T: MutVisitor>(vis: &mut T, ty: &mut TyPat) {
555+
let TyPat { id, kind, span, tokens: _ } = ty;
564556
vis.visit_id(id);
565557
match kind {
566558
TyPatKind::Range(start, end, _include_end) => {
@@ -651,8 +643,8 @@ fn walk_parenthesized_parameter_data<T: MutVisitor>(vis: &mut T, args: &mut Pare
651643
vis.visit_span(inputs_span);
652644
}
653645

654-
fn walk_local<T: MutVisitor>(vis: &mut T, local: &mut P<Local>) {
655-
let Local { id, super_, pat, ty, kind, span, colon_sp, attrs, tokens: _ } = local.deref_mut();
646+
fn walk_local<T: MutVisitor>(vis: &mut T, local: &mut Local) {
647+
let Local { id, super_, pat, ty, kind, span, colon_sp, attrs, tokens: _ } = local;
656648
visit_opt(super_, |sp| vis.visit_span(sp));
657649
vis.visit_id(id);
658650
visit_attrs(vis, attrs);
@@ -789,8 +781,8 @@ fn walk_fn<T: MutVisitor>(vis: &mut T, kind: FnKind<'_>) {
789781
}
790782
}
791783

792-
fn walk_contract<T: MutVisitor>(vis: &mut T, contract: &mut P<FnContract>) {
793-
let FnContract { requires, ensures } = contract.deref_mut();
784+
fn walk_contract<T: MutVisitor>(vis: &mut T, contract: &mut FnContract) {
785+
let FnContract { requires, ensures } = contract;
794786
if let Some(pred) = requires {
795787
vis.visit_expr(pred);
796788
}
@@ -799,8 +791,8 @@ fn walk_contract<T: MutVisitor>(vis: &mut T, contract: &mut P<FnContract>) {
799791
}
800792
}
801793

802-
fn walk_fn_decl<T: MutVisitor>(vis: &mut T, decl: &mut P<FnDecl>) {
803-
let FnDecl { inputs, output } = decl.deref_mut();
794+
fn walk_fn_decl<T: MutVisitor>(vis: &mut T, decl: &mut FnDecl) {
795+
let FnDecl { inputs, output } = decl;
804796
inputs.flat_map_in_place(|param| vis.flat_map_param(param));
805797
vis.visit_fn_ret_ty(output);
806798
}
@@ -999,8 +991,8 @@ pub fn walk_flat_map_expr_field<T: MutVisitor>(
999991
smallvec![f]
1000992
}
1001993

1002-
pub fn walk_block<T: MutVisitor>(vis: &mut T, block: &mut P<Block>) {
1003-
let Block { id, stmts, rules: _, span, tokens: _ } = block.deref_mut();
994+
pub fn walk_block<T: MutVisitor>(vis: &mut T, block: &mut Block) {
995+
let Block { id, stmts, rules: _, span, tokens: _ } = block;
1004996
vis.visit_id(id);
1005997
stmts.flat_map_in_place(|stmt| vis.flat_map_stmt(stmt));
1006998
vis.visit_span(span);
@@ -1049,8 +1041,8 @@ pub fn walk_flat_map_assoc_item(
10491041
smallvec![item]
10501042
}
10511043

1052-
pub fn walk_pat<T: MutVisitor>(vis: &mut T, pat: &mut P<Pat>) {
1053-
let Pat { id, kind, span, tokens: _ } = pat.deref_mut();
1044+
pub fn walk_pat<T: MutVisitor>(vis: &mut T, pat: &mut Pat) {
1045+
let Pat { id, kind, span, tokens: _ } = pat;
10541046
vis.visit_id(id);
10551047
match kind {
10561048
PatKind::Err(_guar) => {}
@@ -1417,101 +1409,6 @@ fn walk_capture_by<T: MutVisitor>(vis: &mut T, capture_by: &mut CaptureBy) {
14171409
}
14181410
}
14191411

1420-
/// Some value for the AST node that is valid but possibly meaningless. Similar
1421-
/// to `Default` but not intended for wide use. The value will never be used
1422-
/// meaningfully, it exists just to support unwinding in `visit_clobber` in the
1423-
/// case where its closure panics.
1424-
pub trait DummyAstNode {
1425-
fn dummy() -> Self;
1426-
}
1427-
1428-
impl<T> DummyAstNode for Option<T> {
1429-
fn dummy() -> Self {
1430-
Default::default()
1431-
}
1432-
}
1433-
1434-
impl<T: DummyAstNode + 'static> DummyAstNode for P<T> {
1435-
fn dummy() -> Self {
1436-
P(DummyAstNode::dummy())
1437-
}
1438-
}
1439-
1440-
impl DummyAstNode for Item {
1441-
fn dummy() -> Self {
1442-
Item {
1443-
attrs: Default::default(),
1444-
id: DUMMY_NODE_ID,
1445-
span: Default::default(),
1446-
vis: Visibility {
1447-
kind: VisibilityKind::Public,
1448-
span: Default::default(),
1449-
tokens: Default::default(),
1450-
},
1451-
kind: ItemKind::ExternCrate(None, Ident::dummy()),
1452-
tokens: Default::default(),
1453-
}
1454-
}
1455-
}
1456-
1457-
impl DummyAstNode for Expr {
1458-
fn dummy() -> Self {
1459-
Expr {
1460-
id: DUMMY_NODE_ID,
1461-
kind: ExprKind::Dummy,
1462-
span: Default::default(),
1463-
attrs: Default::default(),
1464-
tokens: Default::default(),
1465-
}
1466-
}
1467-
}
1468-
1469-
impl DummyAstNode for Ty {
1470-
fn dummy() -> Self {
1471-
Ty {
1472-
id: DUMMY_NODE_ID,
1473-
kind: TyKind::Dummy,
1474-
span: Default::default(),
1475-
tokens: Default::default(),
1476-
}
1477-
}
1478-
}
1479-
1480-
impl DummyAstNode for Pat {
1481-
fn dummy() -> Self {
1482-
Pat {
1483-
id: DUMMY_NODE_ID,
1484-
kind: PatKind::Wild,
1485-
span: Default::default(),
1486-
tokens: Default::default(),
1487-
}
1488-
}
1489-
}
1490-
1491-
impl DummyAstNode for Stmt {
1492-
fn dummy() -> Self {
1493-
Stmt { id: DUMMY_NODE_ID, kind: StmtKind::Empty, span: Default::default() }
1494-
}
1495-
}
1496-
1497-
impl DummyAstNode for Crate {
1498-
fn dummy() -> Self {
1499-
Crate {
1500-
attrs: Default::default(),
1501-
items: Default::default(),
1502-
spans: Default::default(),
1503-
id: DUMMY_NODE_ID,
1504-
is_placeholder: Default::default(),
1505-
}
1506-
}
1507-
}
1508-
1509-
impl<N: DummyAstNode, T: DummyAstNode> DummyAstNode for crate::ast_traits::AstNodeWrapper<N, T> {
1510-
fn dummy() -> Self {
1511-
crate::ast_traits::AstNodeWrapper::new(N::dummy(), T::dummy())
1512-
}
1513-
}
1514-
15151412
#[derive(Debug)]
15161413
pub enum FnKind<'a> {
15171414
/// E.g., `fn foo()`, `fn foo(&self)`, or `extern "Abi" fn foo()`.

0 commit comments

Comments
 (0)