-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
src/test/ui/impl-trait/issue-55608-captures-empty-region.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// This used to ICE because it creates an `impl Trait` that captures a | ||
// hidden empty region. | ||
|
||
#![feature(conservative_impl_trait)] | ||
|
||
fn server() -> impl FilterBase2 { //~ ERROR [E0700] | ||
segment2(|| { loop { } }).map2(|| "") | ||
} | ||
|
||
trait FilterBase2 { | ||
fn map2<F>(self, _fn: F) -> Map2<F> where Self: Sized { loop { } } | ||
} | ||
|
||
struct Map2<F> { _func: F } | ||
|
||
impl<F> FilterBase2 for Map2<F> { } | ||
|
||
fn segment2<F>(_fn: F) -> Map2<F> where F: Fn() -> Result<(), ()> { | ||
loop { } | ||
} | ||
|
||
fn main() { server(); } |
11 changes: 11 additions & 0 deletions
11
src/test/ui/impl-trait/issue-55608-captures-empty-region.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds | ||
--> $DIR/issue-55608-captures-empty-region.rs:6:16 | ||
| | ||
LL | fn server() -> impl FilterBase2 { //~ ERROR [E0700] | ||
| ^^^^^^^^^^^^^^^^ | ||
| | ||
= note: hidden type `Map2<[closure@$DIR/issue-55608-captures-empty-region.rs:7:36: 7:41]>` captures an empty lifetime | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0700`. |