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: func object clause
14 #![feature(rustc_attrs)]
15 #![deny(hr_lifetime_in_assoc_type)]
21 impl<'a> Foo<'a> for() {
25 // Check that appearing in a projection input in the argument is not enough:
27 fn func1(_: for<'a> fn(<() as Foo<'a>>::Item) -> &'a i32) {
28 //[func]~^ ERROR return type references lifetime `'a`
29 //[func]~| WARNING previously accepted
32 // Check that appearing in a projection input in the return still
35 fn func2(_: for<'a> fn() -> <() as Foo<'a>>::Item) {
36 //[func]~^ ERROR return type references lifetime `'a`
37 //[func]~| WARNING previously accepted
41 fn object1(_: Box<for<'a> Fn(<() as Foo<'a>>::Item) -> &'a i32>) {
42 //[object]~^ ERROR `Output` references lifetime `'a`
43 //[object]~| WARNING previously accepted
47 fn object2(_: Box<for<'a> Fn() -> <() as Foo<'a>>::Item>) {
48 //[object]~^ ERROR `Output` references lifetime `'a`
49 //[object]~| WARNING previously accepted
53 fn clause1<T>() where T: for<'a> Fn(<() as Foo<'a>>::Item) -> &'a i32 {
54 //[clause]~^ ERROR `Output` references lifetime `'a`
55 //[clause]~| WARNING previously accepted
59 fn clause2<T>() where T: for<'a> Fn() -> <() as Foo<'a>>::Item {
60 //[clause]~^ ERROR `Output` references lifetime `'a`
61 //[clause]~| WARNING previously accepted
65 fn main() { } //[ok]~ ERROR compilation successful