diff options
| author | Rémy Rakic <remy.rakic+github@gmail.com> | 2024-05-21 18:17:05 +0000 |
|---|---|---|
| committer | Rémy Rakic <remy.rakic+github@gmail.com> | 2024-05-23 15:47:35 +0000 |
| commit | d64a8bd1e55bd4be1e506792eabd812716d31765 (patch) | |
| tree | b9a552928049e5cdcb58c25ca3e83d089b272c4a | |
| parent | fab28f2a4d0bd394546cc37417c7b8aa4ecc1a21 (diff) | |
| download | rust-d64a8bd1e55bd4be1e506792eabd812716d31765.tar.gz rust-d64a8bd1e55bd4be1e506792eabd812716d31765.zip | |
emit an error if we can't find a path to the self-contained linker
| -rw-r--r-- | compiler/rustc_codegen_ssa/messages.ftl | 2 | ||||
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/back/link.rs | 6 | ||||
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/errors.rs | 4 |
3 files changed, 9 insertions, 3 deletions
diff --git a/compiler/rustc_codegen_ssa/messages.ftl b/compiler/rustc_codegen_ssa/messages.ftl index d159fe58d3e..1a851ad04a1 100644 --- a/compiler/rustc_codegen_ssa/messages.ftl +++ b/compiler/rustc_codegen_ssa/messages.ftl @@ -212,6 +212,8 @@ codegen_ssa_rlib_only_rmeta_found = could not find rlib for: `{$crate_name}`, fo codegen_ssa_select_cpp_build_tool_workload = in the Visual Studio installer, ensure the "C++ build tools" workload is selected +codegen_ssa_self_contained_linker_missing = the self-contained linker was requested, but it wasn't found in the target's sysroot, or in rustc's sysroot + codegen_ssa_shuffle_indices_evaluation = could not evaluate shuffle_indices at compile time codegen_ssa_specify_libraries_to_link = use the `-l` flag to specify native libraries to link diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs index 874732ee9ef..9d19ee77d3d 100644 --- a/compiler/rustc_codegen_ssa/src/back/link.rs +++ b/compiler/rustc_codegen_ssa/src/back/link.rs @@ -3127,9 +3127,9 @@ fn add_lld_args( }); } if !linker_path_exists { - // As an additional sanity check, we do nothing if the sysroot doesn't contain the - // linker path at all. - return; + // As a sanity check, we emit an error if none of these paths exist: we want + // self-contained linking and have no linker. + sess.dcx().emit_fatal(errors::SelfContainedLinkerMissing); } } diff --git a/compiler/rustc_codegen_ssa/src/errors.rs b/compiler/rustc_codegen_ssa/src/errors.rs index ed6a0c24410..3641e7842cf 100644 --- a/compiler/rustc_codegen_ssa/src/errors.rs +++ b/compiler/rustc_codegen_ssa/src/errors.rs @@ -414,6 +414,10 @@ pub struct UnableToExeLinker { pub struct MsvcMissingLinker; #[derive(Diagnostic)] +#[diag(codegen_ssa_self_contained_linker_missing)] +pub struct SelfContainedLinkerMissing; + +#[derive(Diagnostic)] #[diag(codegen_ssa_check_installed_visual_studio)] pub struct CheckInstalledVisualStudio; |
