forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test for Failed to normalize closure with TAIT rust-lang#109020
Fixes rust-lang#109020
- Loading branch information
1 parent
5e0d8c3
commit 56ea366
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
tests/ui/type-alias-impl-trait/closure-normalization-ice-109020.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,41 @@ | ||
// ICE Failed to normalize closure with TAIT | ||
// issue: rust-lang/rust#109020 | ||
//@ check-pass | ||
|
||
#![feature(type_alias_impl_trait)] | ||
|
||
use std::marker::PhantomData; | ||
|
||
type WithEmplacableForFn<'a> = impl EmplacableFn + 'a; | ||
|
||
fn with_emplacable_for<'a, F, R>(mut f: F) -> R | ||
where | ||
F: for<'b> FnMut(Emplacable<WithEmplacableForFn<'b>>) -> R, | ||
{ | ||
fn with_emplacable_for_inner<'a, R>( | ||
_: &'a (), | ||
_: &mut dyn FnMut(Emplacable<WithEmplacableForFn<'a>>) -> R, | ||
) -> R { | ||
fn _constrain(_: &mut ()) -> WithEmplacableForFn<'_> { | ||
() | ||
} | ||
loop {} | ||
} | ||
|
||
with_emplacable_for_inner(&(), &mut f) | ||
} | ||
|
||
trait EmplacableFn {} | ||
|
||
impl EmplacableFn for () {} | ||
|
||
struct Emplacable<F> | ||
where | ||
F: EmplacableFn, | ||
{ | ||
phantom: PhantomData<F>, | ||
} | ||
|
||
fn main() { | ||
with_emplacable_for(|_| {}); | ||
} |