]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_typeck/src/check/dropck.rs
Auto merge of #94566 - yanganto:show-ignore-message, r=m-ou-se
[rust.git] / compiler / rustc_typeck / src / check / dropck.rs
index 1849ece9f76d9aa1df6b11acfaf17fd5d2c1f8b7..4ab94f39357d8942dabcf787091e51279f7bd8fd 100644 (file)
@@ -55,11 +55,11 @@ pub fn check_drop_impl(tcx: TyCtxt<'_>, drop_impl_did: DefId) -> Result<(), Erro
             // already checked by coherence, but compilation may
             // not have been terminated.
             let span = tcx.def_span(drop_impl_did);
-            tcx.sess.delay_span_bug(
+            let reported = tcx.sess.delay_span_bug(
                 span,
                 &format!("should have been rejected by coherence check: {}", dtor_self_type),
             );
-            Err(ErrorGuaranteed)
+            Err(reported)
         }
     }
 }
@@ -94,7 +94,7 @@ fn ensure_drop_params_and_item_params_correspond<'tcx>(
             Err(_) => {
                 let item_span = tcx.def_span(self_type_did);
                 let self_descr = tcx.def_kind(self_type_did).descr(self_type_did);
-                struct_span_err!(
+                let reported = struct_span_err!(
                     tcx.sess,
                     drop_impl_span,
                     E0366,
@@ -109,15 +109,15 @@ fn ensure_drop_params_and_item_params_correspond<'tcx>(
                     ),
                 )
                 .emit();
-                return Err(ErrorGuaranteed);
+                return Err(reported);
             }
         }
 
         let errors = fulfillment_cx.select_all_or_error(&infcx);
         if !errors.is_empty() {
             // this could be reached when we get lazy normalization
-            infcx.report_fulfillment_errors(&errors, None, false);
-            return Err(ErrorGuaranteed);
+            let reported = infcx.report_fulfillment_errors(&errors, None, false);
+            return Err(reported);
         }
 
         // NB. It seems a bit... suspicious to use an empty param-env
@@ -243,7 +243,7 @@ fn ensure_drop_predicates_are_implied_by_item_defn<'tcx>(
                 (
                     ty::PredicateKind::ConstEvaluatable(a),
                     ty::PredicateKind::ConstEvaluatable(b),
-                ) => tcx.try_unify_abstract_consts((a, b)),
+                ) => tcx.try_unify_abstract_consts(self_param_env.and((a, b))),
                 (
                     ty::PredicateKind::TypeOutlives(ty::OutlivesPredicate(ty_a, lt_a)),
                     ty::PredicateKind::TypeOutlives(ty::OutlivesPredicate(ty_b, lt_b)),
@@ -258,7 +258,7 @@ fn ensure_drop_predicates_are_implied_by_item_defn<'tcx>(
         if !assumptions_in_impl_context.iter().copied().any(predicate_matches_closure) {
             let item_span = tcx.def_span(self_type_did);
             let self_descr = tcx.def_kind(self_type_did).descr(self_type_did.to_def_id());
-            struct_span_err!(
+            let reported = struct_span_err!(
                 tcx.sess,
                 predicate_sp,
                 E0367,
@@ -268,7 +268,7 @@ fn ensure_drop_predicates_are_implied_by_item_defn<'tcx>(
             )
             .span_note(item_span, "the implementor must specify the same requirement")
             .emit();
-            result = Err(ErrorGuaranteed);
+            result = Err(reported);
         }
     }