File tree 3 files changed +53
-1
lines changed
3 files changed +53
-1
lines changed Original file line number Diff line number Diff line change @@ -10,4 +10,14 @@ fn b() -> impl for<'a> Fn(&'a u8) -> (impl Debug + 'a) {
10
10
|x| x
11
11
}
12
12
13
+ fn c ( ) -> impl for < ' a > Fn ( & ' a u8 ) -> ( impl Debug + ' _ ) {
14
+ //~^ ERROR higher kinded lifetime bounds on nested opaque types are not supported yet
15
+ |x| x
16
+ }
17
+
18
+ fn d ( ) -> impl Fn ( ) -> ( impl Debug + ' _ ) {
19
+ //~^ ERROR missing lifetime specifier
20
+ || ( )
21
+ }
22
+
13
23
fn main ( ) { }
Original file line number Diff line number Diff line change @@ -22,5 +22,35 @@ note: lifetime declared here
22
22
LL | fn b() -> impl for<'a> Fn(&'a u8) -> (impl Debug + 'a) {
23
23
| ^^
24
24
25
- error: aborting due to 2 previous errors
25
+ error: higher kinded lifetime bounds on nested opaque types are not supported yet
26
+ --> $DIR/impl-fn-hrtb-bounds.rs:13:52
27
+ |
28
+ LL | fn c() -> impl for<'a> Fn(&'a u8) -> (impl Debug + '_) {
29
+ | ^^
30
+ |
31
+ note: lifetime declared here
32
+ --> $DIR/impl-fn-hrtb-bounds.rs:13:20
33
+ |
34
+ LL | fn c() -> impl for<'a> Fn(&'a u8) -> (impl Debug + '_) {
35
+ | ^^
36
+
37
+ error[E0106]: missing lifetime specifier
38
+ --> $DIR/impl-fn-hrtb-bounds.rs:18:38
39
+ |
40
+ LL | fn d() -> impl Fn() -> (impl Debug + '_) {
41
+ | ^^ expected named lifetime parameter
42
+ |
43
+ = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
44
+ = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html
45
+ help: consider making the bound lifetime-generic with a new `'a` lifetime
46
+ |
47
+ LL | fn d() -> impl for<'a> Fn() -> (impl Debug + 'a) {
48
+ | +++++++ ~~
49
+ help: consider using the `'static` lifetime
50
+ |
51
+ LL | fn d() -> impl Fn() -> (impl Debug + 'static) {
52
+ | ~~~~~~~
53
+
54
+ error: aborting due to 4 previous errors
26
55
56
+ For more information about this error, try `rustc --explain E0106`.
Original file line number Diff line number Diff line change
1
+ // check-pass
2
+ use std:: fmt:: Debug ;
3
+
4
+ fn a < ' a > ( ) -> impl Fn ( & ' a u8 ) -> ( impl Debug + ' _ ) {
5
+ |x| x
6
+ }
7
+
8
+ fn _b < ' a > ( ) -> impl Fn ( & ' a u8 ) -> ( impl Debug + ' a ) {
9
+ a ( )
10
+ }
11
+
12
+ fn main ( ) { }
You can’t perform that action at this time.
0 commit comments