@@ -1108,7 +1108,13 @@ fn check_associated_item(
11081108 let ty = tcx. type_of ( item. def_id ) . instantiate_identity ( ) ;
11091109 let ty = wfcx. normalize ( span, Some ( WellFormedLoc :: Ty ( item_id) ) , ty) ;
11101110 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+ ) ;
11121118 Ok ( ( ) )
11131119 }
11141120 ty:: AssocKind :: Fn => {
@@ -1354,7 +1360,7 @@ fn check_item_type(
13541360 traits:: ObligationCause :: new (
13551361 ty_span,
13561362 wfcx. body_def_id ,
1357- ObligationCauseCode :: WellFormed ( None ) ,
1363+ ObligationCauseCode :: SizedConstOrStatic ,
13581364 ) ,
13591365 wfcx. param_env ,
13601366 item_ty,
@@ -1698,6 +1704,7 @@ fn check_fn_or_method<'tcx>(
16981704 hir:: FnRetTy :: Return ( ty) => Some ( ty. span ) ,
16991705 hir:: FnRetTy :: DefaultReturn ( _) => None ,
17001706 } ,
1707+ ObligationCauseCode :: SizedReturnType ,
17011708 ) ;
17021709}
17031710
@@ -1706,13 +1713,14 @@ fn check_sized_if_body<'tcx>(
17061713 def_id : LocalDefId ,
17071714 ty : Ty < ' tcx > ,
17081715 maybe_span : Option < Span > ,
1716+ code : ObligationCauseCode < ' tcx > ,
17091717) {
17101718 let tcx = wfcx. tcx ( ) ;
17111719 if let Some ( body) = tcx. hir_maybe_body_owned_by ( def_id) {
17121720 let span = maybe_span. unwrap_or ( body. value . span ) ;
17131721
17141722 wfcx. register_bound (
1715- ObligationCause :: new ( span, def_id, traits :: ObligationCauseCode :: SizedReturnType ) ,
1723+ ObligationCause :: new ( span, def_id, code ) ,
17161724 wfcx. param_env ,
17171725 ty,
17181726 tcx. require_lang_item ( LangItem :: Sized , Some ( span) ) ,
0 commit comments