]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/transmute/utils.rs
Merge remote-tracking branch 'upstream/master' into rustup
[rust.git] / clippy_lints / src / transmute / utils.rs
index 74927570b40ebe579ec00b3df789f8a7d5820e1f..b567d92230bb1cbe4085a444dbb6843b7b7a81bc 100644 (file)
@@ -1,8 +1,11 @@
 use rustc_hir::Expr;
+use rustc_hir_analysis::check::{
+    cast::{self, CastCheckResult},
+    FnCtxt, Inherited,
+};
 use rustc_lint::LateContext;
 use rustc_middle::ty::{cast::CastKind, Ty};
 use rustc_span::DUMMY_SP;
-use rustc_typeck::check::{cast::CastCheck, FnCtxt, Inherited};
 
 // check if the component types of the transmuted collection and the result have different ABI,
 // size or alignment
@@ -42,7 +45,7 @@ pub(super) fn can_be_expressed_as_pointer_cast<'tcx>(
 /// messages. This function will panic if that occurs.
 fn check_cast<'tcx>(cx: &LateContext<'tcx>, e: &'tcx Expr<'_>, from_ty: Ty<'tcx>, to_ty: Ty<'tcx>) -> Option<CastKind> {
     let hir_id = e.hir_id;
-    let local_def_id = hir_id.owner;
+    let local_def_id = hir_id.owner.def_id;
 
     Inherited::build(cx.tcx, local_def_id).enter(|inherited| {
         let fn_ctxt = FnCtxt::new(&inherited, cx.param_env, hir_id);
@@ -53,7 +56,7 @@ fn check_cast<'tcx>(cx: &LateContext<'tcx>, e: &'tcx Expr<'_>, from_ty: Ty<'tcx>
             "Newly created FnCtxt contained errors"
         );
 
-        if let Ok(check) = CastCheck::new(
+        if let CastCheckResult::Deferred(check) = cast::check_cast(
             &fn_ctxt, e, from_ty, to_ty,
             // We won't show any error to the user, so we don't care what the span is here.
             DUMMY_SP, DUMMY_SP,