Normalize type before deferred sizedness checking.

This commit is contained in:
Masaki Hara 2018-11-27 23:37:59 +09:00
parent 691a7f8e2b
commit 9d35e57907
2 changed files with 12 additions and 0 deletions

View file

@ -914,6 +914,7 @@ fn typeck_tables_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
fcx.resolve_generator_interiors(def_id);
for (ty, span, code) in fcx.deferred_sized_obligations.borrow_mut().drain(..) {
let ty = fcx.normalize_ty(span, ty);
fcx.require_type_is_sized(ty, span, code);
}
fcx.select_all_obligations_or_error();

View file

@ -0,0 +1,11 @@
use std::ops::Deref;
fn foo<P>(_value: <P as Deref>::Target)
where
P: Deref,
<P as Deref>::Target: Sized,
{}
fn main() {
foo::<Box<u32>>(2);
}