diff options
| author | bors <bors@rust-lang.org> | 2022-10-25 02:16:57 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-10-25 02:16:57 +0000 |
| commit | f2702e922ba31e49d6167f5651d4545646dcf22d (patch) | |
| tree | b5a5a964027a222e70a770f008af9a70799c83f4 /compiler/rustc_parse/src/parser | |
| parent | 758f19645b8ebce61ea52d1f6672fd057bc8dbee (diff) | |
| parent | d0ffd20a756be1334195ca3cc5fdf0127c1e6358 (diff) | |
| download | rust-f2702e922ba31e49d6167f5651d4545646dcf22d.tar.gz rust-f2702e922ba31e49d6167f5651d4545646dcf22d.zip | |
Auto merge of #103502 - JohnTitor:rollup-o6mhyzq, r=JohnTitor
Rollup of 11 pull requests
Successful merges:
- #103333 (Fix assertion failed for break_last_token and trailing token)
- #103350 (Change terminology for assoc method suggestions when they are not called)
- #103382 (Don't ICE when reporting borrowck errors involving regions from `anonymous_lifetime_in_impl_trait`)
- #103409 (Delay span bug when we can't map lifetimes back in `collect_trait_impl_trait_tys`)
- #103410 (-Z docs: Add link to unstable book)
- #103462 (rustdoc: remove no-op CSS `.source pre.rust { white-space: pre }`)
- #103465 (E0210 explanation: remove redundant sentence)
- #103486 (Use functions in highlight-colors rustdoc GUI test)
- #103493 (rustdoc: remove unused `.sidebar-logo` DOM on source pages)
- #103494 (rustdoc: remove redundant CSS `a.test-arrow:hover`)
- #103495 (rustdoc: Use `unix_sigpipe` instead of `rustc_driver::set_sigpipe_handler`)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_parse/src/parser')
| -rw-r--r-- | compiler/rustc_parse/src/parser/attr_wrapper.rs | 13 | ||||
| -rw-r--r-- | compiler/rustc_parse/src/parser/expr.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_parse/src/parser/mod.rs | 1 |
3 files changed, 11 insertions, 5 deletions
diff --git a/compiler/rustc_parse/src/parser/attr_wrapper.rs b/compiler/rustc_parse/src/parser/attr_wrapper.rs index 81c051b8f35..1b16ecb5ec2 100644 --- a/compiler/rustc_parse/src/parser/attr_wrapper.rs +++ b/compiler/rustc_parse/src/parser/attr_wrapper.rs @@ -273,16 +273,23 @@ impl<'a> Parser<'a> { let cursor_snapshot_next_calls = cursor_snapshot.num_next_calls; let mut end_pos = self.token_cursor.num_next_calls; + let mut captured_trailing = false; + // Capture a trailing token if requested by the callback 'f' match trailing { TrailingToken::None => {} + TrailingToken::Gt => { + assert_eq!(self.token.kind, token::Gt); + } TrailingToken::Semi => { assert_eq!(self.token.kind, token::Semi); end_pos += 1; + captured_trailing = true; } TrailingToken::MaybeComma => { if self.token.kind == token::Comma { end_pos += 1; + captured_trailing = true; } } } @@ -292,11 +299,7 @@ impl<'a> Parser<'a> { // was not actually bumped past it. When the `LazyAttrTokenStream` gets converted // into an `AttrTokenStream`, we will create the proper token. if self.token_cursor.break_last_token { - assert_eq!( - trailing, - TrailingToken::None, - "Cannot set `break_last_token` and have trailing token" - ); + assert!(!captured_trailing, "Cannot set break_last_token and have trailing token"); end_pos += 1; } diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index 98520a446a6..ca216b1cd10 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -3142,6 +3142,8 @@ impl<'a> Parser<'a> { && this.token.kind == token::Semi { TrailingToken::Semi + } else if this.token.kind == token::Gt { + TrailingToken::Gt } else { // FIXME - pass this through from the place where we know // we need a comma, rather than assuming that `#[attr] expr,` diff --git a/compiler/rustc_parse/src/parser/mod.rs b/compiler/rustc_parse/src/parser/mod.rs index b934e087608..89c24920f85 100644 --- a/compiler/rustc_parse/src/parser/mod.rs +++ b/compiler/rustc_parse/src/parser/mod.rs @@ -79,6 +79,7 @@ pub enum ForceCollect { pub enum TrailingToken { None, Semi, + Gt, /// If the trailing token is a comma, then capture it /// Otherwise, ignore the trailing token MaybeComma, |
