Skip to content

Commit 32cb8fa

Browse files
committed
Added more debugging output.
1 parent 3fc38ee commit 32cb8fa

File tree

5 files changed

+16
-3
lines changed

5 files changed

+16
-3
lines changed

src/bin/cargo_semver.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ impl<'a> WorkInfo<'a> {
135135
/// and/or defaults, and dispatch the actual analysis.
136136
// TODO: possibly reduce the complexity by finding where some info can be taken from directly
137137
fn do_main(config: &Config, matches: &Matches) -> CargoResult<()> {
138+
debug!("running cargo-semver");
138139
fn parse_arg(opt: &str) -> CargoResult<NameAndVersion> {
139140
let mut split = opt.split('-');
140141
let name = if let Some(n) = split.next() {
@@ -196,6 +197,8 @@ fn do_main(config: &Config, matches: &Matches) -> CargoResult<()> {
196197
return Ok(());
197198
}
198199

200+
debug!("running rust-semverver on compiled crates");
201+
199202
let mut child = Command::new("rust-semverver")
200203
.arg("--crate-type=lib")
201204
.args(&["--extern", &*format!("old={}", stable_rlib.display())])

src/bin/rust_semverver.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ use syntax::ast;
3131
/// find their root modules and then proceed to walk their module trees.
3232
fn callback(state: &driver::CompileState, version: &str) {
3333
let tcx = state.tcx.unwrap();
34-
// let cstore = &tcx.sess.cstore;
3534

3635
let cnums = tcx
3736
.crates()
@@ -61,6 +60,7 @@ fn callback(state: &driver::CompileState, version: &str) {
6160
return;
6261
};
6362

63+
debug!("running semver analysis");
6464
let changes = run_analysis(tcx, old_def_id, new_def_id);
6565

6666
changes.output(tcx.sess, version);
@@ -135,6 +135,7 @@ impl<'a> CompilerCalls<'a> for SemVerVerCompilerCalls {
135135
controller.after_analysis.callback = box move |state| {
136136
debug!("running rust-semverver after_analysis callback");
137137
callback(state, &version);
138+
debug!("running other after_analysis callback");
138139
old_callback(state);
139140
};
140141
controller.after_analysis.stop = Compilation::Stop;

src/semcheck/mismatch.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,16 @@ impl<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> MismatchRelation<'a, 'gcx, 'tcx> {
4545
use rustc::hir::def::Def::*;
4646

4747
while let Some((old_def_id, new_def_id)) = self.item_queue.pop_front() {
48+
debug!("processing mismatch item pair, remaining: {}", self.item_queue.len());
49+
debug!("old: {:?}, new: {:?}", old_def_id, new_def_id);
4850
match self.tcx.describe_def(old_def_id) {
4951
Some(Trait(_)) | Some(Macro(_, _)) => continue,
5052
_ => (),
5153
}
5254

5355
let old_ty = self.tcx.type_of(old_def_id);
5456
let new_ty = self.tcx.type_of(new_def_id);
57+
debug!("relating item pair");
5558
let _ = self.relate(&old_ty, &new_ty);
5659
}
5760
}
@@ -90,12 +93,14 @@ impl<'a, 'gcx, 'tcx> TypeRelation<'a, 'gcx, 'tcx> for MismatchRelation<'a, 'gcx,
9093
}
9194

9295
fn relate<T: Relate<'tcx>>(&mut self, a: &T, b: &T) -> RelateResult<'tcx, T> {
96+
debug!("relate: mismatch relation: a: {:?}, b: {:?}", a, b);
9397
Relate::relate(self, a, b)
9498
}
9599

96100
fn tys(&mut self, a: Ty<'tcx>, b: Ty<'tcx>) -> RelateResult<'tcx, Ty<'tcx>> {
97101
use rustc::ty::TypeVariants::*;
98102

103+
debug!("tys: mismatch relation: a: {:?}, b: {:?}", a, b);
99104
let matching = match (&a.sty, &b.sty) {
100105
(&TyAdt(a_def, a_substs), &TyAdt(b_def, b_substs)) => {
101106
if self.check_substs(a_substs, b_substs) {

src/semcheck/traverse.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,25 @@ pub fn run_analysis<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, old: DefId, new: DefI
3636
let mut id_mapping = IdMapping::new(old.krate, new.krate);
3737

3838
// first pass
39+
debug!("first pass started");
3940
diff_structure(&mut changes, &mut id_mapping, tcx, old, new);
4041

4142
// second pass
43+
debug!("second pass started");
4244
{
4345
let mut mismatch = MismatchRelation::new(tcx, &mut id_mapping);
46+
debug!("constructed mismatch relation");
4447
mismatch.process();
4548
}
4649

4750
// third pass
51+
debug!("third pass started");
4852
for (old, new) in id_mapping.items() {
4953
diff_types(&mut changes, &id_mapping, tcx, old, new);
5054
}
5155

5256
// fourth pass on impls
57+
debug!("fourth pass started");
5358
diff_inherent_impls(&mut changes, &id_mapping, tcx);
5459
diff_trait_impls(&mut changes, &id_mapping, tcx);
5560

tests/full.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ macro_rules! full_test {
2727
# sanitize paths
2828
gsub(/-->.*"#, $crate_name, r#"/, "--> "#, $crate_name, r#"", $0);
2929
print;
30-
}
31-
"#, $crate_name, $crate_name);
30+
}"#, $crate_name, $crate_name);
3231
let out_file = Path::new("tests/full_cases")
3332
.join(concat!($crate_name, "-", $old_version, "-", $new_version));
3433

0 commit comments

Comments
 (0)