Rollup merge of #71188 - Duddino:fix, r=matthewjasper

Fixed missing trait method suggests incorrect code (self parameter not named "self").

fixes #71150
This commit is contained in:
Dylan DPC 2020-04-19 15:12:38 +02:00 committed by GitHub
commit 36791dabe8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 10 deletions

View file

@ -2,4 +2,8 @@ pub trait X {
const CONSTANT: u32;
type Type;
fn method(&self, s: String) -> Self::Type;
fn method2(self: Box<Self>, s: String) -> Self::Type;
fn method3(other: &Self, s: String) -> Self::Type;
fn method4(&self, other: &Self) -> Self::Type;
fn method5(self: &Box<Self>) -> Self::Type;
}

View file

@ -1,12 +1,16 @@
error[E0046]: not all trait items implemented, missing: `CONSTANT`, `Type`, `method`
error[E0046]: not all trait items implemented, missing: `CONSTANT`, `Type`, `method`, `method2`, `method3`, `method4`, `method5`
--> $DIR/m2.rs:9:1
|
LL | impl m1::X for X {
| ^^^^^^^^^^^^^^^^ missing `CONSTANT`, `Type`, `method` in implementation
| ^^^^^^^^^^^^^^^^ missing `CONSTANT`, `Type`, `method`, `method2`, `method3`, `method4`, `method5` in implementation
|
= help: implement the missing item: `const CONSTANT: u32 = 42;`
= help: implement the missing item: `type Type = Type;`
= help: implement the missing item: `fn method(&self, _: std::string::String) -> <Self as m1::X>::Type { todo!() }`
= help: implement the missing item: `fn method2(self: std::boxed::Box<Self>, _: std::string::String) -> <Self as m1::X>::Type { todo!() }`
= help: implement the missing item: `fn method3(_: &Self, _: std::string::String) -> <Self as m1::X>::Type { todo!() }`
= help: implement the missing item: `fn method4(&self, _: &Self) -> <Self as m1::X>::Type { todo!() }`
= help: implement the missing item: `fn method5(self: &std::boxed::Box<Self>) -> <Self as m1::X>::Type { todo!() }`
error: aborting due to previous error