From 0eccf1d9aa753a04b6dd0b276c9bd11a1fd5534e Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 5 Apr 2020 09:42:39 +0200 Subject: [PATCH 1/2] update Windows leak comment --- src/eval.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/eval.rs b/src/eval.rs index 46e66bc0a81e..54ace889c7a9 100644 --- a/src/eval.rs +++ b/src/eval.rs @@ -183,8 +183,7 @@ pub fn create_ecx<'mir, 'tcx: 'mir>( /// Returns `Some(return_code)` if program executed completed. /// Returns `None` if an evaluation error occured. pub fn eval_main<'tcx>(tcx: TyCtxt<'tcx>, main_id: DefId, config: MiriConfig) -> Option { - // FIXME: on Windows, locks and TLS dtor management allocate and leave that memory in `static`s. - // So we need https://github.com/rust-lang/miri/issues/940 to fix the leaks there. + // FIXME: on Windows, we ignore leaks (https://github.com/rust-lang/miri/issues/1302). let ignore_leaks = config.ignore_leaks || tcx.sess.target.target.target_os == "windows"; let (mut ecx, ret_place) = match create_ecx(tcx, main_id, config) { From 95ea03c124d988c6c16d826c180a14447e53daa8 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 5 Apr 2020 10:20:12 +0200 Subject: [PATCH 2/2] add empty line before backtrace, to separate it from help text --- src/diagnostics.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/diagnostics.rs b/src/diagnostics.rs index 9ff434021150..d12b21be5a60 100644 --- a/src/diagnostics.rs +++ b/src/diagnostics.rs @@ -102,7 +102,7 @@ pub fn report_error<'tcx, 'mir>( e.print_backtrace(); let msg = e.to_string(); - report_msg(ecx, &format!("{}: {}", title, msg), msg, &helps, true) + report_msg(ecx, &format!("{}: {}", title, msg), msg, helps, true) } /// Report an error or note (depending on the `error` argument) at the current frame's current statement. @@ -111,7 +111,7 @@ fn report_msg<'tcx, 'mir>( ecx: &InterpCx<'mir, 'tcx, Evaluator<'tcx>>, title: &str, span_msg: String, - helps: &[String], + mut helps: Vec, error: bool, ) -> Option { let span = if let Some(frame) = ecx.stack().last() { @@ -125,8 +125,12 @@ fn report_msg<'tcx, 'mir>( ecx.tcx.sess.diagnostic().span_note_diag(span, title) }; err.span_label(span, span_msg); - for help in helps { - err.help(help); + if !helps.is_empty() { + // Add visual separator before backtrace. + helps.last_mut().unwrap().push_str("\n"); + for help in helps { + err.help(&help); + } } // Add backtrace let frames = ecx.generate_stacktrace(); @@ -178,7 +182,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx CreatedAlloc(AllocId(id)) => format!("created allocation with id {}", id), }; - report_msg(this, "tracking was triggered", msg, &[], false); + report_msg(this, "tracking was triggered", msg, vec![], false); } }); }