]> git.lizzy.rs Git - rust.git/blob - src/test/ui/methods/method-call-err-msg.rs
review comment
[rust.git] / src / test / ui / methods / method-call-err-msg.rs
1 // Test that parameter cardinality or missing method error gets span exactly.
2
3 pub struct Foo;
4 impl Foo {
5     fn zero(self) -> Foo { self }
6     fn one(self, _: isize) -> Foo { self }
7     fn two(self, _: isize, _: isize) -> Foo { self }
8     fn three<T>(self, _: T, _: T, _: T) -> Foo { self }
9 }
10
11 fn main() {
12     let x = Foo;
13     x.zero(0)   //~ ERROR this function takes 0 arguments but 1 argument was supplied
14      .one()     //~ ERROR this function takes 1 argument but 0 arguments were supplied
15      .two(0);   //~ ERROR this function takes 2 arguments but 1 argument was supplied
16
17     let y = Foo;
18     y.zero()
19      .take()    //~ ERROR not an iterator
20      .one(0);
21     y.three::<usize>(); //~ ERROR this function takes 3 arguments but 0 arguments were supplied
22 }