Skip to content

Commit cc33aec

Browse files
committed
Regression test for issue 55608.
1 parent 5aeb6c7 commit cc33aec

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// This used to ICE because it creates an `impl Trait` that captures a
2+
// hidden empty region.
3+
4+
#![feature(conservative_impl_trait)]
5+
6+
fn server() -> impl FilterBase2 { //~ ERROR [E0700]
7+
segment2(|| { loop { } }).map2(|| "")
8+
}
9+
10+
trait FilterBase2 {
11+
fn map2<F>(self, _fn: F) -> Map2<F> where Self: Sized { loop { } }
12+
}
13+
14+
struct Map2<F> { _func: F }
15+
16+
impl<F> FilterBase2 for Map2<F> { }
17+
18+
fn segment2<F>(_fn: F) -> Map2<F> where F: Fn() -> Result<(), ()> {
19+
loop { }
20+
}
21+
22+
fn main() { server(); }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
2+
--> $DIR/issue-55608-captures-empty-region.rs:6:16
3+
|
4+
LL | fn server() -> impl FilterBase2 { //~ ERROR [E0700]
5+
| ^^^^^^^^^^^^^^^^
6+
|
7+
= note: hidden type `Map2<[closure@$DIR/issue-55608-captures-empty-region.rs:7:36: 7:41]>` captures an empty lifetime
8+
9+
error: aborting due to previous error
10+
11+
For more information about this error, try `rustc --explain E0700`.

0 commit comments

Comments
 (0)