Skip to content

Commit

Permalink
Use names that actually represent what's going on
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Jan 8, 2020
1 parent 90a8f2f commit c69ebaa
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,19 @@ pub fn report_msg<'tcx, 'mir>(
}

thread_local! {
static ECX: RefCell<Vec<NonHaltingDiagnostic>> = RefCell::new(Vec::new());
static DIAGNOSTICS: RefCell<Vec<NonHaltingDiagnostic>> = RefCell::new(Vec::new());
}

pub fn register_err(e: NonHaltingDiagnostic) {
ECX.with(|ecx| ecx.borrow_mut().push(e));
pub fn register_diagnostic(e: NonHaltingDiagnostic) {
DIAGNOSTICS.with(|diagnostics| diagnostics.borrow_mut().push(e));
}

impl<'mir, 'tcx> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> {
fn process_errors(&self) {
fn process_diagnostics(&self) {
let this = self.eval_context_ref();
ECX.with(|ecx| {
for e in ecx.borrow_mut().drain(..) {
DIAGNOSTICS.with(|diagnostics| {
for e in diagnostics.borrow_mut().drain(..) {
let msg = match e {
NonHaltingDiagnostic::PoppedTrackedPointerTag(item) =>
format!("popped tracked tag for item {:?}", item),
Expand Down
2 changes: 1 addition & 1 deletion src/eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ pub fn eval_main<'tcx>(tcx: TyCtxt<'tcx>, main_id: DefId, config: MiriConfig) ->
// Perform the main execution.
let res: InterpResult<'_, i64> = (|| {
while ecx.step()? {
ecx.process_errors();
ecx.process_diagnostics();
}
// Read the return code pointer *before* we run TLS destructors, to assert
// that it was written to by the time that `start` lang item returned.
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub use crate::shims::tls::{EvalContextExt as TlsEvalContextExt, TlsData};
pub use crate::shims::EvalContextExt as ShimsEvalContextExt;

pub use crate::diagnostics::{
register_err, report_err, EvalContextExt as DiagnosticsEvalContextExt, NonHaltingDiagnostic,
register_diagnostic, report_err, EvalContextExt as DiagnosticsEvalContextExt, NonHaltingDiagnostic,
};
pub use crate::eval::{create_ecx, eval_main, MiriConfig, TerminationInfo};
pub use crate::helpers::EvalContextExt as HelpersEvalContextExt;
Expand Down
2 changes: 1 addition & 1 deletion src/stacked_borrows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ impl<'tcx> Stack {
fn check_protector(item: &Item, tag: Option<Tag>, global: &GlobalState) -> InterpResult<'tcx> {
if let Tag::Tagged(id) = item.tag {
if Some(id) == global.tracked_pointer_tag {
register_err(NonHaltingDiagnostic::PoppedTrackedPointerTag(item.clone()));
register_diagnostic(NonHaltingDiagnostic::PoppedTrackedPointerTag(item.clone()));
}
}
if let Some(call) = item.protector {
Expand Down

0 comments on commit c69ebaa

Please sign in to comment.