Skip to content

Commit 31d0d21

Browse files
committed
Auto merge of #142381 - matthiaskrgr:rollup-si4xbko, r=matthiaskrgr
Rollup of 9 pull requests Successful merges: - #142305 (Remove unneeded `check_id` calls as they are already called in `visit_id` in `EarlyContextAndPass` type) - #142314 (remove ice group pings from `triagebot.toml`) - #142343 (remove myself from the project) - #142346 (Add tracing import to execution context) - #142356 (Fix enter_trace_span!() using wrong $crate paths) - #142362 (Add expectation for `{` when parsing lone coroutine qualifiers) - #142364 (Do not warn on `rust.incremental` when using download CI rustc) - #142369 (Improve some attribute docs and rename groups) - #142374 (Fix missing newline trim in bootstrap) r? `@ghost` `@rustbot` modify labels: rollup
2 parents e703dff + c97dca6 commit 31d0d21

File tree

15 files changed

+74
-78
lines changed

15 files changed

+74
-78
lines changed

compiler/rustc_attr_parsing/src/attributes/mod.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
//! - [`CombineAttributeParser`]: makes it easy to implement an attribute which should combine the
1313
//! contents of attributes, if an attribute appear multiple times in a list
1414
//!
15-
//! Attributes should be added to [`ATTRIBUTE_MAPPING`](crate::context::ATTRIBUTE_MAPPING) to be parsed.
15+
//! Attributes should be added to [`ATTRIBUTE_PARSERS`](crate::context::ATTRIBUTE_PARSERS) to be parsed.
1616
1717
use std::marker::PhantomData;
1818

@@ -51,6 +51,9 @@ type AcceptMapping<T> = &'static [(&'static [Symbol], AcceptFn<T>)];
5151
/// whether it has seen the attribute it has been looking for.
5252
///
5353
/// The state machine is automatically reset to parse attributes on the next item.
54+
///
55+
/// For a simpler attribute parsing interface, consider using [`SingleAttributeParser`]
56+
/// or [`CombineAttributeParser`] instead.
5457
pub(crate) trait AttributeParser: Default + 'static {
5558
/// The symbols for the attributes that this parser is interested in.
5659
///
@@ -59,6 +62,12 @@ pub(crate) trait AttributeParser: Default + 'static {
5962

6063
/// The parser has gotten a chance to accept the attributes on an item,
6164
/// here it can produce an attribute.
65+
///
66+
/// All finalize methods of all parsers are unconditionally called.
67+
/// This means you can't unconditionally return `Some` here,
68+
/// that'd be equivalent to unconditionally applying an attribute to
69+
/// every single syntax item that could have attributes applied to it.
70+
/// Your accept mappings should determine whether this returns something.
6271
fn finalize(self, cx: &FinalizeContext<'_>) -> Option<AttributeKind>;
6372
}
6473

compiler/rustc_attr_parsing/src/context.rs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use crate::attributes::transparency::TransparencyParser;
2222
use crate::attributes::{AttributeParser as _, Combine, Single};
2323
use crate::parser::{ArgParser, MetaItemParser};
2424

25-
macro_rules! attribute_groups {
25+
macro_rules! attribute_parsers {
2626
(
2727
pub(crate) static $name: ident = [$($names: ty),* $(,)?];
2828
) => {
@@ -63,8 +63,8 @@ macro_rules! attribute_groups {
6363
};
6464
}
6565

66-
attribute_groups!(
67-
pub(crate) static ATTRIBUTE_MAPPING = [
66+
attribute_parsers!(
67+
pub(crate) static ATTRIBUTE_PARSERS = [
6868
// tidy-alphabetical-start
6969
BodyStabilityParser,
7070
ConfusablesParser,
@@ -90,7 +90,7 @@ attribute_groups!(
9090
///
9191
/// Gives [`AttributeParser`]s enough information to create errors, for example.
9292
pub(crate) struct AcceptContext<'a> {
93-
pub(crate) group_cx: &'a FinalizeContext<'a>,
93+
pub(crate) finalize_cx: &'a FinalizeContext<'a>,
9494
/// The span of the attribute currently being parsed
9595
pub(crate) attr_span: Span,
9696
}
@@ -109,7 +109,7 @@ impl<'a> Deref for AcceptContext<'a> {
109109
type Target = FinalizeContext<'a>;
110110

111111
fn deref(&self) -> &Self::Target {
112-
&self.group_cx
112+
&self.finalize_cx
113113
}
114114
}
115115

@@ -219,7 +219,7 @@ impl<'sess> AttributeParser<'sess> {
219219
) -> Vec<Attribute> {
220220
let mut attributes = Vec::new();
221221

222-
let group_cx = FinalizeContext { cx: self, target_span };
222+
let finalize_cx = FinalizeContext { cx: self, target_span };
223223

224224
for attr in attrs {
225225
// 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> {
268268
let args = parser.args();
269269
let parts = path.segments().map(|i| i.name).collect::<Vec<_>>();
270270

271-
if let Some(accept) = ATTRIBUTE_MAPPING.0.get(parts.as_slice()) {
272-
let cx =
273-
AcceptContext { group_cx: &group_cx, attr_span: lower_span(attr.span) };
271+
if let Some(accept) = ATTRIBUTE_PARSERS.0.get(parts.as_slice()) {
272+
let cx = AcceptContext {
273+
finalize_cx: &finalize_cx,
274+
attr_span: lower_span(attr.span),
275+
};
274276

275277
accept(&cx, &args)
276278
} else {
@@ -302,8 +304,8 @@ impl<'sess> AttributeParser<'sess> {
302304
}
303305

304306
let mut parsed_attributes = Vec::new();
305-
for f in &ATTRIBUTE_MAPPING.1 {
306-
if let Some(attr) = f(&group_cx) {
307+
for f in &ATTRIBUTE_PARSERS.1 {
308+
if let Some(attr) = f(&finalize_cx) {
307309
parsed_attributes.push(Attribute::Parsed(attr));
308310
}
309311
}

compiler/rustc_const_eval/src/interpret/util.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ pub enum MaybeEnteredSpan {
5858
macro_rules! enter_trace_span {
5959
($machine:ident, $($tt:tt)*) => {
6060
if $machine::TRACING_ENABLED {
61-
$crate::interpret::tracing_utils::MaybeEnteredSpan::Some(tracing::info_span!($($tt)*).entered())
61+
$crate::interpret::util::MaybeEnteredSpan::Some(tracing::info_span!($($tt)*).entered())
6262
} else {
63-
$crate::interpret::tracing_utils::MaybeEnteredSpan::None
63+
$crate::interpret::util::MaybeEnteredSpan::None
6464
}
6565
}
6666
}

compiler/rustc_lint/src/early.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ impl<'ast, 'ecx, 'tcx, T: EarlyLintPass> ast_visit::Visitor<'ast>
136136
// the AST struct that they wrap (e.g. an item)
137137
self.with_lint_attrs(s.id, s.attrs(), |cx| {
138138
lint_callback!(cx, check_stmt, s);
139-
cx.check_id(s.id);
140139
});
141140
// The visitor for the AST struct wrapped
142141
// by the statement (e.g. `Item`) will call
@@ -147,7 +146,6 @@ impl<'ast, 'ecx, 'tcx, T: EarlyLintPass> ast_visit::Visitor<'ast>
147146

148147
fn visit_fn(&mut self, fk: ast_visit::FnKind<'ast>, span: Span, id: ast::NodeId) {
149148
lint_callback!(self, check_fn, fk, span, id);
150-
self.check_id(id);
151149
ast_visit::walk_fn(self, fk);
152150
}
153151

compiler/rustc_parse/src/parser/expr.rs

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1520,22 +1520,20 @@ impl<'a> Parser<'a> {
15201520
Ok(this.mk_expr(this.prev_token.span, ExprKind::Underscore))
15211521
} else if this.token_uninterpolated_span().at_least_rust_2018() {
15221522
// `Span::at_least_rust_2018()` is somewhat expensive; don't get it repeatedly.
1523+
let at_async = this.check_keyword(exp!(Async));
1524+
// check for `gen {}` and `gen move {}`
1525+
// or `async gen {}` and `async gen move {}`
1526+
// FIXME: (async) gen closures aren't yet parsed.
1527+
// FIXME(gen_blocks): Parse `gen async` and suggest swap
15231528
if this.token_uninterpolated_span().at_least_rust_2024()
1524-
// check for `gen {}` and `gen move {}`
1525-
// or `async gen {}` and `async gen move {}`
1526-
&& (this.is_gen_block(kw::Gen, 0)
1527-
|| (this.check_keyword(exp!(Async)) && this.is_gen_block(kw::Gen, 1)))
1529+
&& this.is_gen_block(kw::Gen, at_async as usize)
15281530
{
1529-
// FIXME: (async) gen closures aren't yet parsed.
15301531
this.parse_gen_block()
1531-
} else if this.check_keyword(exp!(Async)) {
1532-
// FIXME(gen_blocks): Parse `gen async` and suggest swap
1533-
if this.is_gen_block(kw::Async, 0) {
1534-
// Check for `async {` and `async move {`,
1535-
this.parse_gen_block()
1536-
} else {
1537-
this.parse_expr_closure()
1538-
}
1532+
// Check for `async {` and `async move {`,
1533+
} else if this.is_gen_block(kw::Async, 0) {
1534+
this.parse_gen_block()
1535+
} else if at_async {
1536+
this.parse_expr_closure()
15391537
} else if this.eat_keyword_noexpect(kw::Await) {
15401538
this.recover_incorrect_await_syntax(lo)
15411539
} else {
@@ -2407,6 +2405,14 @@ impl<'a> Parser<'a> {
24072405
None
24082406
};
24092407

2408+
if let ClosureBinder::NotPresent = binder
2409+
&& coroutine_kind.is_some()
2410+
{
2411+
// coroutine closures and generators can have the same qualifiers, so we might end up
2412+
// in here if there is a missing `|` but also no `{`. Adjust the expectations in that case.
2413+
self.expected_token_types.insert(TokenType::OpenBrace);
2414+
}
2415+
24102416
let capture_clause = self.parse_capture_clause()?;
24112417
let (fn_decl, fn_arg_span) = self.parse_fn_block_decl()?;
24122418
let decl_hi = self.prev_token.span;

src/bootstrap/src/core/config/config.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1389,7 +1389,8 @@ impl Config {
13891389
// If there is a tag named after the current branch, git will try to disambiguate by prepending `heads/` to the branch name.
13901390
// This syntax isn't accepted by `branch.{branch}`. Strip it.
13911391
let branch = current_branch.stdout();
1392-
let branch = branch.strip_prefix("heads/").unwrap_or(&branch);
1392+
let branch = branch.trim();
1393+
let branch = branch.strip_prefix("heads/").unwrap_or(branch);
13931394
git.arg("-c").arg(format!("branch.{branch}.remote=origin"));
13941395
}
13951396
git.args(["submodule", "update", "--init", "--recursive", "--depth=1"]);

src/bootstrap/src/core/config/toml/rust.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,11 +321,11 @@ pub fn check_incompatible_options_for_ci_rustc(
321321
rpath,
322322
channel,
323323
description,
324-
incremental,
325324
default_linker,
326325
std_features,
327326

328327
// Rest of the options can simply be ignored.
328+
incremental: _,
329329
debug: _,
330330
codegen_units: _,
331331
codegen_units_std: _,
@@ -389,7 +389,6 @@ pub fn check_incompatible_options_for_ci_rustc(
389389

390390
warn!(current_rust_config.channel, channel, "rust");
391391
warn!(current_rust_config.description, description, "rust");
392-
warn!(current_rust_config.incremental, incremental, "rust");
393392

394393
Ok(())
395394
}

src/bootstrap/src/utils/execution_context.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
use std::sync::{Arc, Mutex};
77

88
use crate::core::config::DryRun;
9+
#[cfg(feature = "tracing")]
10+
use crate::trace_cmd;
911
use crate::{BehaviorOnFailure, BootstrapCommand, CommandOutput, OutputMode, exit};
1012

1113
#[derive(Clone, Default)]

src/ci/docker/host-x86_64/mingw-check-2/Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,7 @@ ENV SCRIPT \
3636
RUSTDOCFLAGS=\"--document-private-items --document-hidden-items\" python3 ../x.py doc --stage 1 library && \
3737
mkdir -p /checkout/obj/staging/doc && \
3838
cp -r build/x86_64-unknown-linux-gnu/doc /checkout/obj/staging && \
39-
RUSTDOCFLAGS=\"--document-private-items --document-hidden-items\" python3 ../x.py doc --stage 1 library/test
39+
RUSTDOCFLAGS=\"--document-private-items --document-hidden-items\" python3 ../x.py doc --stage 1 library/test && \
40+
# The BOOTSTRAP_TRACING flag is added to verify whether the
41+
# bootstrap process compiles successfully with this flag enabled.
42+
BOOTSTRAP_TRACING=1 python3 ../x.py --help

tests/ui/editions/edition-keywords-2018-2015-parsing.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,22 +44,22 @@ note: while trying to match `r#async`
4444
LL | (r#async) => (1)
4545
| ^^^^^^^
4646

47-
error: macro expansion ends with an incomplete expression: expected one of `move`, `use`, `|`, or `||`
47+
error: macro expansion ends with an incomplete expression: expected one of `move`, `use`, `{`, `|`, or `||`
4848
--> $DIR/auxiliary/edition-kw-macro-2015.rs:27:23
4949
|
5050
LL | ($i: ident) => ($i)
51-
| ^ expected one of `move`, `use`, `|`, or `||`
51+
| ^ expected one of `move`, `use`, `{`, `|`, or `||`
5252
|
5353
::: $DIR/edition-keywords-2018-2015-parsing.rs:22:8
5454
|
5555
LL | if passes_ident!(async) == 1 {} // FIXME: Edition hygiene bug, async here is 2018 and reserved
5656
| -------------------- in this macro invocation
5757

58-
error: macro expansion ends with an incomplete expression: expected one of `move`, `use`, `|`, or `||`
58+
error: macro expansion ends with an incomplete expression: expected one of `move`, `use`, `{`, `|`, or `||`
5959
--> $DIR/edition-keywords-2018-2015-parsing.rs:24:24
6060
|
6161
LL | if passes_tt!(async) == 1 {}
62-
| ^ expected one of `move`, `use`, `|`, or `||`
62+
| ^ expected one of `move`, `use`, `{`, `|`, or `||`
6363

6464
error[E0308]: mismatched types
6565
--> $DIR/edition-keywords-2018-2015-parsing.rs:29:33

tests/ui/editions/edition-keywords-2018-2018-parsing.stderr

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,34 +44,34 @@ note: while trying to match `r#async`
4444
LL | (r#async) => (1)
4545
| ^^^^^^^
4646

47-
error: macro expansion ends with an incomplete expression: expected one of `move`, `use`, `|`, or `||`
47+
error: macro expansion ends with an incomplete expression: expected one of `move`, `use`, `{`, `|`, or `||`
4848
--> $DIR/auxiliary/edition-kw-macro-2018.rs:27:23
4949
|
5050
LL | ($i: ident) => ($i)
51-
| ^ expected one of `move`, `use`, `|`, or `||`
51+
| ^ expected one of `move`, `use`, `{`, `|`, or `||`
5252
|
5353
::: $DIR/edition-keywords-2018-2018-parsing.rs:29:8
5454
|
5555
LL | if passes_ident!(async) == 1 {} // FIXME: Edition hygiene bug, async here is 2018 and reserved
5656
| -------------------- in this macro invocation
5757

58-
error: macro expansion ends with an incomplete expression: expected one of `move`, `use`, `|`, or `||`
58+
error: macro expansion ends with an incomplete expression: expected one of `move`, `use`, `{`, `|`, or `||`
5959
--> $DIR/edition-keywords-2018-2018-parsing.rs:31:24
6060
|
6161
LL | if passes_tt!(async) == 1 {}
62-
| ^ expected one of `move`, `use`, `|`, or `||`
62+
| ^ expected one of `move`, `use`, `{`, `|`, or `||`
6363

64-
error: macro expansion ends with an incomplete expression: expected one of `move`, `use`, `|`, or `||`
64+
error: macro expansion ends with an incomplete expression: expected one of `move`, `use`, `{`, `|`, or `||`
6565
--> $DIR/edition-keywords-2018-2018-parsing.rs:14:23
6666
|
6767
LL | ($i: ident) => ($i)
68-
| ^ expected one of `move`, `use`, `|`, or `||`
68+
| ^ expected one of `move`, `use`, `{`, `|`, or `||`
6969

70-
error: macro expansion ends with an incomplete expression: expected one of `move`, `use`, `|`, or `||`
70+
error: macro expansion ends with an incomplete expression: expected one of `move`, `use`, `{`, `|`, or `||`
7171
--> $DIR/edition-keywords-2018-2018-parsing.rs:35:30
7272
|
7373
LL | if local_passes_tt!(async) == 1 {}
74-
| ^ expected one of `move`, `use`, `|`, or `||`
74+
| ^ expected one of `move`, `use`, `{`, `|`, or `||`
7575

7676
error[E0308]: mismatched types
7777
--> $DIR/edition-keywords-2018-2018-parsing.rs:40:33

tests/ui/parser/block-no-opening-brace.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ fn in_try() {
2727
let x = 0;
2828
}
2929

30-
// FIXME(#80931)
3130
fn in_async() {
3231
async
33-
let x = 0; //~ ERROR expected one of `move`, `use`, `|`, or `||`, found keyword `let`
32+
let x = 0;
33+
//~^ ERROR expected one of `move`, `use`, `{`, `|`, or `||`, found keyword `let`
3434
}
3535

3636
// FIXME(#78168)

tests/ui/parser/block-no-opening-brace.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ error: expected expression, found reserved keyword `try`
4343
LL | try
4444
| ^^^ expected expression
4545

46-
error: expected one of `move`, `use`, `|`, or `||`, found keyword `let`
47-
--> $DIR/block-no-opening-brace.rs:33:9
46+
error: expected one of `move`, `use`, `{`, `|`, or `||`, found keyword `let`
47+
--> $DIR/block-no-opening-brace.rs:32:9
4848
|
4949
LL | async
50-
| - expected one of `move`, `use`, `|`, or `||`
50+
| - expected one of `move`, `use`, `{`, `|`, or `||`
5151
LL | let x = 0;
5252
| ^^^ unexpected token
5353

tests/ui/parser/misspelled-keywords/async-move.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error: expected one of `move`, `use`, `|`, or `||`, found `Move`
1+
error: expected one of `move`, `use`, `{`, `|`, or `||`, found `Move`
22
--> $DIR/async-move.rs:4:11
33
|
44
LL | async Move {}
5-
| ^^^^ expected one of `move`, `use`, `|`, or `||`
5+
| ^^^^ expected one of `move`, `use`, `{`, `|`, or `||`
66
|
77
help: write keyword `move` in lowercase
88
|

triagebot.toml

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -44,29 +44,6 @@ remove_labels = ["S-waiting-on-author"]
4444
# Those labels are added when PR author requests a review from an assignee
4545
add_labels = ["S-waiting-on-review"]
4646

47-
[ping.icebreakers-llvm]
48-
message = """\
49-
Hey LLVM ICE-breakers! This bug has been identified as a good
50-
"LLVM ICE-breaking candidate". In case it's useful, here are some
51-
[instructions] for tackling these sorts of bugs. Maybe take a look?
52-
Thanks! <3
53-
54-
[instructions]: https://rustc-dev-guide.rust-lang.org/notification-groups/llvm.html
55-
"""
56-
label = "ICEBreaker-LLVM"
57-
58-
[ping.icebreakers-cleanup-crew]
59-
alias = ["cleanup", "cleanups", "cleanup-crew", "shrink", "reduce", "bisect"]
60-
message = """\
61-
Hey Cleanup Crew ICE-breakers! This bug has been identified as a good
62-
"Cleanup ICE-breaking candidate". In case it's useful, here are some
63-
[instructions] for tackling these sorts of bugs. Maybe take a look?
64-
Thanks! <3
65-
66-
[instructions]: https://rustc-dev-guide.rust-lang.org/notification-groups/cleanup-crew.html
67-
"""
68-
label = "ICEBreaker-Cleanup-Crew"
69-
7047
[ping.windows]
7148
message = """\
7249
Hey Windows Group! This bug has been identified as a good "Windows candidate".
@@ -1266,7 +1243,6 @@ libs = [
12661243
bootstrap = [
12671244
"@Mark-Simulacrum",
12681245
"@albertlarsan68",
1269-
"@onur-ozkan",
12701246
"@kobzol",
12711247
"@jieyouxu",
12721248
"@clubby789",
@@ -1459,8 +1435,8 @@ compiletest = [
14591435
"/src/tools/rustdoc-themes" = ["rustdoc"]
14601436
"/src/tools/tidy" = ["bootstrap"]
14611437
"/src/tools/x" = ["bootstrap"]
1462-
"/src/tools/rustdoc-gui-test" = ["bootstrap", "@onur-ozkan"]
1463-
"/src/tools/libcxx-version" = ["@onur-ozkan"]
1438+
"/src/tools/rustdoc-gui-test" = ["bootstrap"]
1439+
"/src/tools/libcxx-version" = ["bootstrap"]
14641440

14651441
# Enable review queue tracking
14661442
# Documentation at: https://forge.rust-lang.org/triagebot/review-queue-tracking.html

0 commit comments

Comments
 (0)