about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2024-05-02 15:11:22 +0200
committerGitHub <noreply@github.com>2024-05-02 15:11:22 +0200
commit871f047c4cdfda748e8490c7d35c041b875d2026 (patch)
treee5ecb657d24fe2a30b292a0a459c15668533c766
parentdf9f8d0153be35463123f90adf2ba769654392a9 (diff)
parent6115cf6f41e8b10afd0e2f0e0528d0463585d52e (diff)
downloadrust-871f047c4cdfda748e8490c7d35c041b875d2026.tar.gz
rust-871f047c4cdfda748e8490c7d35c041b875d2026.zip
Rollup merge of #124582 - RalfJung:std-not-found, r=Nilstrieb
always print nice 'std not found' error when std is not found

Fixes https://github.com/rust-lang/miri/issues/3529

Arguably Miri is doing something odd by letting people create no-std sysroots for arbitrary targets -- but equally arguably, there's no good reason for rustc to special-case the host triple here. Being a non-host triple does not imply the target is a no-std target, after all.
-rw-r--r--compiler/rustc_metadata/src/errors.rs5
1 files changed, 1 insertions, 4 deletions
diff --git a/compiler/rustc_metadata/src/errors.rs b/compiler/rustc_metadata/src/errors.rs
index e8449d3918b..fb0010f2c5d 100644
--- a/compiler/rustc_metadata/src/errors.rs
+++ b/compiler/rustc_metadata/src/errors.rs
@@ -5,7 +5,6 @@ use std::{
 
 use rustc_errors::{codes::*, Diag, DiagCtxt, Diagnostic, EmissionGuarantee, Level};
 use rustc_macros::{Diagnostic, Subdiagnostic};
-use rustc_session::config;
 use rustc_span::{sym, Span, Symbol};
 use rustc_target::spec::{PanicStrategy, TargetTriple};
 
@@ -640,9 +639,7 @@ impl<G: EmissionGuarantee> Diagnostic<'_, G> for CannotFindCrate {
         diag.arg("locator_triple", self.locator_triple.triple());
         diag.code(E0463);
         diag.span(self.span);
-        if (self.crate_name == sym::std || self.crate_name == sym::core)
-            && self.locator_triple != TargetTriple::from_triple(config::host_triple())
-        {
+        if self.crate_name == sym::std || self.crate_name == sym::core {
             if self.missing_core {
                 diag.note(fluent::metadata_target_not_installed);
             } else {