]> git.proxmox.com Git - rustc.git/blame - src/test/compile-fail/regions-infer-paramd-indirect.rs
Imported Upstream version 0.7
[rustc.git] / src / test / compile-fail / regions-infer-paramd-indirect.rs
CommitLineData
223e47cc
LB
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// Check that we correctly infer that b and c must be region
12// parameterized because they reference a which requires a region.
13
14type a<'self> = &'self int;
15type b<'self> = @a<'self>;
16
17struct c<'self> {
18 f: @b<'self>
19}
20
970d7e83 21trait set_f<'self> {
223e47cc
LB
22 fn set_f_ok(&self, b: @b<'self>);
23 fn set_f_bad(&self, b: @b);
24}
25
970d7e83 26impl<'self> set_f<'self> for c<'self> {
223e47cc
LB
27 fn set_f_ok(&self, b: @b<'self>) {
28 self.f = b;
29 }
30
31 fn set_f_bad(&self, b: @b) {
32 self.f = b; //~ ERROR mismatched types: expected `@@&'self int` but found `@@&int`
33 }
34}
35
36fn main() {}