From 54c122ec0d45799e795f8b2aca38227ce9b05fa5 Mon Sep 17 00:00:00 2001
From: Urgau <urgau@numericable.fr>
Date: Sun, 19 Nov 2023 23:17:27 +0100
Subject: [PATCH] [Miri] Do not respect RUSTC_HOST_FLAGS since RUSTFLAGS isn't

When building the standard library with Miri, it appears that cargo-miri
does not respect the RUSTFLAGS and even if they did it would be wrong
since they are created for ToolRustc not Std. To avoid errors ignore
RUSTC_HOST_FLAGS for Miri.
---
 src/bootstrap/src/bin/rustc.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/bootstrap/src/bin/rustc.rs b/src/bootstrap/src/bin/rustc.rs
index 070a2da6afb..af66cb3ffd7 100644
--- a/src/bootstrap/src/bin/rustc.rs
+++ b/src/bootstrap/src/bin/rustc.rs
@@ -114,7 +114,7 @@ fn main() {
         {
             cmd.arg("-Ztls-model=initial-exec");
         }
-    } else {
+    } else if std::env::var("MIRI").is_err() {
         // Find any host flags that were passed by bootstrap.
         // The flags are stored in a RUSTC_HOST_FLAGS variable, separated by spaces.
         if let Ok(flags) = std::env::var("RUSTC_HOST_FLAGS") {