diff options
| author | bors <bors@rust-lang.org> | 2023-01-09 05:09:45 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-01-09 05:09:45 +0000 |
| commit | 2e677c0645862d17a12c6d04b3019203c8e23fcc (patch) | |
| tree | 70970b8d512c1f88c62d13cfbec27794a1879f02 /compiler/rustc_parse/src | |
| parent | a377893da2cd7124e5a18c7116cbb70e16dd5541 (diff) | |
| parent | 5e8e97f98115191bca09600491d3687e9cf2e8fb (diff) | |
| download | rust-2e677c0645862d17a12c6d04b3019203c8e23fcc.tar.gz rust-2e677c0645862d17a12c6d04b3019203c8e23fcc.zip | |
Auto merge of #106616 - compiler-errors:rollup-emcj0o3, r=compiler-errors
Rollup of 8 pull requests Successful merges: - #104163 (Don't derive Debug for `OnceWith` & `RepeatWith`) - #106131 (Mention "signature" rather than "fn pointer" when impl/trait methods are incompatible) - #106363 (Structured suggestion for `&mut dyn Iterator` when possible) - #106497 (Suggest using clone when we have &T and T implemented Clone) - #106584 (Document that `Vec::from_raw_parts[_in]` must be given a pointer from the correct allocator.) - #106600 (Suppress type errors that come from private fields) - #106602 (Add goml scripts to tidy checks) - #106606 (Do not emit structured suggestion for turbofish with wrong span) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_parse/src')
| -rw-r--r-- | compiler/rustc_parse/src/parser/diagnostics.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs index b3231f55bc6..d9fa3e31db9 100644 --- a/compiler/rustc_parse/src/parser/diagnostics.rs +++ b/compiler/rustc_parse/src/parser/diagnostics.rs @@ -1104,7 +1104,11 @@ impl<'a> Parser<'a> { return if token::ModSep == self.token.kind { // We have some certainty that this was a bad turbofish at this point. // `foo< bar >::` - err.suggest_turbofish = Some(op.span.shrink_to_lo()); + if let ExprKind::Binary(o, ..) = inner_op.kind && o.node == BinOpKind::Lt { + err.suggest_turbofish = Some(op.span.shrink_to_lo()); + } else { + err.help_turbofish = Some(()); + } let snapshot = self.create_snapshot_for_diagnostic(); self.bump(); // `::` @@ -1130,7 +1134,11 @@ impl<'a> Parser<'a> { } else if token::OpenDelim(Delimiter::Parenthesis) == self.token.kind { // We have high certainty that this was a bad turbofish at this point. // `foo< bar >(` - err.suggest_turbofish = Some(op.span.shrink_to_lo()); + if let ExprKind::Binary(o, ..) = inner_op.kind && o.node == BinOpKind::Lt { + err.suggest_turbofish = Some(op.span.shrink_to_lo()); + } else { + err.help_turbofish = Some(()); + } // Consume the fn call arguments. match self.consume_fn_args() { Err(()) => Err(err.into_diagnostic(&self.sess.span_diagnostic)), |
