2012-07-11 12:28:30 -05:00
|
|
|
// Here: foo is parameterized because it contains a method that
|
|
|
|
// refers to self.
|
|
|
|
|
|
|
|
iface foo {
|
2012-07-12 11:36:56 -05:00
|
|
|
fn self_int() -> &self/int;
|
2012-07-11 12:28:30 -05:00
|
|
|
|
|
|
|
fn any_int() -> ∫
|
|
|
|
}
|
|
|
|
|
|
|
|
type with_foo = {mut f: foo};
|
|
|
|
|
2012-07-11 17:00:40 -05:00
|
|
|
trait set_foo_foo {
|
|
|
|
fn set_foo(f: foo);
|
|
|
|
}
|
|
|
|
|
|
|
|
impl methods of set_foo_foo for with_foo {
|
2012-07-11 12:28:30 -05:00
|
|
|
fn set_foo(f: foo) {
|
|
|
|
self.f = f; //~ ERROR mismatched types: expected `foo/&self` but found `foo/&`
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Bar is not region parameterized.
|
|
|
|
|
|
|
|
iface bar {
|
|
|
|
fn any_int() -> ∫
|
|
|
|
}
|
|
|
|
|
|
|
|
type with_bar = {mut f: bar};
|
|
|
|
|
2012-07-11 17:00:40 -05:00
|
|
|
trait set_foo_bar {
|
|
|
|
fn set_foo(f: bar);
|
|
|
|
}
|
|
|
|
|
|
|
|
impl methods of set_foo_bar for with_bar {
|
2012-07-11 12:28:30 -05:00
|
|
|
fn set_foo(f: bar) {
|
|
|
|
self.f = f;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-11 17:00:40 -05:00
|
|
|
fn main() {}
|