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.
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.
11 // Test that we correctly infer variance for region parameters in
12 // case that involve multiple intricate types.
15 #![feature(rustc_attrs)]
18 enum Base<'a, 'b, 'c:'b, 'd> { //~ ERROR regions=[[+, -, o, *];[];[]]
19 Test8A(extern "Rust" fn(&'a isize)),
21 Test8C(&'b mut &'c str),
25 struct Derived1<'w, 'x:'y, 'y, 'z> { //~ ERROR regions=[[*, o, -, +];[];[]]
26 f: Base<'z, 'y, 'x, 'w>
29 #[rustc_variance] // Combine - and + to yield o
30 struct Derived2<'a, 'b:'a, 'c> { //~ ERROR regions=[[o, o, *];[];[]]
31 f: Base<'a, 'a, 'b, 'c>
34 #[rustc_variance] // Combine + and o to yield o (just pay attention to 'a here)
35 struct Derived3<'a:'b, 'b, 'c> { //~ ERROR regions=[[o, -, *];[];[]]
36 f: Base<'a, 'b, 'a, 'c>
39 #[rustc_variance] // Combine + and * to yield + (just pay attention to 'a here)
40 struct Derived4<'a, 'b, 'c:'b> { //~ ERROR regions=[[+, -, o];[];[]]
41 f: Base<'a, 'b, 'c, 'a>