@@ -76,20 +76,10 @@ pub(crate) fn enforce_impl_lifetime_params_are_constrained(
7676 impl_def_id : LocalDefId ,
7777) -> Result < ( ) , ErrorGuaranteed > {
7878 let impl_self_ty = tcx. type_of ( impl_def_id) . instantiate_identity ( ) ;
79- if impl_self_ty. references_error ( ) {
80- // Don't complain about unconstrained type params when self ty isn't known due to errors.
81- // (#36836)
82- tcx. dcx ( ) . span_delayed_bug (
83- tcx. def_span ( impl_def_id) ,
84- format ! (
85- "potentially unconstrained type parameters weren't evaluated: {impl_self_ty:?}" ,
86- ) ,
87- ) ;
88- // This is super fishy, but our current `rustc_hir_analysis::check_crate` pipeline depends on
89- // `type_of` having been called much earlier, and thus this value being read from cache.
90- // Compilation must continue in order for other important diagnostics to keep showing up.
91- return Ok ( ( ) ) ;
92- }
79+
80+ // Don't complain about unconstrained type params when self ty isn't known due to errors.
81+ // (#36836)
82+ impl_self_ty. error_reported ( ) ?;
9383
9484 let impl_generics = tcx. generics_of ( impl_def_id) ;
9585 let impl_predicates = tcx. predicates_of ( impl_def_id) ;
@@ -174,20 +164,11 @@ pub(crate) fn enforce_impl_non_lifetime_params_are_constrained(
174164 impl_def_id : LocalDefId ,
175165) -> Result < ( ) , ErrorGuaranteed > {
176166 let impl_self_ty = tcx. type_of ( impl_def_id) . instantiate_identity ( ) ;
177- if impl_self_ty. references_error ( ) {
178- // Don't complain about unconstrained type params when self ty isn't known due to errors.
179- // (#36836)
180- tcx. dcx ( ) . span_delayed_bug (
181- tcx. def_span ( impl_def_id) ,
182- format ! (
183- "potentially unconstrained type parameters weren't evaluated: {impl_self_ty:?}" ,
184- ) ,
185- ) ;
186- // This is super fishy, but our current `rustc_hir_analysis::check_crate` pipeline depends on
187- // `type_of` having been called much earlier, and thus this value being read from cache.
188- // Compilation must continue in order for other important diagnostics to keep showing up.
189- return Ok ( ( ) ) ;
190- }
167+
168+ // Don't complain about unconstrained type params when self ty isn't known due to errors.
169+ // (#36836)
170+ impl_self_ty. error_reported ( ) ?;
171+
191172 let impl_generics = tcx. generics_of ( impl_def_id) ;
192173 let impl_predicates = tcx. predicates_of ( impl_def_id) ;
193174 let impl_trait_ref = tcx. impl_trait_ref ( impl_def_id) . map ( ty:: EarlyBinder :: instantiate_identity) ;
0 commit comments