diff options
| author | bors <bors@rust-lang.org> | 2024-04-25 06:48:37 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-04-25 06:48:37 +0000 |
| commit | 9d7a47fe31c049d32989ee41efec61b57ea1a4e0 (patch) | |
| tree | 32f82f6179297d50ad208b9e57d39171f8e1635f /compiler/rustc_parse/src/parser | |
| parent | c69c79d42a691b2f8402d18ec87fb0e0873f1bf2 (diff) | |
| parent | 258e5043a156a87497f98d5220624545658aad0b (diff) | |
| download | rust-9d7a47fe31c049d32989ee41efec61b57ea1a4e0.tar.gz rust-9d7a47fe31c049d32989ee41efec61b57ea1a4e0.zip | |
Auto merge of #3513 - rust-lang:rustup-2024-04-25, r=RalfJung
Automatic Rustup
Diffstat (limited to 'compiler/rustc_parse/src/parser')
| -rw-r--r-- | compiler/rustc_parse/src/parser/item.rs | 10 | ||||
| -rw-r--r-- | compiler/rustc_parse/src/parser/mod.rs | 2 |
2 files changed, 5 insertions, 7 deletions
diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs index 84ecd0a0de5..ed51710564a 100644 --- a/compiler/rustc_parse/src/parser/item.rs +++ b/compiler/rustc_parse/src/parser/item.rs @@ -686,6 +686,8 @@ impl<'a> Parser<'a> { (None, self.parse_path(PathStyle::Expr)?) }; + let rename = if self.eat_keyword(kw::As) { Some(self.parse_ident()?) } else { None }; + let body = if self.check(&token::OpenDelim(Delimiter::Brace)) { Some(self.parse_block()?) } else { @@ -695,11 +697,9 @@ impl<'a> Parser<'a> { let span = span.to(self.prev_token.span); self.psess.gated_spans.gate(sym::fn_delegation, span); - let ident = path.segments.last().map(|seg| seg.ident).unwrap_or(Ident::empty()); - Ok(( - ident, - ItemKind::Delegation(Box::new(Delegation { id: DUMMY_NODE_ID, qself, path, body })), - )) + let ident = rename.unwrap_or_else(|| path.segments.last().unwrap().ident); + let deleg = Delegation { id: DUMMY_NODE_ID, qself, path, rename, body }; + Ok((ident, ItemKind::Delegation(Box::new(deleg)))) } fn parse_item_list<T>( diff --git a/compiler/rustc_parse/src/parser/mod.rs b/compiler/rustc_parse/src/parser/mod.rs index 742f4bd3c83..7486da33b21 100644 --- a/compiler/rustc_parse/src/parser/mod.rs +++ b/compiler/rustc_parse/src/parser/mod.rs @@ -1252,8 +1252,6 @@ impl<'a> Parser<'a> { fn parse_const_block(&mut self, span: Span, pat: bool) -> PResult<'a, P<Expr>> { if pat { self.psess.gated_spans.gate(sym::inline_const_pat, span); - } else { - self.psess.gated_spans.gate(sym::inline_const, span); } self.eat_keyword(kw::Const); let (attrs, blk) = self.parse_inner_attrs_and_block()?; |
