Skip to content

Commit af3980d

Browse files
committed
analyze: replace some debug prints with log macros
1 parent 6c3e7af commit af3980d

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

c2rust-analyze/src/rewrite/expr/mir_op.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use crate::pointee_type::PointeeTypes;
1313
use crate::pointer_id::{PointerId, PointerTable};
1414
use crate::type_desc::{self, Ownership, Quantity, TypeDesc};
1515
use crate::util::{self, ty_callee, Callee};
16+
use log::trace;
1617
use rustc_ast::Mutability;
1718
use rustc_middle::mir::{
1819
BasicBlock, Body, BorrowKind, Location, Operand, Place, PlaceElem, PlaceRef, Rvalue, Statement,
@@ -990,17 +991,18 @@ where
990991
(self.emit)(RewriteKind::OptionUnwrap);
991992
from.option = false;
992993
} else if from.option && to.option {
993-
eprintln!("try_build_cast_desc_desc: emit OptionMapBegin");
994+
trace!("try_build_cast_desc_desc: emit OptionMapBegin");
994995
if from.own != to.own {
995-
eprintln!(" own differs: {:?} != {:?}", from.own, to.own);
996+
trace!(" own differs: {:?} != {:?}", from.own, to.own);
996997
}
997998
if from.qty != to.qty {
998-
eprintln!(" qty differs: {:?} != {:?}", from.qty, to.qty);
999+
trace!(" qty differs: {:?} != {:?}", from.qty, to.qty);
9991000
}
10001001
if from.pointee_ty != to.pointee_ty {
1001-
eprintln!(
1002+
trace!(
10021003
" pointee_ty differs: {:?} != {:?}",
1003-
from.pointee_ty, to.pointee_ty
1004+
from.pointee_ty,
1005+
to.pointee_ty
10041006
);
10051007
}
10061008
(self.emit)(RewriteKind::OptionMapBegin);

c2rust-analyze/src/rewrite/expr/unlower.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -895,7 +895,7 @@ fn filter_term(term: &mir::Terminator) -> bool {
895895
}
896896

897897
fn build_span_index(mir: &Body<'_>) -> SpanIndex<Location> {
898-
eprintln!("building span index for {:?}:", mir.source);
898+
debug!("building span index for {:?}:", mir.source);
899899
let mut span_index_items = Vec::new();
900900
for (bb, bb_data) in mir.basic_blocks().iter_enumerated() {
901901
for (i, stmt) in bb_data.statements.iter().enumerate() {
@@ -906,7 +906,7 @@ fn build_span_index(mir: &Body<'_>) -> SpanIndex<Location> {
906906
block: bb,
907907
statement_index: i,
908908
};
909-
eprintln!(" {:?}: {:?}", loc, stmt.source_info.span);
909+
debug!(" {:?}: {:?}", loc, stmt.source_info.span);
910910
span_index_items.push((stmt.source_info.span, loc));
911911
}
912912

@@ -916,7 +916,7 @@ fn build_span_index(mir: &Body<'_>) -> SpanIndex<Location> {
916916
block: bb,
917917
statement_index: bb_data.statements.len(),
918918
};
919-
eprintln!(" {:?}: {:?}", loc, term.source_info.span);
919+
debug!(" {:?}: {:?}", loc, term.source_info.span);
920920
span_index_items.push((term.source_info.span, loc));
921921
}
922922
}

0 commit comments

Comments
 (0)