Files
rust/tests/ui/methods/method-self-arg-1.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

20 lines
527 B
Rust
Raw Normal View History

2014-10-13 16:00:45 +13:00
// Test method calls with self as an argument cannot subvert type checking.
//@ 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
//~| NOTE expected `&Foo`, found `Foo`
Foo::bar(&42); //~ ERROR mismatched types
//~| NOTE expected `&Foo`, found `&{integer}`
//~| NOTE expected reference `&Foo`
//~| NOTE found reference `&{integer}`
2014-10-13 16:00:45 +13:00
}