Skip to content

Commit 9d35e57

Browse files
committed
Normalize type before deferred sizedness checking.
1 parent 691a7f8 commit 9d35e57

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/librustc_typeck/check/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -914,6 +914,7 @@ fn typeck_tables_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
914914
fcx.resolve_generator_interiors(def_id);
915915

916916
for (ty, span, code) in fcx.deferred_sized_obligations.borrow_mut().drain(..) {
917+
let ty = fcx.normalize_ty(span, ty);
917918
fcx.require_type_is_sized(ty, span, code);
918919
}
919920
fcx.select_all_obligations_or_error();

src/test/run-pass/issue-56237.rs

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
use std::ops::Deref;
2+
3+
fn foo<P>(_value: <P as Deref>::Target)
4+
where
5+
P: Deref,
6+
<P as Deref>::Target: Sized,
7+
{}
8+
9+
fn main() {
10+
foo::<Box<u32>>(2);
11+
}

0 commit comments

Comments
 (0)