]> git.proxmox.com Git - rustc.git/blame - src/test/ui/nll/ty-outlives/ty-param-fn.rs
New upstream version 1.63.0+dfsg1
[rustc.git] / src / test / ui / nll / ty-outlives / ty-param-fn.rs
CommitLineData
ff7c6d11 1#![allow(warnings)]
ff7c6d11
XL
2
3use std::fmt::Debug;
4
5fn no_region<'a, T>(x: Box<T>) -> Box<Debug + 'a>
6where
7 T: Debug,
8{
9 x
b7449926 10 //~^ ERROR the parameter type `T` may not live long enough
ff7c6d11
XL
11}
12
13fn correct_region<'a, T>(x: Box<T>) -> Box<Debug + 'a>
14where
15 T: 'a + Debug,
16{
17 x
18}
19
20fn wrong_region<'a, 'b, T>(x: Box<T>) -> Box<Debug + 'a>
21where
22 T: 'b + Debug,
23{
24 x
b7449926 25 //~^ ERROR the parameter type `T` may not live long enough
ff7c6d11
XL
26}
27
28fn outlives_region<'a, 'b, T>(x: Box<T>) -> Box<Debug + 'a>
29where
30 T: 'b + Debug,
31 'b: 'a,
32{
33 x
34}
35
36fn main() {}