-
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.
Rollup merge of #112654 - aliemjay:closure-output-normalize, r=compil…
…er-errors normalize closure output in equate_inputs_and_outputs Fixes #112604
- Loading branch information
Showing
2 changed files
with
50 additions
and
15 deletions.
There are no files selected for viewing
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
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,49 @@ | ||
//check-pass | ||
|
||
use higher_kinded_types::*; | ||
mod higher_kinded_types { | ||
pub(crate) trait HKT { | ||
type Of<'lt>; | ||
} | ||
|
||
pub(crate) trait WithLifetime<'lt> { | ||
type T; | ||
} | ||
|
||
impl<T: ?Sized + for<'any> WithLifetime<'any>> HKT for T { | ||
type Of<'lt> = <T as WithLifetime<'lt>>::T; | ||
} | ||
} | ||
|
||
trait Trait { | ||
type Gat<'lt>; | ||
} | ||
|
||
impl Trait for () { | ||
type Gat<'lt> = (); | ||
} | ||
|
||
/// Same as `Trait`, but using HKTs rather than GATs | ||
trait HTrait { | ||
type Hat: ?Sized + HKT; | ||
} | ||
|
||
impl<T: Trait> HTrait for T { | ||
type Hat = dyn for<'lt> WithLifetime<'lt, T = T::Gat<'lt>>; | ||
} | ||
|
||
impl<Hat: ?Sized + HKT> Trait for Box<dyn '_ + HTrait<Hat = Hat>> { | ||
type Gat<'lt> = Hat::Of<'lt>; | ||
} | ||
|
||
fn existential() -> impl for<'a> Trait<Gat<'a> = ()> {} | ||
|
||
fn dyn_hoops<T: Trait>( | ||
_: T, | ||
) -> Box<dyn HTrait<Hat = dyn for<'a> WithLifetime<'a, T = T::Gat<'a>>>> { | ||
loop {} | ||
} | ||
|
||
fn main() { | ||
let _ = || -> _ { dyn_hoops(existential()) }; | ||
} |