diff options
| author | Jacob Pratt <jacob@jhpratt.dev> | 2025-08-21 17:57:52 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-21 17:57:52 -0400 |
| commit | f49d69093ec31583b055615bb07e056fc9fc0ee3 (patch) | |
| tree | e1f14e2e7984afc184724f149657e434c303dfb1 /compiler/rustc_parse | |
| parent | 54da0402ad3a5184bb18aa2d3e443ed3f52947de (diff) | |
| parent | db0c825d2c745fdf87edd501ebda222052f98771 (diff) | |
| download | rust-f49d69093ec31583b055615bb07e056fc9fc0ee3.tar.gz rust-f49d69093ec31583b055615bb07e056fc9fc0ee3.zip | |
Rollup merge of #145604 - compiler-errors:static-closure, r=fmease
Gate static closures behind a parser feature I'd like to gate `static ||` closures behind a feature gate, since we shouldn't allow people to take advantage of this syntax if it's currently unstable. Right now, since it's only rejected after ast lowering, it's accessible to macros. Let's crater this to see if we can claw it back without breaking anyone's code.
Diffstat (limited to 'compiler/rustc_parse')
| -rw-r--r-- | compiler/rustc_parse/src/parser/expr.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index ea8cd3754a0..cb7f755f524 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -2409,8 +2409,12 @@ impl<'a> Parser<'a> { let constness = self.parse_closure_constness(); - let movability = - if self.eat_keyword(exp!(Static)) { Movability::Static } else { Movability::Movable }; + let movability = if self.eat_keyword(exp!(Static)) { + self.psess.gated_spans.gate(sym::coroutines, self.prev_token.span); + Movability::Static + } else { + Movability::Movable + }; let coroutine_kind = if self.token_uninterpolated_span().at_least_rust_2018() { self.parse_coroutine_kind(Case::Sensitive) |
