Unknown -> Unsupported compression algorithm

Both zstd and zlib are *known* compression algorithms, they just may not
be supported by the backend. We shouldn't mislead users into e.g.
thinking they made a typo.
This commit is contained in:
Mark Rousskov
2026-01-02 17:28:27 -05:00
parent 20f19f4615
commit 6458ca5349
3 changed files with 6 additions and 6 deletions
@@ -36,7 +36,7 @@
use crate::common::AsCCharPtr;
use crate::errors::{
CopyBitcode, FromLlvmDiag, FromLlvmOptimizationDiag, LlvmError, ParseTargetMachineConfig,
UnknownCompression, WithLlvmError, WriteBytecode,
UnsupportedCompression, WithLlvmError, WriteBytecode,
};
use crate::llvm::diagnostic::OptimizationDiagnosticKind::*;
use crate::llvm::{self, DiagnosticInfo};
@@ -248,7 +248,7 @@ pub(crate) fn target_machine_factory(
if llvm::LLVMRustLLVMHasZlibCompression() {
llvm::CompressionKind::Zlib
} else {
sess.dcx().emit_warn(UnknownCompression { algorithm: "zlib" });
sess.dcx().emit_warn(UnsupportedCompression { algorithm: "zlib" });
llvm::CompressionKind::None
}
}
@@ -256,7 +256,7 @@ pub(crate) fn target_machine_factory(
if llvm::LLVMRustLLVMHasZstdCompression() {
llvm::CompressionKind::Zstd
} else {
sess.dcx().emit_warn(UnknownCompression { algorithm: "zstd" });
sess.dcx().emit_warn(UnsupportedCompression { algorithm: "zstd" });
llvm::CompressionKind::None
}
}
+2 -2
View File
@@ -182,9 +182,9 @@ pub(crate) struct CopyBitcode {
#[derive(Diagnostic)]
#[diag(
"unknown debuginfo compression algorithm {$algorithm} - will fall back to uncompressed debuginfo"
"unsupported debuginfo compression algorithm {$algorithm} - will fall back to uncompressed debuginfo"
)]
pub(crate) struct UnknownCompression {
pub(crate) struct UnsupportedCompression {
pub algorithm: &'static str,
}
+1 -1
View File
@@ -23,7 +23,7 @@ fn check_compression(compression: &str, to_find: &str) {
} else {
assert_contains(
stderr,
format!("unknown debuginfo compression algorithm {compression}"),
format!("unsupported debuginfo compression algorithm {compression}"),
);
}
});