@@ -1110,7 +1110,13 @@ fn check_associated_item(
11101110 let ty = tcx. type_of ( item. def_id ) . instantiate_identity ( ) ;
11111111 let ty = wfcx. normalize ( span, Some ( WellFormedLoc :: Ty ( item_id) ) , ty) ;
11121112 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+ ) ;
11141120 Ok ( ( ) )
11151121 }
11161122 ty:: AssocKind :: Fn => {
@@ -1356,7 +1362,7 @@ fn check_item_type(
13561362 traits:: ObligationCause :: new (
13571363 ty_span,
13581364 wfcx. body_def_id ,
1359- ObligationCauseCode :: WellFormed ( None ) ,
1365+ ObligationCauseCode :: SizedConstOrStatic ,
13601366 ) ,
13611367 wfcx. param_env ,
13621368 item_ty,
@@ -1700,6 +1706,7 @@ fn check_fn_or_method<'tcx>(
17001706 hir:: FnRetTy :: Return ( ty) => Some ( ty. span ) ,
17011707 hir:: FnRetTy :: DefaultReturn ( _) => None ,
17021708 } ,
1709+ ObligationCauseCode :: SizedReturnType ,
17031710 ) ;
17041711}
17051712
@@ -1708,13 +1715,14 @@ fn check_sized_if_body<'tcx>(
17081715 def_id : LocalDefId ,
17091716 ty : Ty < ' tcx > ,
17101717 maybe_span : Option < Span > ,
1718+ code : ObligationCauseCode < ' tcx > ,
17111719) {
17121720 let tcx = wfcx. tcx ( ) ;
17131721 if let Some ( body) = tcx. hir_maybe_body_owned_by ( def_id) {
17141722 let span = maybe_span. unwrap_or ( body. value . span ) ;
17151723
17161724 wfcx. register_bound (
1717- ObligationCause :: new ( span, def_id, traits :: ObligationCauseCode :: SizedReturnType ) ,
1725+ ObligationCause :: new ( span, def_id, code ) ,
17181726 wfcx. param_env ,
17191727 ty,
17201728 tcx. require_lang_item ( LangItem :: Sized , Some ( span) ) ,
0 commit comments