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 //~^ ERROR parameter `'d` is never used
20 Test8A(extern "Rust" fn(&'a isize)),
22 Test8C(&'b mut &'c str),
26 struct Derived1<'w, 'x:'y, 'y, 'z> { //~ ERROR regions=[*, o, -, +]
27 //~^ ERROR parameter `'w` is never used
28 f: Base<'z, 'y, 'x, 'w>
31 #[rustc_variance] // Combine - and + to yield o
32 struct Derived2<'a, 'b:'a, 'c> { //~ ERROR regions=[o, o, *]
33 //~^ ERROR parameter `'c` is never used
34 f: Base<'a, 'a, 'b, 'c>
37 #[rustc_variance] // Combine + and o to yield o (just pay attention to 'a here)
38 struct Derived3<'a:'b, 'b, 'c> { //~ ERROR regions=[o, -, *]
39 //~^ ERROR parameter `'c` is never used
40 f: Base<'a, 'b, 'a, 'c>
43 #[rustc_variance] // Combine + and * to yield + (just pay attention to 'a here)
44 struct Derived4<'a, 'b, 'c:'b> { //~ ERROR regions=[+, -, o]
45 f: Base<'a, 'b, 'c, 'a>