1use std::error::Error;
2
3use rustc_macros::{Diagnostic, Subdiagnostic};
4
5#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for CantEmitMIR
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 {
CantEmitMIR { error: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("could not emit MIR: {$error}")));
;
diag.arg("error", __binding_0);
diag
}
}
}
}
};Diagnostic)]
6#[diag("could not emit MIR: {$error}")]
7pub struct CantEmitMIR {
8 pub error: std::io::Error,
9}
10
11#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
RlinkUnableToRead 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 {
RlinkUnableToRead { err: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("failed to read rlink file: `{$err}`")));
;
diag.arg("err", __binding_0);
diag
}
}
}
}
};Diagnostic)]
12#[diag("failed to read rlink file: `{$err}`")]
13pub(crate) struct RlinkUnableToRead {
14 pub err: std::io::Error,
15}
16
17#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
RLinkWrongFileType 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 {
RLinkWrongFileType => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the input does not look like a .rlink file")));
;
diag
}
}
}
}
};Diagnostic)]
18#[diag("the input does not look like a .rlink file")]
19pub(crate) struct RLinkWrongFileType;
20
21#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
RLinkEmptyVersionNumber 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 {
RLinkEmptyVersionNumber => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the input does not contain version number")));
;
diag
}
}
}
}
};Diagnostic)]
22#[diag("the input does not contain version number")]
23pub(crate) struct RLinkEmptyVersionNumber;
24
25#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
RLinkEncodingVersionMismatch 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 {
RLinkEncodingVersionMismatch {
version_array: __binding_0, rlink_version: __binding_1 } =>
{
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed(".rlink file was produced with encoding version `{$version_array}`, but the current version is `{$rlink_version}`")));
;
diag.arg("version_array", __binding_0);
diag.arg("rlink_version", __binding_1);
diag
}
}
}
}
};Diagnostic)]
26#[diag(
27 ".rlink file was produced with encoding version `{$version_array}`, but the current version is `{$rlink_version}`"
28)]
29pub(crate) struct RLinkEncodingVersionMismatch {
30 pub version_array: String,
31 pub rlink_version: u32,
32}
33
34#[derive(const _: () =
{
impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
RLinkRustcVersionMismatch<'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 {
RLinkRustcVersionMismatch {
rustc_version: __binding_0, current_version: __binding_1 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed(".rlink file was produced by rustc version `{$rustc_version}`, but the current version is `{$current_version}`")));
;
diag.arg("rustc_version", __binding_0);
diag.arg("current_version", __binding_1);
diag
}
}
}
}
};Diagnostic)]
35#[diag(
36 ".rlink file was produced by rustc version `{$rustc_version}`, but the current version is `{$current_version}`"
37)]
38pub(crate) struct RLinkRustcVersionMismatch<'a> {
39 pub rustc_version: String,
40 pub current_version: &'a str,
41}
42
43#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for RlinkNotAFile
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 {
RlinkNotAFile => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("rlink must be a file")));
;
diag
}
}
}
}
};Diagnostic)]
44#[diag("rlink must be a file")]
45pub(crate) struct RlinkNotAFile;
46
47#[derive(const _: () =
{
impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
RlinkCorruptFile<'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 {
RlinkCorruptFile { file: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("corrupt metadata encountered in `{$file}`")));
;
diag.arg("file", __binding_0);
diag
}
}
}
}
};Diagnostic)]
48#[diag("corrupt metadata encountered in `{$file}`")]
49pub(crate) struct RlinkCorruptFile<'a> {
50 pub file: &'a std::path::Path,
51}
52
53#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for Ice 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 {
Ice => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the compiler unexpectedly panicked. this is a bug.")));
;
diag
}
}
}
}
};Diagnostic)]
54#[diag("the compiler unexpectedly panicked. this is a bug.")]
55pub(crate) struct Ice;
56
57#[derive(const _: () =
{
impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
IceBugReport<'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 {
IceBugReport { bug_report_url: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("we would appreciate a bug report: {$bug_report_url}")));
;
diag.arg("bug_report_url", __binding_0);
diag
}
}
}
}
};Diagnostic)]
58#[diag("we would appreciate a bug report: {$bug_report_url}")]
59pub(crate) struct IceBugReport<'a> {
60 pub bug_report_url: &'a str,
61}
62
63#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
UpdateNightlyNote 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 {
UpdateNightlyNote => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("please make sure that you have updated to the latest nightly")));
;
diag
}
}
}
}
};Diagnostic)]
64#[diag("please make sure that you have updated to the latest nightly")]
65pub(crate) struct UpdateNightlyNote;
66
67#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
IceBugReportInternalFeature 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 {
IceBugReportInternalFeature => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("using internal features is not supported and expected to cause internal compiler errors when used incorrectly")));
;
diag
}
}
}
}
};Diagnostic)]
68#[diag(
69 "using internal features is not supported and expected to cause internal compiler errors when used incorrectly"
70)]
71pub(crate) struct IceBugReportInternalFeature;
72
73#[derive(const _: () =
{
impl<'_sess, 'a, G> rustc_errors::Diagnostic<'_sess, G> for
IceVersion<'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 {
IceVersion { version: __binding_0, triple: __binding_1 } =>
{
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("rustc {$version} running on {$triple}")));
;
diag.arg("version", __binding_0);
diag.arg("triple", __binding_1);
diag
}
}
}
}
};Diagnostic)]
74#[diag("rustc {$version} running on {$triple}")]
75pub(crate) struct IceVersion<'a> {
76 pub version: &'a str,
77 pub triple: &'a str,
78}
79
80#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for IcePath 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 {
IcePath { path: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("please attach the file at `{$path}` to your bug report")));
;
diag.arg("path", __binding_0);
diag
}
}
}
}
};Diagnostic)]
81#[diag("please attach the file at `{$path}` to your bug report")]
82pub(crate) struct IcePath {
83 pub path: std::path::PathBuf,
84}
85
86#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for IcePathError
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 {
IcePathError {
path: __binding_0, error: __binding_1, env_var: __binding_2
} => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the ICE couldn't be written to `{$path}`: {$error}")));
;
diag.arg("path", __binding_0);
diag.arg("error", __binding_1);
if let Some(__binding_2) = __binding_2 {
diag.subdiagnostic(__binding_2);
}
diag
}
}
}
}
};Diagnostic)]
87#[diag("the ICE couldn't be written to `{$path}`: {$error}")]
88pub(crate) struct IcePathError {
89 pub path: std::path::PathBuf,
90 pub error: String,
91 #[subdiagnostic]
92 pub env_var: Option<IcePathErrorEnv>,
93}
94
95#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for IcePathErrorEnv {
fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
where __G: rustc_errors::EmissionGuarantee {
match self {
IcePathErrorEnv { env_var: __binding_0 } => {
diag.store_args();
diag.arg("env_var", __binding_0);
let __message =
diag.eagerly_translate(rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("the environment variable `RUSTC_ICE` is set to `{$env_var}`")));
diag.note(__message);
diag.restore_args();
}
}
}
}
};Subdiagnostic)]
96#[note("the environment variable `RUSTC_ICE` is set to `{$env_var}`")]
97pub(crate) struct IcePathErrorEnv {
98 pub env_var: std::path::PathBuf,
99}
100
101#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for IceFlags 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 {
IceFlags { flags: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("compiler flags: {$flags}")));
;
diag.arg("flags", __binding_0);
diag
}
}
}
}
};Diagnostic)]
102#[diag("compiler flags: {$flags}")]
103pub(crate) struct IceFlags {
104 pub flags: String,
105}
106
107#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
IceExcludeCargoDefaults 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 {
IceExcludeCargoDefaults => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("some of the compiler flags provided by cargo are hidden")));
;
diag
}
}
}
}
};Diagnostic)]
108#[diag("some of the compiler flags provided by cargo are hidden")]
109pub(crate) struct IceExcludeCargoDefaults;
110
111#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
UnstableFeatureUsage 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 {
UnstableFeatureUsage { error: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
rustc_errors::DiagMessage::Inline(std::borrow::Cow::Borrowed("cannot dump feature usage metrics: {$error}")));
;
diag.arg("error", __binding_0);
diag
}
}
}
}
};Diagnostic)]
112#[diag("cannot dump feature usage metrics: {$error}")]
113pub(crate) struct UnstableFeatureUsage {
114 pub error: Box<dyn Error>,
115}