]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_typeck/src/check/cast.rs
Rollup merge of #87596 - jesyspa:issue-87318-hidden-whitespace, r=estebank
[rust.git] / compiler / rustc_typeck / src / check / cast.rs
index a09fad3b6b78ad72b0b87e5cbba12a6efdbc04c3..181972e3e7bade679d581f9d78135f6b3e1b4bfb 100644 (file)
@@ -45,6 +45,7 @@
 use rustc_session::Session;
 use rustc_span::symbol::sym;
 use rustc_span::Span;
+use rustc_trait_selection::infer::InferCtxtExt;
 use rustc_trait_selection::traits;
 use rustc_trait_selection::traits::error_reporting::report_object_safety_error;
 
@@ -441,8 +442,8 @@ fn report_cast_error(&self, fcx: &FnCtxt<'a, 'tcx>, e: CastError) {
                             let expr_ty = fcx.tcx.erase_regions(expr_ty);
                             let ty_params = fcx.tcx.mk_substs_trait(expr_ty, &[]);
                             if fcx
-                                .tcx
-                                .type_implements_trait((from_trait, ty, ty_params, fcx.param_env))
+                                .infcx
+                                .type_implements_trait(from_trait, ty, ty_params, fcx.param_env)
                                 .must_apply_modulo_regions()
                             {
                                 label = false;
@@ -603,8 +604,8 @@ fn trivial_cast_lint(&self, fcx: &FnCtxt<'a, 'tcx>) {
     }
 
     pub fn check(mut self, fcx: &FnCtxt<'a, 'tcx>) {
-        self.expr_ty = fcx.structurally_resolved_type(self.span, self.expr_ty);
-        self.cast_ty = fcx.structurally_resolved_type(self.span, self.cast_ty);
+        self.expr_ty = fcx.structurally_resolved_type(self.expr.span, self.expr_ty);
+        self.cast_ty = fcx.structurally_resolved_type(self.cast_span, self.cast_ty);
 
         debug!("check_cast({}, {:?} as {:?})", self.expr.hir_id, self.expr_ty, self.cast_ty);