rustc_mir: add sanity asserts for the types of ty::Const
s.
This commit is contained in:
parent
b565ece5d8
commit
9107ec1acd
3 changed files with 6 additions and 0 deletions
|
@ -38,6 +38,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||
inferred_ty: ty,
|
||||
})
|
||||
});
|
||||
assert_eq!(literal.ty, ty);
|
||||
Constant {
|
||||
span,
|
||||
user_ty,
|
||||
|
|
|
@ -63,6 +63,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||
}
|
||||
|
||||
PatternKind::Range(range) => {
|
||||
assert_eq!(range.lo.ty, match_pair.pattern.ty);
|
||||
assert_eq!(range.hi.ty, match_pair.pattern.ty);
|
||||
Test {
|
||||
span: match_pair.pattern.span,
|
||||
kind: TestKind::Range(range),
|
||||
|
@ -269,6 +271,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||
);
|
||||
} else {
|
||||
if let [success, fail] = *make_target_blocks(self) {
|
||||
assert_eq!(value.ty, ty);
|
||||
let expect = self.literal_operand(test.span, value);
|
||||
let val = Operand::Copy(place.clone());
|
||||
self.compare(block, success, fail, source_info, BinOp::Eq, expect, val);
|
||||
|
|
|
@ -441,6 +441,8 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> {
|
|||
|
||||
let mut kind = match (lo, hi) {
|
||||
(PatternKind::Constant { value: lo }, PatternKind::Constant { value: hi }) => {
|
||||
assert_eq!(lo.ty, ty);
|
||||
assert_eq!(hi.ty, ty);
|
||||
let cmp = compare_const_vals(
|
||||
self.tcx,
|
||||
lo,
|
||||
|
|
Loading…
Add table
Reference in a new issue