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: sig local structure ok elision
14 #![feature(rustc_attrs)]
15 #![feature(unboxed_closures)]
16 #![deny(hr_lifetime_in_assoc_type)]
23 fn sig1(_: for<'a> fn() -> &'a i32) {
24 //[sig]~^ ERROR return type references lifetime `'a`
25 //[sig]~| WARNING previously accepted
29 fn sig2(_: for<'a, 'b> fn(&'b i32) -> &'a i32) {
30 //[sig]~^ ERROR return type references lifetime `'a`
31 //[sig]~| WARNING previously accepted
36 let _: for<'a> fn() -> &'a i32 = loop { };
37 //[local]~^ ERROR return type references lifetime `'a`
38 //[local]~| WARNING previously accepted
43 x: for<'a> fn() -> &'a i32
44 //[structure]~^ ERROR return type references lifetime `'a`
45 //[structure]~| WARNING previously accepted
49 fn elision(_: fn() -> &i32) {
50 //[elision]~^ ERROR E0106
53 struct Parameterized<'a> { x: &'a str }
56 fn ok1(_: &for<'a> Fn(&Parameterized<'a>) -> &'a i32) {
60 fn ok2(_: &for<'a,'b> Fn<(&'b Parameterized<'a>,), Output=&'a i32>) {
64 fn main() { } //[ok]~ ERROR compilation successful