implement valtrees as the type-system representation for constant values
This commit is contained in:
parent
edab34ab2a
commit
705d818bd5
116 changed files with 1606 additions and 1032 deletions
|
@ -3,8 +3,8 @@
|
|||
use crate::MirPass;
|
||||
use rustc_hir::Mutability;
|
||||
use rustc_middle::mir::{
|
||||
BinOp, Body, Constant, LocalDecls, Operand, Place, ProjectionElem, Rvalue, SourceInfo,
|
||||
Statement, StatementKind, Terminator, TerminatorKind, UnOp,
|
||||
BinOp, Body, Constant, ConstantKind, LocalDecls, Operand, Place, ProjectionElem, Rvalue,
|
||||
SourceInfo, Statement, StatementKind, Terminator, TerminatorKind, UnOp,
|
||||
};
|
||||
use rustc_middle::ty::{self, TyCtxt};
|
||||
|
||||
|
@ -129,8 +129,8 @@ impl<'tcx> InstCombineContext<'tcx, '_> {
|
|||
return;
|
||||
}
|
||||
|
||||
let constant =
|
||||
Constant { span: source_info.span, literal: len.into(), user_ty: None };
|
||||
let literal = ConstantKind::from_const(len, self.tcx);
|
||||
let constant = Constant { span: source_info.span, literal, user_ty: None };
|
||||
*rvalue = Rvalue::Use(Operand::Constant(Box::new(constant)));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue