1 // Copyright 2016 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 #![feature(conservative_impl_trait)]
13 // Helper creating a fake borrow, captured by the impl Trait.
14 fn borrow<'a, T>(_: &'a mut T) -> impl Copy { () }
16 fn stack() -> impl Copy {
17 //~^ ERROR only named lifetimes are allowed in `impl Trait`
22 fn late_bound(x: &i32) -> impl Copy {
23 //~^ ERROR only named lifetimes are allowed in `impl Trait`
27 // FIXME(#34511) Should work but doesn't at the moment,
28 // region-checking needs an overhault to support this.
29 fn early_bound<'a>(x: &'a i32) -> impl Copy {
30 //~^ ERROR only named lifetimes are allowed in `impl Trait`
34 fn ambiguous<'a, 'b>(x: &'a [u32], y: &'b [u32]) -> impl Iterator<Item=u32> {
35 //~^ ERROR only named lifetimes are allowed in `impl Trait`
36 if x.len() < y.len() {