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