@@ -49,8 +49,8 @@ pub struct MiriEnv {
4949
5050impl MiriEnv {
5151 pub fn new ( ) -> Result < Self > {
52- let sh = shell ( ) ?;
5352 let toolchain = active_toolchain ( ) ?;
53+ let sh = shell ( ) ?; // we are preserving the current_dir on this one, so paths resolve properly!
5454 let miri_dir = miri_dir ( ) ?;
5555
5656 let sysroot = cmd ! ( sh, "rustc +{toolchain} --print sysroot" ) . read ( ) ?. into ( ) ;
@@ -77,18 +77,18 @@ impl MiriEnv {
7777
7878 // Compute rustflags.
7979 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 ( ) ;
8781 // 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
9292 } ;
9393 sh. set_var ( "RUSTFLAGS" , rustflags) ;
9494
0 commit comments