fix usage of LayoutDetails
This commit is contained in:
@@ -9,6 +9,7 @@ use rustc::lint::{LateContext, Level, Lint, LintContext};
|
|||||||
use rustc::session::Session;
|
use rustc::session::Session;
|
||||||
use rustc::traits;
|
use rustc::traits;
|
||||||
use rustc::ty::{self, Ty, TyCtxt};
|
use rustc::ty::{self, Ty, TyCtxt};
|
||||||
|
use rustc::ty::layout::LayoutOf;
|
||||||
use rustc_errors;
|
use rustc_errors;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::env;
|
use std::env;
|
||||||
@@ -1021,9 +1022,9 @@ pub fn is_try(expr: &Expr) -> Option<&Expr> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn type_size<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, ty: Ty<'tcx>) -> Option<u64> {
|
pub fn type_size<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, ty: Ty<'tcx>) -> Option<u64> {
|
||||||
ty.layout(cx.tcx, cx.param_env)
|
(cx.tcx, cx.param_env).layout_of(ty)
|
||||||
.ok()
|
.ok()
|
||||||
.map(|layout| layout.size(cx.tcx).bytes())
|
.map(|layout| layout.size.bytes())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns true if the lint is allowed in the current context
|
/// Returns true if the lint is allowed in the current context
|
||||||
|
|||||||
Reference in New Issue
Block a user