From 8aa58bff99b5510a10bb16429ee360e0b42f67b6 Mon Sep 17 00:00:00 2001 From: Stuart Pernsteiner Date: Tue, 25 Jun 2024 11:50:40 -0700 Subject: [PATCH] analyze: replace some debug prints with log macros --- c2rust-analyze/src/rewrite/expr/mir_op.rs | 9 +++++---- c2rust-analyze/src/rewrite/expr/unlower.rs | 6 +++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/c2rust-analyze/src/rewrite/expr/mir_op.rs b/c2rust-analyze/src/rewrite/expr/mir_op.rs index 5134fca791..ec9ccc4d1a 100644 --- a/c2rust-analyze/src/rewrite/expr/mir_op.rs +++ b/c2rust-analyze/src/rewrite/expr/mir_op.rs @@ -13,6 +13,7 @@ use crate::pointee_type::PointeeTypes; use crate::pointer_id::{PointerId, PointerTable}; use crate::type_desc::{self, Ownership, Quantity, TypeDesc}; use crate::util::{self, ty_callee, Callee}; +use log::trace; use rustc_ast::Mutability; use rustc_middle::mir::{ BasicBlock, Body, BorrowKind, Location, Operand, Place, PlaceElem, PlaceRef, Rvalue, Statement, @@ -990,15 +991,15 @@ where (self.emit)(RewriteKind::OptionUnwrap); from.option = false; } else if from.option && to.option { - eprintln!("try_build_cast_desc_desc: emit OptionMapBegin"); + trace!("try_build_cast_desc_desc: emit OptionMapBegin"); if from.own != to.own { - eprintln!(" own differs: {:?} != {:?}", from.own, to.own); + trace!(" own differs: {:?} != {:?}", from.own, to.own); } if from.qty != to.qty { - eprintln!(" qty differs: {:?} != {:?}", from.qty, to.qty); + trace!(" qty differs: {:?} != {:?}", from.qty, to.qty); } if from.pointee_ty != to.pointee_ty { - eprintln!( + trace!( " pointee_ty differs: {:?} != {:?}", from.pointee_ty, to.pointee_ty ); diff --git a/c2rust-analyze/src/rewrite/expr/unlower.rs b/c2rust-analyze/src/rewrite/expr/unlower.rs index 558e9c8d3d..4905072e25 100644 --- a/c2rust-analyze/src/rewrite/expr/unlower.rs +++ b/c2rust-analyze/src/rewrite/expr/unlower.rs @@ -895,7 +895,7 @@ fn filter_term(term: &mir::Terminator) -> bool { } fn build_span_index(mir: &Body<'_>) -> SpanIndex { - eprintln!("building span index for {:?}:", mir.source); + debug!("building span index for {:?}:", mir.source); let mut span_index_items = Vec::new(); for (bb, bb_data) in mir.basic_blocks().iter_enumerated() { for (i, stmt) in bb_data.statements.iter().enumerate() { @@ -906,7 +906,7 @@ fn build_span_index(mir: &Body<'_>) -> SpanIndex { block: bb, statement_index: i, }; - eprintln!(" {:?}: {:?}", loc, stmt.source_info.span); + debug!(" {:?}: {:?}", loc, stmt.source_info.span); span_index_items.push((stmt.source_info.span, loc)); } @@ -916,7 +916,7 @@ fn build_span_index(mir: &Body<'_>) -> SpanIndex { block: bb, statement_index: bb_data.statements.len(), }; - eprintln!(" {:?}: {:?}", loc, term.source_info.span); + debug!(" {:?}: {:?}", loc, term.source_info.span); span_index_items.push((term.source_info.span, loc)); } }