diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/mismatched_types/E0053.stderr | 2 | ||||
| -rw-r--r-- | tests/ui/mismatched_types/issue-112036.rs | 7 | ||||
| -rw-r--r-- | tests/ui/mismatched_types/issue-112036.stderr | 15 | ||||
| -rw-r--r-- | tests/ui/suggestions/issue-103646.rs | 11 | ||||
| -rw-r--r-- | tests/ui/suggestions/issue-103646.stderr | 21 |
5 files changed, 55 insertions, 1 deletions
diff --git a/tests/ui/mismatched_types/E0053.stderr b/tests/ui/mismatched_types/E0053.stderr index 154f2fcbee0..d0bd5b46cf5 100644 --- a/tests/ui/mismatched_types/E0053.stderr +++ b/tests/ui/mismatched_types/E0053.stderr @@ -22,7 +22,7 @@ LL | fn bar(&mut self) { } | ^^^^^^^^^ | | | types differ in mutability - | help: change the self-receiver type to match the trait: `self: &Bar` + | help: change the self-receiver type to match the trait: `&self` | note: type in trait --> $DIR/E0053.rs:3:12 diff --git a/tests/ui/mismatched_types/issue-112036.rs b/tests/ui/mismatched_types/issue-112036.rs new file mode 100644 index 00000000000..e63471e9747 --- /dev/null +++ b/tests/ui/mismatched_types/issue-112036.rs @@ -0,0 +1,7 @@ +struct Foo; + +impl Drop for Foo { + fn drop(self) {} //~ ERROR method `drop` has an incompatible type for trait +} + +fn main() {} diff --git a/tests/ui/mismatched_types/issue-112036.stderr b/tests/ui/mismatched_types/issue-112036.stderr new file mode 100644 index 00000000000..a883aba35bf --- /dev/null +++ b/tests/ui/mismatched_types/issue-112036.stderr @@ -0,0 +1,15 @@ +error[E0053]: method `drop` has an incompatible type for trait + --> $DIR/issue-112036.rs:4:13 + | +LL | fn drop(self) {} + | ^^^^ + | | + | expected `&mut Foo`, found `Foo` + | help: change the self-receiver type to match the trait: `&mut self` + | + = note: expected signature `fn(&mut Foo)` + found signature `fn(Foo)` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0053`. diff --git a/tests/ui/suggestions/issue-103646.rs b/tests/ui/suggestions/issue-103646.rs new file mode 100644 index 00000000000..f679640c5dc --- /dev/null +++ b/tests/ui/suggestions/issue-103646.rs @@ -0,0 +1,11 @@ +trait Cat { + fn nya() {} +} + +fn uwu<T: Cat>(c: T) { + c.nya(); + //~^ ERROR no method named `nya` found for type parameter `T` in the current scope + //~| Suggestion T::nya() +} + +fn main() {} diff --git a/tests/ui/suggestions/issue-103646.stderr b/tests/ui/suggestions/issue-103646.stderr new file mode 100644 index 00000000000..3ae9813d491 --- /dev/null +++ b/tests/ui/suggestions/issue-103646.stderr @@ -0,0 +1,21 @@ +error[E0599]: no method named `nya` found for type parameter `T` in the current scope + --> $DIR/issue-103646.rs:6:7 + | +LL | fn uwu<T: Cat>(c: T) { + | - method `nya` not found for this type parameter +LL | c.nya(); + | --^^^-- + | | | + | | this is an associated function, not a method + | help: use associated function syntax instead: `T::nya()` + | + = note: found the following associated functions; to be used as methods, functions must have a `self` parameter +note: the candidate is defined in the trait `Cat` + --> $DIR/issue-103646.rs:2:5 + | +LL | fn nya() {} + | ^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. |
