1use std::borrow::Cow;
4use std::ffi::OsString;
5use std::io::Error;
6use std::path::{Path, PathBuf};
7use std::process::ExitStatus;
8
9use rustc_errors::codes::*;
10use rustc_errors::{
11 Diag, DiagArgValue, DiagCtxtHandle, Diagnostic, EmissionGuarantee, IntoDiagArg, Level, msg,
12};
13use rustc_macros::{Diagnostic, Subdiagnostic};
14use rustc_middle::ty::layout::LayoutError;
15use rustc_middle::ty::{FloatTy, Ty};
16use rustc_span::{Span, Symbol};
17
18use crate::assert_module_sources::CguReuse;
19use crate::back::command::Command;
20
21#[derive(const _: () =
{
impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
IncorrectCguReuseType<'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 {
IncorrectCguReuseType {
span: __binding_0,
cgu_user_name: __binding_1,
actual_reuse: __binding_2,
expected_reuse: __binding_3,
at_least: __binding_4 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("CGU-reuse for `{$cgu_user_name}` is `{$actual_reuse}` but should be {$at_least ->\n [one] {\"at least \"}\n *[other] {\"\"}\n }`{$expected_reuse}`")));
;
diag.arg("cgu_user_name", __binding_1);
diag.arg("actual_reuse", __binding_2);
diag.arg("expected_reuse", __binding_3);
diag.arg("at_least", __binding_4);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
22#[diag(
23 "CGU-reuse for `{$cgu_user_name}` is `{$actual_reuse}` but should be {$at_least ->
24 [one] {\"at least \"}
25 *[other] {\"\"}
26 }`{$expected_reuse}`"
27)]
28pub(crate) struct IncorrectCguReuseType<'a> {
29 #[primary_span]
30 pub span: Span,
31 pub cgu_user_name: &'a str,
32 pub actual_reuse: CguReuse,
33 pub expected_reuse: CguReuse,
34 pub at_least: u8,
35}
36
37#[derive(const _: () =
{
impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
CguNotRecorded<'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 {
CguNotRecorded {
cgu_user_name: __binding_0, cgu_name: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("CGU-reuse for `{$cgu_user_name}` is (mangled: `{$cgu_name}`) was not recorded")));
;
diag.arg("cgu_user_name", __binding_0);
diag.arg("cgu_name", __binding_1);
diag
}
}
}
}
};Diagnostic)]
38#[diag("CGU-reuse for `{$cgu_user_name}` is (mangled: `{$cgu_name}`) was not recorded")]
39pub(crate) struct CguNotRecorded<'a> {
40 pub cgu_user_name: &'a str,
41 pub cgu_name: &'a str,
42}
43
44#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
MissingQueryDepGraph 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 {
MissingQueryDepGraph { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("found CGU-reuse attribute but `-Zquery-dep-graph` was not specified")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
45#[diag("found CGU-reuse attribute but `-Zquery-dep-graph` was not specified")]
46pub(crate) struct MissingQueryDepGraph {
47 #[primary_span]
48 pub span: Span,
49}
50
51#[derive(const _: () =
{
impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
MalformedCguName<'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 {
MalformedCguName {
span: __binding_0,
user_path: __binding_1,
crate_name: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("found malformed codegen unit name `{$user_path}`. codegen units names must always start with the name of the crate (`{$crate_name}` in this case)")));
;
diag.arg("user_path", __binding_1);
diag.arg("crate_name", __binding_2);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
52#[diag(
53 "found malformed codegen unit name `{$user_path}`. codegen units names must always start with the name of the crate (`{$crate_name}` in this case)"
54)]
55pub(crate) struct MalformedCguName<'a> {
56 #[primary_span]
57 pub span: Span,
58 pub user_path: &'a str,
59 pub crate_name: &'a str,
60}
61
62#[derive(const _: () =
{
impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
NoModuleNamed<'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 {
NoModuleNamed {
span: __binding_0,
user_path: __binding_1,
cgu_name: __binding_2,
cgu_names: __binding_3 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("no module named `{$user_path}` (mangled: {$cgu_name}). available modules: {$cgu_names}")));
;
diag.arg("user_path", __binding_1);
diag.arg("cgu_name", __binding_2);
diag.arg("cgu_names", __binding_3);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
63#[diag("no module named `{$user_path}` (mangled: {$cgu_name}). available modules: {$cgu_names}")]
64pub(crate) struct NoModuleNamed<'a> {
65 #[primary_span]
66 pub span: Span,
67 pub user_path: &'a str,
68 pub cgu_name: Symbol,
69 pub cgu_names: String,
70}
71
72#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
LibDefWriteFailure 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 {
LibDefWriteFailure { error: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to write lib.def file: {$error}")));
;
diag.arg("error", __binding_0);
diag
}
}
}
}
};Diagnostic)]
73#[diag("failed to write lib.def file: {$error}")]
74pub(crate) struct LibDefWriteFailure {
75 pub error: Error,
76}
77
78#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
VersionScriptWriteFailure 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 {
VersionScriptWriteFailure { error: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to write version script: {$error}")));
;
diag.arg("error", __binding_0);
diag
}
}
}
}
};Diagnostic)]
79#[diag("failed to write version script: {$error}")]
80pub(crate) struct VersionScriptWriteFailure {
81 pub error: Error,
82}
83
84#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
SymbolFileWriteFailure 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 {
SymbolFileWriteFailure { error: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to write symbols file: {$error}")));
;
diag.arg("error", __binding_0);
diag
}
}
}
}
};Diagnostic)]
85#[diag("failed to write symbols file: {$error}")]
86pub(crate) struct SymbolFileWriteFailure {
87 pub error: Error,
88}
89
90#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
Ld64UnimplementedModifier 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 {
Ld64UnimplementedModifier => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`as-needed` modifier not implemented yet for ld64")));
;
diag
}
}
}
}
};Diagnostic)]
91#[diag("`as-needed` modifier not implemented yet for ld64")]
92pub(crate) struct Ld64UnimplementedModifier;
93
94#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
LinkerUnsupportedModifier 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 {
LinkerUnsupportedModifier => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`as-needed` modifier not supported for current linker")));
;
diag
}
}
}
}
};Diagnostic)]
95#[diag("`as-needed` modifier not supported for current linker")]
96pub(crate) struct LinkerUnsupportedModifier;
97
98#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
L4BenderExportingSymbolsUnimplemented 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 {
L4BenderExportingSymbolsUnimplemented => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("exporting symbols not implemented yet for L4Bender")));
;
diag
}
}
}
}
};Diagnostic)]
99#[diag("exporting symbols not implemented yet for L4Bender")]
100pub(crate) struct L4BenderExportingSymbolsUnimplemented;
101
102#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
NoNatvisDirectory 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 {
NoNatvisDirectory { error: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("error enumerating natvis directory: {$error}")));
;
diag.arg("error", __binding_0);
diag
}
}
}
}
};Diagnostic)]
103#[diag("error enumerating natvis directory: {$error}")]
104pub(crate) struct NoNatvisDirectory {
105 pub error: Error,
106}
107
108#[derive(const _: () =
{
impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
NoSavedObjectFile<'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 {
NoSavedObjectFile { cgu_name: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cached cgu {$cgu_name} should have an object file, but doesn't")));
;
diag.arg("cgu_name", __binding_0);
diag
}
}
}
}
};Diagnostic)]
109#[diag("cached cgu {$cgu_name} should have an object file, but doesn't")]
110pub(crate) struct NoSavedObjectFile<'a> {
111 pub cgu_name: &'a str,
112}
113
114#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
RequiresRustAbi 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 {
RequiresRustAbi { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[track_caller]` requires Rust ABI")));
diag.code(E0737);
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
115#[diag("`#[track_caller]` requires Rust ABI", code = E0737)]
116pub(crate) struct RequiresRustAbi {
117 #[primary_span]
118 pub span: Span,
119}
120
121#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for CopyPathBuf
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 {
CopyPathBuf {
source_file: __binding_0,
output_path: __binding_1,
error: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unable to copy {$source_file} to {$output_path}: {$error}")));
;
diag.arg("source_file", __binding_0);
diag.arg("output_path", __binding_1);
diag.arg("error", __binding_2);
diag
}
}
}
}
};Diagnostic)]
122#[diag("unable to copy {$source_file} to {$output_path}: {$error}")]
123pub(crate) struct CopyPathBuf {
124 pub source_file: PathBuf,
125 pub output_path: PathBuf,
126 pub error: Error,
127}
128
129#[derive(const _: () =
{
impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
CopyPath<'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 {
CopyPath {
from: __binding_0, to: __binding_1, error: __binding_2 } =>
{
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("could not copy {$from} to {$to}: {$error}")));
;
diag.arg("from", __binding_0);
diag.arg("to", __binding_1);
diag.arg("error", __binding_2);
diag
}
}
}
}
};Diagnostic)]
131#[diag("could not copy {$from} to {$to}: {$error}")]
132pub(crate) struct CopyPath<'a> {
133 from: DebugArgPath<'a>,
134 to: DebugArgPath<'a>,
135 error: Error,
136}
137
138impl<'a> CopyPath<'a> {
139 pub(crate) fn new(from: &'a Path, to: &'a Path, error: Error) -> CopyPath<'a> {
140 CopyPath { from: DebugArgPath(from), to: DebugArgPath(to), error }
141 }
142}
143
144struct DebugArgPath<'a>(pub &'a Path);
145
146impl IntoDiagArg for DebugArgPath<'_> {
147 fn into_diag_arg(self, _: &mut Option<std::path::PathBuf>) -> rustc_errors::DiagArgValue {
148 DiagArgValue::Str(Cow::Owned(::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0:?}", self.0))
})format!("{:?}", self.0)))
149 }
150}
151
152#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
BinaryOutputToTty 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 {
BinaryOutputToTty { shorthand: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("option `-o` or `--emit` is used to write binary output type `{$shorthand}` to stdout, but stdout is a tty")));
;
diag.arg("shorthand", __binding_0);
diag
}
}
}
}
};Diagnostic)]
153#[diag(
154 "option `-o` or `--emit` is used to write binary output type `{$shorthand}` to stdout, but stdout is a tty"
155)]
156pub(crate) struct BinaryOutputToTty {
157 pub shorthand: &'static str,
158}
159
160#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
IgnoringEmitPath 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 {
IgnoringEmitPath { extension: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("ignoring emit path because multiple .{$extension} files were produced")));
;
diag.arg("extension", __binding_0);
diag
}
}
}
}
};Diagnostic)]
161#[diag("ignoring emit path because multiple .{$extension} files were produced")]
162pub(crate) struct IgnoringEmitPath {
163 pub extension: &'static str,
164}
165
166#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for IgnoringOutput
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 {
IgnoringOutput { extension: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("ignoring -o because multiple .{$extension} files were produced")));
;
diag.arg("extension", __binding_0);
diag
}
}
}
}
};Diagnostic)]
167#[diag("ignoring -o because multiple .{$extension} files were produced")]
168pub(crate) struct IgnoringOutput {
169 pub extension: &'static str,
170}
171
172#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for CreateTempDir
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 {
CreateTempDir { error: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("couldn't create a temp dir: {$error}")));
;
diag.arg("error", __binding_0);
diag
}
}
}
}
};Diagnostic)]
173#[diag("couldn't create a temp dir: {$error}")]
174pub(crate) struct CreateTempDir {
175 pub error: Error,
176}
177
178#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
AddNativeLibrary 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 {
AddNativeLibrary {
library_path: __binding_0, error: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to add native library {$library_path}: {$error}")));
;
diag.arg("library_path", __binding_0);
diag.arg("error", __binding_1);
diag
}
}
}
}
};Diagnostic)]
179#[diag("failed to add native library {$library_path}: {$error}")]
180pub(crate) struct AddNativeLibrary {
181 pub library_path: PathBuf,
182 pub error: Error,
183}
184
185#[derive(const _: () =
{
impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
MultipleExternalFuncDecl<'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 {
MultipleExternalFuncDecl {
span: __binding_0,
function: __binding_1,
library_name: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("multiple declarations of external function `{$function}` from library `{$library_name}` have different calling conventions")));
;
diag.arg("function", __binding_1);
diag.arg("library_name", __binding_2);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
186#[diag(
187 "multiple declarations of external function `{$function}` from library `{$library_name}` have different calling conventions"
188)]
189pub(crate) struct MultipleExternalFuncDecl<'a> {
190 #[primary_span]
191 pub span: Span,
192 pub function: Symbol,
193 pub library_name: &'a str,
194}
195
196#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for LinkRlibError
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 {
LinkRlibError::MissingFormat => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("could not find formats for rlibs")));
;
diag
}
LinkRlibError::OnlyRmetaFound { crate_name: __binding_0 } =>
{
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("could not find rlib for: `{$crate_name}`, found rmeta (metadata) file")));
;
diag.arg("crate_name", __binding_0);
diag
}
LinkRlibError::NotFound { crate_name: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("could not find rlib for: `{$crate_name}`")));
;
diag.arg("crate_name", __binding_0);
diag
}
LinkRlibError::IncompatibleDependencyFormats {
ty1: __binding_0,
ty2: __binding_1,
list1: __binding_2,
list2: __binding_3 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$ty1}` and `{$ty2}` do not have equivalent dependency formats (`{$list1}` vs `{$list2}`)")));
;
diag.arg("ty1", __binding_0);
diag.arg("ty2", __binding_1);
diag.arg("list1", __binding_2);
diag.arg("list2", __binding_3);
diag
}
}
}
}
};Diagnostic)]
197pub enum LinkRlibError {
198 #[diag("could not find formats for rlibs")]
199 MissingFormat,
200
201 #[diag("could not find rlib for: `{$crate_name}`, found rmeta (metadata) file")]
202 OnlyRmetaFound { crate_name: Symbol },
203
204 #[diag("could not find rlib for: `{$crate_name}`")]
205 NotFound { crate_name: Symbol },
206
207 #[diag(
208 "`{$ty1}` and `{$ty2}` do not have equivalent dependency formats (`{$list1}` vs `{$list2}`)"
209 )]
210 IncompatibleDependencyFormats { ty1: String, ty2: String, list1: String, list2: String },
211}
212
213pub(crate) struct ThorinErrorWrapper(pub thorin::Error);
214
215impl<G: EmissionGuarantee> Diagnostic<'_, G> for ThorinErrorWrapper {
216 fn into_diag(self, dcx: DiagCtxtHandle<'_>, level: Level) -> Diag<'_, G> {
217 let build = |msg| Diag::new(dcx, level, msg);
218 match self.0 {
219 thorin::Error::ReadInput(_) => build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to read input file"))msg!("failed to read input file")),
220 thorin::Error::ParseFileKind(_) => {
221 build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to parse input file kind"))msg!("failed to parse input file kind"))
222 }
223 thorin::Error::ParseObjectFile(_) => {
224 build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to parse input object file"))msg!("failed to parse input object file"))
225 }
226 thorin::Error::ParseArchiveFile(_) => {
227 build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to parse input archive file"))msg!("failed to parse input archive file"))
228 }
229 thorin::Error::ParseArchiveMember(_) => {
230 build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to parse archive member"))msg!("failed to parse archive member"))
231 }
232 thorin::Error::InvalidInputKind => build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("input is not an archive or elf object"))msg!("input is not an archive or elf object")),
233 thorin::Error::DecompressData(_) => build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to decompress compressed section"))msg!("failed to decompress compressed section")),
234 thorin::Error::NamelessSection(_, offset) => {
235 build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("section without name at offset {$offset}"))msg!("section without name at offset {$offset}"))
236 .with_arg("offset", ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("0x{0:08x}", offset))
})format!("0x{offset:08x}"))
237 }
238 thorin::Error::RelocationWithInvalidSymbol(section, offset) => {
239 build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("relocation with invalid symbol for section `{$section}` at offset {$offset}"))msg!("relocation with invalid symbol for section `{$section}` at offset {$offset}"))
240 .with_arg("section", section)
241 .with_arg("offset", ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("0x{0:08x}", offset))
})format!("0x{offset:08x}"))
242 }
243 thorin::Error::MultipleRelocations(section, offset) => {
244 build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("multiple relocations for section `{$section}` at offset {$offset}"))msg!("multiple relocations for section `{$section}` at offset {$offset}"))
245 .with_arg("section", section)
246 .with_arg("offset", ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("0x{0:08x}", offset))
})format!("0x{offset:08x}"))
247 }
248 thorin::Error::UnsupportedRelocation(section, offset) => {
249 build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unsupported relocation for section {$section} at offset {$offset}"))msg!("unsupported relocation for section {$section} at offset {$offset}"))
250 .with_arg("section", section)
251 .with_arg("offset", ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("0x{0:08x}", offset))
})format!("0x{offset:08x}"))
252 }
253 thorin::Error::MissingDwoName(id) => build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("missing path attribute to DWARF object ({$id})"))msg!("missing path attribute to DWARF object ({$id})"))
254 .with_arg("id", ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("0x{0:08x}", id))
})format!("0x{id:08x}")),
255 thorin::Error::NoCompilationUnits => {
256 build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("input object has no compilation units"))msg!("input object has no compilation units"))
257 }
258 thorin::Error::NoDie => build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("no top-level debugging information entry in compilation/type unit"))msg!("no top-level debugging information entry in compilation/type unit")),
259 thorin::Error::TopLevelDieNotUnit => {
260 build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("top-level debugging information entry is not a compilation/type unit"))msg!("top-level debugging information entry is not a compilation/type unit"))
261 }
262 thorin::Error::MissingRequiredSection(section) => {
263 build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("input object missing required section `{$section}`"))msg!("input object missing required section `{$section}`"))
264 .with_arg("section", section)
265 }
266 thorin::Error::ParseUnitAbbreviations(_) => {
267 build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to parse unit abbreviations"))msg!("failed to parse unit abbreviations"))
268 }
269 thorin::Error::ParseUnitAttribute(_) => {
270 build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to parse unit attribute"))msg!("failed to parse unit attribute"))
271 }
272 thorin::Error::ParseUnitHeader(_) => {
273 build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to parse unit header"))msg!("failed to parse unit header"))
274 }
275 thorin::Error::ParseUnit(_) => build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to parse unit"))msg!("failed to parse unit")),
276 thorin::Error::IncompatibleIndexVersion(section, format, actual) => {
277 build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("incompatible `{$section}` index version: found version {$actual}, expected version {$format}"))msg!("incompatible `{$section}` index version: found version {$actual}, expected version {$format}"))
278 .with_arg("section", section)
279 .with_arg("actual", actual)
280 .with_arg("format", format)
281 }
282 thorin::Error::OffsetAtIndex(_, index) => {
283 build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("read offset at index {$index} of `.debug_str_offsets.dwo` section"))msg!("read offset at index {$index} of `.debug_str_offsets.dwo` section")).with_arg("index", index)
284 }
285 thorin::Error::StrAtOffset(_, offset) => {
286 build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("read string at offset {$offset} of `.debug_str.dwo` section"))msg!("read string at offset {$offset} of `.debug_str.dwo` section"))
287 .with_arg("offset", ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("0x{0:08x}", offset))
})format!("0x{offset:08x}"))
288 }
289 thorin::Error::ParseIndex(_, section) => {
290 build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to parse `{$section}` index section"))msg!("failed to parse `{$section}` index section")).with_arg("section", section)
291 }
292 thorin::Error::UnitNotInIndex(unit) => {
293 build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unit {$unit} from input package is not in its index"))msg!("unit {$unit} from input package is not in its index"))
294 .with_arg("unit", ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("0x{0:08x}", unit))
})format!("0x{unit:08x}"))
295 }
296 thorin::Error::RowNotInIndex(_, row) => {
297 build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("row {$row} found in index's hash table not present in index"))msg!("row {$row} found in index's hash table not present in index")).with_arg("row", row)
298 }
299 thorin::Error::SectionNotInRow => build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("section not found in unit's row in index"))msg!("section not found in unit's row in index")),
300 thorin::Error::EmptyUnit(unit) => build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unit {$unit} in input DWARF object with no data"))msg!("unit {$unit} in input DWARF object with no data"))
301 .with_arg("unit", ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("0x{0:08x}", unit))
})format!("0x{unit:08x}")),
302 thorin::Error::MultipleDebugInfoSection => {
303 build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("multiple `.debug_info.dwo` sections"))msg!("multiple `.debug_info.dwo` sections"))
304 }
305 thorin::Error::MultipleDebugTypesSection => {
306 build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("multiple `.debug_types.dwo` sections in a package"))msg!("multiple `.debug_types.dwo` sections in a package"))
307 }
308 thorin::Error::NotSplitUnit => build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("regular compilation unit in object (missing dwo identifier)"))msg!("regular compilation unit in object (missing dwo identifier)")),
309 thorin::Error::DuplicateUnit(unit) => build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("duplicate split compilation unit ({$unit})"))msg!("duplicate split compilation unit ({$unit})"))
310 .with_arg("unit", ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("0x{0:08x}", unit))
})format!("0x{unit:08x}")),
311 thorin::Error::MissingReferencedUnit(unit) => {
312 build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unit {$unit} referenced by executable was not found"))msg!("unit {$unit} referenced by executable was not found"))
313 .with_arg("unit", ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("0x{0:08x}", unit))
})format!("0x{unit:08x}"))
314 }
315 thorin::Error::NoOutputObjectCreated => {
316 build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("no output object was created from inputs"))msg!("no output object was created from inputs"))
317 }
318 thorin::Error::MixedInputEncodings => {
319 build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("input objects have mixed encodings"))msg!("input objects have mixed encodings"))
320 }
321 thorin::Error::Io(e) => {
322 build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$error}"))msg!("{$error}")).with_arg("error", ::alloc::__export::must_use({ ::alloc::fmt::format(format_args!("{0}", e)) })format!("{e}"))
323 }
324 thorin::Error::ObjectRead(e) => {
325 build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$error}"))msg!("{$error}")).with_arg("error", ::alloc::__export::must_use({ ::alloc::fmt::format(format_args!("{0}", e)) })format!("{e}"))
326 }
327 thorin::Error::ObjectWrite(e) => {
328 build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$error}"))msg!("{$error}")).with_arg("error", ::alloc::__export::must_use({ ::alloc::fmt::format(format_args!("{0}", e)) })format!("{e}"))
329 }
330 thorin::Error::GimliRead(e) => {
331 build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$error}"))msg!("{$error}")).with_arg("error", ::alloc::__export::must_use({ ::alloc::fmt::format(format_args!("{0}", e)) })format!("{e}"))
332 }
333 thorin::Error::GimliWrite(e) => {
334 build(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$error}"))msg!("{$error}")).with_arg("error", ::alloc::__export::must_use({ ::alloc::fmt::format(format_args!("{0}", e)) })format!("{e}"))
335 }
336 _ => {
::core::panicking::panic_fmt(format_args!("not implemented: {0}",
format_args!("Untranslated thorin error")));
}unimplemented!("Untranslated thorin error"),
337 }
338 }
339}
340
341pub(crate) struct LinkingFailed<'a> {
342 pub linker_path: &'a Path,
343 pub exit_status: ExitStatus,
344 pub command: Command,
345 pub escaped_output: String,
346 pub verbose: bool,
347 pub sysroot_dir: PathBuf,
348}
349
350impl<G: EmissionGuarantee> Diagnostic<'_, G> for LinkingFailed<'_> {
351 fn into_diag(mut self, dcx: DiagCtxtHandle<'_>, level: Level) -> Diag<'_, G> {
352 let mut diag =
353 Diag::new(dcx, level, rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("linking with `{$linker_path}` failed: {$exit_status}"))msg!("linking with `{$linker_path}` failed: {$exit_status}"));
354 diag.arg("linker_path", ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0}", self.linker_path.display()))
})format!("{}", self.linker_path.display()));
355 diag.arg("exit_status", ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0}", self.exit_status))
})format!("{}", self.exit_status));
356
357 let contains_undefined_ref = self.escaped_output.contains("undefined reference to");
358
359 if self.verbose {
360 diag.note(::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0:?}", self.command))
})format!("{:?}", self.command));
361 } else {
362 self.command.env_clear();
363
364 enum ArgGroup {
365 Regular(OsString),
366 Objects(usize),
367 Rlibs(PathBuf, Vec<OsString>),
368 }
369
370 let orig_args = self.command.take_args();
373 let mut args: Vec<ArgGroup> = ::alloc::vec::Vec::new()vec![];
374 for arg in orig_args {
375 if arg.as_encoded_bytes().ends_with(b".rcgu.o") {
376 if let Some(ArgGroup::Objects(n)) = args.last_mut() {
377 *n += 1;
378 } else {
379 args.push(ArgGroup::Objects(1));
380 }
381 } else if arg.as_encoded_bytes().ends_with(b".rlib") {
382 let rlib_path = Path::new(&arg);
383 let dir = rlib_path.parent().unwrap();
384 let filename = rlib_path.file_stem().unwrap().to_owned();
385 if let Some(ArgGroup::Rlibs(parent, rlibs)) = args.last_mut() {
386 if parent == dir {
387 rlibs.push(filename);
388 } else {
389 args.push(ArgGroup::Rlibs(dir.to_owned(), ::alloc::boxed::box_assume_init_into_vec_unsafe(::alloc::intrinsics::write_box_via_move(::alloc::boxed::Box::new_uninit(),
[filename]))vec![filename]));
390 }
391 } else {
392 args.push(ArgGroup::Rlibs(dir.to_owned(), ::alloc::boxed::box_assume_init_into_vec_unsafe(::alloc::intrinsics::write_box_via_move(::alloc::boxed::Box::new_uninit(),
[filename]))vec![filename]));
393 }
394 } else {
395 args.push(ArgGroup::Regular(arg));
396 }
397 }
398 let crate_hash = regex::bytes::Regex::new(r"-[0-9a-f]+").unwrap();
399 self.command.args(args.into_iter().map(|arg_group| {
400 match arg_group {
401 ArgGroup::Regular(arg) => unsafe {
403 use bstr::ByteSlice;
404 OsString::from_encoded_bytes_unchecked(
405 arg.as_encoded_bytes().replace(
406 self.sysroot_dir.as_os_str().as_encoded_bytes(),
407 b"<sysroot>",
408 ),
409 )
410 },
411 ArgGroup::Objects(n) => OsString::from(::alloc::__export::must_use({
::alloc::fmt::format(format_args!("<{0} object files omitted>", n))
})format!("<{n} object files omitted>")),
412 ArgGroup::Rlibs(mut dir, rlibs) => {
413 let is_sysroot_dir = match dir.strip_prefix(&self.sysroot_dir) {
414 Ok(short) => {
415 dir = Path::new("<sysroot>").join(short);
416 true
417 }
418 Err(_) => false,
419 };
420 let mut arg = dir.into_os_string();
421 arg.push("/");
422 let needs_braces = rlibs.len() >= 2;
423 if needs_braces {
424 arg.push("{");
425 }
426 let mut first = true;
427 for mut rlib in rlibs {
428 if !first {
429 arg.push(",");
430 }
431 first = false;
432 if is_sysroot_dir {
433 rlib = unsafe {
435 OsString::from_encoded_bytes_unchecked(
436 crate_hash
437 .replace(rlib.as_encoded_bytes(), b"-*")
438 .into_owned(),
439 )
440 };
441 }
442 arg.push(rlib);
443 }
444 if needs_braces {
445 arg.push("}");
446 }
447 arg.push(".rlib");
448 arg
449 }
450 }
451 }));
452
453 diag.note(::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0:?}", self.command))
})format!("{:?}", self.command).trim_start_matches("env -i").to_owned());
454 diag.note("some arguments are omitted. use `--verbose` to show all linker arguments");
455 }
456
457 diag.note(self.escaped_output);
458
459 if contains_undefined_ref {
462 diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified"))msg!("some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified"))
463 .note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use the `-l` flag to specify native libraries to link"))msg!("use the `-l` flag to specify native libraries to link"));
464
465 if rustc_session::utils::was_invoked_from_cargo() {
466 diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#rustc-link-lib)"))msg!("use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#rustc-link-lib)"));
467 }
468 }
469 diag
470 }
471}
472
473#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
LinkExeUnexpectedError 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 {
LinkExeUnexpectedError => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`link.exe` returned an unexpected error")));
;
diag
}
}
}
}
};Diagnostic)]
474#[diag("`link.exe` returned an unexpected error")]
475pub(crate) struct LinkExeUnexpectedError;
476
477pub(crate) struct LinkExeStatusStackBufferOverrun;
478
479impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for LinkExeStatusStackBufferOverrun {
480 fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'a>, level: Level) -> Diag<'a, G> {
481 let mut diag = Diag::new(dcx, level, rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("0xc0000409 is `STATUS_STACK_BUFFER_OVERRUN`"))msg!("0xc0000409 is `STATUS_STACK_BUFFER_OVERRUN`"));
482 diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this may have been caused by a program abort and not a stack buffer overrun"))msg!(
483 "this may have been caused by a program abort and not a stack buffer overrun"
484 ));
485 diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider checking the Application Event Log for Windows Error Reporting events to see the fail fast error code"))msg!("consider checking the Application Event Log for Windows Error Reporting events to see the fail fast error code"));
486 diag
487 }
488}
489
490#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
RepairVSBuildTools 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 {
RepairVSBuildTools => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the Visual Studio build tools may need to be repaired using the Visual Studio installer")));
;
diag
}
}
}
}
};Diagnostic)]
491#[diag("the Visual Studio build tools may need to be repaired using the Visual Studio installer")]
492pub(crate) struct RepairVSBuildTools;
493
494#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
MissingCppBuildToolComponent 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 {
MissingCppBuildToolComponent => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("or a necessary component may be missing from the \"C++ build tools\" workload")));
;
diag
}
}
}
}
};Diagnostic)]
495#[diag("or a necessary component may be missing from the \"C++ build tools\" workload")]
496pub(crate) struct MissingCppBuildToolComponent;
497
498#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
SelectCppBuildToolWorkload 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 {
SelectCppBuildToolWorkload => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("in the Visual Studio installer, ensure the \"C++ build tools\" workload is selected")));
;
diag
}
}
}
}
};Diagnostic)]
499#[diag("in the Visual Studio installer, ensure the \"C++ build tools\" workload is selected")]
500pub(crate) struct SelectCppBuildToolWorkload;
501
502#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
VisualStudioNotInstalled 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 {
VisualStudioNotInstalled => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("you may need to install Visual Studio build tools with the \"C++ build tools\" workload")));
;
diag
}
}
}
}
};Diagnostic)]
503#[diag("you may need to install Visual Studio build tools with the \"C++ build tools\" workload")]
504pub(crate) struct VisualStudioNotInstalled;
505
506#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for LinkerNotFound
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 {
LinkerNotFound {
linker_path: __binding_0, error: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("linker `{$linker_path}` not found")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$error}")));
;
diag.arg("linker_path", __binding_0);
diag.arg("error", __binding_1);
diag
}
}
}
}
};Diagnostic)]
507#[diag("linker `{$linker_path}` not found")]
508#[note("{$error}")]
509pub(crate) struct LinkerNotFound {
510 pub linker_path: PathBuf,
511 pub error: Error,
512}
513
514#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
UnableToExeLinker 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 {
UnableToExeLinker {
linker_path: __binding_0,
error: __binding_1,
command_formatted: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("could not exec the linker `{$linker_path}`")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$error}")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$command_formatted}")));
;
diag.arg("linker_path", __binding_0);
diag.arg("error", __binding_1);
diag.arg("command_formatted", __binding_2);
diag
}
}
}
}
};Diagnostic)]
515#[diag("could not exec the linker `{$linker_path}`")]
516#[note("{$error}")]
517#[note("{$command_formatted}")]
518pub(crate) struct UnableToExeLinker {
519 pub linker_path: PathBuf,
520 pub error: Error,
521 pub command_formatted: String,
522}
523
524#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
MsvcMissingLinker 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 {
MsvcMissingLinker => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the msvc targets depend on the msvc linker but `link.exe` was not found")));
;
diag
}
}
}
}
};Diagnostic)]
525#[diag("the msvc targets depend on the msvc linker but `link.exe` was not found")]
526pub(crate) struct MsvcMissingLinker;
527
528#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
SelfContainedLinkerMissing 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 {
SelfContainedLinkerMissing => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the self-contained linker was requested, but it wasn't found in the target's sysroot, or in rustc's sysroot")));
;
diag
}
}
}
}
};Diagnostic)]
529#[diag(
530 "the self-contained linker was requested, but it wasn't found in the target's sysroot, or in rustc's sysroot"
531)]
532pub(crate) struct SelfContainedLinkerMissing;
533
534#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
CheckInstalledVisualStudio 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 {
CheckInstalledVisualStudio => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("please ensure that Visual Studio 2017 or later, or Build Tools for Visual Studio were installed with the Visual C++ option")));
;
diag
}
}
}
}
};Diagnostic)]
535#[diag(
536 "please ensure that Visual Studio 2017 or later, or Build Tools for Visual Studio were installed with the Visual C++ option"
537)]
538pub(crate) struct CheckInstalledVisualStudio;
539
540#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
InsufficientVSCodeProduct 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 {
InsufficientVSCodeProduct => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("VS Code is a different product, and is not sufficient")));
;
diag
}
}
}
}
};Diagnostic)]
541#[diag("VS Code is a different product, and is not sufficient")]
542pub(crate) struct InsufficientVSCodeProduct;
543
544#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for CpuRequired
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 {
CpuRequired => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("target requires explicitly specifying a cpu with `-C target-cpu`")));
;
diag
}
}
}
}
};Diagnostic)]
545#[diag("target requires explicitly specifying a cpu with `-C target-cpu`")]
546pub(crate) struct CpuRequired;
547
548#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
ProcessingDymutilFailed 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 {
ProcessingDymutilFailed {
status: __binding_0, output: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("processing debug info with `dsymutil` failed: {$status}")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$output}")));
;
diag.arg("status", __binding_0);
diag.arg("output", __binding_1);
diag
}
}
}
}
};Diagnostic)]
549#[diag("processing debug info with `dsymutil` failed: {$status}")]
550#[note("{$output}")]
551pub(crate) struct ProcessingDymutilFailed {
552 pub status: ExitStatus,
553 pub output: String,
554}
555
556#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
UnableToRunDsymutil 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 {
UnableToRunDsymutil { error: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unable to run `dsymutil`: {$error}")));
;
diag.arg("error", __binding_0);
diag
}
}
}
}
};Diagnostic)]
557#[diag("unable to run `dsymutil`: {$error}")]
558pub(crate) struct UnableToRunDsymutil {
559 pub error: Error,
560}
561
562#[derive(const _: () =
{
impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
StrippingDebugInfoFailed<'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 {
StrippingDebugInfoFailed {
util: __binding_0, status: __binding_1, output: __binding_2
} => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("stripping debug info with `{$util}` failed: {$status}")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$output}")));
;
diag.arg("util", __binding_0);
diag.arg("status", __binding_1);
diag.arg("output", __binding_2);
diag
}
}
}
}
};Diagnostic)]
563#[diag("stripping debug info with `{$util}` failed: {$status}")]
564#[note("{$output}")]
565pub(crate) struct StrippingDebugInfoFailed<'a> {
566 pub util: &'a str,
567 pub status: ExitStatus,
568 pub output: String,
569}
570
571#[derive(const _: () =
{
impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
UnableToRun<'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 {
UnableToRun { util: __binding_0, error: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unable to run `{$util}`: {$error}")));
;
diag.arg("util", __binding_0);
diag.arg("error", __binding_1);
diag
}
}
}
}
};Diagnostic)]
572#[diag("unable to run `{$util}`: {$error}")]
573pub(crate) struct UnableToRun<'a> {
574 pub util: &'a str,
575 pub error: Error,
576}
577
578#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for LinkerFileStem
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 {
LinkerFileStem => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("couldn't extract file stem from specified linker")));
;
diag
}
}
}
}
};Diagnostic)]
579#[diag("couldn't extract file stem from specified linker")]
580pub(crate) struct LinkerFileStem;
581
582#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
StaticLibraryNativeArtifacts 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 {
StaticLibraryNativeArtifacts => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("link against the following native artifacts when linking against this static library. The order and any duplication can be significant on some platforms")));
;
diag
}
}
}
}
};Diagnostic)]
583#[diag(
584 "link against the following native artifacts when linking against this static library. The order and any duplication can be significant on some platforms"
585)]
586pub(crate) struct StaticLibraryNativeArtifacts;
587
588#[derive(const _: () =
{
impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
StaticLibraryNativeArtifactsToFile<'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 {
StaticLibraryNativeArtifactsToFile { path: __binding_0 } =>
{
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("native artifacts to link against have been written to {$path}. The order and any duplication can be significant on some platforms")));
;
diag.arg("path", __binding_0);
diag
}
}
}
}
};Diagnostic)]
589#[diag(
590 "native artifacts to link against have been written to {$path}. The order and any duplication can be significant on some platforms"
591)]
592pub(crate) struct StaticLibraryNativeArtifactsToFile<'a> {
593 pub path: &'a Path,
594}
595
596#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
LinkScriptUnavailable 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 {
LinkScriptUnavailable => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("can only use link script when linking with GNU-like linker")));
;
diag
}
}
}
}
};Diagnostic)]
597#[diag("can only use link script when linking with GNU-like linker")]
598pub(crate) struct LinkScriptUnavailable;
599
600#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
LinkScriptWriteFailure 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 {
LinkScriptWriteFailure {
path: __binding_0, error: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to write link script to {$path}: {$error}")));
;
diag.arg("path", __binding_0);
diag.arg("error", __binding_1);
diag
}
}
}
}
};Diagnostic)]
601#[diag("failed to write link script to {$path}: {$error}")]
602pub(crate) struct LinkScriptWriteFailure {
603 pub path: PathBuf,
604 pub error: Error,
605}
606
607#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for FailedToWrite
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 {
FailedToWrite { path: __binding_0, error: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to write {$path}: {$error}")));
;
diag.arg("path", __binding_0);
diag.arg("error", __binding_1);
diag
}
}
}
}
};Diagnostic)]
608#[diag("failed to write {$path}: {$error}")]
609pub(crate) struct FailedToWrite {
610 pub path: PathBuf,
611 pub error: Error,
612}
613
614#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
UnableToWriteDebuggerVisualizer 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 {
UnableToWriteDebuggerVisualizer {
path: __binding_0, error: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unable to write debugger visualizer file `{$path}`: {$error}")));
;
diag.arg("path", __binding_0);
diag.arg("error", __binding_1);
diag
}
}
}
}
};Diagnostic)]
615#[diag("unable to write debugger visualizer file `{$path}`: {$error}")]
616pub(crate) struct UnableToWriteDebuggerVisualizer {
617 pub path: PathBuf,
618 pub error: Error,
619}
620
621#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
RlibArchiveBuildFailure 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 {
RlibArchiveBuildFailure {
path: __binding_0, error: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to build archive from rlib at `{$path}`: {$error}")));
;
diag.arg("path", __binding_0);
diag.arg("error", __binding_1);
diag
}
}
}
}
};Diagnostic)]
622#[diag("failed to build archive from rlib at `{$path}`: {$error}")]
623pub(crate) struct RlibArchiveBuildFailure {
624 pub path: PathBuf,
625 pub error: Error,
626}
627
628#[derive(const _: () =
{
impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
ExtractBundledLibsError<'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 {
ExtractBundledLibsError::OpenFile {
rlib: __binding_0, error: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to open file '{$rlib}': {$error}")));
;
diag.arg("rlib", __binding_0);
diag.arg("error", __binding_1);
diag
}
ExtractBundledLibsError::MmapFile {
rlib: __binding_0, error: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to mmap file '{$rlib}': {$error}")));
;
diag.arg("rlib", __binding_0);
diag.arg("error", __binding_1);
diag
}
ExtractBundledLibsError::ParseArchive {
rlib: __binding_0, error: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to parse archive '{$rlib}': {$error}")));
;
diag.arg("rlib", __binding_0);
diag.arg("error", __binding_1);
diag
}
ExtractBundledLibsError::ReadEntry {
rlib: __binding_0, error: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to read entry '{$rlib}': {$error}")));
;
diag.arg("rlib", __binding_0);
diag.arg("error", __binding_1);
diag
}
ExtractBundledLibsError::ArchiveMember {
rlib: __binding_0, error: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to get data from archive member '{$rlib}': {$error}")));
;
diag.arg("rlib", __binding_0);
diag.arg("error", __binding_1);
diag
}
ExtractBundledLibsError::ConvertName {
rlib: __binding_0, error: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to convert name '{$rlib}': {$error}")));
;
diag.arg("rlib", __binding_0);
diag.arg("error", __binding_1);
diag
}
ExtractBundledLibsError::WriteFile {
rlib: __binding_0, error: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to write file '{$rlib}': {$error}")));
;
diag.arg("rlib", __binding_0);
diag.arg("error", __binding_1);
diag
}
ExtractBundledLibsError::ExtractSection {
rlib: __binding_0, error: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to write file '{$rlib}': {$error}")));
;
diag.arg("rlib", __binding_0);
diag.arg("error", __binding_1);
diag
}
}
}
}
};Diagnostic)]
629pub enum ExtractBundledLibsError<'a> {
631 #[diag("failed to open file '{$rlib}': {$error}")]
632 OpenFile { rlib: &'a Path, error: Box<dyn std::error::Error> },
633
634 #[diag("failed to mmap file '{$rlib}': {$error}")]
635 MmapFile { rlib: &'a Path, error: Box<dyn std::error::Error> },
636
637 #[diag("failed to parse archive '{$rlib}': {$error}")]
638 ParseArchive { rlib: &'a Path, error: Box<dyn std::error::Error> },
639
640 #[diag("failed to read entry '{$rlib}': {$error}")]
641 ReadEntry { rlib: &'a Path, error: Box<dyn std::error::Error> },
642
643 #[diag("failed to get data from archive member '{$rlib}': {$error}")]
644 ArchiveMember { rlib: &'a Path, error: Box<dyn std::error::Error> },
645
646 #[diag("failed to convert name '{$rlib}': {$error}")]
647 ConvertName { rlib: &'a Path, error: Box<dyn std::error::Error> },
648
649 #[diag("failed to write file '{$rlib}': {$error}")]
650 WriteFile { rlib: &'a Path, error: Box<dyn std::error::Error> },
651
652 #[diag("failed to write file '{$rlib}': {$error}")]
653 ExtractSection { rlib: &'a Path, error: Box<dyn std::error::Error> },
654}
655
656#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for ReadFileError
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 {
ReadFileError { message: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to read file: {$message}")));
;
diag.arg("message", __binding_0);
diag
}
}
}
}
};Diagnostic)]
657#[diag("failed to read file: {$message}")]
658pub(crate) struct ReadFileError {
659 pub message: std::io::Error,
660}
661
662#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
UnsupportedLinkSelfContained 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 {
UnsupportedLinkSelfContained => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("option `-C link-self-contained` is not supported on this target")));
;
diag
}
}
}
}
};Diagnostic)]
663#[diag("option `-C link-self-contained` is not supported on this target")]
664pub(crate) struct UnsupportedLinkSelfContained;
665
666#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
ArchiveBuildFailure 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 {
ArchiveBuildFailure { path: __binding_0, error: __binding_1
} => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to build archive at `{$path}`: {$error}")));
;
diag.arg("path", __binding_0);
diag.arg("error", __binding_1);
diag
}
}
}
}
};Diagnostic)]
667#[diag("failed to build archive at `{$path}`: {$error}")]
668pub(crate) struct ArchiveBuildFailure {
669 pub path: PathBuf,
670 pub error: std::io::Error,
671}
672
673#[derive(const _: () =
{
impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
UnknownArchiveKind<'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 {
UnknownArchiveKind { kind: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("don't know how to build archive of type: {$kind}")));
;
diag.arg("kind", __binding_0);
diag
}
}
}
}
};Diagnostic)]
674#[diag("don't know how to build archive of type: {$kind}")]
675pub(crate) struct UnknownArchiveKind<'a> {
676 pub kind: &'a str,
677}
678
679#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
BpfStaticlibNotSupported 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 {
BpfStaticlibNotSupported => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("linking static libraries is not supported for BPF")));
;
diag
}
}
}
}
};Diagnostic)]
680#[diag("linking static libraries is not supported for BPF")]
681pub(crate) struct BpfStaticlibNotSupported;
682
683#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
MultipleMainFunctions 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 {
MultipleMainFunctions { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("entry symbol `main` declared multiple times")));
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("did you use `#[no_mangle]` on `fn main`? Use `#![no_main]` to suppress the usual Rust-generated entry point")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
684#[diag("entry symbol `main` declared multiple times")]
685#[help(
686 "did you use `#[no_mangle]` on `fn main`? Use `#![no_main]` to suppress the usual Rust-generated entry point"
687)]
688pub(crate) struct MultipleMainFunctions {
689 #[primary_span]
690 pub span: Span,
691}
692
693#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
ShuffleIndicesEvaluation 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 {
ShuffleIndicesEvaluation { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("could not evaluate shuffle_indices at compile time")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
694#[diag("could not evaluate shuffle_indices at compile time")]
695pub(crate) struct ShuffleIndicesEvaluation {
696 #[primary_span]
697 pub span: Span,
698}
699
700#[derive(const _: () =
{
impl<'_sess, 'tcx, G> rustc_errors::Diagnostic<'_sess, G> for
InvalidMonomorphization<'tcx> 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 {
InvalidMonomorphization::BasicIntegerType {
span: __binding_0, name: __binding_1, ty: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: expected basic integer type, found `{$ty}`")));
diag.code(E0511);
;
diag.arg("name", __binding_1);
diag.arg("ty", __binding_2);
diag.span(__binding_0);
diag
}
InvalidMonomorphization::BasicIntegerOrPtrType {
span: __binding_0, name: __binding_1, ty: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: expected basic integer or pointer type, found `{$ty}`")));
diag.code(E0511);
;
diag.arg("name", __binding_1);
diag.arg("ty", __binding_2);
diag.span(__binding_0);
diag
}
InvalidMonomorphization::BasicFloatType {
span: __binding_0, name: __binding_1, ty: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: expected basic float type, found `{$ty}`")));
diag.code(E0511);
;
diag.arg("name", __binding_1);
diag.arg("ty", __binding_2);
diag.span(__binding_0);
diag
}
InvalidMonomorphization::FloatToIntUnchecked {
span: __binding_0, ty: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `float_to_int_unchecked` intrinsic: expected basic float type, found `{$ty}`")));
diag.code(E0511);
;
diag.arg("ty", __binding_1);
diag.span(__binding_0);
diag
}
InvalidMonomorphization::FloatingPointVector {
span: __binding_0,
name: __binding_1,
f_ty: __binding_2,
in_ty: __binding_3 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: unsupported element type `{$f_ty}` of floating-point vector `{$in_ty}`")));
diag.code(E0511);
;
diag.arg("name", __binding_1);
diag.arg("f_ty", __binding_2);
diag.arg("in_ty", __binding_3);
diag.span(__binding_0);
diag
}
InvalidMonomorphization::FloatingPointType {
span: __binding_0, name: __binding_1, in_ty: __binding_2 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: `{$in_ty}` is not a floating-point type")));
diag.code(E0511);
;
diag.arg("name", __binding_1);
diag.arg("in_ty", __binding_2);
diag.span(__binding_0);
diag
}
InvalidMonomorphization::UnrecognizedIntrinsic {
span: __binding_0, name: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: unrecognized intrinsic `{$name}`")));
diag.code(E0511);
;
diag.arg("name", __binding_1);
diag.span(__binding_0);
diag
}
InvalidMonomorphization::SimdArgument {
span: __binding_0, name: __binding_1, ty: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: expected SIMD argument type, found non-SIMD `{$ty}`")));
diag.code(E0511);
;
diag.arg("name", __binding_1);
diag.arg("ty", __binding_2);
diag.span(__binding_0);
diag
}
InvalidMonomorphization::SimdInput {
span: __binding_0, name: __binding_1, ty: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: expected SIMD input type, found non-SIMD `{$ty}`")));
diag.code(E0511);
;
diag.arg("name", __binding_1);
diag.arg("ty", __binding_2);
diag.span(__binding_0);
diag
}
InvalidMonomorphization::SimdFirst {
span: __binding_0, name: __binding_1, ty: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: expected SIMD first type, found non-SIMD `{$ty}`")));
diag.code(E0511);
;
diag.arg("name", __binding_1);
diag.arg("ty", __binding_2);
diag.span(__binding_0);
diag
}
InvalidMonomorphization::SimdSecond {
span: __binding_0, name: __binding_1, ty: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: expected SIMD second type, found non-SIMD `{$ty}`")));
diag.code(E0511);
;
diag.arg("name", __binding_1);
diag.arg("ty", __binding_2);
diag.span(__binding_0);
diag
}
InvalidMonomorphization::SimdThird {
span: __binding_0, name: __binding_1, ty: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: expected SIMD third type, found non-SIMD `{$ty}`")));
diag.code(E0511);
;
diag.arg("name", __binding_1);
diag.arg("ty", __binding_2);
diag.span(__binding_0);
diag
}
InvalidMonomorphization::SimdReturn {
span: __binding_0, name: __binding_1, ty: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: expected SIMD return type, found non-SIMD `{$ty}`")));
diag.code(E0511);
;
diag.arg("name", __binding_1);
diag.arg("ty", __binding_2);
diag.span(__binding_0);
diag
}
InvalidMonomorphization::InvalidBitmask {
span: __binding_0,
name: __binding_1,
mask_ty: __binding_2,
expected_int_bits: __binding_3,
expected_bytes: __binding_4 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: invalid bitmask `{$mask_ty}`, expected `u{$expected_int_bits}` or `[u8; {$expected_bytes}]`")));
diag.code(E0511);
;
diag.arg("name", __binding_1);
diag.arg("mask_ty", __binding_2);
diag.arg("expected_int_bits", __binding_3);
diag.arg("expected_bytes", __binding_4);
diag.span(__binding_0);
diag
}
InvalidMonomorphization::ReturnLengthInputType {
span: __binding_0,
name: __binding_1,
in_len: __binding_2,
in_ty: __binding_3,
ret_ty: __binding_4,
out_len: __binding_5 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: expected return type with length {$in_len} (same as input type `{$in_ty}`), found `{$ret_ty}` with length {$out_len}")));
diag.code(E0511);
;
diag.arg("name", __binding_1);
diag.arg("in_len", __binding_2);
diag.arg("in_ty", __binding_3);
diag.arg("ret_ty", __binding_4);
diag.arg("out_len", __binding_5);
diag.span(__binding_0);
diag
}
InvalidMonomorphization::SecondArgumentLength {
span: __binding_0,
name: __binding_1,
in_len: __binding_2,
in_ty: __binding_3,
arg_ty: __binding_4,
out_len: __binding_5 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: expected second argument with length {$in_len} (same as input type `{$in_ty}`), found `{$arg_ty}` with length {$out_len}")));
diag.code(E0511);
;
diag.arg("name", __binding_1);
diag.arg("in_len", __binding_2);
diag.arg("in_ty", __binding_3);
diag.arg("arg_ty", __binding_4);
diag.arg("out_len", __binding_5);
diag.span(__binding_0);
diag
}
InvalidMonomorphization::ThirdArgumentLength {
span: __binding_0,
name: __binding_1,
in_len: __binding_2,
in_ty: __binding_3,
arg_ty: __binding_4,
out_len: __binding_5 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: expected third argument with length {$in_len} (same as input type `{$in_ty}`), found `{$arg_ty}` with length {$out_len}")));
diag.code(E0511);
;
diag.arg("name", __binding_1);
diag.arg("in_len", __binding_2);
diag.arg("in_ty", __binding_3);
diag.arg("arg_ty", __binding_4);
diag.arg("out_len", __binding_5);
diag.span(__binding_0);
diag
}
InvalidMonomorphization::ReturnIntegerType {
span: __binding_0,
name: __binding_1,
ret_ty: __binding_2,
out_ty: __binding_3 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: expected return type with integer elements, found `{$ret_ty}` with non-integer `{$out_ty}`")));
diag.code(E0511);
;
diag.arg("name", __binding_1);
diag.arg("ret_ty", __binding_2);
diag.arg("out_ty", __binding_3);
diag.span(__binding_0);
diag
}
InvalidMonomorphization::SimdShuffle {
span: __binding_0, name: __binding_1, ty: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: simd_shuffle index must be a SIMD vector of `u32`, got `{$ty}`")));
diag.code(E0511);
;
diag.arg("name", __binding_1);
diag.arg("ty", __binding_2);
diag.span(__binding_0);
diag
}
InvalidMonomorphization::ReturnLength {
span: __binding_0,
name: __binding_1,
in_len: __binding_2,
ret_ty: __binding_3,
out_len: __binding_4 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: expected return type of length {$in_len}, found `{$ret_ty}` with length {$out_len}")));
diag.code(E0511);
;
diag.arg("name", __binding_1);
diag.arg("in_len", __binding_2);
diag.arg("ret_ty", __binding_3);
diag.arg("out_len", __binding_4);
diag.span(__binding_0);
diag
}
InvalidMonomorphization::ReturnElement {
span: __binding_0,
name: __binding_1,
in_elem: __binding_2,
in_ty: __binding_3,
ret_ty: __binding_4,
out_ty: __binding_5 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: expected return element type `{$in_elem}` (element of input `{$in_ty}`), found `{$ret_ty}` with element type `{$out_ty}`")));
diag.code(E0511);
;
diag.arg("name", __binding_1);
diag.arg("in_elem", __binding_2);
diag.arg("in_ty", __binding_3);
diag.arg("ret_ty", __binding_4);
diag.arg("out_ty", __binding_5);
diag.span(__binding_0);
diag
}
InvalidMonomorphization::SimdIndexOutOfBounds {
span: __binding_0,
name: __binding_1,
arg_idx: __binding_2,
total_len: __binding_3 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: SIMD index #{$arg_idx} is out of bounds (limit {$total_len})")));
diag.code(E0511);
;
diag.arg("name", __binding_1);
diag.arg("arg_idx", __binding_2);
diag.arg("total_len", __binding_3);
diag.span(__binding_0);
diag
}
InvalidMonomorphization::InsertedType {
span: __binding_0,
name: __binding_1,
in_elem: __binding_2,
in_ty: __binding_3,
out_ty: __binding_4 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: expected inserted type `{$in_elem}` (element of input `{$in_ty}`), found `{$out_ty}`")));
diag.code(E0511);
;
diag.arg("name", __binding_1);
diag.arg("in_elem", __binding_2);
diag.arg("in_ty", __binding_3);
diag.arg("out_ty", __binding_4);
diag.span(__binding_0);
diag
}
InvalidMonomorphization::ReturnType {
span: __binding_0,
name: __binding_1,
in_elem: __binding_2,
in_ty: __binding_3,
ret_ty: __binding_4 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: expected return type `{$in_elem}` (element of input `{$in_ty}`), found `{$ret_ty}`")));
diag.code(E0511);
;
diag.arg("name", __binding_1);
diag.arg("in_elem", __binding_2);
diag.arg("in_ty", __binding_3);
diag.arg("ret_ty", __binding_4);
diag.span(__binding_0);
diag
}
InvalidMonomorphization::ExpectedReturnType {
span: __binding_0,
name: __binding_1,
in_ty: __binding_2,
ret_ty: __binding_3 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: expected return type `{$in_ty}`, found `{$ret_ty}`")));
diag.code(E0511);
;
diag.arg("name", __binding_1);
diag.arg("in_ty", __binding_2);
diag.arg("ret_ty", __binding_3);
diag.span(__binding_0);
diag
}
InvalidMonomorphization::MismatchedLengths {
span: __binding_0,
name: __binding_1,
m_len: __binding_2,
v_len: __binding_3 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: mismatched lengths: mask length `{$m_len}` != other vector length `{$v_len}`")));
diag.code(E0511);
;
diag.arg("name", __binding_1);
diag.arg("m_len", __binding_2);
diag.arg("v_len", __binding_3);
diag.span(__binding_0);
diag
}
InvalidMonomorphization::MaskWrongElementType {
span: __binding_0, name: __binding_1, ty: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: expected mask element type to be an integer, found `{$ty}`")));
diag.code(E0511);
;
diag.arg("name", __binding_1);
diag.arg("ty", __binding_2);
diag.span(__binding_0);
diag
}
InvalidMonomorphization::CannotReturn {
span: __binding_0,
name: __binding_1,
ret_ty: __binding_2,
expected_int_bits: __binding_3,
expected_bytes: __binding_4 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: cannot return `{$ret_ty}`, expected `u{$expected_int_bits}` or `[u8; {$expected_bytes}]`")));
diag.code(E0511);
;
diag.arg("name", __binding_1);
diag.arg("ret_ty", __binding_2);
diag.arg("expected_int_bits", __binding_3);
diag.arg("expected_bytes", __binding_4);
diag.span(__binding_0);
diag
}
InvalidMonomorphization::ExpectedElementType {
span: __binding_0,
name: __binding_1,
expected_element: __binding_2,
second_arg: __binding_3,
in_elem: __binding_4,
in_ty: __binding_5,
mutability: __binding_6 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: expected element type `{$expected_element}` of second argument `{$second_arg}` to be a pointer to the element type `{$in_elem}` of the first argument `{$in_ty}`, found `{$expected_element}` != `{$mutability} {$in_elem}`")));
diag.code(E0511);
;
diag.arg("name", __binding_1);
diag.arg("expected_element", __binding_2);
diag.arg("second_arg", __binding_3);
diag.arg("in_elem", __binding_4);
diag.arg("in_ty", __binding_5);
diag.arg("mutability", __binding_6);
diag.span(__binding_0);
diag
}
InvalidMonomorphization::UnsupportedSymbolOfSize {
span: __binding_0,
name: __binding_1,
symbol: __binding_2,
in_ty: __binding_3,
in_elem: __binding_4,
size: __binding_5,
ret_ty: __binding_6 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: unsupported {$symbol} from `{$in_ty}` with element `{$in_elem}` of size `{$size}` to `{$ret_ty}`")));
diag.code(E0511);
;
diag.arg("name", __binding_1);
diag.arg("symbol", __binding_2);
diag.arg("in_ty", __binding_3);
diag.arg("in_elem", __binding_4);
diag.arg("size", __binding_5);
diag.arg("ret_ty", __binding_6);
diag.span(__binding_0);
diag
}
InvalidMonomorphization::UnsupportedSymbol {
span: __binding_0,
name: __binding_1,
symbol: __binding_2,
in_ty: __binding_3,
in_elem: __binding_4,
ret_ty: __binding_5 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: unsupported {$symbol} from `{$in_ty}` with element `{$in_elem}` to `{$ret_ty}`")));
diag.code(E0511);
;
diag.arg("name", __binding_1);
diag.arg("symbol", __binding_2);
diag.arg("in_ty", __binding_3);
diag.arg("in_elem", __binding_4);
diag.arg("ret_ty", __binding_5);
diag.span(__binding_0);
diag
}
InvalidMonomorphization::CastWidePointer {
span: __binding_0, name: __binding_1, ty: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: cannot cast wide pointer `{$ty}`")));
diag.code(E0511);
;
diag.arg("name", __binding_1);
diag.arg("ty", __binding_2);
diag.span(__binding_0);
diag
}
InvalidMonomorphization::ExpectedPointer {
span: __binding_0, name: __binding_1, ty: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: expected pointer, got `{$ty}`")));
diag.code(E0511);
;
diag.arg("name", __binding_1);
diag.arg("ty", __binding_2);
diag.span(__binding_0);
diag
}
InvalidMonomorphization::ExpectedUsize {
span: __binding_0, name: __binding_1, ty: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: expected `usize`, got `{$ty}`")));
diag.code(E0511);
;
diag.arg("name", __binding_1);
diag.arg("ty", __binding_2);
diag.span(__binding_0);
diag
}
InvalidMonomorphization::UnsupportedCast {
span: __binding_0,
name: __binding_1,
in_ty: __binding_2,
in_elem: __binding_3,
ret_ty: __binding_4,
out_elem: __binding_5 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: unsupported cast from `{$in_ty}` with element `{$in_elem}` to `{$ret_ty}` with element `{$out_elem}`")));
diag.code(E0511);
;
diag.arg("name", __binding_1);
diag.arg("in_ty", __binding_2);
diag.arg("in_elem", __binding_3);
diag.arg("ret_ty", __binding_4);
diag.arg("out_elem", __binding_5);
diag.span(__binding_0);
diag
}
InvalidMonomorphization::UnsupportedOperation {
span: __binding_0,
name: __binding_1,
in_ty: __binding_2,
in_elem: __binding_3 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: unsupported operation on `{$in_ty}` with element `{$in_elem}`")));
diag.code(E0511);
;
diag.arg("name", __binding_1);
diag.arg("in_ty", __binding_2);
diag.arg("in_elem", __binding_3);
diag.span(__binding_0);
diag
}
InvalidMonomorphization::ExpectedVectorElementType {
span: __binding_0,
name: __binding_1,
expected_element: __binding_2,
vector_type: __binding_3 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: expected element type `{$expected_element}` of vector type `{$vector_type}` to be a signed or unsigned integer type")));
diag.code(E0511);
;
diag.arg("name", __binding_1);
diag.arg("expected_element", __binding_2);
diag.arg("vector_type", __binding_3);
diag.span(__binding_0);
diag
}
InvalidMonomorphization::NonScalableType {
span: __binding_0, name: __binding_1, ty: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invalid monomorphization of `{$name}` intrinsic: expected non-scalable type, found scalable type `{$ty}`")));
diag.code(E0511);
;
diag.arg("name", __binding_1);
diag.arg("ty", __binding_2);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
701pub enum InvalidMonomorphization<'tcx> {
702 #[diag("invalid monomorphization of `{$name}` intrinsic: expected basic integer type, found `{$ty}`", code = E0511)]
703 BasicIntegerType {
704 #[primary_span]
705 span: Span,
706 name: Symbol,
707 ty: Ty<'tcx>,
708 },
709
710 #[diag("invalid monomorphization of `{$name}` intrinsic: expected basic integer or pointer type, found `{$ty}`", code = E0511)]
711 BasicIntegerOrPtrType {
712 #[primary_span]
713 span: Span,
714 name: Symbol,
715 ty: Ty<'tcx>,
716 },
717
718 #[diag("invalid monomorphization of `{$name}` intrinsic: expected basic float type, found `{$ty}`", code = E0511)]
719 BasicFloatType {
720 #[primary_span]
721 span: Span,
722 name: Symbol,
723 ty: Ty<'tcx>,
724 },
725
726 #[diag("invalid monomorphization of `float_to_int_unchecked` intrinsic: expected basic float type, found `{$ty}`", code = E0511)]
727 FloatToIntUnchecked {
728 #[primary_span]
729 span: Span,
730 ty: Ty<'tcx>,
731 },
732
733 #[diag("invalid monomorphization of `{$name}` intrinsic: unsupported element type `{$f_ty}` of floating-point vector `{$in_ty}`", code = E0511)]
734 FloatingPointVector {
735 #[primary_span]
736 span: Span,
737 name: Symbol,
738 f_ty: FloatTy,
739 in_ty: Ty<'tcx>,
740 },
741
742 #[diag("invalid monomorphization of `{$name}` intrinsic: `{$in_ty}` is not a floating-point type", code = E0511)]
743 FloatingPointType {
744 #[primary_span]
745 span: Span,
746 name: Symbol,
747 in_ty: Ty<'tcx>,
748 },
749
750 #[diag("invalid monomorphization of `{$name}` intrinsic: unrecognized intrinsic `{$name}`", code = E0511)]
751 UnrecognizedIntrinsic {
752 #[primary_span]
753 span: Span,
754 name: Symbol,
755 },
756
757 #[diag("invalid monomorphization of `{$name}` intrinsic: expected SIMD argument type, found non-SIMD `{$ty}`", code = E0511)]
758 SimdArgument {
759 #[primary_span]
760 span: Span,
761 name: Symbol,
762 ty: Ty<'tcx>,
763 },
764
765 #[diag("invalid monomorphization of `{$name}` intrinsic: expected SIMD input type, found non-SIMD `{$ty}`", code = E0511)]
766 SimdInput {
767 #[primary_span]
768 span: Span,
769 name: Symbol,
770 ty: Ty<'tcx>,
771 },
772
773 #[diag("invalid monomorphization of `{$name}` intrinsic: expected SIMD first type, found non-SIMD `{$ty}`", code = E0511)]
774 SimdFirst {
775 #[primary_span]
776 span: Span,
777 name: Symbol,
778 ty: Ty<'tcx>,
779 },
780
781 #[diag("invalid monomorphization of `{$name}` intrinsic: expected SIMD second type, found non-SIMD `{$ty}`", code = E0511)]
782 SimdSecond {
783 #[primary_span]
784 span: Span,
785 name: Symbol,
786 ty: Ty<'tcx>,
787 },
788
789 #[diag("invalid monomorphization of `{$name}` intrinsic: expected SIMD third type, found non-SIMD `{$ty}`", code = E0511)]
790 SimdThird {
791 #[primary_span]
792 span: Span,
793 name: Symbol,
794 ty: Ty<'tcx>,
795 },
796
797 #[diag("invalid monomorphization of `{$name}` intrinsic: expected SIMD return type, found non-SIMD `{$ty}`", code = E0511)]
798 SimdReturn {
799 #[primary_span]
800 span: Span,
801 name: Symbol,
802 ty: Ty<'tcx>,
803 },
804
805 #[diag("invalid monomorphization of `{$name}` intrinsic: invalid bitmask `{$mask_ty}`, expected `u{$expected_int_bits}` or `[u8; {$expected_bytes}]`", code = E0511)]
806 InvalidBitmask {
807 #[primary_span]
808 span: Span,
809 name: Symbol,
810 mask_ty: Ty<'tcx>,
811 expected_int_bits: u64,
812 expected_bytes: u64,
813 },
814
815 #[diag("invalid monomorphization of `{$name}` intrinsic: expected return type with length {$in_len} (same as input type `{$in_ty}`), found `{$ret_ty}` with length {$out_len}", code = E0511)]
816 ReturnLengthInputType {
817 #[primary_span]
818 span: Span,
819 name: Symbol,
820 in_len: u64,
821 in_ty: Ty<'tcx>,
822 ret_ty: Ty<'tcx>,
823 out_len: u64,
824 },
825
826 #[diag("invalid monomorphization of `{$name}` intrinsic: expected second argument with length {$in_len} (same as input type `{$in_ty}`), found `{$arg_ty}` with length {$out_len}", code = E0511)]
827 SecondArgumentLength {
828 #[primary_span]
829 span: Span,
830 name: Symbol,
831 in_len: u64,
832 in_ty: Ty<'tcx>,
833 arg_ty: Ty<'tcx>,
834 out_len: u64,
835 },
836
837 #[diag("invalid monomorphization of `{$name}` intrinsic: expected third argument with length {$in_len} (same as input type `{$in_ty}`), found `{$arg_ty}` with length {$out_len}", code = E0511)]
838 ThirdArgumentLength {
839 #[primary_span]
840 span: Span,
841 name: Symbol,
842 in_len: u64,
843 in_ty: Ty<'tcx>,
844 arg_ty: Ty<'tcx>,
845 out_len: u64,
846 },
847
848 #[diag("invalid monomorphization of `{$name}` intrinsic: expected return type with integer elements, found `{$ret_ty}` with non-integer `{$out_ty}`", code = E0511)]
849 ReturnIntegerType {
850 #[primary_span]
851 span: Span,
852 name: Symbol,
853 ret_ty: Ty<'tcx>,
854 out_ty: Ty<'tcx>,
855 },
856
857 #[diag("invalid monomorphization of `{$name}` intrinsic: simd_shuffle index must be a SIMD vector of `u32`, got `{$ty}`", code = E0511)]
858 SimdShuffle {
859 #[primary_span]
860 span: Span,
861 name: Symbol,
862 ty: Ty<'tcx>,
863 },
864
865 #[diag("invalid monomorphization of `{$name}` intrinsic: expected return type of length {$in_len}, found `{$ret_ty}` with length {$out_len}", code = E0511)]
866 ReturnLength {
867 #[primary_span]
868 span: Span,
869 name: Symbol,
870 in_len: u64,
871 ret_ty: Ty<'tcx>,
872 out_len: u64,
873 },
874
875 #[diag("invalid monomorphization of `{$name}` intrinsic: expected return element type `{$in_elem}` (element of input `{$in_ty}`), found `{$ret_ty}` with element type `{$out_ty}`", code = E0511)]
876 ReturnElement {
877 #[primary_span]
878 span: Span,
879 name: Symbol,
880 in_elem: Ty<'tcx>,
881 in_ty: Ty<'tcx>,
882 ret_ty: Ty<'tcx>,
883 out_ty: Ty<'tcx>,
884 },
885
886 #[diag("invalid monomorphization of `{$name}` intrinsic: SIMD index #{$arg_idx} is out of bounds (limit {$total_len})", code = E0511)]
887 SimdIndexOutOfBounds {
888 #[primary_span]
889 span: Span,
890 name: Symbol,
891 arg_idx: u64,
892 total_len: u128,
893 },
894
895 #[diag("invalid monomorphization of `{$name}` intrinsic: expected inserted type `{$in_elem}` (element of input `{$in_ty}`), found `{$out_ty}`", code = E0511)]
896 InsertedType {
897 #[primary_span]
898 span: Span,
899 name: Symbol,
900 in_elem: Ty<'tcx>,
901 in_ty: Ty<'tcx>,
902 out_ty: Ty<'tcx>,
903 },
904
905 #[diag("invalid monomorphization of `{$name}` intrinsic: expected return type `{$in_elem}` (element of input `{$in_ty}`), found `{$ret_ty}`", code = E0511)]
906 ReturnType {
907 #[primary_span]
908 span: Span,
909 name: Symbol,
910 in_elem: Ty<'tcx>,
911 in_ty: Ty<'tcx>,
912 ret_ty: Ty<'tcx>,
913 },
914
915 #[diag("invalid monomorphization of `{$name}` intrinsic: expected return type `{$in_ty}`, found `{$ret_ty}`", code = E0511)]
916 ExpectedReturnType {
917 #[primary_span]
918 span: Span,
919 name: Symbol,
920 in_ty: Ty<'tcx>,
921 ret_ty: Ty<'tcx>,
922 },
923
924 #[diag("invalid monomorphization of `{$name}` intrinsic: mismatched lengths: mask length `{$m_len}` != other vector length `{$v_len}`", code = E0511)]
925 MismatchedLengths {
926 #[primary_span]
927 span: Span,
928 name: Symbol,
929 m_len: u64,
930 v_len: u64,
931 },
932
933 #[diag("invalid monomorphization of `{$name}` intrinsic: expected mask element type to be an integer, found `{$ty}`", code = E0511)]
934 MaskWrongElementType {
935 #[primary_span]
936 span: Span,
937 name: Symbol,
938 ty: Ty<'tcx>,
939 },
940
941 #[diag("invalid monomorphization of `{$name}` intrinsic: cannot return `{$ret_ty}`, expected `u{$expected_int_bits}` or `[u8; {$expected_bytes}]`", code = E0511)]
942 CannotReturn {
943 #[primary_span]
944 span: Span,
945 name: Symbol,
946 ret_ty: Ty<'tcx>,
947 expected_int_bits: u64,
948 expected_bytes: u64,
949 },
950
951 #[diag("invalid monomorphization of `{$name}` intrinsic: expected element type `{$expected_element}` of second argument `{$second_arg}` to be a pointer to the element type `{$in_elem}` of the first argument `{$in_ty}`, found `{$expected_element}` != `{$mutability} {$in_elem}`", code = E0511)]
952 ExpectedElementType {
953 #[primary_span]
954 span: Span,
955 name: Symbol,
956 expected_element: Ty<'tcx>,
957 second_arg: Ty<'tcx>,
958 in_elem: Ty<'tcx>,
959 in_ty: Ty<'tcx>,
960 mutability: ExpectedPointerMutability,
961 },
962
963 #[diag("invalid monomorphization of `{$name}` intrinsic: unsupported {$symbol} from `{$in_ty}` with element `{$in_elem}` of size `{$size}` to `{$ret_ty}`", code = E0511)]
964 UnsupportedSymbolOfSize {
965 #[primary_span]
966 span: Span,
967 name: Symbol,
968 symbol: Symbol,
969 in_ty: Ty<'tcx>,
970 in_elem: Ty<'tcx>,
971 size: u64,
972 ret_ty: Ty<'tcx>,
973 },
974
975 #[diag("invalid monomorphization of `{$name}` intrinsic: unsupported {$symbol} from `{$in_ty}` with element `{$in_elem}` to `{$ret_ty}`", code = E0511)]
976 UnsupportedSymbol {
977 #[primary_span]
978 span: Span,
979 name: Symbol,
980 symbol: Symbol,
981 in_ty: Ty<'tcx>,
982 in_elem: Ty<'tcx>,
983 ret_ty: Ty<'tcx>,
984 },
985
986 #[diag("invalid monomorphization of `{$name}` intrinsic: cannot cast wide pointer `{$ty}`", code = E0511)]
987 CastWidePointer {
988 #[primary_span]
989 span: Span,
990 name: Symbol,
991 ty: Ty<'tcx>,
992 },
993
994 #[diag("invalid monomorphization of `{$name}` intrinsic: expected pointer, got `{$ty}`", code = E0511)]
995 ExpectedPointer {
996 #[primary_span]
997 span: Span,
998 name: Symbol,
999 ty: Ty<'tcx>,
1000 },
1001
1002 #[diag("invalid monomorphization of `{$name}` intrinsic: expected `usize`, got `{$ty}`", code = E0511)]
1003 ExpectedUsize {
1004 #[primary_span]
1005 span: Span,
1006 name: Symbol,
1007 ty: Ty<'tcx>,
1008 },
1009
1010 #[diag("invalid monomorphization of `{$name}` intrinsic: unsupported cast from `{$in_ty}` with element `{$in_elem}` to `{$ret_ty}` with element `{$out_elem}`", code = E0511)]
1011 UnsupportedCast {
1012 #[primary_span]
1013 span: Span,
1014 name: Symbol,
1015 in_ty: Ty<'tcx>,
1016 in_elem: Ty<'tcx>,
1017 ret_ty: Ty<'tcx>,
1018 out_elem: Ty<'tcx>,
1019 },
1020
1021 #[diag("invalid monomorphization of `{$name}` intrinsic: unsupported operation on `{$in_ty}` with element `{$in_elem}`", code = E0511)]
1022 UnsupportedOperation {
1023 #[primary_span]
1024 span: Span,
1025 name: Symbol,
1026 in_ty: Ty<'tcx>,
1027 in_elem: Ty<'tcx>,
1028 },
1029
1030 #[diag("invalid monomorphization of `{$name}` intrinsic: expected element type `{$expected_element}` of vector type `{$vector_type}` to be a signed or unsigned integer type", code = E0511)]
1031 ExpectedVectorElementType {
1032 #[primary_span]
1033 span: Span,
1034 name: Symbol,
1035 expected_element: Ty<'tcx>,
1036 vector_type: Ty<'tcx>,
1037 },
1038
1039 #[diag("invalid monomorphization of `{$name}` intrinsic: expected non-scalable type, found scalable type `{$ty}`", code = E0511)]
1040 NonScalableType {
1041 #[primary_span]
1042 span: Span,
1043 name: Symbol,
1044 ty: Ty<'tcx>,
1045 },
1046}
1047
1048pub enum ExpectedPointerMutability {
1049 Mut,
1050 Not,
1051}
1052
1053impl IntoDiagArg for ExpectedPointerMutability {
1054 fn into_diag_arg(self, _: &mut Option<std::path::PathBuf>) -> DiagArgValue {
1055 match self {
1056 ExpectedPointerMutability::Mut => DiagArgValue::Str(Cow::Borrowed("*mut")),
1057 ExpectedPointerMutability::Not => DiagArgValue::Str(Cow::Borrowed("*_")),
1058 }
1059 }
1060}
1061
1062#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
TargetFeatureSafeTrait 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 {
TargetFeatureSafeTrait { span: __binding_0, def: __binding_1
} => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`#[target_feature(..)]` cannot be applied to safe trait method")));
;
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot be applied to safe trait method")));
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("not an `unsafe` function")));
diag
}
}
}
}
};Diagnostic)]
1063#[diag("`#[target_feature(..)]` cannot be applied to safe trait method")]
1064pub(crate) struct TargetFeatureSafeTrait {
1065 #[primary_span]
1066 #[label("cannot be applied to safe trait method")]
1067 pub span: Span,
1068 #[label("not an `unsafe` function")]
1069 pub def: Span,
1070}
1071
1072#[derive(const _: () =
{
impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
ForbiddenTargetFeatureAttr<'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 {
ForbiddenTargetFeatureAttr {
span: __binding_0, feature: __binding_1, reason: __binding_2
} => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("target feature `{$feature}` cannot be enabled with `#[target_feature]`: {$reason}")));
;
diag.arg("feature", __binding_1);
diag.arg("reason", __binding_2);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1073#[diag("target feature `{$feature}` cannot be enabled with `#[target_feature]`: {$reason}")]
1074pub struct ForbiddenTargetFeatureAttr<'a> {
1075 #[primary_span]
1076 pub span: Span,
1077 pub feature: &'a str,
1078 pub reason: &'a str,
1079}
1080
1081#[derive(const _: () =
{
impl<'_sess, 'tcx, G> rustc_errors::Diagnostic<'_sess, G> for
FailedToGetLayout<'tcx> 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 {
FailedToGetLayout {
span: __binding_0, ty: __binding_1, err: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to get layout for {$ty}: {$err}")));
;
diag.arg("ty", __binding_1);
diag.arg("err", __binding_2);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1082#[diag("failed to get layout for {$ty}: {$err}")]
1083pub struct FailedToGetLayout<'tcx> {
1084 #[primary_span]
1085 pub span: Span,
1086 pub ty: Ty<'tcx>,
1087 pub err: LayoutError<'tcx>,
1088}
1089
1090#[derive(const _: () =
{
impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
DlltoolFailImportLibrary<'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 {
DlltoolFailImportLibrary {
dlltool_path: __binding_0,
dlltool_args: __binding_1,
stdout: __binding_2,
stderr: __binding_3 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("dlltool could not create import library with {$dlltool_path} {$dlltool_args}:\n{$stdout}\n{$stderr}")));
;
diag.arg("dlltool_path", __binding_0);
diag.arg("dlltool_args", __binding_1);
diag.arg("stdout", __binding_2);
diag.arg("stderr", __binding_3);
diag
}
}
}
}
};Diagnostic)]
1091#[diag(
1092 "dlltool could not create import library with {$dlltool_path} {$dlltool_args}:
1093{$stdout}
1094{$stderr}"
1095)]
1096pub(crate) struct DlltoolFailImportLibrary<'a> {
1097 pub dlltool_path: Cow<'a, str>,
1098 pub dlltool_args: String,
1099 pub stdout: Cow<'a, str>,
1100 pub stderr: Cow<'a, str>,
1101}
1102
1103#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
ErrorWritingDEFFile 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 {
ErrorWritingDEFFile { error: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("error writing .DEF file: {$error}")));
;
diag.arg("error", __binding_0);
diag
}
}
}
}
};Diagnostic)]
1104#[diag("error writing .DEF file: {$error}")]
1105pub(crate) struct ErrorWritingDEFFile {
1106 pub error: std::io::Error,
1107}
1108
1109#[derive(const _: () =
{
impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
ErrorCallingDllTool<'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 {
ErrorCallingDllTool {
dlltool_path: __binding_0, error: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("error calling dlltool '{$dlltool_path}': {$error}")));
;
diag.arg("dlltool_path", __binding_0);
diag.arg("error", __binding_1);
diag
}
}
}
}
};Diagnostic)]
1110#[diag("error calling dlltool '{$dlltool_path}': {$error}")]
1111pub(crate) struct ErrorCallingDllTool<'a> {
1112 pub dlltool_path: Cow<'a, str>,
1113 pub error: std::io::Error,
1114}
1115
1116#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
ErrorCreatingRemarkDir 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 {
ErrorCreatingRemarkDir { error: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to create remark directory: {$error}")));
;
diag.arg("error", __binding_0);
diag
}
}
}
}
};Diagnostic)]
1117#[diag("failed to create remark directory: {$error}")]
1118pub(crate) struct ErrorCreatingRemarkDir {
1119 pub error: std::io::Error,
1120}
1121
1122#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
CompilerBuiltinsCannotCall 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 {
CompilerBuiltinsCannotCall {
caller: __binding_0, callee: __binding_1, span: __binding_2
} => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`compiler_builtins` cannot call functions through upstream monomorphizations; encountered invalid call from `{$caller}` to `{$callee}`")));
;
diag.arg("caller", __binding_0);
diag.arg("callee", __binding_1);
diag.span(__binding_2);
diag
}
}
}
}
};Diagnostic)]
1123#[diag(
1124 "`compiler_builtins` cannot call functions through upstream monomorphizations; encountered invalid call from `{$caller}` to `{$callee}`"
1125)]
1126pub struct CompilerBuiltinsCannotCall {
1127 pub caller: String,
1128 pub callee: String,
1129 #[primary_span]
1130 pub span: Span,
1131}
1132
1133#[derive(const _: () =
{
impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
ErrorCreatingImportLibrary<'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 {
ErrorCreatingImportLibrary {
lib_name: __binding_0, error: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("error creating import library for {$lib_name}: {$error}")));
;
diag.arg("lib_name", __binding_0);
diag.arg("error", __binding_1);
diag
}
}
}
}
};Diagnostic)]
1134#[diag("error creating import library for {$lib_name}: {$error}")]
1135pub(crate) struct ErrorCreatingImportLibrary<'a> {
1136 pub lib_name: &'a str,
1137 pub error: String,
1138}
1139
1140#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
AixStripNotUsed 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 {
AixStripNotUsed => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("using host's `strip` binary to cross-compile to AIX which is not guaranteed to work")));
;
diag
}
}
}
}
};Diagnostic)]
1141#[diag("using host's `strip` binary to cross-compile to AIX which is not guaranteed to work")]
1142pub(crate) struct AixStripNotUsed;
1143
1144#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for XcrunError
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 {
XcrunError::FailedInvoking {
sdk_name: __binding_0,
command_formatted: __binding_1,
error: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("invoking `{$command_formatted}` to find {$sdk_name}.sdk failed: {$error}")));
;
diag.arg("sdk_name", __binding_0);
diag.arg("command_formatted", __binding_1);
diag.arg("error", __binding_2);
diag
}
XcrunError::Unsuccessful {
sdk_name: __binding_0,
command_formatted: __binding_1,
stdout: __binding_2,
stderr: __binding_3 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed running `{$command_formatted}` to find {$sdk_name}.sdk")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$stdout}{$stderr}")));
;
diag.arg("sdk_name", __binding_0);
diag.arg("command_formatted", __binding_1);
diag.arg("stdout", __binding_2);
diag.arg("stderr", __binding_3);
diag
}
}
}
}
};Diagnostic, #[automatically_derived]
impl ::core::fmt::Debug for XcrunError {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
XcrunError::FailedInvoking {
sdk_name: __self_0,
command_formatted: __self_1,
error: __self_2 } =>
::core::fmt::Formatter::debug_struct_field3_finish(f,
"FailedInvoking", "sdk_name", __self_0, "command_formatted",
__self_1, "error", &__self_2),
XcrunError::Unsuccessful {
sdk_name: __self_0,
command_formatted: __self_1,
stdout: __self_2,
stderr: __self_3 } =>
::core::fmt::Formatter::debug_struct_field4_finish(f,
"Unsuccessful", "sdk_name", __self_0, "command_formatted",
__self_1, "stdout", __self_2, "stderr", &__self_3),
}
}
}Debug)]
1145pub(crate) enum XcrunError {
1146 #[diag("invoking `{$command_formatted}` to find {$sdk_name}.sdk failed: {$error}")]
1147 FailedInvoking { sdk_name: &'static str, command_formatted: String, error: std::io::Error },
1148
1149 #[diag("failed running `{$command_formatted}` to find {$sdk_name}.sdk")]
1150 #[note("{$stdout}{$stderr}")]
1151 Unsuccessful {
1152 sdk_name: &'static str,
1153 command_formatted: String,
1154 stdout: String,
1155 stderr: String,
1156 },
1157}
1158
1159#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
XcrunSdkPathWarning 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 {
XcrunSdkPathWarning {
sdk_name: __binding_0, stderr: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("output of `xcrun` while finding {$sdk_name}.sdk")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("{$stderr}")));
;
diag.arg("sdk_name", __binding_0);
diag.arg("stderr", __binding_1);
diag
}
}
}
}
};Diagnostic, #[automatically_derived]
impl ::core::fmt::Debug for XcrunSdkPathWarning {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f,
"XcrunSdkPathWarning", "sdk_name", &self.sdk_name, "stderr",
&&self.stderr)
}
}Debug)]
1160#[diag("output of `xcrun` while finding {$sdk_name}.sdk")]
1161#[note("{$stderr}")]
1162pub(crate) struct XcrunSdkPathWarning {
1163 pub sdk_name: &'static str,
1164 pub stderr: String,
1165}
1166
1167#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
Aarch64SoftfloatNeon 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 {
Aarch64SoftfloatNeon => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("enabling the `neon` target feature on the current target is unsound due to ABI issues")));
;
diag
}
}
}
}
};Diagnostic)]
1168#[diag("enabling the `neon` target feature on the current target is unsound due to ABI issues")]
1169pub(crate) struct Aarch64SoftfloatNeon;
1170
1171#[derive(const _: () =
{
impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
UnknownCTargetFeaturePrefix<'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 {
UnknownCTargetFeaturePrefix { feature: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unknown feature specified for `-Ctarget-feature`: `{$feature}`")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("features must begin with a `+` to enable or `-` to disable it")));
;
diag.arg("feature", __binding_0);
diag
}
}
}
}
};Diagnostic)]
1172#[diag("unknown feature specified for `-Ctarget-feature`: `{$feature}`")]
1173#[note("features must begin with a `+` to enable or `-` to disable it")]
1174pub(crate) struct UnknownCTargetFeaturePrefix<'a> {
1175 pub feature: &'a str,
1176}
1177
1178#[derive(const _: () =
{
impl<'a> rustc_errors::Subdiagnostic for PossibleFeature<'a> {
fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
where __G: rustc_errors::EmissionGuarantee {
match self {
PossibleFeature::Some { rust_feature: __binding_0 } => {
diag.store_args();
diag.arg("rust_feature", __binding_0);
let __message =
diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("you might have meant: `{$rust_feature}`")));
diag.help(__message);
diag.restore_args();
}
PossibleFeature::None => {
diag.store_args();
let __message =
diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider filing a feature request")));
diag.help(__message);
diag.restore_args();
}
}
}
}
};Subdiagnostic)]
1179pub(crate) enum PossibleFeature<'a> {
1180 #[help("you might have meant: `{$rust_feature}`")]
1181 Some { rust_feature: &'a str },
1182 #[help("consider filing a feature request")]
1183 None,
1184}
1185
1186#[derive(const _: () =
{
impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
UnknownCTargetFeature<'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 {
UnknownCTargetFeature {
feature: __binding_0, rust_feature: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unknown and unstable feature specified for `-Ctarget-feature`: `{$feature}`")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("it is still passed through to the codegen backend, but use of this feature might be unsound and the behavior of this feature can change in the future")));
;
diag.arg("feature", __binding_0);
diag.subdiagnostic(__binding_1);
diag
}
}
}
}
};Diagnostic)]
1187#[diag("unknown and unstable feature specified for `-Ctarget-feature`: `{$feature}`")]
1188#[note(
1189 "it is still passed through to the codegen backend, but use of this feature might be unsound and the behavior of this feature can change in the future"
1190)]
1191pub(crate) struct UnknownCTargetFeature<'a> {
1192 pub feature: &'a str,
1193 #[subdiagnostic]
1194 pub rust_feature: PossibleFeature<'a>,
1195}
1196
1197#[derive(const _: () =
{
impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
UnstableCTargetFeature<'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 {
UnstableCTargetFeature { feature: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unstable feature specified for `-Ctarget-feature`: `{$feature}`")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this feature is not stably supported; its behavior can change in the future")));
;
diag.arg("feature", __binding_0);
diag
}
}
}
}
};Diagnostic)]
1198#[diag("unstable feature specified for `-Ctarget-feature`: `{$feature}`")]
1199#[note("this feature is not stably supported; its behavior can change in the future")]
1200pub(crate) struct UnstableCTargetFeature<'a> {
1201 pub feature: &'a str,
1202}
1203
1204#[derive(const _: () =
{
impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
ForbiddenCTargetFeature<'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 {
ForbiddenCTargetFeature {
feature: __binding_0,
enabled: __binding_1,
reason: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("target feature `{$feature}` cannot be {$enabled} with `-Ctarget-feature`: {$reason}")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("for more information, see issue #116344 <https://github.com/rust-lang/rust/issues/116344>")));
;
diag.arg("feature", __binding_0);
diag.arg("enabled", __binding_1);
diag.arg("reason", __binding_2);
diag
}
}
}
}
};Diagnostic)]
1205#[diag("target feature `{$feature}` cannot be {$enabled} with `-Ctarget-feature`: {$reason}")]
1206#[note(
1207 "this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!"
1208)]
1209#[note("for more information, see issue #116344 <https://github.com/rust-lang/rust/issues/116344>")]
1210pub(crate) struct ForbiddenCTargetFeature<'a> {
1211 pub feature: &'a str,
1212 pub enabled: &'a str,
1213 pub reason: &'a str,
1214}
1215
1216pub struct TargetFeatureDisableOrEnable<'a> {
1217 pub features: &'a [&'a str],
1218 pub span: Option<Span>,
1219 pub missing_features: Option<MissingFeatures>,
1220}
1221
1222#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for MissingFeatures {
fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
where __G: rustc_errors::EmissionGuarantee {
match self {
MissingFeatures => {
diag.store_args();
let __message =
diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("add the missing features in a `target_feature` attribute")));
diag.help(__message);
diag.restore_args();
}
}
}
}
};Subdiagnostic)]
1223#[help("add the missing features in a `target_feature` attribute")]
1224pub struct MissingFeatures;
1225
1226impl<G: EmissionGuarantee> Diagnostic<'_, G> for TargetFeatureDisableOrEnable<'_> {
1227 fn into_diag(self, dcx: DiagCtxtHandle<'_>, level: Level) -> Diag<'_, G> {
1228 let mut diag = Diag::new(
1229 dcx,
1230 level,
1231 rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the target features {$features} must all be either enabled or disabled together"))msg!("the target features {$features} must all be either enabled or disabled together"),
1232 );
1233 if let Some(span) = self.span {
1234 diag.span(span);
1235 };
1236 if let Some(missing_features) = self.missing_features {
1237 diag.subdiagnostic(missing_features);
1238 }
1239 diag.arg("features", self.features.join(", "));
1240 diag
1241 }
1242}
1243
1244#[derive(const _: () =
{
impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
FeatureNotValid<'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 {
FeatureNotValid {
feature: __binding_0,
span: __binding_1,
plus_hint: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the feature named `{$feature}` is not valid for this target")));
;
diag.arg("feature", __binding_0);
diag.span(__binding_1);
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$feature}` is not valid for this target")));
if __binding_2 {
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider removing the leading `+` in the feature name")));
}
diag
}
}
}
}
};Diagnostic)]
1245#[diag("the feature named `{$feature}` is not valid for this target")]
1246pub(crate) struct FeatureNotValid<'a> {
1247 pub feature: &'a str,
1248 #[primary_span]
1249 #[label("`{$feature}` is not valid for this target")]
1250 pub span: Span,
1251 #[help("consider removing the leading `+` in the feature name")]
1252 pub plus_hint: bool,
1253}
1254
1255#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for LtoDisallowed
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 {
LtoDisallowed => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("lto can only be run for executables, cdylibs and static library outputs")));
;
diag
}
}
}
}
};Diagnostic)]
1256#[diag("lto can only be run for executables, cdylibs and static library outputs")]
1257pub(crate) struct LtoDisallowed;
1258
1259#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for LtoDylib 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 {
LtoDylib => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("lto cannot be used for `dylib` crate type without `-Zdylib-lto`")));
;
diag
}
}
}
}
};Diagnostic)]
1260#[diag("lto cannot be used for `dylib` crate type without `-Zdylib-lto`")]
1261pub(crate) struct LtoDylib;
1262
1263#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for LtoProcMacro
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 {
LtoProcMacro => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("lto cannot be used for `proc-macro` crate type without `-Zdylib-lto`")));
;
diag
}
}
}
}
};Diagnostic)]
1264#[diag("lto cannot be used for `proc-macro` crate type without `-Zdylib-lto`")]
1265pub(crate) struct LtoProcMacro;
1266
1267#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
DynamicLinkingWithLTO 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 {
DynamicLinkingWithLTO => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot prefer dynamic linking when performing LTO")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only 'staticlib', 'bin', and 'cdylib' outputs are supported with LTO")));
;
diag
}
}
}
}
};Diagnostic)]
1268#[diag("cannot prefer dynamic linking when performing LTO")]
1269#[note("only 'staticlib', 'bin', and 'cdylib' outputs are supported with LTO")]
1270pub(crate) struct DynamicLinkingWithLTO;