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 // revisions: angle paren ok elision
14 #![feature(rustc_attrs)]
15 #![feature(unboxed_closures)]
16 #![deny(hr_lifetime_in_assoc_type)]
23 fn angle<T: for<'a> Foo<Item=&'a i32>>() {
24 //[angle]~^ ERROR binding for associated type `Item` references lifetime `'a`
25 //[angle]~| WARNING previously accepted
29 fn angle1<T>() where T: for<'a> Foo<Item=&'a i32> {
30 //[angle]~^ ERROR binding for associated type `Item` references lifetime `'a`
31 //[angle]~| WARNING previously accepted
35 fn angle2<T>() where for<'a> T: Foo<Item=&'a i32> {
36 //[angle]~^ ERROR binding for associated type `Item` references lifetime `'a`
37 //[angle]~| WARNING previously accepted
41 fn angle3(_: &for<'a> Foo<Item=&'a i32>) {
42 //[angle]~^ ERROR binding for associated type `Item` references lifetime `'a`
43 //[angle]~| WARNING previously accepted
47 fn paren<T: for<'a> Fn() -> &'a i32>() {
48 //[paren]~^ ERROR binding for associated type `Output` references lifetime `'a`
49 //[paren]~| WARNING previously accepted
53 fn paren1<T>() where T: for<'a> Fn() -> &'a i32 {
54 //[paren]~^ ERROR binding for associated type `Output` references lifetime `'a`
55 //[paren]~| WARNING previously accepted
59 fn paren2<T>() where for<'a> T: Fn() -> &'a i32 {
60 //[paren]~^ ERROR binding for associated type `Output` references lifetime `'a`
61 //[paren]~| WARNING previously accepted
65 fn paren3(_: &for<'a> Fn() -> &'a i32) {
66 //[paren]~^ ERROR binding for associated type `Output` references lifetime `'a`
67 //[paren]~| WARNING previously accepted
71 fn elision<T: Fn() -> &i32>() {
72 //[elision]~^ ERROR E0106
75 struct Parameterized<'a> { x: &'a str }
78 fn ok1<T: for<'a> Fn(&Parameterized<'a>) -> &'a i32>() {
82 fn ok2<T: for<'a,'b> Fn<(&'b Parameterized<'a>,), Output=&'a i32>>() {
86 fn ok3<T>() where for<'a> Parameterized<'a>: Foo<Item=&'a i32> {
90 fn main() { } //[ok]~ ERROR compilation successful