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