7

Improve error message for missing trait in trait impl by FabianWolff · Pull Requ...

 2 years ago
source link: https://github.com/rust-lang/rust/pull/88894
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Copy link

Contributor

FabianWolff commented on Sep 12

Fixes #88818. For the following example:

struct S { }
impl for S { }

the current output is:

error: missing trait in a trait impl
 --> t1.rs:2:5
  |
2 | impl for S { }
  |     ^

With my changes, I get:

error: missing trait in a trait impl
 --> t1.rs:2:5
  |
2 | impl for S { }
  |     ^
  |
help: add a trait here
  |
2 | impl Trait for S { }
  |      +++++
help: for an inherent impl, drop this `for`
  |
2 - impl for S { }
2 + impl S { }
  | 

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK