Replace remaining instances of use of debug feature with debug_assertions.

Also fix some code that did not build in debug mode anymore (d'oh!) in
`src/ion/merges.rs`, as exposed by this change.
This commit is contained in:
Chris Fallin
2021-08-12 17:35:55 -07:00
parent 8ed83e3a57
commit 69ad31f013
2 changed files with 5 additions and 5 deletions

View File

@@ -48,16 +48,16 @@ impl<'a, F: Function> Env<'a, F> {
return false; return false;
} }
#[cfg(debug)] #[cfg(debug_assertions)]
{ {
// Sanity check: both bundles should contain only ranges with appropriate VReg classes. // Sanity check: both bundles should contain only ranges with appropriate VReg classes.
for entry in &self.bundles[from.index()].ranges { for entry in &self.bundles[from.index()].ranges {
let vreg = self.ranges[entry.index.index()].vreg; let vreg = self.ranges[entry.index.index()].vreg;
assert_eq!(rc, self.vregs[vreg.index()].reg.class()); assert_eq!(from_rc, self.vreg_regs[vreg.index()].class());
} }
for entry in &self.bundles[to.index()].ranges { for entry in &self.bundles[to.index()].ranges {
let vreg = self.ranges[entry.index.index()].vreg; let vreg = self.ranges[entry.index.index()].vreg;
assert_eq!(rc, self.vregs[vreg.index()].reg.class()); assert_eq!(to_rc, self.vreg_regs[vreg.index()].class());
} }
} }

View File

@@ -78,11 +78,11 @@ impl<T: Clone + Copy + Default> ParallelMoves<T> {
// Sort moves by destination and check that each destination // Sort moves by destination and check that each destination
// has only one writer. // has only one writer.
self.parallel_moves.sort_by_key(|&(_, dst, _)| dst); self.parallel_moves.sort_by_key(|&(_, dst, _)| dst);
if cfg!(debug) { if cfg!(debug_assertions) {
let mut last_dst = None; let mut last_dst = None;
for &(_, dst, _) in &self.parallel_moves { for &(_, dst, _) in &self.parallel_moves {
if last_dst.is_some() { if last_dst.is_some() {
assert!(last_dst.unwrap() != dst); debug_assert!(last_dst.unwrap() != dst);
} }
last_dst = Some(dst); last_dst = Some(dst);
} }