From 6f958ac88fbf83a1b45d2eff59aedf681b4f6723 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Tue, 10 Jun 2025 20:09:06 +0200 Subject: [PATCH 01/13] Remove unneeded `check_id` calls as they are already called in `visit_id` in `EarlyContextAndPass` type --- compiler/rustc_lint/src/early.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/compiler/rustc_lint/src/early.rs b/compiler/rustc_lint/src/early.rs index 4978f293ab72a..12666d383f933 100644 --- a/compiler/rustc_lint/src/early.rs +++ b/compiler/rustc_lint/src/early.rs @@ -136,7 +136,6 @@ impl<'ast, 'ecx, 'tcx, T: EarlyLintPass> ast_visit::Visitor<'ast> // the AST struct that they wrap (e.g. an item) self.with_lint_attrs(s.id, s.attrs(), |cx| { lint_callback!(cx, check_stmt, s); - cx.check_id(s.id); }); // The visitor for the AST struct wrapped // by the statement (e.g. `Item`) will call @@ -147,7 +146,6 @@ impl<'ast, 'ecx, 'tcx, T: EarlyLintPass> ast_visit::Visitor<'ast> fn visit_fn(&mut self, fk: ast_visit::FnKind<'ast>, span: Span, id: ast::NodeId) { lint_callback!(self, check_fn, fk, span, id); - self.check_id(id); ast_visit::walk_fn(self, fk); } From 296f9f2513b4540631455d8baec3910ea5ba4c1a Mon Sep 17 00:00:00 2001 From: cyrgani Date: Tue, 10 Jun 2025 23:16:07 +0200 Subject: [PATCH 02/13] remove ice group pings from `triagebot.toml` --- triagebot.toml | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/triagebot.toml b/triagebot.toml index 15c56f8861f5f..dbbbffd3e13ec 100644 --- a/triagebot.toml +++ b/triagebot.toml @@ -44,29 +44,6 @@ remove_labels = ["S-waiting-on-author"] # Those labels are added when PR author requests a review from an assignee add_labels = ["S-waiting-on-review"] -[ping.icebreakers-llvm] -message = """\ -Hey LLVM ICE-breakers! This bug has been identified as a good -"LLVM ICE-breaking candidate". In case it's useful, here are some -[instructions] for tackling these sorts of bugs. Maybe take a look? -Thanks! <3 - -[instructions]: https://rustc-dev-guide.rust-lang.org/notification-groups/llvm.html -""" -label = "ICEBreaker-LLVM" - -[ping.icebreakers-cleanup-crew] -alias = ["cleanup", "cleanups", "cleanup-crew", "shrink", "reduce", "bisect"] -message = """\ -Hey Cleanup Crew ICE-breakers! This bug has been identified as a good -"Cleanup ICE-breaking candidate". In case it's useful, here are some -[instructions] for tackling these sorts of bugs. Maybe take a look? -Thanks! <3 - -[instructions]: https://rustc-dev-guide.rust-lang.org/notification-groups/cleanup-crew.html -""" -label = "ICEBreaker-Cleanup-Crew" - [ping.windows] message = """\ Hey Windows Group! This bug has been identified as a good "Windows candidate". From 9dd7c019fe9a31450b08e2639e777a40ae426c64 Mon Sep 17 00:00:00 2001 From: bit-aloo Date: Wed, 11 Jun 2025 13:30:53 +0530 Subject: [PATCH 03/13] add trace_cmd import in tracing feature in execution context --- src/bootstrap/src/utils/execution_context.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/bootstrap/src/utils/execution_context.rs b/src/bootstrap/src/utils/execution_context.rs index d12c02c161dfa..a5e1e9bcc07df 100644 --- a/src/bootstrap/src/utils/execution_context.rs +++ b/src/bootstrap/src/utils/execution_context.rs @@ -6,6 +6,8 @@ use std::sync::{Arc, Mutex}; use crate::core::config::DryRun; +#[cfg(feature = "tracing")] +use crate::trace_cmd; use crate::{BehaviorOnFailure, BootstrapCommand, CommandOutput, OutputMode, exit}; #[derive(Clone, Default)] From 103d668e697bc0b76eacc446968f989e9193c5a3 Mon Sep 17 00:00:00 2001 From: onur-ozkan Date: Wed, 11 Jun 2025 11:02:52 +0300 Subject: [PATCH 04/13] remove myself from the project Signed-off-by: onur-ozkan --- triagebot.toml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/triagebot.toml b/triagebot.toml index 15c56f8861f5f..3bb3dd268aafe 100644 --- a/triagebot.toml +++ b/triagebot.toml @@ -1231,7 +1231,6 @@ libs = [ bootstrap = [ "@Mark-Simulacrum", "@albertlarsan68", - "@onur-ozkan", "@kobzol", "@jieyouxu", "@clubby789", @@ -1424,8 +1423,8 @@ compiletest = [ "/src/tools/rustdoc-themes" = ["rustdoc"] "/src/tools/tidy" = ["bootstrap"] "/src/tools/x" = ["bootstrap"] -"/src/tools/rustdoc-gui-test" = ["bootstrap", "@onur-ozkan"] -"/src/tools/libcxx-version" = ["@onur-ozkan"] +"/src/tools/rustdoc-gui-test" = ["bootstrap"] +"/src/tools/libcxx-version" = ["bootstrap"] # Enable review queue tracking # Documentation at: https://forge.rust-lang.org/triagebot/review-queue-tracking.html From 052a7c56188030effb7c9fd34524cd65a5849fb4 Mon Sep 17 00:00:00 2001 From: bit-aloo Date: Wed, 11 Jun 2025 13:31:41 +0530 Subject: [PATCH 05/13] add tracing flag in bootstrap check cmd in mingw-check-2 ci workflow --- src/ci/docker/host-x86_64/mingw-check-2/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ci/docker/host-x86_64/mingw-check-2/Dockerfile b/src/ci/docker/host-x86_64/mingw-check-2/Dockerfile index a1d04bd984c6e..2aeb26153c2d6 100644 --- a/src/ci/docker/host-x86_64/mingw-check-2/Dockerfile +++ b/src/ci/docker/host-x86_64/mingw-check-2/Dockerfile @@ -27,7 +27,7 @@ COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh ENV SCRIPT \ - python3 ../x.py check && \ + BOOTSTRAP_TRACING=bootstrap=TRACE python3 ../x.py check && \ python3 ../x.py clippy ci && \ python3 ../x.py test --stage 1 core alloc std test proc_macro && \ python3 ../x.py doc --stage 0 bootstrap && \ From 8c236ab51e9d0df6501a59a1bf8e680dd05bf8ec Mon Sep 17 00:00:00 2001 From: bit-aloo Date: Wed, 11 Jun 2025 13:48:50 +0530 Subject: [PATCH 06/13] add comment over ci change --- src/ci/docker/host-x86_64/mingw-check-2/Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ci/docker/host-x86_64/mingw-check-2/Dockerfile b/src/ci/docker/host-x86_64/mingw-check-2/Dockerfile index 2aeb26153c2d6..cd61d1d752d92 100644 --- a/src/ci/docker/host-x86_64/mingw-check-2/Dockerfile +++ b/src/ci/docker/host-x86_64/mingw-check-2/Dockerfile @@ -27,7 +27,9 @@ COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh ENV SCRIPT \ - BOOTSTRAP_TRACING=bootstrap=TRACE python3 ../x.py check && \ + # The BOOTSTRAP_TRACING flag is added to verify whether the + # bootstrap process compiles successfully with this flag enabled. + BOOTSTRAP_TRACING=1 python3 ../x.py check && \ python3 ../x.py clippy ci && \ python3 ../x.py test --stage 1 core alloc std test proc_macro && \ python3 ../x.py doc --stage 0 bootstrap && \ From cd04717899c3266ca0f1a8af8829ff6187a2266c Mon Sep 17 00:00:00 2001 From: Stypox Date: Wed, 11 Jun 2025 12:22:20 +0200 Subject: [PATCH 07/13] Fix enter_trace_span!() using wrong $crate paths --- compiler/rustc_const_eval/src/interpret/util.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_const_eval/src/interpret/util.rs b/compiler/rustc_const_eval/src/interpret/util.rs index 83a170926191b..99add01f95c60 100644 --- a/compiler/rustc_const_eval/src/interpret/util.rs +++ b/compiler/rustc_const_eval/src/interpret/util.rs @@ -58,9 +58,9 @@ pub enum MaybeEnteredSpan { macro_rules! enter_trace_span { ($machine:ident, $($tt:tt)*) => { if $machine::TRACING_ENABLED { - $crate::interpret::tracing_utils::MaybeEnteredSpan::Some(tracing::info_span!($($tt)*).entered()) + $crate::interpret::util::MaybeEnteredSpan::Some(tracing::info_span!($($tt)*).entered()) } else { - $crate::interpret::tracing_utils::MaybeEnteredSpan::None + $crate::interpret::util::MaybeEnteredSpan::None } } } From d4d90ca3d26f9f620a55561e31f3ee3923efe190 Mon Sep 17 00:00:00 2001 From: bit-aloo Date: Wed, 11 Jun 2025 16:01:40 +0530 Subject: [PATCH 08/13] put flag check at the end of command chain in mingw-check-2 --- src/ci/docker/host-x86_64/mingw-check-2/Dockerfile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/ci/docker/host-x86_64/mingw-check-2/Dockerfile b/src/ci/docker/host-x86_64/mingw-check-2/Dockerfile index cd61d1d752d92..ce18a181d313d 100644 --- a/src/ci/docker/host-x86_64/mingw-check-2/Dockerfile +++ b/src/ci/docker/host-x86_64/mingw-check-2/Dockerfile @@ -27,9 +27,7 @@ COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh ENV SCRIPT \ - # The BOOTSTRAP_TRACING flag is added to verify whether the - # bootstrap process compiles successfully with this flag enabled. - BOOTSTRAP_TRACING=1 python3 ../x.py check && \ + python3 ../x.py check && \ python3 ../x.py clippy ci && \ python3 ../x.py test --stage 1 core alloc std test proc_macro && \ python3 ../x.py doc --stage 0 bootstrap && \ @@ -38,4 +36,7 @@ ENV SCRIPT \ RUSTDOCFLAGS=\"--document-private-items --document-hidden-items\" python3 ../x.py doc --stage 1 library && \ mkdir -p /checkout/obj/staging/doc && \ cp -r build/x86_64-unknown-linux-gnu/doc /checkout/obj/staging && \ - RUSTDOCFLAGS=\"--document-private-items --document-hidden-items\" python3 ../x.py doc --stage 1 library/test + RUSTDOCFLAGS=\"--document-private-items --document-hidden-items\" python3 ../x.py doc --stage 1 library/test && \ + # The BOOTSTRAP_TRACING flag is added to verify whether the + # bootstrap process compiles successfully with this flag enabled. + BOOTSTRAP_TRACING=1 python3 ../x.py --help From 796ee4ff6cbcad73a21dc94ea715364e426475cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Wed, 11 Jun 2025 14:42:06 +0200 Subject: [PATCH 09/13] Do not warn on `rust.incremental` when using download CI rustc --- src/bootstrap/src/core/config/toml/rust.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/bootstrap/src/core/config/toml/rust.rs b/src/bootstrap/src/core/config/toml/rust.rs index 81f95f356a56b..bb18fa802afeb 100644 --- a/src/bootstrap/src/core/config/toml/rust.rs +++ b/src/bootstrap/src/core/config/toml/rust.rs @@ -321,11 +321,11 @@ pub fn check_incompatible_options_for_ci_rustc( rpath, channel, description, - incremental, default_linker, std_features, // Rest of the options can simply be ignored. + incremental: _, debug: _, codegen_units: _, codegen_units_std: _, @@ -389,7 +389,6 @@ pub fn check_incompatible_options_for_ci_rustc( warn!(current_rust_config.channel, channel, "rust"); warn!(current_rust_config.description, description, "rust"); - warn!(current_rust_config.incremental, incremental, "rust"); Ok(()) } From edc405d383b896c0417ad1ba33558cf1c506af48 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Wed, 11 Jun 2025 14:03:57 +0200 Subject: [PATCH 10/13] Add expectation for `{` when parsing lone coroutine qualifiers --- compiler/rustc_parse/src/parser/expr.rs | 32 +++++++++++-------- .../edition-keywords-2018-2015-parsing.stderr | 8 ++--- .../edition-keywords-2018-2018-parsing.stderr | 16 +++++----- tests/ui/parser/block-no-opening-brace.rs | 4 +-- tests/ui/parser/block-no-opening-brace.stderr | 6 ++-- .../misspelled-keywords/async-move.stderr | 4 +-- 6 files changed, 38 insertions(+), 32 deletions(-) diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index a298c4d4dec0e..93489aa8ee948 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -1520,22 +1520,20 @@ impl<'a> Parser<'a> { Ok(this.mk_expr(this.prev_token.span, ExprKind::Underscore)) } else if this.token_uninterpolated_span().at_least_rust_2018() { // `Span::at_least_rust_2018()` is somewhat expensive; don't get it repeatedly. + let at_async = this.check_keyword(exp!(Async)); + // check for `gen {}` and `gen move {}` + // or `async gen {}` and `async gen move {}` + // FIXME: (async) gen closures aren't yet parsed. + // FIXME(gen_blocks): Parse `gen async` and suggest swap if this.token_uninterpolated_span().at_least_rust_2024() - // check for `gen {}` and `gen move {}` - // or `async gen {}` and `async gen move {}` - && (this.is_gen_block(kw::Gen, 0) - || (this.check_keyword(exp!(Async)) && this.is_gen_block(kw::Gen, 1))) + && this.is_gen_block(kw::Gen, at_async as usize) { - // FIXME: (async) gen closures aren't yet parsed. this.parse_gen_block() - } else if this.check_keyword(exp!(Async)) { - // FIXME(gen_blocks): Parse `gen async` and suggest swap - if this.is_gen_block(kw::Async, 0) { - // Check for `async {` and `async move {`, - this.parse_gen_block() - } else { - this.parse_expr_closure() - } + // Check for `async {` and `async move {`, + } else if this.is_gen_block(kw::Async, 0) { + this.parse_gen_block() + } else if at_async { + this.parse_expr_closure() } else if this.eat_keyword_noexpect(kw::Await) { this.recover_incorrect_await_syntax(lo) } else { @@ -2407,6 +2405,14 @@ impl<'a> Parser<'a> { None }; + if let ClosureBinder::NotPresent = binder + && coroutine_kind.is_some() + { + // coroutine closures and generators can have the same qualifiers, so we might end up + // in here if there is a missing `|` but also no `{`. Adjust the expectations in that case. + self.expected_token_types.insert(TokenType::OpenBrace); + } + let capture_clause = self.parse_capture_clause()?; let (fn_decl, fn_arg_span) = self.parse_fn_block_decl()?; let decl_hi = self.prev_token.span; diff --git a/tests/ui/editions/edition-keywords-2018-2015-parsing.stderr b/tests/ui/editions/edition-keywords-2018-2015-parsing.stderr index 152a6f3a41e64..34f5c7d30842d 100644 --- a/tests/ui/editions/edition-keywords-2018-2015-parsing.stderr +++ b/tests/ui/editions/edition-keywords-2018-2015-parsing.stderr @@ -44,22 +44,22 @@ note: while trying to match `r#async` LL | (r#async) => (1) | ^^^^^^^ -error: macro expansion ends with an incomplete expression: expected one of `move`, `use`, `|`, or `||` +error: macro expansion ends with an incomplete expression: expected one of `move`, `use`, `{`, `|`, or `||` --> $DIR/auxiliary/edition-kw-macro-2015.rs:27:23 | LL | ($i: ident) => ($i) - | ^ expected one of `move`, `use`, `|`, or `||` + | ^ expected one of `move`, `use`, `{`, `|`, or `||` | ::: $DIR/edition-keywords-2018-2015-parsing.rs:22:8 | LL | if passes_ident!(async) == 1 {} // FIXME: Edition hygiene bug, async here is 2018 and reserved | -------------------- in this macro invocation -error: macro expansion ends with an incomplete expression: expected one of `move`, `use`, `|`, or `||` +error: macro expansion ends with an incomplete expression: expected one of `move`, `use`, `{`, `|`, or `||` --> $DIR/edition-keywords-2018-2015-parsing.rs:24:24 | LL | if passes_tt!(async) == 1 {} - | ^ expected one of `move`, `use`, `|`, or `||` + | ^ expected one of `move`, `use`, `{`, `|`, or `||` error[E0308]: mismatched types --> $DIR/edition-keywords-2018-2015-parsing.rs:29:33 diff --git a/tests/ui/editions/edition-keywords-2018-2018-parsing.stderr b/tests/ui/editions/edition-keywords-2018-2018-parsing.stderr index 53f1b827f9c6a..dd3f4938c74b5 100644 --- a/tests/ui/editions/edition-keywords-2018-2018-parsing.stderr +++ b/tests/ui/editions/edition-keywords-2018-2018-parsing.stderr @@ -44,34 +44,34 @@ note: while trying to match `r#async` LL | (r#async) => (1) | ^^^^^^^ -error: macro expansion ends with an incomplete expression: expected one of `move`, `use`, `|`, or `||` +error: macro expansion ends with an incomplete expression: expected one of `move`, `use`, `{`, `|`, or `||` --> $DIR/auxiliary/edition-kw-macro-2018.rs:27:23 | LL | ($i: ident) => ($i) - | ^ expected one of `move`, `use`, `|`, or `||` + | ^ expected one of `move`, `use`, `{`, `|`, or `||` | ::: $DIR/edition-keywords-2018-2018-parsing.rs:29:8 | LL | if passes_ident!(async) == 1 {} // FIXME: Edition hygiene bug, async here is 2018 and reserved | -------------------- in this macro invocation -error: macro expansion ends with an incomplete expression: expected one of `move`, `use`, `|`, or `||` +error: macro expansion ends with an incomplete expression: expected one of `move`, `use`, `{`, `|`, or `||` --> $DIR/edition-keywords-2018-2018-parsing.rs:31:24 | LL | if passes_tt!(async) == 1 {} - | ^ expected one of `move`, `use`, `|`, or `||` + | ^ expected one of `move`, `use`, `{`, `|`, or `||` -error: macro expansion ends with an incomplete expression: expected one of `move`, `use`, `|`, or `||` +error: macro expansion ends with an incomplete expression: expected one of `move`, `use`, `{`, `|`, or `||` --> $DIR/edition-keywords-2018-2018-parsing.rs:14:23 | LL | ($i: ident) => ($i) - | ^ expected one of `move`, `use`, `|`, or `||` + | ^ expected one of `move`, `use`, `{`, `|`, or `||` -error: macro expansion ends with an incomplete expression: expected one of `move`, `use`, `|`, or `||` +error: macro expansion ends with an incomplete expression: expected one of `move`, `use`, `{`, `|`, or `||` --> $DIR/edition-keywords-2018-2018-parsing.rs:35:30 | LL | if local_passes_tt!(async) == 1 {} - | ^ expected one of `move`, `use`, `|`, or `||` + | ^ expected one of `move`, `use`, `{`, `|`, or `||` error[E0308]: mismatched types --> $DIR/edition-keywords-2018-2018-parsing.rs:40:33 diff --git a/tests/ui/parser/block-no-opening-brace.rs b/tests/ui/parser/block-no-opening-brace.rs index b08c830bfc76f..ea5a98ff6fc1e 100644 --- a/tests/ui/parser/block-no-opening-brace.rs +++ b/tests/ui/parser/block-no-opening-brace.rs @@ -27,10 +27,10 @@ fn in_try() { let x = 0; } -// FIXME(#80931) fn in_async() { async - let x = 0; //~ ERROR expected one of `move`, `use`, `|`, or `||`, found keyword `let` + let x = 0; + //~^ ERROR expected one of `move`, `use`, `{`, `|`, or `||`, found keyword `let` } // FIXME(#78168) diff --git a/tests/ui/parser/block-no-opening-brace.stderr b/tests/ui/parser/block-no-opening-brace.stderr index f51ee92626f53..cf9eeba573dc8 100644 --- a/tests/ui/parser/block-no-opening-brace.stderr +++ b/tests/ui/parser/block-no-opening-brace.stderr @@ -43,11 +43,11 @@ error: expected expression, found reserved keyword `try` LL | try | ^^^ expected expression -error: expected one of `move`, `use`, `|`, or `||`, found keyword `let` - --> $DIR/block-no-opening-brace.rs:33:9 +error: expected one of `move`, `use`, `{`, `|`, or `||`, found keyword `let` + --> $DIR/block-no-opening-brace.rs:32:9 | LL | async - | - expected one of `move`, `use`, `|`, or `||` + | - expected one of `move`, `use`, `{`, `|`, or `||` LL | let x = 0; | ^^^ unexpected token diff --git a/tests/ui/parser/misspelled-keywords/async-move.stderr b/tests/ui/parser/misspelled-keywords/async-move.stderr index 2507326fb2854..26449a17f7843 100644 --- a/tests/ui/parser/misspelled-keywords/async-move.stderr +++ b/tests/ui/parser/misspelled-keywords/async-move.stderr @@ -1,8 +1,8 @@ -error: expected one of `move`, `use`, `|`, or `||`, found `Move` +error: expected one of `move`, `use`, `{`, `|`, or `||`, found `Move` --> $DIR/async-move.rs:4:11 | LL | async Move {} - | ^^^^ expected one of `move`, `use`, `|`, or `||` + | ^^^^ expected one of `move`, `use`, `{`, `|`, or `||` | help: write keyword `move` in lowercase | From 34241e539717e210a2a8336b28c7c0dbaceb2914 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jana=20D=C3=B6nszelmann?= Date: Wed, 11 Jun 2025 16:10:47 +0200 Subject: [PATCH 11/13] document attribute parsers better --- compiler/rustc_attr_parsing/src/attributes/mod.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/compiler/rustc_attr_parsing/src/attributes/mod.rs b/compiler/rustc_attr_parsing/src/attributes/mod.rs index bf18e10e19fd0..744f925e6401a 100644 --- a/compiler/rustc_attr_parsing/src/attributes/mod.rs +++ b/compiler/rustc_attr_parsing/src/attributes/mod.rs @@ -51,6 +51,9 @@ type AcceptMapping = &'static [(&'static [Symbol], AcceptFn)]; /// whether it has seen the attribute it has been looking for. /// /// The state machine is automatically reset to parse attributes on the next item. +/// +/// For a simpler attribute parsing interface, consider using [`SingleAttributeParser`] +/// or [`CombineAttributeParser`] instead. pub(crate) trait AttributeParser: Default + 'static { /// The symbols for the attributes that this parser is interested in. /// @@ -59,6 +62,12 @@ pub(crate) trait AttributeParser: Default + 'static { /// The parser has gotten a chance to accept the attributes on an item, /// here it can produce an attribute. + /// + /// All finalize methods of all parsers are unconditionally called. + /// This means you can't unconditionally return `Some` here, + /// that'd be equivalent to unconditionally applying an attribute to + /// every single syntax item that could have attributes applied to it. + /// Your accept mappings should determine whether this returns something. fn finalize(self, cx: &FinalizeContext<'_>) -> Option; } From ce0438684da2e67e715e2711fbbb304f394c2703 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jana=20D=C3=B6nszelmann?= Date: Wed, 11 Jun 2025 16:33:50 +0200 Subject: [PATCH 12/13] consistently rename (old) attribute groups --- .../rustc_attr_parsing/src/attributes/mod.rs | 2 +- compiler/rustc_attr_parsing/src/context.rs | 24 ++++++++++--------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/compiler/rustc_attr_parsing/src/attributes/mod.rs b/compiler/rustc_attr_parsing/src/attributes/mod.rs index 744f925e6401a..7cceca3c24dcd 100644 --- a/compiler/rustc_attr_parsing/src/attributes/mod.rs +++ b/compiler/rustc_attr_parsing/src/attributes/mod.rs @@ -12,7 +12,7 @@ //! - [`CombineAttributeParser`]: makes it easy to implement an attribute which should combine the //! contents of attributes, if an attribute appear multiple times in a list //! -//! Attributes should be added to [`ATTRIBUTE_MAPPING`](crate::context::ATTRIBUTE_MAPPING) to be parsed. +//! Attributes should be added to [`ATTRIBUTE_PARSERS`](crate::context::ATTRIBUTE_PARSERS) to be parsed. use std::marker::PhantomData; diff --git a/compiler/rustc_attr_parsing/src/context.rs b/compiler/rustc_attr_parsing/src/context.rs index c02760d830c2a..35fb768ad0bd9 100644 --- a/compiler/rustc_attr_parsing/src/context.rs +++ b/compiler/rustc_attr_parsing/src/context.rs @@ -22,7 +22,7 @@ use crate::attributes::transparency::TransparencyParser; use crate::attributes::{AttributeParser as _, Combine, Single}; use crate::parser::{ArgParser, MetaItemParser}; -macro_rules! attribute_groups { +macro_rules! attribute_parsers { ( pub(crate) static $name: ident = [$($names: ty),* $(,)?]; ) => { @@ -63,8 +63,8 @@ macro_rules! attribute_groups { }; } -attribute_groups!( - pub(crate) static ATTRIBUTE_MAPPING = [ +attribute_parsers!( + pub(crate) static ATTRIBUTE_PARSERS = [ // tidy-alphabetical-start BodyStabilityParser, ConfusablesParser, @@ -90,7 +90,7 @@ attribute_groups!( /// /// Gives [`AttributeParser`]s enough information to create errors, for example. pub(crate) struct AcceptContext<'a> { - pub(crate) group_cx: &'a FinalizeContext<'a>, + pub(crate) finalize_cx: &'a FinalizeContext<'a>, /// The span of the attribute currently being parsed pub(crate) attr_span: Span, } @@ -109,7 +109,7 @@ impl<'a> Deref for AcceptContext<'a> { type Target = FinalizeContext<'a>; fn deref(&self) -> &Self::Target { - &self.group_cx + &self.finalize_cx } } @@ -219,7 +219,7 @@ impl<'sess> AttributeParser<'sess> { ) -> Vec { let mut attributes = Vec::new(); - let group_cx = FinalizeContext { cx: self, target_span }; + let finalize_cx = FinalizeContext { cx: self, target_span }; for attr in attrs { // If we're only looking for a single attribute, skip all the ones we don't care about. @@ -268,9 +268,11 @@ impl<'sess> AttributeParser<'sess> { let args = parser.args(); let parts = path.segments().map(|i| i.name).collect::>(); - if let Some(accept) = ATTRIBUTE_MAPPING.0.get(parts.as_slice()) { - let cx = - AcceptContext { group_cx: &group_cx, attr_span: lower_span(attr.span) }; + if let Some(accept) = ATTRIBUTE_PARSERS.0.get(parts.as_slice()) { + let cx = AcceptContext { + finalize_cx: &finalize_cx, + attr_span: lower_span(attr.span), + }; accept(&cx, &args) } else { @@ -302,8 +304,8 @@ impl<'sess> AttributeParser<'sess> { } let mut parsed_attributes = Vec::new(); - for f in &ATTRIBUTE_MAPPING.1 { - if let Some(attr) = f(&group_cx) { + for f in &ATTRIBUTE_PARSERS.1 { + if let Some(attr) = f(&finalize_cx) { parsed_attributes.push(Attribute::Parsed(attr)); } } From 87b068ccb7d36e494a1cb4cfd104bf782eeac088 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Wed, 11 Jun 2025 18:38:29 +0200 Subject: [PATCH 13/13] Fix missing newline trim in bootstrap --- src/bootstrap/src/core/config/config.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs index 7f52697e6c7c6..c7ad36d08da10 100644 --- a/src/bootstrap/src/core/config/config.rs +++ b/src/bootstrap/src/core/config/config.rs @@ -1402,7 +1402,8 @@ impl Config { // If there is a tag named after the current branch, git will try to disambiguate by prepending `heads/` to the branch name. // This syntax isn't accepted by `branch.{branch}`. Strip it. let branch = current_branch.stdout(); - let branch = branch.strip_prefix("heads/").unwrap_or(&branch); + let branch = branch.trim(); + let branch = branch.strip_prefix("heads/").unwrap_or(branch); git.arg("-c").arg(format!("branch.{branch}.remote=origin")); } git.args(["submodule", "update", "--init", "--recursive", "--depth=1"]);