@@ -1110,7 +1110,13 @@ fn check_associated_item(
1110
1110
let ty = tcx. type_of ( item. def_id ) . instantiate_identity ( ) ;
1111
1111
let ty = wfcx. normalize ( span, Some ( WellFormedLoc :: Ty ( item_id) ) , ty) ;
1112
1112
wfcx. register_wf_obligation ( span, loc, ty. into ( ) ) ;
1113
- check_sized_if_body ( wfcx, item. def_id . expect_local ( ) , ty, Some ( span) ) ;
1113
+ check_sized_if_body (
1114
+ wfcx,
1115
+ item. def_id . expect_local ( ) ,
1116
+ ty,
1117
+ Some ( span) ,
1118
+ ObligationCauseCode :: SizedConstOrStatic ,
1119
+ ) ;
1114
1120
Ok ( ( ) )
1115
1121
}
1116
1122
ty:: AssocKind :: Fn => {
@@ -1356,7 +1362,7 @@ fn check_item_type(
1356
1362
traits:: ObligationCause :: new (
1357
1363
ty_span,
1358
1364
wfcx. body_def_id ,
1359
- ObligationCauseCode :: WellFormed ( None ) ,
1365
+ ObligationCauseCode :: SizedConstOrStatic ,
1360
1366
) ,
1361
1367
wfcx. param_env ,
1362
1368
item_ty,
@@ -1700,6 +1706,7 @@ fn check_fn_or_method<'tcx>(
1700
1706
hir:: FnRetTy :: Return ( ty) => Some ( ty. span ) ,
1701
1707
hir:: FnRetTy :: DefaultReturn ( _) => None ,
1702
1708
} ,
1709
+ ObligationCauseCode :: SizedReturnType ,
1703
1710
) ;
1704
1711
}
1705
1712
@@ -1708,13 +1715,14 @@ fn check_sized_if_body<'tcx>(
1708
1715
def_id : LocalDefId ,
1709
1716
ty : Ty < ' tcx > ,
1710
1717
maybe_span : Option < Span > ,
1718
+ code : ObligationCauseCode < ' tcx > ,
1711
1719
) {
1712
1720
let tcx = wfcx. tcx ( ) ;
1713
1721
if let Some ( body) = tcx. hir_maybe_body_owned_by ( def_id) {
1714
1722
let span = maybe_span. unwrap_or ( body. value . span ) ;
1715
1723
1716
1724
wfcx. register_bound (
1717
- ObligationCause :: new ( span, def_id, traits :: ObligationCauseCode :: SizedReturnType ) ,
1725
+ ObligationCause :: new ( span, def_id, code ) ,
1718
1726
wfcx. param_env ,
1719
1727
ty,
1720
1728
tcx. require_lang_item ( LangItem :: Sized , Some ( span) ) ,
0 commit comments