mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
In relate_tys, when creating new universes, insert missing universes as other
This commit is contained in:
parent
497ee321af
commit
0a3c6bb887
@ -80,10 +80,15 @@ impl TypeRelatingDelegate<'tcx> for NllTypeRelatingDelegate<'_, '_, 'tcx> {
|
||||
}
|
||||
|
||||
fn create_next_universe(&mut self) -> ty::UniverseIndex {
|
||||
let info_universe =
|
||||
self.borrowck_context.constraints.universe_causes.push(self.universe_info.clone());
|
||||
let universe = self.infcx.create_next_universe();
|
||||
assert_eq!(info_universe, universe);
|
||||
// FIXME: If we relate tys after normalizing with late-bound regions, there will
|
||||
// be extra universes. A proper solution would be to somehow track those universes
|
||||
// during projection, but here we just treat those as "other"
|
||||
self.borrowck_context
|
||||
.constraints
|
||||
.universe_causes
|
||||
.ensure_contains_elem(universe, || UniverseInfo::other());
|
||||
self.borrowck_context.constraints.universe_causes[universe] = self.universe_info.clone();
|
||||
universe
|
||||
}
|
||||
|
||||
|
35
src/test/ui/hrtb/issue-88446.rs
Normal file
35
src/test/ui/hrtb/issue-88446.rs
Normal file
@ -0,0 +1,35 @@
|
||||
// check-pass
|
||||
|
||||
trait Yokeable<'a> {
|
||||
type Output: 'a;
|
||||
}
|
||||
impl<'a> Yokeable<'a> for () {
|
||||
type Output = ();
|
||||
}
|
||||
|
||||
trait DataMarker<'data> {
|
||||
type Yokeable: for<'a> Yokeable<'a>;
|
||||
}
|
||||
impl<'data> DataMarker<'data> for () {
|
||||
type Yokeable = ();
|
||||
}
|
||||
|
||||
struct DataPayload<'data, M>(&'data M);
|
||||
|
||||
impl DataPayload<'static, ()> {
|
||||
pub fn map_project_with_capture<M2, T>(
|
||||
_: for<'a> fn(
|
||||
capture: T,
|
||||
std::marker::PhantomData<&'a ()>,
|
||||
) -> <M2::Yokeable as Yokeable<'a>>::Output,
|
||||
) -> DataPayload<'static, M2>
|
||||
where
|
||||
M2: DataMarker<'static>,
|
||||
{
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let _: DataPayload<()> = DataPayload::<()>::map_project_with_capture::<_, &()>(|_, _| todo!());
|
||||
}
|
Loading…
Reference in New Issue
Block a user