2014-10-13 16:00:45 +13:00
|
|
|
// Test method calls with self as an argument cannot subvert type checking.
|
|
|
|
|
|
2025-04-05 19:19:56 +03:00
|
|
|
//@ dont-require-annotations: NOTE
|
|
|
|
|
|
2014-10-13 16:00:45 +13:00
|
|
|
struct Foo;
|
|
|
|
|
|
|
|
|
|
impl Foo {
|
|
|
|
|
fn bar(&self) {}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
|
let x = Foo;
|
2015-01-12 01:01:44 -05:00
|
|
|
Foo::bar(x); //~ ERROR mismatched types
|
2025-04-05 19:19:56 +03:00
|
|
|
//~| NOTE expected `&Foo`, found `Foo`
|
2015-03-03 10:42:26 +02:00
|
|
|
Foo::bar(&42); //~ ERROR mismatched types
|
2025-04-05 19:19:56 +03:00
|
|
|
//~| NOTE expected `&Foo`, found `&{integer}`
|
|
|
|
|
//~| NOTE expected reference `&Foo`
|
|
|
|
|
//~| NOTE found reference `&{integer}`
|
2014-10-13 16:00:45 +13:00
|
|
|
}
|