]> git.lizzy.rs Git - rust.git/blob - src/test/parse-fail/regions-trait-3.rs
rollup merge of #24541: alexcrichton/issue-24538
[rust.git] / src / test / parse-fail / regions-trait-3.rs
1 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 // ignore-test
12 // ignore'd due to problems with by-value self.
13
14 // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
15 // file at the top-level directory of this distribution and at
16 // http://rust-lang.org/COPYRIGHT.
17 //
18 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
19 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
20 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
21 // option. This file may not be copied, modified, or distributed
22 // except according to those terms.
23
24 // compile-flags: -Z parse-only
25
26 trait get_ctxt<'a> {
27     fn get_ctxt(self) -> &'a usize;
28 }
29
30 fn make_gc1(gc: @get_ctxt<'a>) -> @get_ctxt<'b>  {
31     return gc; //~ ERROR mismatched types: expected `@get_ctxt/&b`, found `@get_ctxt/&a`
32 }
33
34 struct Foo {
35     r: &'a usize
36 }
37
38 impl get_ctxt for Foo<'a> {
39     fn get_ctxt(&self) -> &'a usize { self.r }
40 }
41
42 fn make_gc2<'a,'b>(foo: Foo<'a>) -> @get_ctxt<'b>  {
43     return @foo as @get_ctxt; //~ ERROR cannot infer
44 }
45
46 fn main() {
47 }