diff options
| author | bors <bors@rust-lang.org> | 2021-09-14 08:46:22 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-09-14 08:46:22 +0000 |
| commit | ec9a1bdc4586eec99acbe34df3717b3fd1277b06 (patch) | |
| tree | 1b45d045bf596184c37ae58cefb2d04fbf43d8fd /compiler/rustc_parse/src/parser | |
| parent | 9f85cd6f2ab2769c16e89dcdddb3e11d9736b351 (diff) | |
| parent | fb673bfdaafc903c351c2d0f7fdf665cb4ee3d8f (diff) | |
| download | rust-ec9a1bdc4586eec99acbe34df3717b3fd1277b06.tar.gz rust-ec9a1bdc4586eec99acbe34df3717b3fd1277b06.zip | |
Auto merge of #88914 - GuillaumeGomez:rollup-h5svc6w, r=GuillaumeGomez
Rollup of 7 pull requests Successful merges: - #88033 (Add links for primitives in "jump to definition" feature) - #88722 (Make `UnsafeCell::get_mut` const) - #88851 (Fix duplicate bounds for const_trait_impl) - #88859 (interpreter PointerArithmetic: use new Size helper methods) - #88885 (Fix jump def background) - #88894 (Improve error message for missing trait in trait impl) - #88896 (Reduce possibility of flaky tests) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_parse/src/parser')
| -rw-r--r-- | compiler/rustc_parse/src/parser/item.rs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs index 10c73fd64bc..04a7948e8c9 100644 --- a/compiler/rustc_parse/src/parser/item.rs +++ b/compiler/rustc_parse/src/parser/item.rs @@ -493,7 +493,20 @@ impl<'a> Parser<'a> { let ty_first = if self.token.is_keyword(kw::For) && self.look_ahead(1, |t| t != &token::Lt) { let span = self.prev_token.span.between(self.token.span); - self.struct_span_err(span, "missing trait in a trait impl").emit(); + self.struct_span_err(span, "missing trait in a trait impl") + .span_suggestion( + span, + "add a trait here", + " Trait ".into(), + Applicability::HasPlaceholders, + ) + .span_suggestion( + span.to(self.token.span), + "for an inherent impl, drop this `for`", + "".into(), + Applicability::MaybeIncorrect, + ) + .emit(); P(Ty { kind: TyKind::Path(None, err_path(span)), span, |
