2013-03-13 19:57:30 -05:00
|
|
|
// xfail-test
|
|
|
|
// xfail'd due to problems with by value self.
|
|
|
|
|
2012-12-10 19:32:48 -06:00
|
|
|
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
2012-07-11 12:28:30 -05:00
|
|
|
// Here: foo is parameterized because it contains a method that
|
|
|
|
// refers to self.
|
|
|
|
|
2013-12-10 01:16:18 -06:00
|
|
|
trait foo<'a> {
|
|
|
|
fn self_int(self) -> &'a int;
|
2012-07-11 12:28:30 -05:00
|
|
|
|
2013-03-13 19:57:30 -05:00
|
|
|
fn any_int(self) -> ∫
|
2012-07-11 12:28:30 -05:00
|
|
|
}
|
|
|
|
|
2013-12-10 01:16:18 -06:00
|
|
|
struct with_foo<'a> {
|
|
|
|
f: @foo<'a>
|
2013-02-22 18:08:16 -06:00
|
|
|
}
|
2012-07-11 12:28:30 -05:00
|
|
|
|
2012-07-11 17:00:40 -05:00
|
|
|
trait set_foo_foo {
|
2013-02-26 13:34:00 -06:00
|
|
|
fn set_foo(&mut self, f: @foo);
|
2012-07-11 17:00:40 -05:00
|
|
|
}
|
|
|
|
|
2013-12-10 01:16:18 -06:00
|
|
|
impl<'a> set_foo_foo for with_foo<'a> {
|
2013-02-26 13:34:00 -06:00
|
|
|
fn set_foo(&mut self, f: @foo) {
|
2012-08-14 20:17:18 -05:00
|
|
|
self.f = f; //~ ERROR mismatched types: expected `@foo/&self` but found `@foo/&`
|
2012-07-11 12:28:30 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Bar is not region parameterized.
|
|
|
|
|
2012-07-31 12:27:51 -05:00
|
|
|
trait bar {
|
2013-03-12 21:32:14 -05:00
|
|
|
fn any_int(&self) -> ∫
|
2012-07-11 12:28:30 -05:00
|
|
|
}
|
|
|
|
|
2013-02-22 18:08:16 -06:00
|
|
|
struct with_bar {
|
|
|
|
f: bar
|
|
|
|
}
|
2012-07-11 12:28:30 -05:00
|
|
|
|
2012-07-11 17:00:40 -05:00
|
|
|
trait set_foo_bar {
|
2013-02-22 18:08:16 -06:00
|
|
|
fn set_foo(&mut self, f: bar);
|
2012-07-11 17:00:40 -05:00
|
|
|
}
|
|
|
|
|
2013-02-14 13:47:00 -06:00
|
|
|
impl set_foo_bar for with_bar {
|
2013-02-22 18:08:16 -06:00
|
|
|
fn set_foo(&mut self, f: bar) {
|
2012-07-11 12:28:30 -05:00
|
|
|
self.f = f;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-11 17:00:40 -05:00
|
|
|
fn main() {}
|