2012-07-11 12:28:30 -05:00
|
|
|
// Here: foo is parameterized because it contains a method that
|
|
|
|
// refers to self.
|
|
|
|
|
2012-07-31 12:27:51 -05:00
|
|
|
trait 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);
|
|
|
|
}
|
|
|
|
|
2012-08-07 20:10:06 -05:00
|
|
|
impl with_foo: set_foo_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.
|
|
|
|
|
2012-07-31 12:27:51 -05:00
|
|
|
trait bar {
|
2012-07-11 12:28:30 -05:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2012-08-07 20:10:06 -05:00
|
|
|
impl with_bar: set_foo_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() {}
|