From 939510348d841b081dbfe49766d220740c580e97 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Sun, 10 Jul 2022 21:30:06 -0500 Subject: [PATCH 01/19] Give a better error when `x dist` fails for an optional tool Before: ``` thread 'main' panicked at 'Unable to build RLS', dist.rs:42:9 ``` After: ``` thread 'main' panicked at 'Unable to build submodule tool RLS (use `missing-tools = true` to ignore this failure) note: not all tools are available on all nightlies help: see https://forge.rust-lang.org/infra/toolstate.html for more information', dist.rs:43:9 ``` --- src/bootstrap/dist.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index 4aadc3943c94a..cba013b5bb689 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -39,7 +39,11 @@ fn missing_tool(tool_name: &str, skip: bool) { if skip { println!("Unable to build {}, skipping dist", tool_name) } else { - panic!("Unable to build {}", tool_name) + let help = "note: not all tools are available on all nightlies\nhelp: see https://forge.rust-lang.org/infra/toolstate.html for more information"; + panic!( + "Unable to build submodule tool {} (use `missing-tools = true` to ignore this failure)\n{}", + tool_name, help + ) } } From 40ae7b5b8e09da657b62bc849b8bcdf99a1cb210 Mon Sep 17 00:00:00 2001 From: Maybe Waffle Date: Thu, 2 Jun 2022 20:15:05 +0400 Subject: [PATCH 02/19] Parse closure binders This is first step in implementing RFC 3216. - Parse `for<'a>` before closures in ast - Error in lowering - Add `closure_lifetime_binder` feature --- compiler/rustc_ast/src/ast.rs | 27 +++++++- compiler/rustc_ast/src/mut_visit.rs | 18 ++++- compiler/rustc_ast/src/visit.rs | 25 +++++-- compiler/rustc_ast_lowering/src/expr.rs | 24 +++++++ .../rustc_ast_passes/src/ast_validation.rs | 4 ++ compiler/rustc_ast_passes/src/feature_gate.rs | 5 ++ .../rustc_ast_pretty/src/pprust/state/expr.rs | 11 +++ .../src/assert/context.rs | 2 +- compiler/rustc_expand/src/build.rs | 1 + compiler/rustc_feature/src/active.rs | 2 + compiler/rustc_lint/src/early.rs | 2 +- compiler/rustc_parse/src/parser/expr.rs | 48 ++++++------- compiler/rustc_resolve/src/def_collector.rs | 2 +- compiler/rustc_resolve/src/late.rs | 2 +- compiler/rustc_span/src/symbol.rs | 1 + src/test/ui-fulldeps/pprust-expr-roundtrip.rs | 1 + .../binder/async-closure-with-binder.rs | 7 ++ .../binder/async-closure-with-binder.stderr | 8 +++ .../ui/closures/binder/implicit-return.rs | 6 ++ .../ui/closures/binder/implicit-return.stderr | 10 +++ ...on-for-introducing-lifetime-into-binder.rs | 7 ++ ...or-introducing-lifetime-into-binder.stderr | 33 +++++++++ .../feature-gate-closure_lifetime_binder.rs | 12 ++++ ...eature-gate-closure_lifetime_binder.stderr | 67 +++++++++++++++++++ 24 files changed, 287 insertions(+), 38 deletions(-) create mode 100644 src/test/ui/closures/binder/async-closure-with-binder.rs create mode 100644 src/test/ui/closures/binder/async-closure-with-binder.stderr create mode 100644 src/test/ui/closures/binder/implicit-return.rs create mode 100644 src/test/ui/closures/binder/implicit-return.stderr create mode 100644 src/test/ui/closures/binder/suggestion-for-introducing-lifetime-into-binder.rs create mode 100644 src/test/ui/closures/binder/suggestion-for-introducing-lifetime-into-binder.stderr create mode 100644 src/test/ui/feature-gates/feature-gate-closure_lifetime_binder.rs create mode 100644 src/test/ui/feature-gates/feature-gate-closure_lifetime_binder.stderr diff --git a/compiler/rustc_ast/src/ast.rs b/compiler/rustc_ast/src/ast.rs index f705d00442227..ac2328a582418 100644 --- a/compiler/rustc_ast/src/ast.rs +++ b/compiler/rustc_ast/src/ast.rs @@ -1390,7 +1390,7 @@ pub enum ExprKind { /// A closure (e.g., `move |a, b, c| a + b + c`). /// /// The final span is the span of the argument block `|...|`. - Closure(CaptureBy, Async, Movability, P, P, Span), + Closure(ClosureBinder, CaptureBy, Async, Movability, P, P, Span), /// A block (`'label: { ... }`). Block(P, Option