File tree 2 files changed +11
-1
lines changed
2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,8 @@ use rustc_middle::{
30
30
} ,
31
31
ty:: { query:: ExternProviders , TyCtxt } ,
32
32
} ;
33
+ use rustc_session:: config:: OptLevel ;
34
+
33
35
use rustc_session:: { config:: CrateType , search_paths:: PathKind , CtfeBacktrace } ;
34
36
35
37
use miri:: { BacktraceStyle , ProvenanceMode , RetagFields } ;
@@ -82,6 +84,15 @@ impl rustc_driver::Callbacks for MiriCompilerCalls {
82
84
env:: set_current_dir ( cwd) . unwrap ( ) ;
83
85
}
84
86
87
+ if tcx. sess . opts . optimize != OptLevel :: No {
88
+ tcx. sess . warn ( "Miri does not support optimizations." ) ;
89
+ } else if tcx. sess . mir_opt_level ( ) > 0 {
90
+ tcx. sess . warn ( "You have explicitly enabled MIR optimizations, overriding Miri's default \
91
+ which is to completely disable them. Any optimizations may hide UB that Miri would \
92
+ otherwise detect, and it is not necessarily possible to predict what kind of UB will \
93
+ be missed.") ;
94
+ }
95
+
85
96
if let Some ( return_code) = miri:: eval_entry ( tcx, entry_def_id, entry_type, config) {
86
97
std:: process:: exit (
87
98
i32:: try_from ( return_code) . expect ( "Return value was too large!" ) ,
Original file line number Diff line number Diff line change @@ -129,6 +129,5 @@ pub const MIRI_DEFAULT_ARGS: &[&str] = &[
129
129
"-Zmir-emit-retag" ,
130
130
"-Zmir-opt-level=0" ,
131
131
"--cfg=miri" ,
132
- "-Cdebug-assertions=on" ,
133
132
"-Zextra-const-ub-checks" ,
134
133
] ;
You can’t perform that action at this time.
0 commit comments