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