Decouple CguReuseTracker from Session
This commit is contained in:
parent
2ea18337f7
commit
b7cd58c00e
2 changed files with 4 additions and 5 deletions
|
@ -2,7 +2,6 @@
|
||||||
//! compilation. This is used for incremental compilation tests and debug
|
//! compilation. This is used for incremental compilation tests and debug
|
||||||
//! output.
|
//! output.
|
||||||
|
|
||||||
use crate::session::Session;
|
|
||||||
use rustc_data_structures::fx::FxHashMap;
|
use rustc_data_structures::fx::FxHashMap;
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
use syntax_pos::Span;
|
use syntax_pos::Span;
|
||||||
|
@ -94,7 +93,7 @@ impl CguReuseTracker {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn check_expected_reuse(&self, sess: &Session) {
|
pub fn check_expected_reuse(&self, diag: &errors::Handler) {
|
||||||
if let Some(ref data) = self.data {
|
if let Some(ref data) = self.data {
|
||||||
let data = data.lock().unwrap();
|
let data = data.lock().unwrap();
|
||||||
|
|
||||||
|
@ -120,14 +119,14 @@ impl CguReuseTracker {
|
||||||
actual_reuse,
|
actual_reuse,
|
||||||
at_least,
|
at_least,
|
||||||
expected_reuse);
|
expected_reuse);
|
||||||
sess.span_err(error_span.0, &msg);
|
diag.span_err(error_span.0, &msg);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let msg = format!("CGU-reuse for `{}` (mangled: `{}`) was \
|
let msg = format!("CGU-reuse for `{}` (mangled: `{}`) was \
|
||||||
not recorded",
|
not recorded",
|
||||||
cgu_user_name,
|
cgu_user_name,
|
||||||
cgu_name);
|
cgu_name);
|
||||||
sess.span_fatal(error_span.0, &msg);
|
diag.span_fatal(error_span.0, &msg).raise();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1752,7 +1752,7 @@ impl<B: ExtraBackendMethods> OngoingCodegen<B> {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
sess.cgu_reuse_tracker.check_expected_reuse(sess);
|
sess.cgu_reuse_tracker.check_expected_reuse(sess.diagnostic());
|
||||||
|
|
||||||
sess.abort_if_errors();
|
sess.abort_if_errors();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue