Auto merge of #2869 - oli-obk:only_interp_compiling_code, r=RalfJung
Avoid interpreting code that has lint errors fixes #2608 we previously only checked for actual errors, as deny lints are handled differently.
This commit is contained in:
commit
9db11c9789
@ -63,7 +63,9 @@ impl rustc_driver::Callbacks for MiriCompilerCalls {
|
||||
queries: &'tcx rustc_interface::Queries<'tcx>,
|
||||
) -> Compilation {
|
||||
queries.global_ctxt().unwrap().enter(|tcx| {
|
||||
tcx.sess.abort_if_errors();
|
||||
if tcx.sess.compile_status().is_err() {
|
||||
tcx.sess.fatal("miri cannot be run on programs that fail compilation");
|
||||
}
|
||||
|
||||
init_late_loggers(tcx);
|
||||
if !tcx.sess.crate_types().contains(&CrateType::Executable) {
|
||||
|
8
src/tools/miri/tests/fail/deny_lint.rs
Normal file
8
src/tools/miri/tests/fail/deny_lint.rs
Normal file
@ -0,0 +1,8 @@
|
||||
//@error-pattern: miri cannot be run on programs that fail compilation
|
||||
|
||||
#![deny(warnings)]
|
||||
|
||||
struct Foo;
|
||||
//~^ ERROR: struct `Foo` is never constructed
|
||||
|
||||
fn main() {}
|
12
src/tools/miri/tests/fail/deny_lint.stderr
Normal file
12
src/tools/miri/tests/fail/deny_lint.stderr
Normal file
@ -0,0 +1,12 @@
|
||||
error: struct `Foo` is never constructed
|
||||
--> $DIR/deny_lint.rs:LL:CC
|
||||
|
|
||||
LL | struct Foo;
|
||||
| ^^^
|
||||
|
|
||||
= note: `-D dead-code` implied by `-D unused`
|
||||
|
||||
error: miri cannot be run on programs that fail compilation
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
Loading…
x
Reference in New Issue
Block a user