diff options
| author | Mara Bos <m-ou.se@m-ou.se> | 2025-03-28 18:32:12 +0100 |
|---|---|---|
| committer | Mara Bos <m-ou.se@m-ou.se> | 2025-03-28 19:06:18 +0100 |
| commit | 40b1f4899a9081c0d8edf56072aaeb510b63a415 (patch) | |
| tree | fbd2636f3a843a2b8c305f9e12efdb8a6b16e0f1 /compiler/rustc_parse/src/parser/stmt.rs | |
| parent | 2a06022951893fe5b5384f8dbd75b4e6e3b5cee0 (diff) | |
| download | rust-40b1f4899a9081c0d8edf56072aaeb510b63a415.tar.gz rust-40b1f4899a9081c0d8edf56072aaeb510b63a415.zip | |
Add the feature gate for the `super let` experiment.
Diffstat (limited to 'compiler/rustc_parse/src/parser/stmt.rs')
| -rw-r--r-- | compiler/rustc_parse/src/parser/stmt.rs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/compiler/rustc_parse/src/parser/stmt.rs b/compiler/rustc_parse/src/parser/stmt.rs index 97cd4d2117f..2cd09aa8959 100644 --- a/compiler/rustc_parse/src/parser/stmt.rs +++ b/compiler/rustc_parse/src/parser/stmt.rs @@ -73,7 +73,20 @@ impl<'a> Parser<'a> { }); } - let stmt = if self.token.is_keyword(kw::Let) { + let stmt = if self.token.is_keyword(kw::Super) && self.is_keyword_ahead(1, &[kw::Let]) { + self.collect_tokens(None, attrs, force_collect, |this, attrs| { + this.expect_keyword(exp!(Super))?; + this.psess.gated_spans.gate(sym::super_let, this.prev_token.span); + this.expect_keyword(exp!(Let))?; + let local = this.parse_local(attrs)?; // FIXME(mara): implement super let + let trailing = Trailing::from(capture_semi && this.token == token::Semi); + Ok(( + this.mk_stmt(lo.to(this.prev_token.span), StmtKind::Let(local)), + trailing, + UsePreAttrPos::No, + )) + })? + } else if self.token.is_keyword(kw::Let) { self.collect_tokens(None, attrs, force_collect, |this, attrs| { this.expect_keyword(exp!(Let))?; let local = this.parse_local(attrs)?; |
