diff --git a/src/diagnostics.rs b/src/diagnostics.rs index 2b53efe864e5..24e68934c66f 100644 --- a/src/diagnostics.rs +++ b/src/diagnostics.rs @@ -106,7 +106,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. @@ -115,7 +115,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() { @@ -129,8 +129,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(); @@ -182,7 +186,7 @@ fn process_diagnostics(&self) { 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); } }); } diff --git a/src/eval.rs b/src/eval.rs index c3510188e3cb..094be194f178 100644 --- a/src/eval.rs +++ b/src/eval.rs @@ -186,8 +186,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) {