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.
Rollup merge of rust-lang#90801 - b-naber:missing_normalization_equat…
…e_inputs_output, r=jackh726 Normalize both arguments of `equate_normalized_input_or_output` Fixes rust-lang#90638 Fixes rust-lang#90612 Temporary fix for a more complex underlying problem stemming from an inability to normalize closure substs during typecheck. r? `@jackh726`
- Loading branch information
Showing
4 changed files
with
121 additions
and
24 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
43 changes: 43 additions & 0 deletions
43
src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-90612.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,43 @@ | ||
// check-pass | ||
|
||
#![feature(generic_associated_types)] | ||
|
||
use std::marker::PhantomData; | ||
|
||
trait Family: Sized { | ||
type Item<'a>; | ||
|
||
fn apply_all<F>(&self, f: F) | ||
where | ||
F: FamilyItemFn<Self> { } | ||
} | ||
|
||
struct Array<T>(PhantomData<T>); | ||
|
||
impl<T: 'static> Family for Array<T> { | ||
type Item<'a> = &'a T; | ||
} | ||
|
||
trait FamilyItemFn<T: Family> { | ||
fn apply(&self, item: T::Item<'_>); | ||
} | ||
|
||
impl<T, F> FamilyItemFn<T> for F | ||
where | ||
T: Family, | ||
for<'a> F: Fn(T::Item<'a>) | ||
{ | ||
fn apply(&self, item: T::Item<'_>) { | ||
(*self)(item); | ||
} | ||
} | ||
|
||
fn process<T: 'static>(array: Array<T>) { | ||
// Works | ||
array.apply_all(|x: &T| { }); | ||
|
||
// ICE: NoSolution | ||
array.apply_all(|x: <Array<T> as Family>::Item<'_>| { }); | ||
} | ||
|
||
fn main() {} |
37 changes: 37 additions & 0 deletions
37
src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-90638.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,37 @@ | ||
//check-pass | ||
|
||
#![feature(generic_associated_types)] | ||
|
||
trait Yokeable<'a>: 'static { | ||
type Output: 'a; | ||
} | ||
|
||
trait IsCovariant<'a> {} | ||
|
||
struct Yoke<Y: for<'a> Yokeable<'a>> { | ||
data: Y, | ||
} | ||
|
||
impl<Y: for<'a> Yokeable<'a>> Yoke<Y> { | ||
fn project<Y2: for<'a> Yokeable<'a>>(&self, _f: for<'a> fn(<Y as Yokeable<'a>>::Output, &'a ()) | ||
-> <Y2 as Yokeable<'a>>::Output) -> Yoke<Y2> { | ||
|
||
unimplemented!() | ||
} | ||
} | ||
|
||
fn _upcast<Y>(x: Yoke<Y>) -> Yoke<Box<dyn IsCovariant<'static> + 'static>> where | ||
Y: for<'a> Yokeable<'a>, | ||
for<'a> <Y as Yokeable<'a>>::Output: IsCovariant<'a> | ||
{ | ||
x.project(|data, _| { | ||
Box::new(data) | ||
}) | ||
} | ||
|
||
|
||
impl<'a> Yokeable<'a> for Box<dyn IsCovariant<'static> + 'static> { | ||
type Output = Box<dyn IsCovariant<'a> + 'a>; | ||
} | ||
|
||
fn main() {} |