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.
|
|
|
|
|
2013-12-10 01:16:18 -06:00
|
|
|
trait get_ctxt<'a> {
|
|
|
|
fn get_ctxt(self) -> &'a uint;
|
2012-04-24 17:52:52 -05:00
|
|
|
}
|
|
|
|
|
2013-03-22 18:07:55 -05:00
|
|
|
fn make_gc1(gc: @get_ctxt<'a>) -> @get_ctxt<'b> {
|
2012-08-14 20:17:18 -05:00
|
|
|
return gc; //~ ERROR mismatched types: expected `@get_ctxt/&b` but found `@get_ctxt/&a`
|
2012-04-24 17:52:52 -05:00
|
|
|
}
|
|
|
|
|
2013-03-05 16:49:50 -06:00
|
|
|
struct Foo {
|
2013-12-10 01:16:18 -06:00
|
|
|
r: &'a uint
|
2013-03-05 16:49:50 -06:00
|
|
|
}
|
|
|
|
|
2013-12-10 01:16:18 -06:00
|
|
|
impl get_ctxt for Foo<'a> {
|
|
|
|
fn get_ctxt(&self) -> &'a uint { self.r }
|
2013-03-05 16:49:50 -06:00
|
|
|
}
|
|
|
|
|
2013-03-22 18:07:55 -05:00
|
|
|
fn make_gc2<'a,'b>(foo: Foo<'a>) -> @get_ctxt<'b> {
|
2013-03-12 15:00:50 -05:00
|
|
|
return @foo as @get_ctxt; //~ ERROR cannot infer an appropriate lifetime
|
2012-04-24 17:52:52 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
}
|