1use std::ffi::CString;
2use std::path::Path;
3
4use rustc_data_structures::small_c_str::SmallCStr;
5use rustc_errors::{Diag, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level, msg};
6use rustc_macros::Diagnostic;
7use rustc_span::Span;
8
9#[derive(const _: () =
{
impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
SymbolAlreadyDefined<'a> where G: rustc_errors::EmissionGuarantee
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
SymbolAlreadyDefined {
span: __binding_0, symbol_name: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("symbol `{$symbol_name}` is already defined")));
;
diag.arg("symbol_name", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
10#[diag("symbol `{$symbol_name}` is already defined")]
11pub(crate) struct SymbolAlreadyDefined<'a> {
12 #[primary_span]
13 pub span: Span,
14 pub symbol_name: &'a str,
15}
16
17#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
SanitizerMemtagRequiresMte where
G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
SanitizerMemtagRequiresMte => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`-Zsanitizer=memtag` requires `-Ctarget-feature=+mte`")));
;
diag
}
}
}
}
};Diagnostic)]
18#[diag("`-Zsanitizer=memtag` requires `-Ctarget-feature=+mte`")]
19pub(crate) struct SanitizerMemtagRequiresMte;
20
21pub(crate) struct ParseTargetMachineConfig<'a>(pub LlvmError<'a>);
22
23impl<G: EmissionGuarantee> Diagnostic<'_, G> for ParseTargetMachineConfig<'_> {
24 fn into_diag(self, dcx: DiagCtxtHandle<'_>, level: Level) -> Diag<'_, G> {
25 let diag: Diag<'_, G> = self.0.into_diag(dcx, level);
26 let (message, _) = diag.messages.first().expect("`LlvmError` with no message");
27 let message = dcx.eagerly_translate_to_string(message.clone(), diag.args.iter());
28 Diag::new(
29 dcx,
30 level,
31 rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to parse target machine config to target machine: {$error}"))msg!("failed to parse target machine config to target machine: {$error}"),
32 )
33 .with_arg("error", message)
34 }
35}
36
37#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
AutoDiffComponentUnavailable where
G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
AutoDiffComponentUnavailable { err: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to load our autodiff backend: {$err}")));
;
diag.arg("err", __binding_0);
diag
}
}
}
}
};Diagnostic)]
38#[diag("failed to load our autodiff backend: {$err}")]
39pub(crate) struct AutoDiffComponentUnavailable {
40 pub err: String,
41}
42
43#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
AutoDiffComponentMissing where G: rustc_errors::EmissionGuarantee
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
AutoDiffComponentMissing { err: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("autodiff backend not found in the sysroot: {$err}")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("it will be distributed via rustup in the future")));
;
diag.arg("err", __binding_0);
diag
}
}
}
}
};Diagnostic)]
44#[diag("autodiff backend not found in the sysroot: {$err}")]
45#[note("it will be distributed via rustup in the future")]
46pub(crate) struct AutoDiffComponentMissing {
47 pub err: String,
48}
49
50#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
AutoDiffWithoutLto where G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
AutoDiffWithoutLto => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("using the autodiff feature requires setting `lto=\"fat\"` in your Cargo.toml")));
;
diag
}
}
}
}
};Diagnostic)]
51#[diag("using the autodiff feature requires setting `lto=\"fat\"` in your Cargo.toml")]
52pub(crate) struct AutoDiffWithoutLto;
53
54#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
AutoDiffWithoutEnable where G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
AutoDiffWithoutEnable => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("using the autodiff feature requires -Z autodiff=Enable")));
;
diag
}
}
}
}
};Diagnostic)]
55#[diag("using the autodiff feature requires -Z autodiff=Enable")]
56pub(crate) struct AutoDiffWithoutEnable;
57
58#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
OffloadWithoutEnable where G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
OffloadWithoutEnable => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("using the offload feature requires -Z offload=<Device or Host=/absolute/path/to/host.out>")));
;
diag
}
}
}
}
};Diagnostic)]
59#[diag("using the offload feature requires -Z offload=<Device or Host=/absolute/path/to/host.out>")]
60pub(crate) struct OffloadWithoutEnable;
61
62#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
OffloadWithoutFatLTO where G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
OffloadWithoutFatLTO => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("using the offload feature requires -C lto=fat")));
;
diag
}
}
}
}
};Diagnostic)]
63#[diag("using the offload feature requires -C lto=fat")]
64pub(crate) struct OffloadWithoutFatLTO;
65
66#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
OffloadWithoutAbsPath where G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
OffloadWithoutAbsPath => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("using the `-Z offload=Host=/absolute/path/to/host.out` flag requires an absolute path")));
;
diag
}
}
}
}
};Diagnostic)]
67#[diag("using the `-Z offload=Host=/absolute/path/to/host.out` flag requires an absolute path")]
68pub(crate) struct OffloadWithoutAbsPath;
69
70#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
OffloadWrongFileName where G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
OffloadWrongFileName => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("using the `-Z offload=Host=/absolute/path/to/host.out` flag must point to a `host.out` file")));
;
diag
}
}
}
}
};Diagnostic)]
71#[diag(
72 "using the `-Z offload=Host=/absolute/path/to/host.out` flag must point to a `host.out` file"
73)]
74pub(crate) struct OffloadWrongFileName;
75
76#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
OffloadNonexistingPath where G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
OffloadNonexistingPath => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the given path/file to `host.out` does not exist. Did you forget to run the device compilation first?")));
;
diag
}
}
}
}
};Diagnostic)]
77#[diag(
78 "the given path/file to `host.out` does not exist. Did you forget to run the device compilation first?"
79)]
80pub(crate) struct OffloadNonexistingPath;
81
82#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
OffloadBundleImagesFailed where G: rustc_errors::EmissionGuarantee
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
OffloadBundleImagesFailed => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("call to BundleImages failed, `host.out` was not created")));
;
diag
}
}
}
}
};Diagnostic)]
83#[diag("call to BundleImages failed, `host.out` was not created")]
84pub(crate) struct OffloadBundleImagesFailed;
85
86#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
OffloadEmbedFailed where G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
OffloadEmbedFailed => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("call to EmbedBufferInModule failed, `host.o` was not created")));
;
diag
}
}
}
}
};Diagnostic)]
87#[diag("call to EmbedBufferInModule failed, `host.o` was not created")]
88pub(crate) struct OffloadEmbedFailed;
89
90#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
LtoBitcodeFromRlib where G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
LtoBitcodeFromRlib { err: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to get bitcode from object file for LTO ({$err})")));
;
diag.arg("err", __binding_0);
diag
}
}
}
}
};Diagnostic)]
91#[diag("failed to get bitcode from object file for LTO ({$err})")]
92pub(crate) struct LtoBitcodeFromRlib {
93 pub err: String,
94}
95
96#[derive(const _: () =
{
impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
LlvmError<'a> where G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
LlvmError::WriteOutput { path: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("could not write output to {$path}")));
;
diag.arg("path", __binding_0);
diag
}
LlvmError::CreateTargetMachine { triple: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("could not create LLVM TargetMachine for triple: {$triple}")));
;
diag.arg("triple", __binding_0);
diag
}
LlvmError::RunLlvmPasses => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to run LLVM passes")));
;
diag
}
LlvmError::WriteIr { path: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to write LLVM IR to {$path}")));
;
diag.arg("path", __binding_0);
diag
}
LlvmError::PrepareThinLtoContext => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to prepare thin LTO context")));
;
diag
}
LlvmError::LoadBitcode { name: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to load bitcode of module \"{$name}\"")));
;
diag.arg("name", __binding_0);
diag
}
LlvmError::WriteThinLtoKey { err: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("error while writing ThinLTO key data: {$err}")));
;
diag.arg("err", __binding_0);
diag
}
LlvmError::PrepareThinLtoModule => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to prepare thin LTO module")));
;
diag
}
LlvmError::ParseBitcode => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to parse bitcode for LTO module")));
;
diag
}
}
}
}
};Diagnostic)]
97pub(crate) enum LlvmError<'a> {
98 #[diag("could not write output to {$path}")]
99 WriteOutput { path: &'a Path },
100 #[diag("could not create LLVM TargetMachine for triple: {$triple}")]
101 CreateTargetMachine { triple: SmallCStr },
102 #[diag("failed to run LLVM passes")]
103 RunLlvmPasses,
104 #[diag("failed to write LLVM IR to {$path}")]
105 WriteIr { path: &'a Path },
106 #[diag("failed to prepare thin LTO context")]
107 PrepareThinLtoContext,
108 #[diag("failed to load bitcode of module \"{$name}\"")]
109 LoadBitcode { name: CString },
110 #[diag("error while writing ThinLTO key data: {$err}")]
111 WriteThinLtoKey { err: std::io::Error },
112 #[diag("failed to prepare thin LTO module")]
113 PrepareThinLtoModule,
114 #[diag("failed to parse bitcode for LTO module")]
115 ParseBitcode,
116}
117
118pub(crate) struct WithLlvmError<'a>(pub LlvmError<'a>, pub String);
119
120impl<G: EmissionGuarantee> Diagnostic<'_, G> for WithLlvmError<'_> {
121 fn into_diag(self, dcx: DiagCtxtHandle<'_>, level: Level) -> Diag<'_, G> {
122 use LlvmError::*;
123 let msg_with_llvm_err = match &self.0 {
124 WriteOutput { .. } => rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("could not write output to {$path}: {$llvm_err}"))msg!("could not write output to {$path}: {$llvm_err}"),
125 CreateTargetMachine { .. } => {
126 rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("could not create LLVM TargetMachine for triple: {$triple}: {$llvm_err}"))msg!("could not create LLVM TargetMachine for triple: {$triple}: {$llvm_err}")
127 }
128 RunLlvmPasses => rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to run LLVM passes: {$llvm_err}"))msg!("failed to run LLVM passes: {$llvm_err}"),
129 WriteIr { .. } => rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to write LLVM IR to {$path}: {$llvm_err}"))msg!("failed to write LLVM IR to {$path}: {$llvm_err}"),
130 PrepareThinLtoContext => {
131 rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to prepare thin LTO context: {$llvm_err}"))msg!("failed to prepare thin LTO context: {$llvm_err}")
132 }
133 LoadBitcode { .. } => {
134 rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to load bitcode of module \"{$name}\": {$llvm_err}"))msg!("failed to load bitcode of module \"{$name}\": {$llvm_err}")
135 }
136 WriteThinLtoKey { .. } => {
137 rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("error while writing ThinLTO key data: {$err}: {$llvm_err}"))msg!("error while writing ThinLTO key data: {$err}: {$llvm_err}")
138 }
139 PrepareThinLtoModule => {
140 rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to prepare thin LTO module: {$llvm_err}"))msg!("failed to prepare thin LTO module: {$llvm_err}")
141 }
142 ParseBitcode => rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to parse bitcode for LTO module: {$llvm_err}"))msg!("failed to parse bitcode for LTO module: {$llvm_err}"),
143 };
144 self.0
145 .into_diag(dcx, level)
146 .with_primary_message(msg_with_llvm_err)
147 .with_arg("llvm_err", self.1)
148 }
149}
150
151#[derive(const _: () =
{
impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
FromLlvmOptimizationDiag<'a> where
G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
FromLlvmOptimizationDiag {
filename: __binding_0,
line: __binding_1,
column: __binding_2,
pass_name: __binding_3,
kind: __binding_4,
message: __binding_5 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$filename}:{$line}:{$column} {$pass_name} ({$kind}): {$message}")));
;
diag.arg("filename", __binding_0);
diag.arg("line", __binding_1);
diag.arg("column", __binding_2);
diag.arg("pass_name", __binding_3);
diag.arg("kind", __binding_4);
diag.arg("message", __binding_5);
diag
}
}
}
}
};Diagnostic)]
152#[diag("{$filename}:{$line}:{$column} {$pass_name} ({$kind}): {$message}")]
153pub(crate) struct FromLlvmOptimizationDiag<'a> {
154 pub filename: &'a str,
155 pub line: std::ffi::c_uint,
156 pub column: std::ffi::c_uint,
157 pub pass_name: &'a str,
158 pub kind: &'a str,
159 pub message: &'a str,
160}
161
162#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for FromLlvmDiag
where G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
FromLlvmDiag { message: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$message}")));
;
diag.arg("message", __binding_0);
diag
}
}
}
}
};Diagnostic)]
163#[diag("{$message}")]
164pub(crate) struct FromLlvmDiag {
165 pub message: String,
166}
167
168#[derive(const _: () =
{
impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
WriteBytecode<'a> where G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
WriteBytecode { path: __binding_0, err: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to write bytecode to {$path}: {$err}")));
;
diag.arg("path", __binding_0);
diag.arg("err", __binding_1);
diag
}
}
}
}
};Diagnostic)]
169#[diag("failed to write bytecode to {$path}: {$err}")]
170pub(crate) struct WriteBytecode<'a> {
171 pub path: &'a Path,
172 pub err: std::io::Error,
173}
174
175#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for CopyBitcode
where G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
CopyBitcode { err: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to copy bitcode to object file: {$err}")));
;
diag.arg("err", __binding_0);
diag
}
}
}
}
};Diagnostic)]
176#[diag("failed to copy bitcode to object file: {$err}")]
177pub(crate) struct CopyBitcode {
178 pub err: std::io::Error,
179}
180
181#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
UnknownCompression where G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
UnknownCompression { algorithm: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unknown debuginfo compression algorithm {$algorithm} - will fall back to uncompressed debuginfo")));
;
diag.arg("algorithm", __binding_0);
diag
}
}
}
}
};Diagnostic)]
182#[diag(
183 "unknown debuginfo compression algorithm {$algorithm} - will fall back to uncompressed debuginfo"
184)]
185pub(crate) struct UnknownCompression {
186 pub algorithm: &'static str,
187}
188
189#[derive(const _: () =
{
impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
MismatchedDataLayout<'a> where G: rustc_errors::EmissionGuarantee
{
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
MismatchedDataLayout {
rustc_target: __binding_0,
rustc_layout: __binding_1,
llvm_target: __binding_2,
llvm_layout: __binding_3 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("data-layout for target `{$rustc_target}`, `{$rustc_layout}`, differs from LLVM target's `{$llvm_target}` default layout, `{$llvm_layout}`")));
;
diag.arg("rustc_target", __binding_0);
diag.arg("rustc_layout", __binding_1);
diag.arg("llvm_target", __binding_2);
diag.arg("llvm_layout", __binding_3);
diag
}
}
}
}
};Diagnostic)]
190#[diag(
191 "data-layout for target `{$rustc_target}`, `{$rustc_layout}`, differs from LLVM target's `{$llvm_target}` default layout, `{$llvm_layout}`"
192)]
193pub(crate) struct MismatchedDataLayout<'a> {
194 pub rustc_target: &'a str,
195 pub rustc_layout: &'a str,
196 pub llvm_target: &'a str,
197 pub llvm_layout: &'a str,
198}
199
200#[derive(const _: () =
{
impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
FixedX18InvalidArch<'a> where G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
FixedX18InvalidArch { arch: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the `-Zfixed-x18` flag is not supported on the `{$arch}` architecture")));
;
diag.arg("arch", __binding_0);
diag
}
}
}
}
};Diagnostic)]
201#[diag("the `-Zfixed-x18` flag is not supported on the `{$arch}` architecture")]
202pub(crate) struct FixedX18InvalidArch<'a> {
203 pub arch: &'a str,
204}
205
206#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
SanitizerKcfiArityRequiresLLVM2100 where
G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
SanitizerKcfiArityRequiresLLVM2100 => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`-Zsanitizer-kcfi-arity` requires LLVM 21.0.0 or later")));
;
diag
}
}
}
}
};Diagnostic)]
207#[diag("`-Zsanitizer-kcfi-arity` requires LLVM 21.0.0 or later")]
208pub(crate) struct SanitizerKcfiArityRequiresLLVM2100;