]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_hir_typeck/src/cast.rs
Add a helper for replacing the self type in trait refs
[rust.git] / compiler / rustc_hir_typeck / src / cast.rs
index e5dc4b06c0ba620ade32f1d8a79b7feab64bd322..50fd4fd2a8f89a7002431c7d29f451e0967efa24 100644 (file)
@@ -498,7 +498,7 @@ fn report_cast_error(&self, fcx: &FnCtxt<'a, 'tcx>, e: CastError) {
                         let ty = fcx.tcx.erase_regions(ty);
                         let expr_ty = fcx.resolve_vars_if_possible(self.expr_ty);
                         let expr_ty = fcx.tcx.erase_regions(expr_ty);
-                        let ty_params = fcx.tcx.mk_substs_trait(expr_ty, &[]);
+                        let ty_params = fcx.tcx.mk_substs(std::iter::once(ty::GenericArg::from(expr_ty)));
                         if fcx
                             .infcx
                             .type_implements_trait(from_trait, ty, ty_params, fcx.param_env)