]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_hir_typeck/src/coercion.rs
Rollup merge of #104286 - ozkanonur:fix-doc-bootstrap-recompilation, r=jyn514
[rust.git] / compiler / rustc_hir_typeck / src / coercion.rs
index c1e4ab600f34f204242165cba1ed560b1fd580cb..43c7127b0d4c56b0e8495508eb2e9f51fa784d0d 100644 (file)
@@ -630,8 +630,7 @@ fn coerce_unsized(&self, mut source: Ty<'tcx>, mut target: Ty<'tcx>) -> CoerceRe
             cause,
             coerce_unsized_did,
             0,
-            coerce_source,
-            &[coerce_target.into()]
+            [coerce_source, coerce_target]
         )];
 
         let mut has_unsized_tuple_coercion = false;
@@ -748,7 +747,7 @@ fn coerce_dyn_star(
         &self,
         a: Ty<'tcx>,
         b: Ty<'tcx>,
-        predicates: &'tcx ty::List<ty::Binder<'tcx, ty::ExistentialPredicate<'tcx>>>,
+        predicates: &'tcx ty::List<ty::PolyExistentialPredicate<'tcx>>,
         b_region: ty::Region<'tcx>,
     ) -> CoerceResult<'tcx> {
         if !self.tcx.features().dyn_star {
@@ -805,10 +804,9 @@ fn coerce_dyn_star(
                 self.tcx,
                 self.cause.clone(),
                 self.param_env,
-                ty::Binder::dummy(ty::TraitRef::new(
-                    self.tcx.require_lang_item(hir::LangItem::PointerSized, Some(self.cause.span)),
-                    self.tcx.mk_substs_trait(a, &[]),
-                ))
+                ty::Binder::dummy(
+                    self.tcx.at(self.cause.span).mk_trait_ref(hir::LangItem::PointerSized, [a]),
+                )
                 .to_poly_trait_predicate(),
             ));
         }
@@ -1086,8 +1084,7 @@ pub fn deref_once_mutably_for_diagnostic(&self, expr_ty: Ty<'tcx>) -> Option<Ty<
             self.infcx
                 .type_implements_trait(
                     self.tcx.lang_items().deref_mut_trait()?,
-                    expr_ty,
-                    ty::List::empty(),
+                    [expr_ty],
                     self.param_env,
                 )
                 .may_apply()
@@ -1561,7 +1558,9 @@ pub(crate) fn coerce_inner<'a>(
                 // Mark that we've failed to coerce the types here to suppress
                 // any superfluous errors we might encounter while trying to
                 // emit or provide suggestions on how to fix the initial error.
-                fcx.set_tainted_by_errors();
+                fcx.set_tainted_by_errors(
+                    fcx.tcx.sess.delay_span_bug(cause.span, "coercion error but no error emitted"),
+                );
                 let (expected, found) = if label_expression_as_expected {
                     // In the case where this is a "forced unit", like
                     // `break`, we want to call the `()` "expected"