1 // Copyright 2017 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.
13 // Make sure this related feature didn't accidentally enable this
14 #![feature(impl_header_lifetime_elision)]
16 fn foo(x: &'x u8) -> &'x u8 { x }
17 //~^ ERROR use of undeclared lifetime name
18 //~^^ ERROR use of undeclared lifetime name
23 fn inner(&self) -> &'a u8 {
29 //~^ ERROR use of undeclared lifetime name
30 fn inner_2(&self) -> &'b u8 {
31 //~^ ERROR use of undeclared lifetime name
37 //~^ ERROR use of undeclared lifetime name
38 fn inner_3(&self) -> &'b u8 {
39 //~^ ERROR use of undeclared lifetime name
47 //~^ ERROR use of undeclared lifetime name
48 fn inner(&self) -> &'a u8 {
49 //~^ ERROR use of undeclared lifetime name
55 fn my_lifetime(&self) -> &'a u8;
56 fn any_lifetime() -> &'b u8;
57 //~^ ERROR use of undeclared lifetime name
58 fn borrowed_lifetime(&'b self) -> &'b u8;
59 //~^ ERROR use of undeclared lifetime name
60 //~^^ ERROR use of undeclared lifetime name
63 impl MyTrait<'a> for Y<&'a u8> {
64 //~^ ERROR use of undeclared lifetime name
65 //~^^ ERROR use of undeclared lifetime name
66 fn my_lifetime(&self) -> &'a u8 { self.0 }
67 //~^ ERROR use of undeclared lifetime name
68 fn any_lifetime() -> &'b u8 { &0 }
69 //~^ ERROR use of undeclared lifetime name
70 fn borrowed_lifetime(&'b self) -> &'b u8 { &*self.0 }
71 //~^ ERROR use of undeclared lifetime name
72 //~^^ ERROR use of undeclared lifetime name