From 66ca0f2cc214368c1b4364a4dc941ec95a7b2d03 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Fri, 19 Jul 2019 17:36:25 +0200 Subject: [PATCH 1/2] fix for rustc_driver change --- benches/helpers/miri_helper.rs | 6 +++--- rust-version | 2 +- src/bin/miri.rs | 11 +++++------ 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/benches/helpers/miri_helper.rs b/benches/helpers/miri_helper.rs index 44a94cd61a0..203a8b1133a 100644 --- a/benches/helpers/miri_helper.rs +++ b/benches/helpers/miri_helper.rs @@ -8,6 +8,7 @@ extern crate test; use self::miri::eval_main; use rustc::hir::def_id::LOCAL_CRATE; use rustc_interface::interface; +use rustc_driver::Compilation; use crate::test::Bencher; struct MiriCompilerCalls<'a> { @@ -15,7 +16,7 @@ struct MiriCompilerCalls<'a> { } impl rustc_driver::Callbacks for MiriCompilerCalls<'_> { - fn after_analysis(&mut self, compiler: &interface::Compiler) -> bool { + fn after_analysis(&mut self, compiler: &interface::Compiler) -> Compilation { compiler.session().abort_if_errors(); compiler.global_ctxt().unwrap().peek_mut().enter(|tcx| { @@ -31,8 +32,7 @@ impl rustc_driver::Callbacks for MiriCompilerCalls<'_> { compiler.session().abort_if_errors(); - // Don't continue execution - false + Compilation::Stop } } diff --git a/rust-version b/rust-version index 570ef637627..9ee662c00cb 100644 --- a/rust-version +++ b/rust-version @@ -1 +1 @@ -d36b7f69448f7390fa9dfde75d58b914365acdab +527dce7137f7a3c7bf47d9a503abf25f88ea22de diff --git a/src/bin/miri.rs b/src/bin/miri.rs index 6e67246d2ca..43cb19b2658 100644 --- a/src/bin/miri.rs +++ b/src/bin/miri.rs @@ -21,24 +21,24 @@ use hex::FromHexError; use rustc_interface::interface; use rustc::hir::def_id::LOCAL_CRATE; +use rustc_driver::Compilation; struct MiriCompilerCalls { miri_config: miri::MiriConfig, } impl rustc_driver::Callbacks for MiriCompilerCalls { - fn after_parsing(&mut self, compiler: &interface::Compiler) -> bool { + fn after_parsing(&mut self, compiler: &interface::Compiler) -> Compilation { let attr = ( syntax::symbol::Symbol::intern("miri"), syntax::feature_gate::AttributeType::Whitelisted, ); compiler.session().plugin_attributes.borrow_mut().push(attr); - // Continue execution - true + Compilation::Continue } - fn after_analysis(&mut self, compiler: &interface::Compiler) -> bool { + fn after_analysis(&mut self, compiler: &interface::Compiler) -> Compilation { init_late_loggers(); compiler.session().abort_if_errors(); @@ -54,8 +54,7 @@ impl rustc_driver::Callbacks for MiriCompilerCalls { compiler.session().abort_if_errors(); - // Don't continue execution - false + Compilation::Stop } } From 11d71195dd73f779cd020dd4811f1ed348f55988 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Fri, 19 Jul 2019 18:03:55 +0200 Subject: [PATCH 2/2] fix miri-rustc-tests --- src/bin/miri-rustc-tests.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/bin/miri-rustc-tests.rs b/src/bin/miri-rustc-tests.rs index 9b0d02f4b7e..dae5189937a 100644 --- a/src/bin/miri-rustc-tests.rs +++ b/src/bin/miri-rustc-tests.rs @@ -19,6 +19,7 @@ use rustc_interface::interface; use rustc::hir::{self, itemlikevisit}; use rustc::ty::TyCtxt; use rustc::hir::def_id::LOCAL_CRATE; +use rustc_driver::Compilation; use miri::MiriConfig; @@ -28,18 +29,17 @@ struct MiriCompilerCalls { } impl rustc_driver::Callbacks for MiriCompilerCalls { - fn after_parsing(&mut self, compiler: &interface::Compiler) -> bool { + fn after_parsing(&mut self, compiler: &interface::Compiler) -> Compilation { let attr = ( syntax::symbol::Symbol::intern("miri"), syntax::feature_gate::AttributeType::Whitelisted, ); compiler.session().plugin_attributes.borrow_mut().push(attr); - // Continue execution - true + Compilation::Continue } - fn after_analysis(&mut self, compiler: &interface::Compiler) -> bool { + fn after_analysis(&mut self, compiler: &interface::Compiler) -> Compilation { compiler.session().abort_if_errors(); compiler.global_ctxt().unwrap().peek_mut().enter(|tcx| { if std::env::args().any(|arg| arg == "--test") { @@ -71,7 +71,7 @@ impl rustc_driver::Callbacks for MiriCompilerCalls { }); // Continue execution on host target - self.host_target + if self.host_target { Compilation::Continue } else { Compilation::Stop } } }