]> git.lizzy.rs Git - rust.git/blob - src/test/ui/methods/method-self-arg-1.rs
move an `assert!` to the right place
[rust.git] / src / test / ui / methods / method-self-arg-1.rs
1 // Test method calls with self as an argument cannot subvert type checking.
2
3 struct Foo;
4
5 impl Foo {
6     fn bar(&self) {}
7 }
8
9 fn main() {
10     let x = Foo;
11     Foo::bar(x); //~  ERROR mismatched types
12                  //~| expected `&Foo`, found struct `Foo`
13     Foo::bar(&42); //~  ERROR mismatched types
14                       //~| expected struct `Foo`, found integer
15                       //~| expected reference `&Foo`
16                       //~| found reference `&{integer}`
17 }