diff options
| author | Trevor Gross <t.gross35@gmail.com> | 2024-07-18 05:14:07 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-18 05:14:07 -0500 |
| commit | e2e0681e3a400558e5fd9381f76b70fbb1c4735f (patch) | |
| tree | a2396ba3e64513546584725b93d3ce8a74cdb78d /compiler/rustc_parse/src/parser/generics.rs | |
| parent | d817c0f87a900c4c824aa638d26f6a6c301c7952 (diff) | |
| parent | 487802d6c8a74ee375d2f71e3ff97cea11cc9c18 (diff) | |
| download | rust-e2e0681e3a400558e5fd9381f76b70fbb1c4735f.tar.gz rust-e2e0681e3a400558e5fd9381f76b70fbb1c4735f.zip | |
Rollup merge of #127842 - nnethercote:rm-TrailingToken, r=petrochenkov
Remove `TrailingToken`. It's used in `Parser::collect_tokens_trailing_token` to decide whether to capture a trailing token. But the callers actually know whether to capture a trailing token, so it's simpler for them to just pass in a bool. Also, the `TrailingToken::Gt` case was weird, because it didn't result in a trailing token being captured. It could have been subsumed by the `TrailingToken::MaybeComma` case, and it effectively is in the new code. r? `@petrochenkov`
Diffstat (limited to 'compiler/rustc_parse/src/parser/generics.rs')
| -rw-r--r-- | compiler/rustc_parse/src/parser/generics.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/compiler/rustc_parse/src/parser/generics.rs b/compiler/rustc_parse/src/parser/generics.rs index 10c7715c7dc..523538e9643 100644 --- a/compiler/rustc_parse/src/parser/generics.rs +++ b/compiler/rustc_parse/src/parser/generics.rs @@ -4,7 +4,7 @@ use crate::errors::{ WhereClauseBeforeTupleStructBodySugg, }; -use super::{ForceCollect, Parser, TrailingToken}; +use super::{ForceCollect, Parser}; use ast::token::Delimiter; use rustc_ast::token; @@ -229,13 +229,13 @@ impl<'a> Parser<'a> { span: where_predicate.span(), }); // FIXME - try to continue parsing other generics? - return Ok((None, TrailingToken::None)); + return Ok((None, false)); } Err(err) => { err.cancel(); // FIXME - maybe we should overwrite 'self' outside of `collect_tokens`? this.restore_snapshot(snapshot); - return Ok((None, TrailingToken::None)); + return Ok((None, false)); } } } else { @@ -249,14 +249,14 @@ impl<'a> Parser<'a> { .emit_err(errors::AttrWithoutGenerics { span: attrs[0].span }); } } - return Ok((None, TrailingToken::None)); + return Ok((None, false)); }; if !this.eat(&token::Comma) { done = true; } - // We just ate the comma, so no need to use `TrailingToken` - Ok((param, TrailingToken::None)) + // We just ate the comma, so no need to capture the trailing token. + Ok((param, false)) })?; if let Some(param) = param { |
