change thir to use mir::ConstantKind instead of ty::Const

This commit is contained in:
b-naber
2022-02-21 22:43:15 +01:00
parent 9d843171d1
commit b38077ea0b
29 changed files with 534 additions and 112 deletions

View File

@@ -25,8 +25,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
/// Convenience function for creating a literal operand, one
/// without any user type annotation.
crate fn literal_operand(&mut self, span: Span, literal: ty::Const<'tcx>) -> Operand<'tcx> {
let literal = literal.into();
crate fn literal_operand(&mut self, span: Span, literal: ConstantKind<'tcx>) -> Operand<'tcx> {
let constant = Box::new(Constant { span, user_ty: None, literal });
Operand::Constant(constant)
}
@@ -34,7 +33,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
// Returns a zero literal operand for the appropriate type, works for
// bool, char and integers.
crate fn zero_literal(&mut self, span: Span, ty: Ty<'tcx>) -> Operand<'tcx> {
let literal = ty::Const::from_bits(self.tcx, 0, ty::ParamEnv::empty().and(ty));
let literal = ConstantKind::from_bits(self.tcx, 0, ty::ParamEnv::empty().and(ty));
self.literal_operand(span, literal)
}