mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 02:57:37 +00:00
Fix fallout
This commit is contained in:
parent
9b4faf97f3
commit
7cc8fa2e25
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user