From e91b01348e4d1ebbb35232d78fd3e8b380d1e7fd Mon Sep 17 00:00:00 2001 From: Frederick Zhang Date: Tue, 21 Nov 2017 16:51:36 +1100 Subject: [PATCH] fix usage of LayoutDetails --- clippy_lints/src/utils/mod.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/clippy_lints/src/utils/mod.rs b/clippy_lints/src/utils/mod.rs index 8571e5bb563..77c70922dba 100644 --- a/clippy_lints/src/utils/mod.rs +++ b/clippy_lints/src/utils/mod.rs @@ -9,6 +9,7 @@ use rustc::session::Session; use rustc::traits; use rustc::ty::{self, Ty, TyCtxt}; +use rustc::ty::layout::LayoutOf; use rustc_errors; use std::borrow::Cow; use std::env; @@ -1021,9 +1022,9 @@ fn is_err(arm: &Arm) -> bool { } pub fn type_size<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, ty: Ty<'tcx>) -> Option { - ty.layout(cx.tcx, cx.param_env) + (cx.tcx, cx.param_env).layout_of(ty) .ok() - .map(|layout| layout.size(cx.tcx).bytes()) + .map(|layout| layout.size.bytes()) } /// Returns true if the lint is allowed in the current context