Skip to content

Commit 7dc36ad

Browse files
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.
1 parent 021fc25 commit 7dc36ad

4 files changed

Lines changed: 7 additions & 7 deletions

File tree

compiler/rustc_codegen_llvm/messages.ftl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ codegen_llvm_symbol_already_defined =
6161
codegen_llvm_target_machine = could not create LLVM TargetMachine for triple: {$triple}
6262
codegen_llvm_target_machine_with_llvm_err = could not create LLVM TargetMachine for triple: {$triple}: {$llvm_err}
6363
64-
codegen_llvm_unknown_debuginfo_compression = unknown debuginfo compression algorithm {$algorithm} - will fall back to uncompressed debuginfo
64+
codegen_llvm_unsupported_debuginfo_compression = unsupported debuginfo compression algorithm {$algorithm} - will fall back to uncompressed debuginfo
6565
6666
codegen_llvm_write_bytecode = failed to write bytecode to {$path}: {$err}
6767

compiler/rustc_codegen_llvm/src/back/write.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ use crate::builder::SBuilder;
3838
use crate::builder::gpu_offload::scalar_width;
3939
use crate::common::AsCCharPtr;
4040
use crate::errors::{
41-
CopyBitcode, FromLlvmDiag, FromLlvmOptimizationDiag, LlvmError, UnknownCompression,
41+
CopyBitcode, FromLlvmDiag, FromLlvmOptimizationDiag, LlvmError, UnsupportedCompression,
4242
WithLlvmError, WriteBytecode,
4343
};
4444
use crate::llvm::diagnostic::OptimizationDiagnosticKind::*;
@@ -259,15 +259,15 @@ pub(crate) fn target_machine_factory(
259259
if llvm::LLVMRustLLVMHasZlibCompression() {
260260
llvm::CompressionKind::Zlib
261261
} else {
262-
sess.dcx().emit_warn(UnknownCompression { algorithm: "zlib" });
262+
sess.dcx().emit_warn(UnsupportedCompression { algorithm: "zlib" });
263263
llvm::CompressionKind::None
264264
}
265265
}
266266
config::DebugInfoCompression::Zstd => {
267267
if llvm::LLVMRustLLVMHasZstdCompression() {
268268
llvm::CompressionKind::Zstd
269269
} else {
270-
sess.dcx().emit_warn(UnknownCompression { algorithm: "zstd" });
270+
sess.dcx().emit_warn(UnsupportedCompression { algorithm: "zstd" });
271271
llvm::CompressionKind::None
272272
}
273273
}

compiler/rustc_codegen_llvm/src/errors.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,8 @@ pub(crate) struct CopyBitcode {
169169
}
170170

171171
#[derive(Diagnostic)]
172-
#[diag(codegen_llvm_unknown_debuginfo_compression)]
173-
pub(crate) struct UnknownCompression {
172+
#[diag(codegen_llvm_unsupported_debuginfo_compression)]
173+
pub(crate) struct UnsupportedCompression {
174174
pub algorithm: &'static str,
175175
}
176176

tests/run-make/compressed-debuginfo/rmake.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fn check_compression(compression: &str, to_find: &str) {
2323
} else {
2424
assert_contains(
2525
stderr,
26-
format!("unknown debuginfo compression algorithm {compression}"),
26+
format!("unsupported debuginfo compression algorithm {compression}"),
2727
);
2828
}
2929
});

0 commit comments

Comments
 (0)