Fix fallout

This commit is contained in:
flip1995 2019-11-23 18:09:09 +01:00
parent 9b4faf97f3
commit 7cc8fa2e25
No known key found for this signature in database
GPG Key ID: 693086869D506637

View File

@ -1,7 +1,7 @@
use rustc::hir::*;
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
use rustc::mir::interpret::ConstValue;
use rustc::ty;
use rustc::ty::{self, ConstKind};
use rustc::{declare_tool_lint, impl_lint_pass};
use if_chain::if_chain;
@ -43,7 +43,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LargeStackArrays {
if_chain! {
if let ExprKind::Repeat(_, _) = expr.kind;
if let ty::Array(element_type, cst) = cx.tables.expr_ty(expr).kind;
if let ConstValue::Scalar(element_count) = cst.val;
if let ConstKind::Value(val) = cst.val;
if let ConstValue::Scalar(element_count) = val;
if let Ok(element_count) = element_count.to_machine_usize(&cx.tcx);
if let Ok(element_size) = cx.layout_of(element_type).map(|l| l.size.bytes());
if self.maximum_allowed_size < element_count * element_size;