Skip to content

Commit d116859

Browse files
committed
--bless
1 parent cc752f5 commit d116859

13 files changed

+106
-89
lines changed
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
#![feature(impl_trait_in_fn_trait_return)]
12
use std::fmt::Debug;
23

34
fn a() -> impl Fn(&u8) -> impl Debug {
4-
|x| x //~ ERROR lifetime may not live long enough
5+
|x| x //~ ERROR hidden type for `impl Debug` captures lifetime that does not appear in bounds
56
}
67

78
fn main() {}
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
error: lifetime may not live long enough
2-
--> $DIR/impl-fn-hrtb-bounds-2.rs:4:9
1+
error[E0700]: hidden type for `impl Debug` captures lifetime that does not appear in bounds
2+
--> $DIR/impl-fn-hrtb-bounds-2.rs:5:9
33
|
44
LL | |x| x
5-
| -- ^ returning this value requires that `'1` must outlive `'2`
6-
| ||
7-
| |return type of closure is &'2 u8
8-
| has type `&'1 u8`
5+
| --- ^
6+
| |
7+
| hidden type `&u8` captures the anonymous lifetime #1 defined here
98

109
error: aborting due to previous error
1110

11+
For more information about this error, try `rustc --explain E0700`.

src/test/ui/impl-trait/impl-fn-hrtb-bounds.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![feature(impl_trait_in_fn_trait_return)]
12
use std::fmt::Debug;
23

34
fn a() -> impl Fn(&u8) -> (impl Debug + '_) {
Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,51 @@
1+
error[E0106]: missing lifetime specifier
2+
--> $DIR/impl-fn-hrtb-bounds.rs:19:38
3+
|
4+
LL | fn d() -> impl Fn() -> (impl Debug + '_) {
5+
| ^^ expected named lifetime parameter
6+
|
7+
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
8+
help: consider using the `'static` lifetime
9+
|
10+
LL | fn d() -> impl Fn() -> (impl Debug + 'static) {
11+
| ~~~~~~~
12+
113
error: higher kinded lifetime bounds on nested opaque types are not supported yet
2-
--> $DIR/impl-fn-hrtb-bounds.rs:3:41
14+
--> $DIR/impl-fn-hrtb-bounds.rs:4:41
315
|
416
LL | fn a() -> impl Fn(&u8) -> (impl Debug + '_) {
517
| ^^
618
|
719
note: lifetime declared here
8-
--> $DIR/impl-fn-hrtb-bounds.rs:3:19
20+
--> $DIR/impl-fn-hrtb-bounds.rs:4:19
921
|
1022
LL | fn a() -> impl Fn(&u8) -> (impl Debug + '_) {
1123
| ^
1224

1325
error: higher kinded lifetime bounds on nested opaque types are not supported yet
14-
--> $DIR/impl-fn-hrtb-bounds.rs:8:52
26+
--> $DIR/impl-fn-hrtb-bounds.rs:9:52
1527
|
1628
LL | fn b() -> impl for<'a> Fn(&'a u8) -> (impl Debug + 'a) {
1729
| ^^
1830
|
1931
note: lifetime declared here
20-
--> $DIR/impl-fn-hrtb-bounds.rs:8:20
32+
--> $DIR/impl-fn-hrtb-bounds.rs:9:20
2133
|
2234
LL | fn b() -> impl for<'a> Fn(&'a u8) -> (impl Debug + 'a) {
2335
| ^^
2436

2537
error: higher kinded lifetime bounds on nested opaque types are not supported yet
26-
--> $DIR/impl-fn-hrtb-bounds.rs:13:52
38+
--> $DIR/impl-fn-hrtb-bounds.rs:14:52
2739
|
2840
LL | fn c() -> impl for<'a> Fn(&'a u8) -> (impl Debug + '_) {
2941
| ^^
3042
|
3143
note: lifetime declared here
32-
--> $DIR/impl-fn-hrtb-bounds.rs:13:20
44+
--> $DIR/impl-fn-hrtb-bounds.rs:14:20
3345
|
3446
LL | fn c() -> impl for<'a> Fn(&'a u8) -> (impl Debug + '_) {
3547
| ^^
3648

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-
5449
error: aborting due to 4 previous errors
5550

5651
For more information about this error, try `rustc --explain E0106`.

src/test/ui/impl-trait/impl-fn-parsing-ambiguities.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![feature(impl_trait_in_fn_trait_return)]
12
use std::fmt::Debug;
23

34
fn a() -> impl Fn(&u8) -> impl Debug + '_ {

src/test/ui/impl-trait/impl-fn-parsing-ambiguities.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
error: ambiguous `+` in a type
2-
--> $DIR/impl-fn-parsing-ambiguities.rs:3:27
2+
--> $DIR/impl-fn-parsing-ambiguities.rs:4:27
33
|
44
LL | fn a() -> impl Fn(&u8) -> impl Debug + '_ {
55
| ^^^^^^^^^^^^^^^ help: use parentheses to disambiguate: `(impl Debug + '_)`
66

77
error: ambiguous `+` in a type
8-
--> $DIR/impl-fn-parsing-ambiguities.rs:9:24
8+
--> $DIR/impl-fn-parsing-ambiguities.rs:10:24
99
|
1010
LL | fn b() -> impl Fn() -> impl Debug + Send {
1111
| ^^^^^^^^^^^^^^^^^ help: use parentheses to disambiguate: `(impl Debug + Send)`
1212

1313
error: higher kinded lifetime bounds on nested opaque types are not supported yet
14-
--> $DIR/impl-fn-parsing-ambiguities.rs:3:40
14+
--> $DIR/impl-fn-parsing-ambiguities.rs:4:40
1515
|
1616
LL | fn a() -> impl Fn(&u8) -> impl Debug + '_ {
1717
| ^^
1818
|
1919
note: lifetime declared here
20-
--> $DIR/impl-fn-parsing-ambiguities.rs:3:19
20+
--> $DIR/impl-fn-parsing-ambiguities.rs:4:19
2121
|
2222
LL | fn a() -> impl Fn(&u8) -> impl Debug + '_ {
2323
| ^

src/test/ui/impl-trait/impl-fn-predefined-lifetimes.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
// check-pass
1+
#![feature(impl_trait_in_fn_trait_return)]
22
use std::fmt::Debug;
33

44
fn a<'a>() -> impl Fn(&'a u8) -> (impl Debug + '_) {
5+
//~^ ERROR hidden type for `impl Debug` captures lifetime that does not appear in bounds
56
|x| x
67
}
78

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error[E0700]: hidden type for `impl Debug` captures lifetime that does not appear in bounds
2+
--> $DIR/impl-fn-predefined-lifetimes.rs:4:35
3+
|
4+
LL | fn a<'a>() -> impl Fn(&'a u8) -> (impl Debug + '_) {
5+
| ^^^^^^^^^^^^^^^
6+
|
7+
note: hidden type `&'<empty> u8` captures lifetime smaller than the function body
8+
--> $DIR/impl-fn-predefined-lifetimes.rs:4:35
9+
|
10+
LL | fn a<'a>() -> impl Fn(&'a u8) -> (impl Debug + '_) {
11+
| ^^^^^^^^^^^^^^^
12+
13+
error: aborting due to previous error
14+
15+
For more information about this error, try `rustc --explain E0700`.

src/test/ui/impl-trait/impl_fn_associativity.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// run-pass
2+
#![feature(impl_trait_in_fn_trait_return)]
23
use std::fmt::Debug;
34

45
fn f_debug() -> impl Fn() -> impl Debug {

src/test/ui/impl-trait/nested_impl_trait.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![feature(impl_trait_in_fn_trait_return)]
12
use std::fmt::Debug;
23

34
fn fine(x: impl Into<u32>) -> impl Into<u32> { x }

0 commit comments

Comments
 (0)