@@ -49,8 +49,8 @@ pub struct MiriEnv {
49
49
50
50
impl MiriEnv {
51
51
pub fn new ( ) -> Result < Self > {
52
- let sh = shell ( ) ?;
53
52
let toolchain = active_toolchain ( ) ?;
53
+ let sh = shell ( ) ?; // we are preserving the current_dir on this one, so paths resolve properly!
54
54
let miri_dir = miri_dir ( ) ?;
55
55
56
56
let sysroot = cmd ! ( sh, "rustc +{toolchain} --print sysroot" ) . read ( ) ?. into ( ) ;
@@ -77,18 +77,18 @@ impl MiriEnv {
77
77
78
78
// Compute rustflags.
79
79
let rustflags = {
80
- let env = std:: env:: var_os ( "RUSTFLAGS" ) ;
81
- let mut flags_with_warnings = OsString :: from (
82
- "-Zunstable-options -Wrustc::internal -Wrust_2018_idioms -Wunused_lifetimes -Wsemicolon_in_expressions_from_macros " ,
83
- ) ;
84
- if let Some ( value) = env {
85
- flags_with_warnings. push ( value) ;
86
- }
80
+ let mut flags = OsString :: new ( ) ;
87
81
// We set the rpath so that Miri finds the private rustc libraries it needs.
88
- let mut flags_with_compiler_settings = OsString :: from ( "-C link-args=-Wl,-rpath," ) ;
89
- flags_with_compiler_settings. push ( & libdir) ;
90
- flags_with_compiler_settings. push ( flags_with_warnings) ;
91
- flags_with_compiler_settings
82
+ flags. push ( "-C link-args=-Wl,-rpath," ) ;
83
+ flags. push ( libdir) ;
84
+ // Enable rustc-specific lints (ignored without `-Zunstable-options`).
85
+ flags. push ( " -Zunstable-options -Wrustc::internal -Wrust_2018_idioms -Wunused_lifetimes -Wsemicolon_in_expressions_from_macros" ) ;
86
+ // Add user-defined flags.
87
+ if let Some ( value) = std:: env:: var_os ( "RUSTFLAGS" ) {
88
+ flags. push ( " " ) ;
89
+ flags. push ( value) ;
90
+ }
91
+ flags
92
92
} ;
93
93
sh. set_var ( "RUSTFLAGS" , rustflags) ;
94
94
0 commit comments