]> git.lizzy.rs Git - rust.git/blob - src/test/compile-fail/lifetime-inference-give-expl-lifetime-param-3.rs
Auto merge of #22541 - Manishearth:rollup, r=Gankro
[rust.git] / src / test / compile-fail / lifetime-inference-give-expl-lifetime-param-3.rs
1 // Copyright 2014 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 // ignore-tidy-linelength
12
13 use std::marker::PhantomData;
14
15 struct Bar<'x, 'y, 'z> { bar: &'y i32, baz: i32, marker: PhantomData<(&'x(),&'y(),&'z())> }
16 fn bar1<'a>(x: &Bar) -> (&'a i32, &'a i32, &'a i32) {
17 //~^ HELP: consider using an explicit lifetime parameter as shown: fn bar1<'b, 'c, 'a>(x: &'a Bar<'b, 'a, 'c>) -> (&'a i32, &'a i32, &'a i32)
18     (x.bar, &x.baz, &x.baz)
19     //~^ ERROR: cannot infer
20     //~^^ ERROR: cannot infer
21     //~^^^ ERROR: cannot infer
22 }
23
24 fn bar2<'a, 'b, 'c>(x: &Bar<'a, 'b, 'c>) -> (&'a i32, &'a i32, &'a i32) {
25 //~^ HELP: consider using an explicit lifetime parameter as shown: fn bar2<'a, 'c>(x: &'a Bar<'a, 'a, 'c>) -> (&'a i32, &'a i32, &'a i32)
26     (x.bar, &x.baz, &x.baz)
27     //~^ ERROR: cannot infer
28     //~^^ ERROR: cannot infer
29     //~^^^ ERROR: cannot infer
30 }
31
32 fn main() { }