From c6bae16dc2e75456786e0f7af39f0cf9e3186bb5 Mon Sep 17 00:00:00 2001 From: Petr Hosek Date: Fri, 30 Mar 2018 19:37:08 -0700 Subject: Only include space in RUSTFLAGS extra flags if not empty When the RUSTFLAGS_STAGE_{1,2} is not set, including a space means the string will always be non-empty and RUSTFLAGS will be always be reset which breaks other ways of setting these such as through config in CARGO_HOME. --- src/bootstrap/builder.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/bootstrap') diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index eb23236638b..0464840c3e8 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -555,7 +555,9 @@ impl<'a> Builder<'a> { let mut extra_args = env::var(&format!("RUSTFLAGS_STAGE_{}", stage)).unwrap_or_default(); if stage != 0 { let s = env::var("RUSTFLAGS_STAGE_NOT_0").unwrap_or_default(); - extra_args.push_str(" "); + if !extra_args.is_empty() { + extra_args.push_str(" "); + } extra_args.push_str(&s); } -- cgit 1.4.1-3-g733a5