1use rustc_macros::Diagnostic;
2use rustc_middle::ty::{Instance, Ty};
3use rustc_span::{Span, Symbol};
4
5#[derive(const _: () =
{
impl<'_sess, 'tcx, G> rustc_errors::Diagnostic<'_sess, G> for
RecursionLimit<'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 {
RecursionLimit {
span: __binding_0,
instance: __binding_1,
def_span: __binding_2,
def_path_str: __binding_3 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("reached the recursion limit while instantiating `{$instance}`")));
;
diag.arg("instance", __binding_1);
diag.arg("def_path_str", __binding_3);
diag.span(__binding_0);
diag.span_note(__binding_2,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("`{$def_path_str}` defined here")));
diag
}
}
}
}
};Diagnostic)]
6#[diag("reached the recursion limit while instantiating `{$instance}`")]
7pub(crate) struct RecursionLimit<'tcx> {
8 #[primary_span]
9 pub span: Span,
10 pub instance: Instance<'tcx>,
11 #[note("`{$def_path_str}` defined here")]
12 pub def_span: Span,
13 pub def_path_str: String,
14}
15
16#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for NoOptimizedMir
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 {
NoOptimizedMir {
span: __binding_0,
crate_name: __binding_1,
instance: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("missing optimized MIR for `{$instance}` in the crate `{$crate_name}`")));
;
diag.arg("crate_name", __binding_1);
diag.arg("instance", __binding_2);
diag.span_note(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("missing optimized MIR for this item (was the crate `{$crate_name}` compiled with `--emit=metadata`?)")));
diag
}
}
}
}
};Diagnostic)]
17#[diag("missing optimized MIR for `{$instance}` in the crate `{$crate_name}`")]
18pub(crate) struct NoOptimizedMir {
19 #[note(
20 "missing optimized MIR for this item (was the crate `{$crate_name}` compiled with `--emit=metadata`?)"
21 )]
22 pub span: Span,
23 pub crate_name: Symbol,
24 pub instance: String,
25}
26
27#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
LargeAssignmentsLint 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 {
LargeAssignmentsLint {
span: __binding_0, size: __binding_1, limit: __binding_2 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("moving {$size} bytes")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the current maximum size is {$limit}, but it can be customized with the move_size_limit attribute: `#![move_size_limit = \"...\"]`")));
;
diag.arg("size", __binding_1);
diag.arg("limit", __binding_2);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("value moved from here")));
diag
}
}
}
}
};Diagnostic)]
28#[diag("moving {$size} bytes")]
29#[note(
30 "the current maximum size is {$limit}, but it can be customized with the move_size_limit attribute: `#![move_size_limit = \"...\"]`"
31)]
32pub(crate) struct LargeAssignmentsLint {
33 #[label("value moved from here")]
34 pub span: Span,
35 pub size: u64,
36 pub limit: u64,
37}
38
39#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
SymbolAlreadyDefined where G: rustc_errors::EmissionGuarantee {
#[track_caller]
fn into_diag(self, dcx: rustc_errors::DiagCtxtHandle<'_sess>,
level: rustc_errors::Level) -> rustc_errors::Diag<'_sess, G> {
match self {
SymbolAlreadyDefined {
span: __binding_0, symbol: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("symbol `{$symbol}` is already defined")));
;
diag.arg("symbol", __binding_1);
if let Some(__binding_0) = __binding_0 {
diag.span(__binding_0);
}
diag
}
}
}
}
};Diagnostic)]
40#[diag("symbol `{$symbol}` is already defined")]
41pub(crate) struct SymbolAlreadyDefined {
42 #[primary_span]
43 pub span: Option<Span>,
44 pub symbol: String,
45}
46
47#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
CouldntDumpMonoStats 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 {
CouldntDumpMonoStats { error: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("unexpected error occurred while dumping monomorphization stats: {$error}")));
;
diag.arg("error", __binding_0);
diag
}
}
}
}
};Diagnostic)]
48#[diag("unexpected error occurred while dumping monomorphization stats: {$error}")]
49pub(crate) struct CouldntDumpMonoStats {
50 pub error: String,
51}
52
53#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
OffloadManifestWriteError 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 {
OffloadManifestWriteError {
path: __binding_0, err: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("could not write offload monomorphization manifest to `{$path}`: {$err}")));
;
diag.arg("path", __binding_0);
diag.arg("err", __binding_1);
diag
}
}
}
}
};Diagnostic)]
54#[diag("could not write offload monomorphization manifest to `{$path}`: {$err}")]
55pub(crate) struct OffloadManifestWriteError {
56 pub path: String,
57 pub err: String,
58}
59
60#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
OffloadManifestReadError 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 {
OffloadManifestReadError {
path: __binding_0, err: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("could not read offload monomorphization manifest from `{$path}`: {$err}")));
;
diag.arg("path", __binding_0);
diag.arg("err", __binding_1);
diag
}
}
}
}
};Diagnostic)]
61#[diag("could not read offload monomorphization manifest from `{$path}`: {$err}")]
62pub(crate) struct OffloadManifestReadError {
63 pub path: String,
64 pub err: String,
65}
66
67#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
GenericKernelNotInstantiated 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 {
GenericKernelNotInstantiated {
span: __binding_0, def_path: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("generic offload kernel `{$def_path}` is not instantiated")));
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("with `-Zoffload=Device` (without a manifest), generic kernels are only discovered via monomorphization; if this kernel is called from host code, pass `-Zoffload=Device=<manifest>`, using the manifest written by `-Zoffload=HostMetadata=<manifest>`")));
;
diag.arg("def_path", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
68#[diag("generic offload kernel `{$def_path}` is not instantiated")]
69#[help(
70 "with `-Zoffload=Device` (without a manifest), generic kernels are only discovered via \
71 monomorphization; if this kernel is called from host code, pass \
72 `-Zoffload=Device=<manifest>`, using the manifest written by `-Zoffload=HostMetadata=<manifest>`"
73)]
74pub(crate) struct GenericKernelNotInstantiated {
75 #[primary_span]
76 pub span: Span,
77 pub def_path: String,
78}
79
80#[derive(const _: () =
{
impl<'_sess, 'tcx, G> rustc_errors::Diagnostic<'_sess, G> for
EncounteredErrorWhileInstantiating<'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 {
EncounteredErrorWhileInstantiating {
span: __binding_0, kind: __binding_1, instance: __binding_2
} => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the above error was encountered while instantiating `{$kind} {$instance}`")));
;
diag.arg("kind", __binding_1);
diag.arg("instance", __binding_2);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
81#[diag("the above error was encountered while instantiating `{$kind} {$instance}`")]
82pub(crate) struct EncounteredErrorWhileInstantiating<'tcx> {
83 #[primary_span]
84 pub span: Span,
85 pub kind: &'static str,
86 pub instance: Instance<'tcx>,
87}
88
89#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
EncounteredErrorWhileInstantiatingGlobalAsm 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 {
EncounteredErrorWhileInstantiatingGlobalAsm {
span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the above error was encountered while instantiating `global_asm`")));
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
90#[diag("the above error was encountered while instantiating `global_asm`")]
91pub(crate) struct EncounteredErrorWhileInstantiatingGlobalAsm {
92 #[primary_span]
93 pub span: Span,
94}
95
96#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for StartNotFound
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 {
StartNotFound => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("using `fn main` requires the standard library")));
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("use `#![no_main]` to bypass the Rust generated entrypoint and declare a platform specific entrypoint yourself, usually with `#[no_mangle]`")));
;
diag
}
}
}
}
};Diagnostic)]
97#[diag("using `fn main` requires the standard library")]
98#[help(
99 "use `#![no_main]` to bypass the Rust generated entrypoint and declare a platform specific entrypoint yourself, usually with `#[no_mangle]`"
100)]
101pub(crate) struct StartNotFound;
102
103#[derive(const _: () =
{
impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
AbiErrorDisabledVectorType<'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 {
AbiErrorDisabledVectorType {
span: __binding_0,
required_feature: __binding_1,
ty: __binding_2,
is_call: __binding_3,
is_scalable: __binding_4 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this function {$is_call ->\n [true] call\n *[false] definition\n} uses {$is_scalable ->\n [true] scalable\n *[false] SIMD\n} vector type `{$ty}` which (with the chosen ABI) requires the `{$required_feature}` target feature, which is not enabled{$is_call ->\n [true] {\" \"}in the caller\n *[false] {\"\"}\n}")));
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider enabling it globally (`-C target-feature=+{$required_feature}`) or locally (`#[target_feature(enable=\"{$required_feature}\")]`)")));
;
diag.arg("required_feature", __binding_1);
diag.arg("ty", __binding_2);
diag.arg("is_call", __binding_3);
diag.arg("is_scalable", __binding_4);
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("function {$is_call ->\n [true] called\n *[false] defined\n } here")));
diag
}
}
}
}
};Diagnostic)]
104#[diag("this function {$is_call ->
105 [true] call
106 *[false] definition
107} uses {$is_scalable ->
108 [true] scalable
109 *[false] SIMD
110} vector type `{$ty}` which (with the chosen ABI) requires the `{$required_feature}` target feature, which is not enabled{$is_call ->
111 [true] {\" \"}in the caller
112 *[false] {\"\"}
113}")]
114#[help(
115 "consider enabling it globally (`-C target-feature=+{$required_feature}`) or locally (`#[target_feature(enable=\"{$required_feature}\")]`)"
116)]
117pub(crate) struct AbiErrorDisabledVectorType<'a> {
118 #[primary_span]
119 #[label(
120 "function {$is_call ->
121 [true] called
122 *[false] defined
123 } here"
124 )]
125 pub span: Span,
126 pub required_feature: &'a str,
127 pub ty: Ty<'a>,
128 pub is_call: bool,
130 pub is_scalable: bool,
132}
133
134#[derive(const _: () =
{
impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
AbiErrorUnsupportedUnsizedParameter<'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 {
AbiErrorUnsupportedUnsizedParameter {
span: __binding_0, ty: __binding_1, is_call: __binding_2 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this function {$is_call ->\n [true] call\n *[false] definition\n } uses unsized type `{$ty}` which is not supported with the chosen ABI")));
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("only rustic ABIs support unsized parameters")));
;
diag.arg("ty", __binding_1);
diag.arg("is_call", __binding_2);
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("function {$is_call ->\n [true] called\n *[false] defined\n } here")));
diag
}
}
}
}
};Diagnostic)]
135#[diag(
136 "this function {$is_call ->
137 [true] call
138 *[false] definition
139 } uses unsized type `{$ty}` which is not supported with the chosen ABI"
140)]
141#[help("only rustic ABIs support unsized parameters")]
142pub(crate) struct AbiErrorUnsupportedUnsizedParameter<'a> {
143 #[primary_span]
144 #[label(
145 "function {$is_call ->
146 [true] called
147 *[false] defined
148 } here"
149 )]
150 pub span: Span,
151 pub ty: Ty<'a>,
152 pub is_call: bool,
154}
155
156#[derive(const _: () =
{
impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
AbiErrorUnsupportedVectorType<'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 {
AbiErrorUnsupportedVectorType {
span: __binding_0, ty: __binding_1, is_call: __binding_2 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this function {$is_call ->\n [true] call\n *[false] definition\n } uses SIMD vector type `{$ty}` which is not currently supported with the chosen ABI")));
;
diag.arg("ty", __binding_1);
diag.arg("is_call", __binding_2);
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("function {$is_call ->\n [true] called\n *[false] defined\n } here")));
diag
}
}
}
}
};Diagnostic)]
157#[diag(
158 "this function {$is_call ->
159 [true] call
160 *[false] definition
161 } uses SIMD vector type `{$ty}` which is not currently supported with the chosen ABI"
162)]
163pub(crate) struct AbiErrorUnsupportedVectorType<'a> {
164 #[primary_span]
165 #[label(
166 "function {$is_call ->
167 [true] called
168 *[false] defined
169 } here"
170 )]
171 pub span: Span,
172 pub ty: Ty<'a>,
173 pub is_call: bool,
175}
176
177#[derive(const _: () =
{
impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
AbiRequiredTargetFeature<'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 {
AbiRequiredTargetFeature {
span: __binding_0,
required_feature: __binding_1,
abi: __binding_2,
is_call: __binding_3 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("this function {$is_call ->\n [true] call\n *[false] definition\n} uses ABI \"{$abi}\" which requires the `{$required_feature}` target feature, which is not enabled{$is_call ->\n [true] {\" \"}in the caller\n *[false] {\"\"}\n}")));
diag.help(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("consider enabling it globally (`-C target-feature=+{$required_feature}`) or locally (`#[target_feature(enable=\"{$required_feature}\")]`)")));
;
diag.arg("required_feature", __binding_1);
diag.arg("abi", __binding_2);
diag.arg("is_call", __binding_3);
diag.span(__binding_0);
diag.span_label(__binding_0,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("function {$is_call ->\n [true] called\n *[false] defined\n } here")));
diag
}
}
}
}
};Diagnostic)]
178#[diag("this function {$is_call ->
179 [true] call
180 *[false] definition
181} uses ABI \"{$abi}\" which requires the `{$required_feature}` target feature, which is not enabled{$is_call ->
182 [true] {\" \"}in the caller
183 *[false] {\"\"}
184}")]
185#[help(
186 "consider enabling it globally (`-C target-feature=+{$required_feature}`) or locally (`#[target_feature(enable=\"{$required_feature}\")]`)"
187)]
188pub(crate) struct AbiRequiredTargetFeature<'a> {
189 #[primary_span]
190 #[label(
191 "function {$is_call ->
192 [true] called
193 *[false] defined
194 } here"
195 )]
196 pub span: Span,
197 pub required_feature: &'a str,
198 pub abi: &'a str,
199 pub is_call: bool,
201}
202
203#[derive(const _: () =
{
impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
StaticInitializerCyclic<'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 {
StaticInitializerCyclic {
span: __binding_0,
labels: __binding_1,
head: __binding_2,
target: __binding_3 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("static initializer forms a cycle involving `{$head}`")));
diag.note(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cyclic static initializers are not supported for target `{$target}`")));
;
diag.arg("head", __binding_2);
diag.arg("target", __binding_3);
diag.span(__binding_0);
for __binding_1 in __binding_1 {
diag.span_label(__binding_1,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("part of this cycle")));
}
diag
}
}
}
}
};Diagnostic)]
204#[diag("static initializer forms a cycle involving `{$head}`")]
205#[note("cyclic static initializers are not supported for target `{$target}`")]
206pub(crate) struct StaticInitializerCyclic<'a> {
207 #[primary_span]
208 pub span: Span,
209 #[label("part of this cycle")]
210 pub labels: Vec<Span>,
211 pub head: &'a str,
212 pub target: &'a str,
213}