diff options
Diffstat (limited to 'tests/ui/methods')
-rw-r--r-- | tests/ui/methods/issue-3707.rs | 18 | ||||
-rw-r--r-- | tests/ui/methods/issue-3707.stderr | 19 | ||||
-rw-r--r-- | tests/ui/methods/issues/issue-61525.stderr | 4 | ||||
-rw-r--r-- | tests/ui/methods/method-missing-call.stderr | 2 |
4 files changed, 40 insertions, 3 deletions
diff --git a/tests/ui/methods/issue-3707.rs b/tests/ui/methods/issue-3707.rs new file mode 100644 index 000000000..0817c51ee --- /dev/null +++ b/tests/ui/methods/issue-3707.rs @@ -0,0 +1,18 @@ +struct Obj { + member: usize +} + +impl Obj { + pub fn boom() -> bool { + return 1+1 == 2 + } + pub fn chirp(&self) { + self.boom(); //~ ERROR no method named `boom` found + } +} + +fn main() { + let o = Obj { member: 0 }; + o.chirp(); + 1 + 1; +} diff --git a/tests/ui/methods/issue-3707.stderr b/tests/ui/methods/issue-3707.stderr new file mode 100644 index 000000000..07c8101cb --- /dev/null +++ b/tests/ui/methods/issue-3707.stderr @@ -0,0 +1,19 @@ +error[E0599]: no method named `boom` found for reference `&Obj` in the current scope + --> $DIR/issue-3707.rs:10:14 + | +LL | self.boom(); + | -----^^^^-- + | | | + | | this is an associated function, not a method + | help: use associated function syntax instead: `Obj::boom()` + | + = note: found the following associated functions; to be used as methods, functions must have a `self` parameter +note: the candidate is defined in an impl for the type `Obj` + --> $DIR/issue-3707.rs:6:5 + | +LL | pub fn boom() -> bool { + | ^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/methods/issues/issue-61525.stderr b/tests/ui/methods/issues/issue-61525.stderr index a8afdeb84..a329b52e3 100644 --- a/tests/ui/methods/issues/issue-61525.stderr +++ b/tests/ui/methods/issues/issue-61525.stderr @@ -1,8 +1,8 @@ error[E0277]: the size for values of type `dyn ToString` cannot be known at compilation time - --> $DIR/issue-61525.rs:14:33 + --> $DIR/issue-61525.rs:14:19 | LL | 1.query::<dyn ToString>("") - | ----- ^^ doesn't have a size known at compile-time + | ----- ^^^^^^^^^^^^ doesn't have a size known at compile-time | | | required by a bound introduced by this call | diff --git a/tests/ui/methods/method-missing-call.stderr b/tests/ui/methods/method-missing-call.stderr index 040a65d16..bc508461b 100644 --- a/tests/ui/methods/method-missing-call.stderr +++ b/tests/ui/methods/method-missing-call.stderr @@ -9,7 +9,7 @@ help: use parentheses to call the method LL | .get_x(); | ++ -error[E0615]: attempted to take value of method `filter_map` on type `Filter<Map<std::slice::Iter<'_, {integer}>, [closure@$DIR/method-missing-call.rs:27:20: 27:23]>, [closure@$DIR/method-missing-call.rs:28:23: 28:28]>` +error[E0615]: attempted to take value of method `filter_map` on type `Filter<Map<std::slice::Iter<'_, {integer}>, {closure@$DIR/method-missing-call.rs:27:20: 27:23}>, {closure@$DIR/method-missing-call.rs:28:23: 28:28}>` --> $DIR/method-missing-call.rs:29:16 | LL | .filter_map; |