diff options
| author | bors <bors@rust-lang.org> | 2021-12-12 14:24:23 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-12-12 14:24:23 +0000 |
| commit | 753e569c9c2a4e3ef394ef7abd0802bf57f66bce (patch) | |
| tree | e171cbd9a5f95de83f7705a4ec69901239b00592 /compiler/rustc_parse/src | |
| parent | 4c9bdf4cbbf1deab0b5da398d4910558a66b332f (diff) | |
| parent | 1e896df2fe8978b549e05e4b79a89456ee272715 (diff) | |
| download | rust-753e569c9c2a4e3ef394ef7abd0802bf57f66bce.tar.gz rust-753e569c9c2a4e3ef394ef7abd0802bf57f66bce.zip | |
Auto merge of #90207 - BoxyUwU:stabilise_cg_defaults, r=lcnr
Stabilise `feature(const_generics_defaults)` `feature(const_generics_defaults)` is complete implementation wise and has a pretty extensive test suite so I think is ready for stabilisation. needs stabilisation report and maybe an RFC :sweat_smile: r? `@lcnr` cc `@rust-lang/project-const-generics`
Diffstat (limited to 'compiler/rustc_parse/src')
| -rw-r--r-- | compiler/rustc_parse/src/parser/generics.rs | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/compiler/rustc_parse/src/parser/generics.rs b/compiler/rustc_parse/src/parser/generics.rs index 07887a7a59c..419ea9cced0 100644 --- a/compiler/rustc_parse/src/parser/generics.rs +++ b/compiler/rustc_parse/src/parser/generics.rs @@ -5,7 +5,7 @@ use rustc_ast::{ self as ast, Attribute, GenericBounds, GenericParam, GenericParamKind, WhereClause, }; use rustc_errors::PResult; -use rustc_span::symbol::{kw, sym}; +use rustc_span::symbol::kw; impl<'a> Parser<'a> { /// Parses bounds of a lifetime parameter `BOUND + BOUND + BOUND`, possibly with trailing `+`. @@ -59,19 +59,8 @@ impl<'a> Parser<'a> { self.expect(&token::Colon)?; let ty = self.parse_ty()?; - // Parse optional const generics default value, taking care of feature gating the spans - // with the unstable syntax mechanism. - let default = if self.eat(&token::Eq) { - // The gated span goes from the `=` to the end of the const argument that follows (and - // which could be a block expression). - let start = self.prev_token.span; - let const_arg = self.parse_const_arg()?; - let span = start.to(const_arg.value.span); - self.sess.gated_spans.gate(sym::const_generics_defaults, span); - Some(const_arg) - } else { - None - }; + // Parse optional const generics default value. + let default = if self.eat(&token::Eq) { Some(self.parse_const_arg()?) } else { None }; Ok(GenericParam { ident, |
