Check pointee metadata correctly in ui test
This commit is contained in:
parent
f5c78c4d3a
commit
321a5dba9e
@ -346,10 +346,8 @@ impl<'tcx> assembly::GoalKind<'tcx> for ProjectionPredicate<'tcx> {
|
|||||||
LangItem::Sized,
|
LangItem::Sized,
|
||||||
[ty::GenericArg::from(goal.predicate.self_ty())],
|
[ty::GenericArg::from(goal.predicate.self_ty())],
|
||||||
));
|
));
|
||||||
|
|
||||||
ecx.add_goal(goal.with(tcx, sized_predicate));
|
ecx.add_goal(goal.with(tcx, sized_predicate));
|
||||||
ecx.eq(goal.param_env, goal.predicate.term, tcx.types.unit.into())?;
|
tcx.types.unit
|
||||||
return ecx.evaluate_added_goals_and_make_canonical_response(Certainty::Yes);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ty::Adt(def, substs) if def.is_struct() => {
|
ty::Adt(def, substs) if def.is_struct() => {
|
||||||
|
@ -7,17 +7,15 @@ use std::ptr::{DynMetadata, Pointee};
|
|||||||
trait Trait<U> {}
|
trait Trait<U> {}
|
||||||
struct MyDst<T: ?Sized>(T);
|
struct MyDst<T: ?Sized>(T);
|
||||||
|
|
||||||
fn works<T>() {
|
fn meta_is<T: Pointee<Metadata = U> + ?Sized, U>() {}
|
||||||
let _: <T as Pointee>::Metadata = ();
|
|
||||||
let _: <[T] as Pointee>::Metadata = 1_usize;
|
|
||||||
let _: <str as Pointee>::Metadata = 1_usize;
|
|
||||||
let _: <dyn Trait<T> as Pointee>::Metadata = give::<DynMetadata<dyn Trait<T>>>();
|
|
||||||
let _: <MyDst<T> as Pointee>::Metadata = ();
|
|
||||||
let _: <((((([u8],),),),),) as Pointee>::Metadata = 1_usize;
|
|
||||||
}
|
|
||||||
|
|
||||||
fn give<U>() -> U {
|
fn works<T>() {
|
||||||
loop {}
|
meta_is::<T, ()>();
|
||||||
|
meta_is::<[T], usize>();
|
||||||
|
meta_is::<str, usize>();
|
||||||
|
meta_is::<dyn Trait<T>, DynMetadata<dyn Trait<T>>>();
|
||||||
|
meta_is::<MyDst<T>, ()>();
|
||||||
|
meta_is::<((((([u8],),),),),), usize>();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user