]> git.lizzy.rs Git - rust.git/blob - src/test/compile-fail/regions-infer-paramd-indirect.rs
Convert most code to new inner attribute syntax.
[rust.git] / src / test / compile-fail / regions-infer-paramd-indirect.rs
1 // Copyright 2012 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 #![feature(managed_boxes)]
12
13 // Check that we correctly infer that b and c must be region
14 // parameterized because they reference a which requires a region.
15
16 type a<'a> = &'a int;
17 type b<'a> = @a<'a>;
18
19 struct c<'a> {
20     f: @b<'a>
21 }
22
23 trait set_f<'a> {
24     fn set_f_ok(&self, b: @b<'a>);
25     fn set_f_bad(&self, b: @b);
26 }
27
28 impl<'a> set_f<'a> for c<'a> {
29     fn set_f_ok(&self, b: @b<'a>) {
30         self.f = b;
31     }
32
33     fn set_f_bad(&self, b: @b) {
34         self.f = b; //~ ERROR mismatched types: expected `@@&'a int` but found `@@&int`
35         //~^ ERROR cannot infer
36     }
37 }
38
39 fn main() {}