]> git.lizzy.rs Git - rust.git/blob - src/test/compile-fail/associated-types/bound-lifetime-in-return-only.rs
Unignore u128 test for stage 0,1
[rust.git] / src / test / compile-fail / associated-types / bound-lifetime-in-return-only.rs
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.
4 //
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.
10
11 // revisions: sig local structure ok elision
12
13 #![allow(dead_code)]
14 #![feature(rustc_attrs)]
15 #![feature(unboxed_closures)]
16 #![deny(hr_lifetime_in_assoc_type)]
17
18 trait Foo {
19     type Item;
20 }
21
22 #[cfg(sig)]
23 fn sig1(_: for<'a> fn() -> &'a i32) {
24     //[sig]~^ ERROR return type references lifetime `'a`
25     //[sig]~| WARNING previously accepted
26 }
27
28 #[cfg(sig)]
29 fn sig2(_: for<'a, 'b> fn(&'b i32) -> &'a i32) {
30     //[sig]~^ ERROR return type references lifetime `'a`
31     //[sig]~| WARNING previously accepted
32 }
33
34 #[cfg(local)]
35 fn local1() {
36     let _: for<'a> fn() -> &'a i32 = loop { };
37     //[local]~^ ERROR return type references lifetime `'a`
38     //[local]~| WARNING previously accepted
39 }
40
41 #[cfg(structure)]
42 struct Struct1 {
43     x: for<'a> fn() -> &'a i32
44     //[structure]~^ ERROR return type references lifetime `'a`
45     //[structure]~| WARNING previously accepted
46 }
47
48 #[cfg(elision)]
49 fn elision(_: fn() -> &i32) {
50     //[elision]~^ ERROR E0106
51 }
52
53 struct Parameterized<'a> { x: &'a str }
54
55 #[cfg(ok)]
56 fn ok1(_: &for<'a> Fn(&Parameterized<'a>) -> &'a i32) {
57 }
58
59 #[cfg(ok)]
60 fn ok2(_: &for<'a,'b> Fn<(&'b Parameterized<'a>,), Output=&'a i32>) {
61 }
62
63 #[rustc_error]
64 fn main() { } //[ok]~ ERROR compilation successful