1use rustc_errors::codes::*;
2use rustc_errors::{
3 Applicability, Diag, DiagArgValue, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level,
4 MultiSpan, Subdiagnostic,
5};
6use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
7use rustc_middle::ty::{self, Ty};
8use rustc_pattern_analysis::errors::Uncovered;
9use rustc_pattern_analysis::rustc::RustcPatCtxt;
10use rustc_span::{Ident, Span, Symbol};
11
12use crate::fluent_generated as fluent;
13
14#[derive(const _: () =
{
impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
CallToDeprecatedSafeFnRequiresUnsafe {
#[track_caller]
fn decorate_lint<'__b>(self,
diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
match self {
CallToDeprecatedSafeFnRequiresUnsafe {
span: __binding_0,
function: __binding_1,
guarantee: __binding_2,
sub: __binding_3 } => {
diag.primary_message(crate::fluent_generated::mir_build_call_to_deprecated_safe_fn_requires_unsafe);
;
diag.arg("function", __binding_1);
diag.arg("guarantee", __binding_2);
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
diag.subdiagnostic(__binding_3);
diag
}
};
}
}
};LintDiagnostic)]
15#[diag(mir_build_call_to_deprecated_safe_fn_requires_unsafe)]
16pub(crate) struct CallToDeprecatedSafeFnRequiresUnsafe {
17 #[label]
18 pub(crate) span: Span,
19 pub(crate) function: String,
20 pub(crate) guarantee: String,
21 #[subdiagnostic]
22 pub(crate) sub: CallToDeprecatedSafeFnRequiresUnsafeSub,
23}
24
25#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for
CallToDeprecatedSafeFnRequiresUnsafeSub {
fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
where __G: rustc_errors::EmissionGuarantee {
match self {
CallToDeprecatedSafeFnRequiresUnsafeSub {
start_of_line_suggestion: __binding_0,
start_of_line: __binding_1,
left: __binding_2,
right: __binding_3 } => {
let mut suggestions = Vec::new();
let __code_0 =
::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0}", __binding_0))
});
let __code_1 =
::alloc::__export::must_use({
::alloc::fmt::format(format_args!("unsafe {{ "))
});
let __code_2 =
::alloc::__export::must_use({
::alloc::fmt::format(format_args!(" }}"))
});
suggestions.push((__binding_1, __code_0));
suggestions.push((__binding_2, __code_1));
suggestions.push((__binding_3, __code_2));
diag.store_args();
diag.arg("start_of_line_suggestion", __binding_0);
let __message =
diag.eagerly_translate(crate::fluent_generated::mir_build_suggestion);
diag.multipart_suggestion_with_style(__message, suggestions,
rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowCode);
diag.restore_args();
}
}
}
}
};Subdiagnostic)]
26#[multipart_suggestion(mir_build_suggestion, applicability = "machine-applicable")]
27pub(crate) struct CallToDeprecatedSafeFnRequiresUnsafeSub {
28 pub(crate) start_of_line_suggestion: String,
29 #[suggestion_part(code = "{start_of_line_suggestion}")]
30 pub(crate) start_of_line: Span,
31 #[suggestion_part(code = "unsafe {{ ")]
32 pub(crate) left: Span,
33 #[suggestion_part(code = " }}")]
34 pub(crate) right: Span,
35}
36
37#[derive(const _: () =
{
impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
UnsafeOpInUnsafeFnCallToUnsafeFunctionRequiresUnsafe {
#[track_caller]
fn decorate_lint<'__b>(self,
diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
match self {
UnsafeOpInUnsafeFnCallToUnsafeFunctionRequiresUnsafe {
span: __binding_0,
function: __binding_1,
unsafe_not_inherited_note: __binding_2 } => {
diag.primary_message(crate::fluent_generated::mir_build_unsafe_op_in_unsafe_fn_call_to_unsafe_fn_requires_unsafe);
diag.code(E0133);
diag.note(crate::fluent_generated::_subdiag::note);
;
diag.arg("function", __binding_1);
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
if let Some(__binding_2) = __binding_2 {
diag.subdiagnostic(__binding_2);
}
diag
}
};
}
}
};LintDiagnostic)]
38#[diag(mir_build_unsafe_op_in_unsafe_fn_call_to_unsafe_fn_requires_unsafe, code = E0133)]
39#[note]
40pub(crate) struct UnsafeOpInUnsafeFnCallToUnsafeFunctionRequiresUnsafe {
41 #[label]
42 pub(crate) span: Span,
43 pub(crate) function: String,
44 #[subdiagnostic]
45 pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>,
46}
47
48#[derive(const _: () =
{
impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
UnsafeOpInUnsafeFnCallToUnsafeFunctionRequiresUnsafeNameless {
#[track_caller]
fn decorate_lint<'__b>(self,
diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
match self {
UnsafeOpInUnsafeFnCallToUnsafeFunctionRequiresUnsafeNameless {
span: __binding_0, unsafe_not_inherited_note: __binding_1 }
=> {
diag.primary_message(crate::fluent_generated::mir_build_unsafe_op_in_unsafe_fn_call_to_unsafe_fn_requires_unsafe_nameless);
diag.code(E0133);
diag.note(crate::fluent_generated::_subdiag::note);
;
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
if let Some(__binding_1) = __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
};
}
}
};LintDiagnostic)]
49#[diag(mir_build_unsafe_op_in_unsafe_fn_call_to_unsafe_fn_requires_unsafe_nameless, code = E0133)]
50#[note]
51pub(crate) struct UnsafeOpInUnsafeFnCallToUnsafeFunctionRequiresUnsafeNameless {
52 #[label]
53 pub(crate) span: Span,
54 #[subdiagnostic]
55 pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>,
56}
57
58#[derive(const _: () =
{
impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
UnsafeOpInUnsafeFnUseOfInlineAssemblyRequiresUnsafe {
#[track_caller]
fn decorate_lint<'__b>(self,
diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
match self {
UnsafeOpInUnsafeFnUseOfInlineAssemblyRequiresUnsafe {
span: __binding_0, unsafe_not_inherited_note: __binding_1 }
=> {
diag.primary_message(crate::fluent_generated::mir_build_unsafe_op_in_unsafe_fn_inline_assembly_requires_unsafe);
diag.code(E0133);
diag.note(crate::fluent_generated::_subdiag::note);
;
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
if let Some(__binding_1) = __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
};
}
}
};LintDiagnostic)]
59#[diag(mir_build_unsafe_op_in_unsafe_fn_inline_assembly_requires_unsafe, code = E0133)]
60#[note]
61pub(crate) struct UnsafeOpInUnsafeFnUseOfInlineAssemblyRequiresUnsafe {
62 #[label]
63 pub(crate) span: Span,
64 #[subdiagnostic]
65 pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>,
66}
67
68#[derive(const _: () =
{
impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
UnsafeOpInUnsafeFnInitializingTypeWithRequiresUnsafe {
#[track_caller]
fn decorate_lint<'__b>(self,
diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
match self {
UnsafeOpInUnsafeFnInitializingTypeWithRequiresUnsafe {
span: __binding_0, unsafe_not_inherited_note: __binding_1 }
=> {
diag.primary_message(crate::fluent_generated::mir_build_unsafe_op_in_unsafe_fn_initializing_type_with_requires_unsafe);
diag.code(E0133);
diag.note(crate::fluent_generated::_subdiag::note);
;
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
if let Some(__binding_1) = __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
};
}
}
};LintDiagnostic)]
69#[diag(mir_build_unsafe_op_in_unsafe_fn_initializing_type_with_requires_unsafe, code = E0133)]
70#[note]
71pub(crate) struct UnsafeOpInUnsafeFnInitializingTypeWithRequiresUnsafe {
72 #[label]
73 pub(crate) span: Span,
74 #[subdiagnostic]
75 pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>,
76}
77
78#[derive(const _: () =
{
impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
UnsafeOpInUnsafeFnInitializingTypeWithUnsafeFieldRequiresUnsafe {
#[track_caller]
fn decorate_lint<'__b>(self,
diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
match self {
UnsafeOpInUnsafeFnInitializingTypeWithUnsafeFieldRequiresUnsafe {
span: __binding_0, unsafe_not_inherited_note: __binding_1 }
=> {
diag.primary_message(crate::fluent_generated::mir_build_unsafe_op_in_unsafe_fn_initializing_type_with_unsafe_field_requires_unsafe);
diag.code(E0133);
diag.note(crate::fluent_generated::_subdiag::note);
;
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
if let Some(__binding_1) = __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
};
}
}
};LintDiagnostic)]
79#[diag(mir_build_unsafe_op_in_unsafe_fn_initializing_type_with_unsafe_field_requires_unsafe, code = E0133)]
80#[note]
81pub(crate) struct UnsafeOpInUnsafeFnInitializingTypeWithUnsafeFieldRequiresUnsafe {
82 #[label]
83 pub(crate) span: Span,
84 #[subdiagnostic]
85 pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>,
86}
87
88#[derive(const _: () =
{
impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
UnsafeOpInUnsafeFnUseOfMutableStaticRequiresUnsafe {
#[track_caller]
fn decorate_lint<'__b>(self,
diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
match self {
UnsafeOpInUnsafeFnUseOfMutableStaticRequiresUnsafe {
span: __binding_0, unsafe_not_inherited_note: __binding_1 }
=> {
diag.primary_message(crate::fluent_generated::mir_build_unsafe_op_in_unsafe_fn_mutable_static_requires_unsafe);
diag.code(E0133);
diag.note(crate::fluent_generated::_subdiag::note);
;
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
if let Some(__binding_1) = __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
};
}
}
};LintDiagnostic)]
89#[diag(mir_build_unsafe_op_in_unsafe_fn_mutable_static_requires_unsafe, code = E0133)]
90#[note]
91pub(crate) struct UnsafeOpInUnsafeFnUseOfMutableStaticRequiresUnsafe {
92 #[label]
93 pub(crate) span: Span,
94 #[subdiagnostic]
95 pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>,
96}
97
98#[derive(const _: () =
{
impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
UnsafeOpInUnsafeFnUseOfExternStaticRequiresUnsafe {
#[track_caller]
fn decorate_lint<'__b>(self,
diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
match self {
UnsafeOpInUnsafeFnUseOfExternStaticRequiresUnsafe {
span: __binding_0, unsafe_not_inherited_note: __binding_1 }
=> {
diag.primary_message(crate::fluent_generated::mir_build_unsafe_op_in_unsafe_fn_extern_static_requires_unsafe);
diag.code(E0133);
diag.note(crate::fluent_generated::_subdiag::note);
;
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
if let Some(__binding_1) = __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
};
}
}
};LintDiagnostic)]
99#[diag(mir_build_unsafe_op_in_unsafe_fn_extern_static_requires_unsafe, code = E0133)]
100#[note]
101pub(crate) struct UnsafeOpInUnsafeFnUseOfExternStaticRequiresUnsafe {
102 #[label]
103 pub(crate) span: Span,
104 #[subdiagnostic]
105 pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>,
106}
107
108#[derive(const _: () =
{
impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
UnsafeOpInUnsafeFnUseOfUnsafeFieldRequiresUnsafe {
#[track_caller]
fn decorate_lint<'__b>(self,
diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
match self {
UnsafeOpInUnsafeFnUseOfUnsafeFieldRequiresUnsafe {
span: __binding_0, unsafe_not_inherited_note: __binding_1 }
=> {
diag.primary_message(crate::fluent_generated::mir_build_unsafe_op_in_unsafe_fn_unsafe_field_requires_unsafe);
diag.code(E0133);
diag.note(crate::fluent_generated::_subdiag::note);
;
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
if let Some(__binding_1) = __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
};
}
}
};LintDiagnostic)]
109#[diag(mir_build_unsafe_op_in_unsafe_fn_unsafe_field_requires_unsafe, code = E0133)]
110#[note]
111pub(crate) struct UnsafeOpInUnsafeFnUseOfUnsafeFieldRequiresUnsafe {
112 #[label]
113 pub(crate) span: Span,
114 #[subdiagnostic]
115 pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>,
116}
117
118#[derive(const _: () =
{
impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
UnsafeOpInUnsafeFnDerefOfRawPointerRequiresUnsafe {
#[track_caller]
fn decorate_lint<'__b>(self,
diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
match self {
UnsafeOpInUnsafeFnDerefOfRawPointerRequiresUnsafe {
span: __binding_0, unsafe_not_inherited_note: __binding_1 }
=> {
diag.primary_message(crate::fluent_generated::mir_build_unsafe_op_in_unsafe_fn_deref_raw_pointer_requires_unsafe);
diag.code(E0133);
diag.note(crate::fluent_generated::_subdiag::note);
;
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
if let Some(__binding_1) = __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
};
}
}
};LintDiagnostic)]
119#[diag(mir_build_unsafe_op_in_unsafe_fn_deref_raw_pointer_requires_unsafe, code = E0133)]
120#[note]
121pub(crate) struct UnsafeOpInUnsafeFnDerefOfRawPointerRequiresUnsafe {
122 #[label]
123 pub(crate) span: Span,
124 #[subdiagnostic]
125 pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>,
126}
127
128#[derive(const _: () =
{
impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
UnsafeOpInUnsafeFnAccessToUnionFieldRequiresUnsafe {
#[track_caller]
fn decorate_lint<'__b>(self,
diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
match self {
UnsafeOpInUnsafeFnAccessToUnionFieldRequiresUnsafe {
span: __binding_0, unsafe_not_inherited_note: __binding_1 }
=> {
diag.primary_message(crate::fluent_generated::mir_build_unsafe_op_in_unsafe_fn_union_field_requires_unsafe);
diag.code(E0133);
diag.note(crate::fluent_generated::_subdiag::note);
;
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
if let Some(__binding_1) = __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
};
}
}
};LintDiagnostic)]
129#[diag(mir_build_unsafe_op_in_unsafe_fn_union_field_requires_unsafe, code = E0133)]
130#[note]
131pub(crate) struct UnsafeOpInUnsafeFnAccessToUnionFieldRequiresUnsafe {
132 #[label]
133 pub(crate) span: Span,
134 #[subdiagnostic]
135 pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>,
136}
137
138#[derive(const _: () =
{
impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
UnsafeOpInUnsafeFnMutationOfLayoutConstrainedFieldRequiresUnsafe {
#[track_caller]
fn decorate_lint<'__b>(self,
diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
match self {
UnsafeOpInUnsafeFnMutationOfLayoutConstrainedFieldRequiresUnsafe {
span: __binding_0, unsafe_not_inherited_note: __binding_1 }
=> {
diag.primary_message(crate::fluent_generated::mir_build_unsafe_op_in_unsafe_fn_mutation_of_layout_constrained_field_requires_unsafe);
diag.code(E0133);
diag.note(crate::fluent_generated::_subdiag::note);
;
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
if let Some(__binding_1) = __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
};
}
}
};LintDiagnostic)]
139#[diag(
140 mir_build_unsafe_op_in_unsafe_fn_mutation_of_layout_constrained_field_requires_unsafe,
141 code = E0133
142)]
143#[note]
144pub(crate) struct UnsafeOpInUnsafeFnMutationOfLayoutConstrainedFieldRequiresUnsafe {
145 #[label]
146 pub(crate) span: Span,
147 #[subdiagnostic]
148 pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>,
149}
150
151#[derive(const _: () =
{
impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
UnsafeOpInUnsafeFnBorrowOfLayoutConstrainedFieldRequiresUnsafe {
#[track_caller]
fn decorate_lint<'__b>(self,
diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
match self {
UnsafeOpInUnsafeFnBorrowOfLayoutConstrainedFieldRequiresUnsafe {
span: __binding_0, unsafe_not_inherited_note: __binding_1 }
=> {
diag.primary_message(crate::fluent_generated::mir_build_unsafe_op_in_unsafe_fn_borrow_of_layout_constrained_field_requires_unsafe);
diag.code(E0133);
;
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
if let Some(__binding_1) = __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
};
}
}
};LintDiagnostic)]
152#[diag(
153 mir_build_unsafe_op_in_unsafe_fn_borrow_of_layout_constrained_field_requires_unsafe,
154 code = E0133,
155)]
156pub(crate) struct UnsafeOpInUnsafeFnBorrowOfLayoutConstrainedFieldRequiresUnsafe {
157 #[label]
158 pub(crate) span: Span,
159 #[subdiagnostic]
160 pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>,
161}
162
163#[derive(const _: () =
{
impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
UnsafeOpInUnsafeFnUnsafeBinderCastRequiresUnsafe {
#[track_caller]
fn decorate_lint<'__b>(self,
diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
match self {
UnsafeOpInUnsafeFnUnsafeBinderCastRequiresUnsafe {
span: __binding_0, unsafe_not_inherited_note: __binding_1 }
=> {
diag.primary_message(crate::fluent_generated::mir_build_unsafe_binder_cast_requires_unsafe);
diag.code(E0133);
;
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
if let Some(__binding_1) = __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
};
}
}
};LintDiagnostic)]
164#[diag(
165 mir_build_unsafe_binder_cast_requires_unsafe,
166 code = E0133,
167)]
168pub(crate) struct UnsafeOpInUnsafeFnUnsafeBinderCastRequiresUnsafe {
169 #[label]
170 pub(crate) span: Span,
171 #[subdiagnostic]
172 pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>,
173}
174
175#[derive(const _: () =
{
impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
UnsafeOpInUnsafeFnCallToFunctionWithRequiresUnsafe {
#[track_caller]
fn decorate_lint<'__b>(self,
diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
match self {
UnsafeOpInUnsafeFnCallToFunctionWithRequiresUnsafe {
span: __binding_0,
function: __binding_1,
missing_target_features: __binding_2,
missing_target_features_count: __binding_3,
note: __binding_4,
build_target_features: __binding_5,
build_target_features_count: __binding_6,
unsafe_not_inherited_note: __binding_7 } => {
diag.primary_message(crate::fluent_generated::mir_build_unsafe_op_in_unsafe_fn_call_to_fn_with_requires_unsafe);
diag.code(E0133);
diag.help(crate::fluent_generated::_subdiag::help);
;
diag.arg("function", __binding_1);
diag.arg("missing_target_features", __binding_2);
diag.arg("missing_target_features_count", __binding_3);
diag.arg("build_target_features", __binding_5);
diag.arg("build_target_features_count", __binding_6);
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
if __binding_4 {
diag.note(crate::fluent_generated::_subdiag::note);
}
if let Some(__binding_7) = __binding_7 {
diag.subdiagnostic(__binding_7);
}
diag
}
};
}
}
};LintDiagnostic)]
176#[diag(mir_build_unsafe_op_in_unsafe_fn_call_to_fn_with_requires_unsafe, code = E0133)]
177#[help]
178pub(crate) struct UnsafeOpInUnsafeFnCallToFunctionWithRequiresUnsafe {
179 #[label]
180 pub(crate) span: Span,
181 pub(crate) function: String,
182 pub(crate) missing_target_features: DiagArgValue,
183 pub(crate) missing_target_features_count: usize,
184 #[note]
185 pub(crate) note: bool,
186 pub(crate) build_target_features: DiagArgValue,
187 pub(crate) build_target_features_count: usize,
188 #[subdiagnostic]
189 pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedLintNote>,
190}
191
192#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
CallToUnsafeFunctionRequiresUnsafe 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 {
CallToUnsafeFunctionRequiresUnsafe {
span: __binding_0,
function: __binding_1,
unsafe_not_inherited_note: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_call_to_unsafe_fn_requires_unsafe);
diag.code(E0133);
diag.note(crate::fluent_generated::_subdiag::note);
;
diag.arg("function", __binding_1);
diag.span(__binding_0);
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
if let Some(__binding_2) = __binding_2 {
diag.subdiagnostic(__binding_2);
}
diag
}
}
}
}
};Diagnostic)]
193#[diag(mir_build_call_to_unsafe_fn_requires_unsafe, code = E0133)]
194#[note]
195pub(crate) struct CallToUnsafeFunctionRequiresUnsafe {
196 #[primary_span]
197 #[label]
198 pub(crate) span: Span,
199 pub(crate) function: String,
200 #[subdiagnostic]
201 pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
202}
203
204#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
CallToUnsafeFunctionRequiresUnsafeNameless 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 {
CallToUnsafeFunctionRequiresUnsafeNameless {
span: __binding_0, unsafe_not_inherited_note: __binding_1 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_call_to_unsafe_fn_requires_unsafe_nameless);
diag.code(E0133);
diag.note(crate::fluent_generated::_subdiag::note);
;
diag.span(__binding_0);
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
if let Some(__binding_1) = __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
}
}
}
};Diagnostic)]
205#[diag(mir_build_call_to_unsafe_fn_requires_unsafe_nameless, code = E0133)]
206#[note]
207pub(crate) struct CallToUnsafeFunctionRequiresUnsafeNameless {
208 #[primary_span]
209 #[label]
210 pub(crate) span: Span,
211 #[subdiagnostic]
212 pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
213}
214
215#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
CallToUnsafeFunctionRequiresUnsafeUnsafeOpInUnsafeFnAllowed 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 {
CallToUnsafeFunctionRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
span: __binding_0,
function: __binding_1,
unsafe_not_inherited_note: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_call_to_unsafe_fn_requires_unsafe_unsafe_op_in_unsafe_fn_allowed);
diag.code(E0133);
diag.note(crate::fluent_generated::_subdiag::note);
;
diag.arg("function", __binding_1);
diag.span(__binding_0);
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
if let Some(__binding_2) = __binding_2 {
diag.subdiagnostic(__binding_2);
}
diag
}
}
}
}
};Diagnostic)]
216#[diag(mir_build_call_to_unsafe_fn_requires_unsafe_unsafe_op_in_unsafe_fn_allowed, code = E0133)]
217#[note]
218pub(crate) struct CallToUnsafeFunctionRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
219 #[primary_span]
220 #[label]
221 pub(crate) span: Span,
222 pub(crate) function: String,
223 #[subdiagnostic]
224 pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
225}
226
227#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
CallToUnsafeFunctionRequiresUnsafeNamelessUnsafeOpInUnsafeFnAllowed
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 {
CallToUnsafeFunctionRequiresUnsafeNamelessUnsafeOpInUnsafeFnAllowed {
span: __binding_0, unsafe_not_inherited_note: __binding_1 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_call_to_unsafe_fn_requires_unsafe_nameless_unsafe_op_in_unsafe_fn_allowed);
diag.code(E0133);
diag.note(crate::fluent_generated::_subdiag::note);
;
diag.span(__binding_0);
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
if let Some(__binding_1) = __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
}
}
}
};Diagnostic)]
228#[diag(
229 mir_build_call_to_unsafe_fn_requires_unsafe_nameless_unsafe_op_in_unsafe_fn_allowed,
230 code = E0133
231)]
232#[note]
233pub(crate) struct CallToUnsafeFunctionRequiresUnsafeNamelessUnsafeOpInUnsafeFnAllowed {
234 #[primary_span]
235 #[label]
236 pub(crate) span: Span,
237 #[subdiagnostic]
238 pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
239}
240
241#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
UseOfInlineAssemblyRequiresUnsafe 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 {
UseOfInlineAssemblyRequiresUnsafe {
span: __binding_0, unsafe_not_inherited_note: __binding_1 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_inline_assembly_requires_unsafe);
diag.code(E0133);
diag.note(crate::fluent_generated::_subdiag::note);
;
diag.span(__binding_0);
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
if let Some(__binding_1) = __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
}
}
}
};Diagnostic)]
242#[diag(mir_build_inline_assembly_requires_unsafe, code = E0133)]
243#[note]
244pub(crate) struct UseOfInlineAssemblyRequiresUnsafe {
245 #[primary_span]
246 #[label]
247 pub(crate) span: Span,
248 #[subdiagnostic]
249 pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
250}
251
252#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
UseOfInlineAssemblyRequiresUnsafeUnsafeOpInUnsafeFnAllowed 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 {
UseOfInlineAssemblyRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
span: __binding_0, unsafe_not_inherited_note: __binding_1 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_inline_assembly_requires_unsafe_unsafe_op_in_unsafe_fn_allowed);
diag.code(E0133);
diag.note(crate::fluent_generated::_subdiag::note);
;
diag.span(__binding_0);
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
if let Some(__binding_1) = __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
}
}
}
};Diagnostic)]
253#[diag(mir_build_inline_assembly_requires_unsafe_unsafe_op_in_unsafe_fn_allowed, code = E0133)]
254#[note]
255pub(crate) struct UseOfInlineAssemblyRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
256 #[primary_span]
257 #[label]
258 pub(crate) span: Span,
259 #[subdiagnostic]
260 pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
261}
262
263#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
InitializingTypeWithRequiresUnsafe 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 {
InitializingTypeWithRequiresUnsafe {
span: __binding_0, unsafe_not_inherited_note: __binding_1 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_initializing_type_with_requires_unsafe);
diag.code(E0133);
diag.note(crate::fluent_generated::_subdiag::note);
;
diag.span(__binding_0);
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
if let Some(__binding_1) = __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
}
}
}
};Diagnostic)]
264#[diag(mir_build_initializing_type_with_requires_unsafe, code = E0133)]
265#[note]
266pub(crate) struct InitializingTypeWithRequiresUnsafe {
267 #[primary_span]
268 #[label]
269 pub(crate) span: Span,
270 #[subdiagnostic]
271 pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
272}
273
274#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
InitializingTypeWithUnsafeFieldRequiresUnsafe 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 {
InitializingTypeWithUnsafeFieldRequiresUnsafe {
span: __binding_0, unsafe_not_inherited_note: __binding_1 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_initializing_type_with_unsafe_field_requires_unsafe);
diag.code(E0133);
diag.note(crate::fluent_generated::_subdiag::note);
;
diag.span(__binding_0);
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
if let Some(__binding_1) = __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
}
}
}
};Diagnostic)]
275#[diag(mir_build_initializing_type_with_unsafe_field_requires_unsafe, code = E0133)]
276#[note]
277pub(crate) struct InitializingTypeWithUnsafeFieldRequiresUnsafe {
278 #[primary_span]
279 #[label]
280 pub(crate) span: Span,
281 #[subdiagnostic]
282 pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
283}
284
285#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
InitializingTypeWithRequiresUnsafeUnsafeOpInUnsafeFnAllowed 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 {
InitializingTypeWithRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
span: __binding_0, unsafe_not_inherited_note: __binding_1 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_initializing_type_with_requires_unsafe_unsafe_op_in_unsafe_fn_allowed);
diag.code(E0133);
diag.note(crate::fluent_generated::_subdiag::note);
;
diag.span(__binding_0);
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
if let Some(__binding_1) = __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
}
}
}
};Diagnostic)]
286#[diag(
287 mir_build_initializing_type_with_requires_unsafe_unsafe_op_in_unsafe_fn_allowed,
288 code = E0133
289)]
290#[note]
291pub(crate) struct InitializingTypeWithRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
292 #[primary_span]
293 #[label]
294 pub(crate) span: Span,
295 #[subdiagnostic]
296 pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
297}
298
299#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
InitializingTypeWithUnsafeFieldRequiresUnsafeUnsafeOpInUnsafeFnAllowed
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 {
InitializingTypeWithUnsafeFieldRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
span: __binding_0, unsafe_not_inherited_note: __binding_1 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_initializing_type_with_unsafe_field_requires_unsafe_unsafe_op_in_unsafe_fn_allowed);
diag.code(E0133);
diag.note(crate::fluent_generated::_subdiag::note);
;
diag.span(__binding_0);
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
if let Some(__binding_1) = __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
}
}
}
};Diagnostic)]
300#[diag(
301 mir_build_initializing_type_with_unsafe_field_requires_unsafe_unsafe_op_in_unsafe_fn_allowed,
302 code = E0133
303)]
304#[note]
305pub(crate) struct InitializingTypeWithUnsafeFieldRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
306 #[primary_span]
307 #[label]
308 pub(crate) span: Span,
309 #[subdiagnostic]
310 pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
311}
312
313#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
UseOfMutableStaticRequiresUnsafe 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 {
UseOfMutableStaticRequiresUnsafe {
span: __binding_0, unsafe_not_inherited_note: __binding_1 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_mutable_static_requires_unsafe);
diag.code(E0133);
diag.note(crate::fluent_generated::_subdiag::note);
;
diag.span(__binding_0);
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
if let Some(__binding_1) = __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
}
}
}
};Diagnostic)]
314#[diag(mir_build_mutable_static_requires_unsafe, code = E0133)]
315#[note]
316pub(crate) struct UseOfMutableStaticRequiresUnsafe {
317 #[primary_span]
318 #[label]
319 pub(crate) span: Span,
320 #[subdiagnostic]
321 pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
322}
323
324#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
UseOfMutableStaticRequiresUnsafeUnsafeOpInUnsafeFnAllowed 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 {
UseOfMutableStaticRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
span: __binding_0, unsafe_not_inherited_note: __binding_1 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_mutable_static_requires_unsafe_unsafe_op_in_unsafe_fn_allowed);
diag.code(E0133);
diag.note(crate::fluent_generated::_subdiag::note);
;
diag.span(__binding_0);
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
if let Some(__binding_1) = __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
}
}
}
};Diagnostic)]
325#[diag(mir_build_mutable_static_requires_unsafe_unsafe_op_in_unsafe_fn_allowed, code = E0133)]
326#[note]
327pub(crate) struct UseOfMutableStaticRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
328 #[primary_span]
329 #[label]
330 pub(crate) span: Span,
331 #[subdiagnostic]
332 pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
333}
334
335#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
UseOfExternStaticRequiresUnsafe 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 {
UseOfExternStaticRequiresUnsafe {
span: __binding_0, unsafe_not_inherited_note: __binding_1 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_extern_static_requires_unsafe);
diag.code(E0133);
diag.note(crate::fluent_generated::_subdiag::note);
;
diag.span(__binding_0);
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
if let Some(__binding_1) = __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
}
}
}
};Diagnostic)]
336#[diag(mir_build_extern_static_requires_unsafe, code = E0133)]
337#[note]
338pub(crate) struct UseOfExternStaticRequiresUnsafe {
339 #[primary_span]
340 #[label]
341 pub(crate) span: Span,
342 #[subdiagnostic]
343 pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
344}
345
346#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
UseOfExternStaticRequiresUnsafeUnsafeOpInUnsafeFnAllowed 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 {
UseOfExternStaticRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
span: __binding_0, unsafe_not_inherited_note: __binding_1 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_extern_static_requires_unsafe_unsafe_op_in_unsafe_fn_allowed);
diag.code(E0133);
diag.note(crate::fluent_generated::_subdiag::note);
;
diag.span(__binding_0);
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
if let Some(__binding_1) = __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
}
}
}
};Diagnostic)]
347#[diag(mir_build_extern_static_requires_unsafe_unsafe_op_in_unsafe_fn_allowed, code = E0133)]
348#[note]
349pub(crate) struct UseOfExternStaticRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
350 #[primary_span]
351 #[label]
352 pub(crate) span: Span,
353 #[subdiagnostic]
354 pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
355}
356
357#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
UseOfUnsafeFieldRequiresUnsafe 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 {
UseOfUnsafeFieldRequiresUnsafe {
span: __binding_0, unsafe_not_inherited_note: __binding_1 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_unsafe_field_requires_unsafe);
diag.code(E0133);
diag.note(crate::fluent_generated::_subdiag::note);
;
diag.span(__binding_0);
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
if let Some(__binding_1) = __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
}
}
}
};Diagnostic)]
358#[diag(mir_build_unsafe_field_requires_unsafe, code = E0133)]
359#[note]
360pub(crate) struct UseOfUnsafeFieldRequiresUnsafe {
361 #[primary_span]
362 #[label]
363 pub(crate) span: Span,
364 #[subdiagnostic]
365 pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
366}
367
368#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
UseOfUnsafeFieldRequiresUnsafeUnsafeOpInUnsafeFnAllowed 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 {
UseOfUnsafeFieldRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
span: __binding_0, unsafe_not_inherited_note: __binding_1 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_unsafe_field_requires_unsafe_unsafe_op_in_unsafe_fn_allowed);
diag.code(E0133);
diag.note(crate::fluent_generated::_subdiag::note);
;
diag.span(__binding_0);
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
if let Some(__binding_1) = __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
}
}
}
};Diagnostic)]
369#[diag(mir_build_unsafe_field_requires_unsafe_unsafe_op_in_unsafe_fn_allowed, code = E0133)]
370#[note]
371pub(crate) struct UseOfUnsafeFieldRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
372 #[primary_span]
373 #[label]
374 pub(crate) span: Span,
375 #[subdiagnostic]
376 pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
377}
378
379#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
DerefOfRawPointerRequiresUnsafe 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 {
DerefOfRawPointerRequiresUnsafe {
span: __binding_0, unsafe_not_inherited_note: __binding_1 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_deref_raw_pointer_requires_unsafe);
diag.code(E0133);
diag.note(crate::fluent_generated::_subdiag::note);
;
diag.span(__binding_0);
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
if let Some(__binding_1) = __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
}
}
}
};Diagnostic)]
380#[diag(mir_build_deref_raw_pointer_requires_unsafe, code = E0133)]
381#[note]
382pub(crate) struct DerefOfRawPointerRequiresUnsafe {
383 #[primary_span]
384 #[label]
385 pub(crate) span: Span,
386 #[subdiagnostic]
387 pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
388}
389
390#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
DerefOfRawPointerRequiresUnsafeUnsafeOpInUnsafeFnAllowed 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 {
DerefOfRawPointerRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
span: __binding_0, unsafe_not_inherited_note: __binding_1 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_deref_raw_pointer_requires_unsafe_unsafe_op_in_unsafe_fn_allowed);
diag.code(E0133);
diag.note(crate::fluent_generated::_subdiag::note);
;
diag.span(__binding_0);
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
if let Some(__binding_1) = __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
}
}
}
};Diagnostic)]
391#[diag(mir_build_deref_raw_pointer_requires_unsafe_unsafe_op_in_unsafe_fn_allowed, code = E0133)]
392#[note]
393pub(crate) struct DerefOfRawPointerRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
394 #[primary_span]
395 #[label]
396 pub(crate) span: Span,
397 #[subdiagnostic]
398 pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
399}
400
401#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
AccessToUnionFieldRequiresUnsafe 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 {
AccessToUnionFieldRequiresUnsafe {
span: __binding_0, unsafe_not_inherited_note: __binding_1 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_union_field_requires_unsafe);
diag.code(E0133);
diag.note(crate::fluent_generated::_subdiag::note);
;
diag.span(__binding_0);
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
if let Some(__binding_1) = __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
}
}
}
};Diagnostic)]
402#[diag(mir_build_union_field_requires_unsafe, code = E0133)]
403#[note]
404pub(crate) struct AccessToUnionFieldRequiresUnsafe {
405 #[primary_span]
406 #[label]
407 pub(crate) span: Span,
408 #[subdiagnostic]
409 pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
410}
411
412#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
AccessToUnionFieldRequiresUnsafeUnsafeOpInUnsafeFnAllowed 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 {
AccessToUnionFieldRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
span: __binding_0, unsafe_not_inherited_note: __binding_1 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_union_field_requires_unsafe_unsafe_op_in_unsafe_fn_allowed);
diag.code(E0133);
diag.note(crate::fluent_generated::_subdiag::note);
;
diag.span(__binding_0);
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
if let Some(__binding_1) = __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
}
}
}
};Diagnostic)]
413#[diag(mir_build_union_field_requires_unsafe_unsafe_op_in_unsafe_fn_allowed, code = E0133)]
414#[note]
415pub(crate) struct AccessToUnionFieldRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
416 #[primary_span]
417 #[label]
418 pub(crate) span: Span,
419 #[subdiagnostic]
420 pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
421}
422
423#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
MutationOfLayoutConstrainedFieldRequiresUnsafe 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 {
MutationOfLayoutConstrainedFieldRequiresUnsafe {
span: __binding_0, unsafe_not_inherited_note: __binding_1 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_mutation_of_layout_constrained_field_requires_unsafe);
diag.code(E0133);
diag.note(crate::fluent_generated::_subdiag::note);
;
diag.span(__binding_0);
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
if let Some(__binding_1) = __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
}
}
}
};Diagnostic)]
424#[diag(mir_build_mutation_of_layout_constrained_field_requires_unsafe, code = E0133)]
425#[note]
426pub(crate) struct MutationOfLayoutConstrainedFieldRequiresUnsafe {
427 #[primary_span]
428 #[label]
429 pub(crate) span: Span,
430 #[subdiagnostic]
431 pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
432}
433
434#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
MutationOfLayoutConstrainedFieldRequiresUnsafeUnsafeOpInUnsafeFnAllowed
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 {
MutationOfLayoutConstrainedFieldRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
span: __binding_0, unsafe_not_inherited_note: __binding_1 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_mutation_of_layout_constrained_field_requires_unsafe_unsafe_op_in_unsafe_fn_allowed);
diag.code(E0133);
diag.note(crate::fluent_generated::_subdiag::note);
;
diag.span(__binding_0);
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
if let Some(__binding_1) = __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
}
}
}
};Diagnostic)]
435#[diag(
436 mir_build_mutation_of_layout_constrained_field_requires_unsafe_unsafe_op_in_unsafe_fn_allowed,
437 code = E0133
438)]
439#[note]
440pub(crate) struct MutationOfLayoutConstrainedFieldRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
441 #[primary_span]
442 #[label]
443 pub(crate) span: Span,
444 #[subdiagnostic]
445 pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
446}
447
448#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
BorrowOfLayoutConstrainedFieldRequiresUnsafe 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 {
BorrowOfLayoutConstrainedFieldRequiresUnsafe {
span: __binding_0, unsafe_not_inherited_note: __binding_1 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_borrow_of_layout_constrained_field_requires_unsafe);
diag.code(E0133);
diag.note(crate::fluent_generated::_subdiag::note);
;
diag.span(__binding_0);
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
if let Some(__binding_1) = __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
}
}
}
};Diagnostic)]
449#[diag(mir_build_borrow_of_layout_constrained_field_requires_unsafe, code = E0133)]
450#[note]
451pub(crate) struct BorrowOfLayoutConstrainedFieldRequiresUnsafe {
452 #[primary_span]
453 #[label]
454 pub(crate) span: Span,
455 #[subdiagnostic]
456 pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
457}
458
459#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
BorrowOfLayoutConstrainedFieldRequiresUnsafeUnsafeOpInUnsafeFnAllowed
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 {
BorrowOfLayoutConstrainedFieldRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
span: __binding_0, unsafe_not_inherited_note: __binding_1 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_borrow_of_layout_constrained_field_requires_unsafe_unsafe_op_in_unsafe_fn_allowed);
diag.code(E0133);
diag.note(crate::fluent_generated::_subdiag::note);
;
diag.span(__binding_0);
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
if let Some(__binding_1) = __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
}
}
}
};Diagnostic)]
460#[diag(
461 mir_build_borrow_of_layout_constrained_field_requires_unsafe_unsafe_op_in_unsafe_fn_allowed,
462 code = E0133
463)]
464#[note]
465pub(crate) struct BorrowOfLayoutConstrainedFieldRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
466 #[primary_span]
467 #[label]
468 pub(crate) span: Span,
469 #[subdiagnostic]
470 pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
471}
472
473#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
CallToFunctionWithRequiresUnsafe 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 {
CallToFunctionWithRequiresUnsafe {
span: __binding_0,
function: __binding_1,
missing_target_features: __binding_2,
missing_target_features_count: __binding_3,
note: __binding_4,
build_target_features: __binding_5,
build_target_features_count: __binding_6,
unsafe_not_inherited_note: __binding_7 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_call_to_fn_with_requires_unsafe);
diag.code(E0133);
diag.help(crate::fluent_generated::_subdiag::help);
;
diag.arg("function", __binding_1);
diag.arg("missing_target_features", __binding_2);
diag.arg("missing_target_features_count", __binding_3);
diag.arg("build_target_features", __binding_5);
diag.arg("build_target_features_count", __binding_6);
diag.span(__binding_0);
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
if __binding_4 {
diag.note(crate::fluent_generated::_subdiag::note);
}
if let Some(__binding_7) = __binding_7 {
diag.subdiagnostic(__binding_7);
}
diag
}
}
}
}
};Diagnostic)]
474#[diag(mir_build_call_to_fn_with_requires_unsafe, code = E0133)]
475#[help]
476pub(crate) struct CallToFunctionWithRequiresUnsafe {
477 #[primary_span]
478 #[label]
479 pub(crate) span: Span,
480 pub(crate) function: String,
481 pub(crate) missing_target_features: DiagArgValue,
482 pub(crate) missing_target_features_count: usize,
483 #[note]
484 pub(crate) note: bool,
485 pub(crate) build_target_features: DiagArgValue,
486 pub(crate) build_target_features_count: usize,
487 #[subdiagnostic]
488 pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
489}
490
491#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
CallToFunctionWithRequiresUnsafeUnsafeOpInUnsafeFnAllowed 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 {
CallToFunctionWithRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
span: __binding_0,
function: __binding_1,
missing_target_features: __binding_2,
missing_target_features_count: __binding_3,
note: __binding_4,
build_target_features: __binding_5,
build_target_features_count: __binding_6,
unsafe_not_inherited_note: __binding_7 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_call_to_fn_with_requires_unsafe_unsafe_op_in_unsafe_fn_allowed);
diag.code(E0133);
diag.help(crate::fluent_generated::_subdiag::help);
;
diag.arg("function", __binding_1);
diag.arg("missing_target_features", __binding_2);
diag.arg("missing_target_features_count", __binding_3);
diag.arg("build_target_features", __binding_5);
diag.arg("build_target_features_count", __binding_6);
diag.span(__binding_0);
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
if __binding_4 {
diag.note(crate::fluent_generated::_subdiag::note);
}
if let Some(__binding_7) = __binding_7 {
diag.subdiagnostic(__binding_7);
}
diag
}
}
}
}
};Diagnostic)]
492#[diag(mir_build_call_to_fn_with_requires_unsafe_unsafe_op_in_unsafe_fn_allowed, code = E0133)]
493#[help]
494pub(crate) struct CallToFunctionWithRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
495 #[primary_span]
496 #[label]
497 pub(crate) span: Span,
498 pub(crate) function: String,
499 pub(crate) missing_target_features: DiagArgValue,
500 pub(crate) missing_target_features_count: usize,
501 #[note]
502 pub(crate) note: bool,
503 pub(crate) build_target_features: DiagArgValue,
504 pub(crate) build_target_features_count: usize,
505 #[subdiagnostic]
506 pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
507}
508
509#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
UnsafeBinderCastRequiresUnsafe 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 {
UnsafeBinderCastRequiresUnsafe {
span: __binding_0, unsafe_not_inherited_note: __binding_1 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_unsafe_binder_cast_requires_unsafe);
diag.code(E0133);
;
diag.span(__binding_0);
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
if let Some(__binding_1) = __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
}
}
}
};Diagnostic)]
510#[diag(
511 mir_build_unsafe_binder_cast_requires_unsafe,
512 code = E0133,
513)]
514pub(crate) struct UnsafeBinderCastRequiresUnsafe {
515 #[primary_span]
516 #[label]
517 pub(crate) span: Span,
518 #[subdiagnostic]
519 pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
520}
521
522#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
UnsafeBinderCastRequiresUnsafeUnsafeOpInUnsafeFnAllowed 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 {
UnsafeBinderCastRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
span: __binding_0, unsafe_not_inherited_note: __binding_1 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_unsafe_binder_cast_requires_unsafe_unsafe_op_in_unsafe_fn_allowed);
diag.code(E0133);
;
diag.span(__binding_0);
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
if let Some(__binding_1) = __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
}
}
}
};Diagnostic)]
523#[diag(
524 mir_build_unsafe_binder_cast_requires_unsafe_unsafe_op_in_unsafe_fn_allowed,
525 code = E0133,
526)]
527pub(crate) struct UnsafeBinderCastRequiresUnsafeUnsafeOpInUnsafeFnAllowed {
528 #[primary_span]
529 #[label]
530 pub(crate) span: Span,
531 #[subdiagnostic]
532 pub(crate) unsafe_not_inherited_note: Option<UnsafeNotInheritedNote>,
533}
534
535#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for UnsafeNotInheritedNote {
fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
where __G: rustc_errors::EmissionGuarantee {
match self {
UnsafeNotInheritedNote { span: __binding_0 } => {
diag.store_args();
let __message =
diag.eagerly_translate(crate::fluent_generated::mir_build_unsafe_not_inherited);
diag.span_label(__binding_0, __message);
diag.restore_args();
}
}
}
}
};Subdiagnostic)]
536#[label(mir_build_unsafe_not_inherited)]
537pub(crate) struct UnsafeNotInheritedNote {
538 #[primary_span]
539 pub(crate) span: Span,
540}
541
542pub(crate) struct UnsafeNotInheritedLintNote {
543 pub(crate) signature_span: Span,
544 pub(crate) body_span: Span,
545}
546
547impl Subdiagnostic for UnsafeNotInheritedLintNote {
548 fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
549 diag.span_note(self.signature_span, fluent::mir_build_unsafe_fn_safe_body);
550 let body_start = self.body_span.shrink_to_lo();
551 let body_end = self.body_span.shrink_to_hi();
552 diag.tool_only_multipart_suggestion(
553 fluent::mir_build_wrap_suggestion,
554 <[_]>::into_vec(::alloc::boxed::box_new([(body_start, "{ unsafe ".into()),
(body_end, "}".into())]))vec![(body_start, "{ unsafe ".into()), (body_end, "}".into())],
555 Applicability::MachineApplicable,
556 );
557 }
558}
559
560#[derive(const _: () =
{
impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for UnusedUnsafe {
#[track_caller]
fn decorate_lint<'__b>(self,
diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
match self {
UnusedUnsafe { span: __binding_0, enclosing: __binding_1 }
=> {
diag.primary_message(crate::fluent_generated::mir_build_unused_unsafe);
;
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
if let Some(__binding_1) = __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
};
}
}
};LintDiagnostic)]
561#[diag(mir_build_unused_unsafe)]
562pub(crate) struct UnusedUnsafe {
563 #[label]
564 pub(crate) span: Span,
565 #[subdiagnostic]
566 pub(crate) enclosing: Option<UnusedUnsafeEnclosing>,
567}
568
569#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for UnusedUnsafeEnclosing {
fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
where __G: rustc_errors::EmissionGuarantee {
match self {
UnusedUnsafeEnclosing::Block { span: __binding_0 } => {
diag.store_args();
let __message =
diag.eagerly_translate(crate::fluent_generated::mir_build_unused_unsafe_enclosing_block_label);
diag.span_label(__binding_0, __message);
diag.restore_args();
}
}
}
}
};Subdiagnostic)]
570pub(crate) enum UnusedUnsafeEnclosing {
571 #[label(mir_build_unused_unsafe_enclosing_block_label)]
572 Block {
573 #[primary_span]
574 span: Span,
575 },
576}
577
578pub(crate) struct NonExhaustivePatternsTypeNotEmpty<'p, 'tcx, 'm> {
579 pub(crate) cx: &'m RustcPatCtxt<'p, 'tcx>,
580 pub(crate) scrut_span: Span,
581 pub(crate) braces_span: Option<Span>,
582 pub(crate) ty: Ty<'tcx>,
583}
584
585impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for NonExhaustivePatternsTypeNotEmpty<'_, '_, '_> {
586 fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, G> {
587 let mut diag =
588 Diag::new(dcx, level, fluent::mir_build_non_exhaustive_patterns_type_not_empty);
589 diag.span(self.scrut_span);
590 diag.code(E0004);
591 let peeled_ty = self.ty.peel_refs();
592 diag.arg("ty", self.ty);
593 diag.arg("peeled_ty", peeled_ty);
594
595 if let ty::Adt(def, _) = peeled_ty.kind() {
596 let def_span = self
597 .cx
598 .tcx
599 .hir_get_if_local(def.did())
600 .and_then(|node| node.ident())
601 .map(|ident| ident.span)
602 .unwrap_or_else(|| self.cx.tcx.def_span(def.did()));
603
604 let mut span: MultiSpan = def_span.into();
606 span.push_span_label(def_span, "");
607
608 diag.span_note(span, fluent::mir_build_def_note);
609 }
610
611 let is_non_exhaustive = #[allow(non_exhaustive_omitted_patterns)] match self.ty.kind() {
ty::Adt(def, _) if def.variant_list_has_applicable_non_exhaustive() =>
true,
_ => false,
}matches!(self.ty.kind(),
612 ty::Adt(def, _) if def.variant_list_has_applicable_non_exhaustive());
613 if is_non_exhaustive {
614 diag.note(fluent::mir_build_non_exhaustive_type_note);
615 } else {
616 diag.note(fluent::mir_build_type_note);
617 }
618
619 if let ty::Ref(_, sub_ty, _) = self.ty.kind() {
620 if !sub_ty.is_inhabited_from(self.cx.tcx, self.cx.module, self.cx.typing_env) {
621 diag.note(fluent::mir_build_reference_note);
622 }
623 }
624
625 let sm = self.cx.tcx.sess.source_map();
626 if let Some(braces_span) = self.braces_span {
627 let (indentation, more) = if let Some(snippet) = sm.indentation_before(self.scrut_span)
629 {
630 (::alloc::__export::must_use({
::alloc::fmt::format(format_args!("\n{0}", snippet))
})format!("\n{snippet}"), " ")
631 } else {
632 (" ".to_string(), "")
633 };
634 diag.span_suggestion_verbose(
635 braces_span,
636 fluent::mir_build_suggestion,
637 ::alloc::__export::must_use({
::alloc::fmt::format(format_args!(" {{{0}{1}_ => todo!(),{0}}}",
indentation, more))
})format!(" {{{indentation}{more}_ => todo!(),{indentation}}}"),
638 Applicability::HasPlaceholders,
639 );
640 } else {
641 diag.help(fluent::mir_build_help);
642 }
643
644 diag
645 }
646}
647
648#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for NonExhaustiveMatchAllArmsGuarded
{
fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
where __G: rustc_errors::EmissionGuarantee {
match self {
NonExhaustiveMatchAllArmsGuarded => {
diag.store_args();
let __message =
diag.eagerly_translate(crate::fluent_generated::mir_build_non_exhaustive_match_all_arms_guarded);
diag.note(__message);
diag.restore_args();
}
}
}
}
};Subdiagnostic)]
649#[note(mir_build_non_exhaustive_match_all_arms_guarded)]
650pub(crate) struct NonExhaustiveMatchAllArmsGuarded;
651
652#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
StaticInPattern 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 {
StaticInPattern {
span: __binding_0, static_span: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_static_in_pattern);
diag.code(E0158);
;
diag.span(__binding_0);
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
diag.span_label(__binding_1,
crate::fluent_generated::mir_build_static_in_pattern_def);
diag
}
}
}
}
};Diagnostic)]
653#[diag(mir_build_static_in_pattern, code = E0158)]
654pub(crate) struct StaticInPattern {
655 #[primary_span]
656 #[label]
657 pub(crate) span: Span,
658 #[label(mir_build_static_in_pattern_def)]
659 pub(crate) static_span: Span,
660}
661
662#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
ConstParamInPattern 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 {
ConstParamInPattern {
span: __binding_0, const_span: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_const_param_in_pattern);
diag.code(E0158);
;
diag.span(__binding_0);
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
diag.span_label(__binding_1,
crate::fluent_generated::mir_build_const_param_in_pattern_def);
diag
}
}
}
}
};Diagnostic)]
663#[diag(mir_build_const_param_in_pattern, code = E0158)]
664pub(crate) struct ConstParamInPattern {
665 #[primary_span]
666 #[label]
667 pub(crate) span: Span,
668 #[label(mir_build_const_param_in_pattern_def)]
669 pub(crate) const_span: Span,
670}
671
672#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for NonConstPath
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 {
NonConstPath { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_non_const_path);
diag.code(E0080);
;
diag.span(__binding_0);
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
diag
}
}
}
}
};Diagnostic)]
673#[diag(mir_build_non_const_path, code = E0080)]
674pub(crate) struct NonConstPath {
675 #[primary_span]
676 #[label]
677 pub(crate) span: Span,
678}
679
680#[derive(const _: () =
{
impl<'__a, 'tcx> rustc_errors::LintDiagnostic<'__a, ()> for
UnreachablePattern<'tcx> {
#[track_caller]
fn decorate_lint<'__b>(self,
diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
match self {
UnreachablePattern {
span: __binding_0,
matches_no_values: __binding_1,
matches_no_values_ty: __binding_2,
uninhabited_note: __binding_3,
covered_by_catchall: __binding_4,
wanted_constant: __binding_5,
accessible_constant: __binding_6,
inaccessible_constant: __binding_7,
pattern_let_binding: __binding_8,
covered_by_one: __binding_9,
covered_by_many: __binding_10,
covered_by_many_n_more_count: __binding_11,
suggest_remove: __binding_12 } => {
diag.primary_message(crate::fluent_generated::mir_build_unreachable_pattern);
;
let __code_3 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!(""))
})].into_iter();
diag.arg("matches_no_values_ty", __binding_2);
diag.arg("covered_by_many_n_more_count", __binding_11);
if let Some(__binding_0) = __binding_0 {
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
}
if let Some(__binding_1) = __binding_1 {
diag.span_label(__binding_1,
crate::fluent_generated::mir_build_unreachable_matches_no_values);
}
if let Some(__binding_3) = __binding_3 {
diag.note(crate::fluent_generated::mir_build_unreachable_uninhabited_note);
}
if let Some(__binding_4) = __binding_4 {
diag.span_label(__binding_4,
crate::fluent_generated::mir_build_unreachable_covered_by_catchall);
}
if let Some(__binding_5) = __binding_5 {
diag.subdiagnostic(__binding_5);
}
if let Some(__binding_6) = __binding_6 {
diag.span_note(__binding_6,
crate::fluent_generated::mir_build_unreachable_pattern_const_reexport_accessible);
}
if let Some(__binding_7) = __binding_7 {
diag.span_note(__binding_7,
crate::fluent_generated::mir_build_unreachable_pattern_const_inaccessible);
}
if let Some(__binding_8) = __binding_8 {
diag.span_note(__binding_8,
crate::fluent_generated::mir_build_unreachable_pattern_let_binding);
}
if let Some(__binding_9) = __binding_9 {
diag.span_label(__binding_9,
crate::fluent_generated::mir_build_unreachable_covered_by_one);
}
if let Some(__binding_10) = __binding_10 {
diag.span_note(__binding_10,
crate::fluent_generated::mir_build_unreachable_covered_by_many);
}
if let Some(__binding_12) = __binding_12 {
diag.span_suggestions_with_style(__binding_12,
crate::fluent_generated::_subdiag::suggestion, __code_3,
rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowCode);
}
diag
}
};
}
}
};LintDiagnostic)]
681#[diag(mir_build_unreachable_pattern)]
682pub(crate) struct UnreachablePattern<'tcx> {
683 #[label]
684 pub(crate) span: Option<Span>,
685 #[label(mir_build_unreachable_matches_no_values)]
686 pub(crate) matches_no_values: Option<Span>,
687 pub(crate) matches_no_values_ty: Ty<'tcx>,
688 #[note(mir_build_unreachable_uninhabited_note)]
689 pub(crate) uninhabited_note: Option<()>,
690 #[label(mir_build_unreachable_covered_by_catchall)]
691 pub(crate) covered_by_catchall: Option<Span>,
692 #[subdiagnostic]
693 pub(crate) wanted_constant: Option<WantedConstant>,
694 #[note(mir_build_unreachable_pattern_const_reexport_accessible)]
695 pub(crate) accessible_constant: Option<Span>,
696 #[note(mir_build_unreachable_pattern_const_inaccessible)]
697 pub(crate) inaccessible_constant: Option<Span>,
698 #[note(mir_build_unreachable_pattern_let_binding)]
699 pub(crate) pattern_let_binding: Option<Span>,
700 #[label(mir_build_unreachable_covered_by_one)]
701 pub(crate) covered_by_one: Option<Span>,
702 #[note(mir_build_unreachable_covered_by_many)]
703 pub(crate) covered_by_many: Option<MultiSpan>,
704 pub(crate) covered_by_many_n_more_count: usize,
705 #[suggestion(code = "", applicability = "machine-applicable")]
706 pub(crate) suggest_remove: Option<Span>,
707}
708
709#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for WantedConstant {
fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
where __G: rustc_errors::EmissionGuarantee {
match self {
WantedConstant {
span: __binding_0,
is_typo: __binding_1,
const_name: __binding_2,
const_path: __binding_3 } => {
let __code_4 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0}", __binding_3))
})].into_iter();
diag.store_args();
diag.arg("is_typo", __binding_1);
diag.arg("const_name", __binding_2);
diag.arg("const_path", __binding_3);
let __message =
diag.eagerly_translate(crate::fluent_generated::mir_build_unreachable_pattern_wanted_const);
diag.span_suggestions_with_style(__binding_0, __message,
__code_4, rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowCode);
diag.restore_args();
}
}
}
}
};Subdiagnostic)]
710#[suggestion(
711 mir_build_unreachable_pattern_wanted_const,
712 code = "{const_path}",
713 applicability = "machine-applicable"
714)]
715pub(crate) struct WantedConstant {
716 #[primary_span]
717 pub(crate) span: Span,
718 pub(crate) is_typo: bool,
719 pub(crate) const_name: String,
720 pub(crate) const_path: String,
721}
722
723#[derive(const _: () =
{
impl<'__a, 'desc, 'tcx> rustc_errors::LintDiagnostic<'__a, ()> for
UnreachableDueToUninhabited<'desc, 'tcx> {
#[track_caller]
fn decorate_lint<'__b>(self,
diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
match self {
UnreachableDueToUninhabited {
descr: __binding_0,
expr: __binding_1,
orig: __binding_2,
ty: __binding_3 } => {
diag.primary_message(crate::fluent_generated::mir_build_unreachable_due_to_uninhabited);
;
diag.arg("descr", __binding_0);
diag.arg("ty", __binding_3);
diag.span_label(__binding_1,
crate::fluent_generated::_subdiag::label);
diag.span_label(__binding_2,
crate::fluent_generated::mir_build_label_orig);
diag.span_note(__binding_2,
crate::fluent_generated::_subdiag::note);
diag
}
};
}
}
};LintDiagnostic)]
724#[diag(mir_build_unreachable_due_to_uninhabited)]
725pub(crate) struct UnreachableDueToUninhabited<'desc, 'tcx> {
726 pub descr: &'desc str,
727 #[label]
728 pub expr: Span,
729 #[label(mir_build_label_orig)]
730 #[note]
731 pub orig: Span,
732 pub ty: Ty<'tcx>,
733}
734
735#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
ConstPatternDependsOnGenericParameter 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 {
ConstPatternDependsOnGenericParameter { span: __binding_0 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_const_pattern_depends_on_generic_parameter);
diag.code(E0158);
;
diag.span(__binding_0);
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
diag
}
}
}
}
};Diagnostic)]
736#[diag(mir_build_const_pattern_depends_on_generic_parameter, code = E0158)]
737pub(crate) struct ConstPatternDependsOnGenericParameter {
738 #[primary_span]
739 #[label]
740 pub(crate) span: Span,
741}
742
743#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
CouldNotEvalConstPattern 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 {
CouldNotEvalConstPattern { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_could_not_eval_const_pattern);
;
diag.span(__binding_0);
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
diag
}
}
}
}
};Diagnostic)]
744#[diag(mir_build_could_not_eval_const_pattern)]
745pub(crate) struct CouldNotEvalConstPattern {
746 #[primary_span]
747 #[label]
748 pub(crate) span: Span,
749}
750
751#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
LowerRangeBoundMustBeLessThanOrEqualToUpper 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 {
LowerRangeBoundMustBeLessThanOrEqualToUpper {
span: __binding_0, teach: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_lower_range_bound_must_be_less_than_or_equal_to_upper);
diag.code(E0030);
;
diag.span(__binding_0);
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
if __binding_1 {
diag.note(crate::fluent_generated::mir_build_teach_note);
}
diag
}
}
}
}
};Diagnostic)]
752#[diag(mir_build_lower_range_bound_must_be_less_than_or_equal_to_upper, code = E0030)]
753pub(crate) struct LowerRangeBoundMustBeLessThanOrEqualToUpper {
754 #[primary_span]
755 #[label]
756 pub(crate) span: Span,
757 #[note(mir_build_teach_note)]
758 pub(crate) teach: bool,
759}
760
761#[derive(const _: () =
{
impl<'_sess, 'tcx, G> rustc_errors::Diagnostic<'_sess, G> for
LiteralOutOfRange<'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 {
LiteralOutOfRange {
span: __binding_0,
ty: __binding_1,
min: __binding_2,
max: __binding_3 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_literal_in_range_out_of_bounds);
;
diag.arg("ty", __binding_1);
diag.arg("min", __binding_2);
diag.arg("max", __binding_3);
diag.span(__binding_0);
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
diag
}
}
}
}
};Diagnostic)]
762#[diag(mir_build_literal_in_range_out_of_bounds)]
763pub(crate) struct LiteralOutOfRange<'tcx> {
764 #[primary_span]
765 #[label]
766 pub(crate) span: Span,
767 pub(crate) ty: Ty<'tcx>,
768 pub(crate) min: i128,
769 pub(crate) max: u128,
770}
771
772#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
LowerRangeBoundMustBeLessThanUpper 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 {
LowerRangeBoundMustBeLessThanUpper { span: __binding_0 } =>
{
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_lower_range_bound_must_be_less_than_upper);
diag.code(E0579);
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
773#[diag(mir_build_lower_range_bound_must_be_less_than_upper, code = E0579)]
774pub(crate) struct LowerRangeBoundMustBeLessThanUpper {
775 #[primary_span]
776 pub(crate) span: Span,
777}
778
779#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
UpperRangeBoundCannotBeMin 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 {
UpperRangeBoundCannotBeMin { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_upper_range_bound_cannot_be_min);
diag.code(E0579);
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
780#[diag(mir_build_upper_range_bound_cannot_be_min, code = E0579)]
781pub(crate) struct UpperRangeBoundCannotBeMin {
782 #[primary_span]
783 pub(crate) span: Span,
784}
785
786#[derive(const _: () =
{
impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
LeadingIrrefutableLetPatterns {
#[track_caller]
fn decorate_lint<'__b>(self,
diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
match self {
LeadingIrrefutableLetPatterns { count: __binding_0 } => {
diag.primary_message(crate::fluent_generated::mir_build_leading_irrefutable_let_patterns);
diag.note(crate::fluent_generated::_subdiag::note);
diag.help(crate::fluent_generated::_subdiag::help);
;
diag.arg("count", __binding_0);
diag
}
};
}
}
};LintDiagnostic)]
787#[diag(mir_build_leading_irrefutable_let_patterns)]
788#[note]
789#[help]
790pub(crate) struct LeadingIrrefutableLetPatterns {
791 pub(crate) count: usize,
792}
793
794#[derive(const _: () =
{
impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
TrailingIrrefutableLetPatterns {
#[track_caller]
fn decorate_lint<'__b>(self,
diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
match self {
TrailingIrrefutableLetPatterns { count: __binding_0 } => {
diag.primary_message(crate::fluent_generated::mir_build_trailing_irrefutable_let_patterns);
diag.note(crate::fluent_generated::_subdiag::note);
diag.help(crate::fluent_generated::_subdiag::help);
;
diag.arg("count", __binding_0);
diag
}
};
}
}
};LintDiagnostic)]
795#[diag(mir_build_trailing_irrefutable_let_patterns)]
796#[note]
797#[help]
798pub(crate) struct TrailingIrrefutableLetPatterns {
799 pub(crate) count: usize,
800}
801
802#[derive(const _: () =
{
impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
BindingsWithVariantName {
#[track_caller]
fn decorate_lint<'__b>(self,
diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
match self {
BindingsWithVariantName {
suggestion: __binding_0,
ty_path: __binding_1,
name: __binding_2 } => {
diag.primary_message(crate::fluent_generated::mir_build_bindings_with_variant_name);
diag.code(E0170);
;
let __code_5 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{1}::{0}", __binding_2,
__binding_1))
})].into_iter();
diag.arg("ty_path", __binding_1);
diag.arg("name", __binding_2);
if let Some(__binding_0) = __binding_0 {
diag.span_suggestions_with_style(__binding_0,
crate::fluent_generated::_subdiag::suggestion, __code_5,
rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowCode);
}
diag
}
};
}
}
};LintDiagnostic)]
803#[diag(mir_build_bindings_with_variant_name, code = E0170)]
804pub(crate) struct BindingsWithVariantName {
805 #[suggestion(code = "{ty_path}::{name}", applicability = "machine-applicable")]
806 pub(crate) suggestion: Option<Span>,
807 pub(crate) ty_path: String,
808 pub(crate) name: Ident,
809}
810
811#[derive(const _: () =
{
impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
IrrefutableLetPatternsIfLet {
#[track_caller]
fn decorate_lint<'__b>(self,
diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
match self {
IrrefutableLetPatternsIfLet { count: __binding_0 } => {
diag.primary_message(crate::fluent_generated::mir_build_irrefutable_let_patterns_if_let);
diag.note(crate::fluent_generated::_subdiag::note);
diag.help(crate::fluent_generated::_subdiag::help);
;
diag.arg("count", __binding_0);
diag
}
};
}
}
};LintDiagnostic)]
812#[diag(mir_build_irrefutable_let_patterns_if_let)]
813#[note]
814#[help]
815pub(crate) struct IrrefutableLetPatternsIfLet {
816 pub(crate) count: usize,
817}
818
819#[derive(const _: () =
{
impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
IrrefutableLetPatternsIfLetGuard {
#[track_caller]
fn decorate_lint<'__b>(self,
diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
match self {
IrrefutableLetPatternsIfLetGuard { count: __binding_0 } => {
diag.primary_message(crate::fluent_generated::mir_build_irrefutable_let_patterns_if_let_guard);
diag.note(crate::fluent_generated::_subdiag::note);
diag.help(crate::fluent_generated::_subdiag::help);
;
diag.arg("count", __binding_0);
diag
}
};
}
}
};LintDiagnostic)]
820#[diag(mir_build_irrefutable_let_patterns_if_let_guard)]
821#[note]
822#[help]
823pub(crate) struct IrrefutableLetPatternsIfLetGuard {
824 pub(crate) count: usize,
825}
826
827#[derive(const _: () =
{
impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
IrrefutableLetPatternsLetElse {
#[track_caller]
fn decorate_lint<'__b>(self,
diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
match self {
IrrefutableLetPatternsLetElse { count: __binding_0 } => {
diag.primary_message(crate::fluent_generated::mir_build_irrefutable_let_patterns_let_else);
diag.note(crate::fluent_generated::_subdiag::note);
diag.help(crate::fluent_generated::_subdiag::help);
;
diag.arg("count", __binding_0);
diag
}
};
}
}
};LintDiagnostic)]
828#[diag(mir_build_irrefutable_let_patterns_let_else)]
829#[note]
830#[help]
831pub(crate) struct IrrefutableLetPatternsLetElse {
832 pub(crate) count: usize,
833}
834
835#[derive(const _: () =
{
impl<'__a> rustc_errors::LintDiagnostic<'__a, ()> for
IrrefutableLetPatternsWhileLet {
#[track_caller]
fn decorate_lint<'__b>(self,
diag: &'__b mut rustc_errors::Diag<'__a, ()>) {
match self {
IrrefutableLetPatternsWhileLet { count: __binding_0 } => {
diag.primary_message(crate::fluent_generated::mir_build_irrefutable_let_patterns_while_let);
diag.note(crate::fluent_generated::_subdiag::note);
diag.help(crate::fluent_generated::_subdiag::help);
;
diag.arg("count", __binding_0);
diag
}
};
}
}
};LintDiagnostic)]
836#[diag(mir_build_irrefutable_let_patterns_while_let)]
837#[note]
838#[help]
839pub(crate) struct IrrefutableLetPatternsWhileLet {
840 pub(crate) count: usize,
841}
842
843#[derive(const _: () =
{
impl<'_sess, 'tcx, G> rustc_errors::Diagnostic<'_sess, G> for
BorrowOfMovedValue<'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 {
BorrowOfMovedValue {
binding_span: __binding_0,
conflicts_ref: __binding_1,
name: __binding_2,
ty: __binding_3,
suggest_borrowing: __binding_4 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_borrow_of_moved_value);
let __code_6 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!("ref "))
})].into_iter();
;
diag.arg("name", __binding_2);
diag.arg("ty", __binding_3);
diag.span(__binding_0);
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
diag.span_label(__binding_0,
crate::fluent_generated::mir_build_occurs_because_label);
for __binding_1 in __binding_1 {
diag.span_label(__binding_1,
crate::fluent_generated::mir_build_value_borrowed_label);
}
if let Some(__binding_4) = __binding_4 {
diag.span_suggestions_with_style(__binding_4,
crate::fluent_generated::_subdiag::suggestion, __code_6,
rustc_errors::Applicability::MachineApplicable,
rustc_errors::SuggestionStyle::ShowCode);
}
diag
}
}
}
}
};Diagnostic)]
844#[diag(mir_build_borrow_of_moved_value)]
845pub(crate) struct BorrowOfMovedValue<'tcx> {
846 #[primary_span]
847 #[label]
848 #[label(mir_build_occurs_because_label)]
849 pub(crate) binding_span: Span,
850 #[label(mir_build_value_borrowed_label)]
851 pub(crate) conflicts_ref: Vec<Span>,
852 pub(crate) name: Ident,
853 pub(crate) ty: Ty<'tcx>,
854 #[suggestion(code = "ref ", applicability = "machine-applicable")]
855 pub(crate) suggest_borrowing: Option<Span>,
856}
857
858#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
MultipleMutBorrows 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 {
MultipleMutBorrows {
span: __binding_0, occurrences: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_multiple_mut_borrows);
;
diag.span(__binding_0);
for __binding_1 in __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
}
}
}
};Diagnostic)]
859#[diag(mir_build_multiple_mut_borrows)]
860pub(crate) struct MultipleMutBorrows {
861 #[primary_span]
862 pub(crate) span: Span,
863 #[subdiagnostic]
864 pub(crate) occurrences: Vec<Conflict>,
865}
866
867#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
AlreadyBorrowed 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 {
AlreadyBorrowed {
span: __binding_0, occurrences: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_already_borrowed);
;
diag.span(__binding_0);
for __binding_1 in __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
}
}
}
};Diagnostic)]
868#[diag(mir_build_already_borrowed)]
869pub(crate) struct AlreadyBorrowed {
870 #[primary_span]
871 pub(crate) span: Span,
872 #[subdiagnostic]
873 pub(crate) occurrences: Vec<Conflict>,
874}
875
876#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
AlreadyMutBorrowed 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 {
AlreadyMutBorrowed {
span: __binding_0, occurrences: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_already_mut_borrowed);
;
diag.span(__binding_0);
for __binding_1 in __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
}
}
}
};Diagnostic)]
877#[diag(mir_build_already_mut_borrowed)]
878pub(crate) struct AlreadyMutBorrowed {
879 #[primary_span]
880 pub(crate) span: Span,
881 #[subdiagnostic]
882 pub(crate) occurrences: Vec<Conflict>,
883}
884
885#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
MovedWhileBorrowed 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 {
MovedWhileBorrowed {
span: __binding_0, occurrences: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_moved_while_borrowed);
;
diag.span(__binding_0);
for __binding_1 in __binding_1 {
diag.subdiagnostic(__binding_1);
}
diag
}
}
}
}
};Diagnostic)]
886#[diag(mir_build_moved_while_borrowed)]
887pub(crate) struct MovedWhileBorrowed {
888 #[primary_span]
889 pub(crate) span: Span,
890 #[subdiagnostic]
891 pub(crate) occurrences: Vec<Conflict>,
892}
893
894#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for Conflict {
fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
where __G: rustc_errors::EmissionGuarantee {
match self {
Conflict::Mut { span: __binding_0, name: __binding_1 } => {
diag.store_args();
diag.arg("name", __binding_1);
let __message =
diag.eagerly_translate(crate::fluent_generated::mir_build_mutable_borrow);
diag.span_label(__binding_0, __message);
diag.restore_args();
}
Conflict::Ref { span: __binding_0, name: __binding_1 } => {
diag.store_args();
diag.arg("name", __binding_1);
let __message =
diag.eagerly_translate(crate::fluent_generated::mir_build_borrow);
diag.span_label(__binding_0, __message);
diag.restore_args();
}
Conflict::Moved { span: __binding_0, name: __binding_1 } =>
{
diag.store_args();
diag.arg("name", __binding_1);
let __message =
diag.eagerly_translate(crate::fluent_generated::mir_build_moved);
diag.span_label(__binding_0, __message);
diag.restore_args();
}
}
}
}
};Subdiagnostic)]
895pub(crate) enum Conflict {
896 #[label(mir_build_mutable_borrow)]
897 Mut {
898 #[primary_span]
899 span: Span,
900 name: Symbol,
901 },
902 #[label(mir_build_borrow)]
903 Ref {
904 #[primary_span]
905 span: Span,
906 name: Symbol,
907 },
908 #[label(mir_build_moved)]
909 Moved {
910 #[primary_span]
911 span: Span,
912 name: Symbol,
913 },
914}
915
916#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for UnionPattern
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 {
UnionPattern { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_union_pattern);
;
diag.span(__binding_0);
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
diag
}
}
}
}
};Diagnostic)]
917#[diag(mir_build_union_pattern)]
918pub(crate) struct UnionPattern {
919 #[primary_span]
920 #[label]
921 pub(crate) span: Span,
922}
923
924#[derive(const _: () =
{
impl<'_sess, 'tcx, G> rustc_errors::Diagnostic<'_sess, G> for
TypeNotStructural<'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 {
TypeNotStructural {
span: __binding_0,
ty_def_span: __binding_1,
ty: __binding_2,
manual_partialeq_impl_span: __binding_3,
manual_partialeq_impl_note: __binding_4 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_type_not_structural);
;
diag.arg("ty", __binding_2);
diag.span(__binding_0);
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
diag.span_label(__binding_1,
crate::fluent_generated::mir_build_type_not_structural_def);
if let Some(__binding_3) = __binding_3 {
diag.span_note(__binding_3,
crate::fluent_generated::mir_build_type_not_structural_tip);
}
if __binding_4 {
diag.note(crate::fluent_generated::mir_build_type_not_structural_more_info);
}
diag
}
}
}
}
};Diagnostic)]
925#[diag(mir_build_type_not_structural)]
926pub(crate) struct TypeNotStructural<'tcx> {
927 #[primary_span]
928 #[label]
929 pub(crate) span: Span,
930 #[label(mir_build_type_not_structural_def)]
931 pub(crate) ty_def_span: Span,
932 pub(crate) ty: Ty<'tcx>,
933 #[note(mir_build_type_not_structural_tip)]
934 pub(crate) manual_partialeq_impl_span: Option<Span>,
935 #[note(mir_build_type_not_structural_more_info)]
936 pub(crate) manual_partialeq_impl_note: bool,
937}
938
939#[derive(const _: () =
{
impl<'_sess, 'tcx, G> rustc_errors::Diagnostic<'_sess, G> for
TypeNotPartialEq<'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 {
TypeNotPartialEq { span: __binding_0, ty: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_non_partial_eq_match);
diag.note(crate::fluent_generated::mir_build_type_not_structural_more_info);
;
diag.arg("ty", __binding_1);
diag.span(__binding_0);
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
diag
}
}
}
}
};Diagnostic)]
940#[diag(mir_build_non_partial_eq_match)]
941#[note(mir_build_type_not_structural_more_info)]
942pub(crate) struct TypeNotPartialEq<'tcx> {
943 #[primary_span]
944 #[label]
945 pub(crate) span: Span,
946 pub(crate) ty: Ty<'tcx>,
947}
948
949#[derive(const _: () =
{
impl<'_sess, 'tcx, G> rustc_errors::Diagnostic<'_sess, G> for
InvalidPattern<'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 {
InvalidPattern {
span: __binding_0,
non_sm_ty: __binding_1,
prefix: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_invalid_pattern);
;
diag.arg("non_sm_ty", __binding_1);
diag.arg("prefix", __binding_2);
diag.span(__binding_0);
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
diag
}
}
}
}
};Diagnostic)]
950#[diag(mir_build_invalid_pattern)]
951pub(crate) struct InvalidPattern<'tcx> {
952 #[primary_span]
953 #[label]
954 pub(crate) span: Span,
955 pub(crate) non_sm_ty: Ty<'tcx>,
956 pub(crate) prefix: String,
957}
958
959#[derive(const _: () =
{
impl<'_sess, 'tcx, G> rustc_errors::Diagnostic<'_sess, G> for
UnsizedPattern<'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 {
UnsizedPattern { span: __binding_0, non_sm_ty: __binding_1 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_unsized_pattern);
;
diag.arg("non_sm_ty", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
960#[diag(mir_build_unsized_pattern)]
961pub(crate) struct UnsizedPattern<'tcx> {
962 #[primary_span]
963 pub(crate) span: Span,
964 pub(crate) non_sm_ty: Ty<'tcx>,
965}
966
967#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for NaNPattern
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 {
NaNPattern { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_nan_pattern);
diag.note(crate::fluent_generated::_subdiag::note);
diag.help(crate::fluent_generated::_subdiag::help);
;
diag.span(__binding_0);
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
diag
}
}
}
}
};Diagnostic)]
968#[diag(mir_build_nan_pattern)]
969#[note]
970#[help]
971pub(crate) struct NaNPattern {
972 #[primary_span]
973 #[label]
974 pub(crate) span: Span,
975}
976
977#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for PointerPattern
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 {
PointerPattern { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_pointer_pattern);
diag.note(crate::fluent_generated::_subdiag::note);
;
diag.span(__binding_0);
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
diag
}
}
}
}
};Diagnostic)]
978#[diag(mir_build_pointer_pattern)]
979#[note]
980pub(crate) struct PointerPattern {
981 #[primary_span]
982 #[label]
983 pub(crate) span: Span,
984}
985
986#[derive(const _: () =
{
impl<'_sess, 'tcx, G> rustc_errors::Diagnostic<'_sess, G> for
NonEmptyNeverPattern<'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 {
NonEmptyNeverPattern { span: __binding_0, ty: __binding_1 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_non_empty_never_pattern);
diag.note(crate::fluent_generated::_subdiag::note);
;
diag.arg("ty", __binding_1);
diag.span(__binding_0);
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
diag
}
}
}
}
};Diagnostic)]
987#[diag(mir_build_non_empty_never_pattern)]
988#[note]
989pub(crate) struct NonEmptyNeverPattern<'tcx> {
990 #[primary_span]
991 #[label]
992 pub(crate) span: Span,
993 pub(crate) ty: Ty<'tcx>,
994}
995
996#[derive(const _: () =
{
impl<'_sess, 's, 'tcx, G> rustc_errors::Diagnostic<'_sess, G> for
PatternNotCovered<'s, '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 {
PatternNotCovered {
span: __binding_0,
origin: __binding_1,
uncovered: __binding_2,
inform: __binding_3,
interpreted_as_const: __binding_4,
interpreted_as_const_sugg: __binding_5,
adt_defined_here: __binding_6,
witness_1_is_privately_uninhabited: __binding_7,
witness_1: __binding_8,
_p: __binding_9,
pattern_ty: __binding_10,
let_suggestion: __binding_11,
misc_suggestion: __binding_12 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_pattern_not_covered);
diag.code(E0005);
;
diag.arg("origin", __binding_1);
diag.arg("witness_1", __binding_8);
diag.arg("pattern_ty", __binding_10);
diag.span(__binding_0);
diag.subdiagnostic(__binding_2);
if let Some(__binding_3) = __binding_3 {
diag.subdiagnostic(__binding_3);
}
if let Some(__binding_4) = __binding_4 {
diag.subdiagnostic(__binding_4);
}
if let Some(__binding_5) = __binding_5 {
diag.subdiagnostic(__binding_5);
}
if let Some(__binding_6) = __binding_6 {
diag.subdiagnostic(__binding_6);
}
if __binding_7 {
diag.note(crate::fluent_generated::mir_build_privately_uninhabited);
}
diag.note(crate::fluent_generated::mir_build_pattern_ty);
if let Some(__binding_11) = __binding_11 {
diag.subdiagnostic(__binding_11);
}
if let Some(__binding_12) = __binding_12 {
diag.subdiagnostic(__binding_12);
}
diag
}
}
}
}
};Diagnostic)]
997#[diag(mir_build_pattern_not_covered, code = E0005)]
998pub(crate) struct PatternNotCovered<'s, 'tcx> {
999 #[primary_span]
1000 pub(crate) span: Span,
1001 pub(crate) origin: &'s str,
1002 #[subdiagnostic]
1003 pub(crate) uncovered: Uncovered,
1004 #[subdiagnostic]
1005 pub(crate) inform: Option<Inform>,
1006 #[subdiagnostic]
1007 pub(crate) interpreted_as_const: Option<InterpretedAsConst>,
1008 #[subdiagnostic]
1009 pub(crate) interpreted_as_const_sugg: Option<InterpretedAsConstSugg>,
1010 #[subdiagnostic]
1011 pub(crate) adt_defined_here: Option<AdtDefinedHere<'tcx>>,
1012 #[note(mir_build_privately_uninhabited)]
1013 pub(crate) witness_1_is_privately_uninhabited: bool,
1014 pub(crate) witness_1: String,
1015 #[note(mir_build_pattern_ty)]
1016 pub(crate) _p: (),
1017 pub(crate) pattern_ty: Ty<'tcx>,
1018 #[subdiagnostic]
1019 pub(crate) let_suggestion: Option<SuggestLet>,
1020 #[subdiagnostic]
1021 pub(crate) misc_suggestion: Option<MiscPatternSuggestion>,
1022}
1023
1024#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for Inform {
fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
where __G: rustc_errors::EmissionGuarantee {
match self {
Inform => {
diag.store_args();
let __message =
diag.eagerly_translate(crate::fluent_generated::mir_build_inform_irrefutable);
diag.note(__message);
let __message =
diag.eagerly_translate(crate::fluent_generated::mir_build_more_information);
diag.note(__message);
diag.restore_args();
}
}
}
}
};Subdiagnostic)]
1025#[note(mir_build_inform_irrefutable)]
1026#[note(mir_build_more_information)]
1027pub(crate) struct Inform;
1028
1029#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for InterpretedAsConst {
fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
where __G: rustc_errors::EmissionGuarantee {
match self {
InterpretedAsConst {
span: __binding_0, variable: __binding_1 } => {
diag.store_args();
diag.arg("variable", __binding_1);
let __message =
diag.eagerly_translate(crate::fluent_generated::mir_build_confused);
diag.span_label(__binding_0, __message);
diag.restore_args();
}
}
}
}
};Subdiagnostic)]
1030#[label(mir_build_confused)]
1031pub(crate) struct InterpretedAsConst {
1032 #[primary_span]
1033 pub(crate) span: Span,
1034 pub(crate) variable: String,
1035}
1036
1037pub(crate) struct AdtDefinedHere<'tcx> {
1038 pub(crate) adt_def_span: Span,
1039 pub(crate) ty: Ty<'tcx>,
1040 pub(crate) variants: Vec<Variant>,
1041}
1042
1043pub(crate) struct Variant {
1044 pub(crate) span: Span,
1045}
1046
1047impl<'tcx> Subdiagnostic for AdtDefinedHere<'tcx> {
1048 fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
1049 diag.arg("ty", self.ty);
1050 let mut spans = MultiSpan::from(self.adt_def_span);
1051
1052 for Variant { span } in self.variants {
1053 spans.push_span_label(span, fluent::mir_build_variant_defined_here);
1054 }
1055
1056 diag.span_note(spans, fluent::mir_build_adt_defined_here);
1057 }
1058}
1059
1060#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for InterpretedAsConstSugg {
fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
where __G: rustc_errors::EmissionGuarantee {
match self {
InterpretedAsConstSugg {
span: __binding_0, variable: __binding_1 } => {
let __code_7 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!("{0}_var", __binding_1))
})].into_iter();
diag.store_args();
diag.arg("variable", __binding_1);
let __message =
diag.eagerly_translate(crate::fluent_generated::mir_build_interpreted_as_const);
diag.span_suggestions_with_style(__binding_0, __message,
__code_7, rustc_errors::Applicability::MaybeIncorrect,
rustc_errors::SuggestionStyle::ShowAlways);
diag.restore_args();
}
}
}
}
};Subdiagnostic)]
1061#[suggestion(
1062 mir_build_interpreted_as_const,
1063 code = "{variable}_var",
1064 applicability = "maybe-incorrect",
1065 style = "verbose"
1066)]
1067pub(crate) struct InterpretedAsConstSugg {
1068 #[primary_span]
1069 pub(crate) span: Span,
1070 pub(crate) variable: String,
1071}
1072
1073#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for SuggestLet {
fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
where __G: rustc_errors::EmissionGuarantee {
match self {
SuggestLet::If {
start_span: __binding_0,
semi_span: __binding_1,
count: __binding_2 } => {
let mut suggestions = Vec::new();
let __code_8 =
::alloc::__export::must_use({
::alloc::fmt::format(format_args!("if "))
});
let __code_9 =
::alloc::__export::must_use({
::alloc::fmt::format(format_args!(" {{ todo!() }}"))
});
suggestions.push((__binding_0, __code_8));
suggestions.push((__binding_1, __code_9));
diag.store_args();
diag.arg("count", __binding_2);
let __message =
diag.eagerly_translate(crate::fluent_generated::mir_build_suggest_if_let);
diag.multipart_suggestion_with_style(__message, suggestions,
rustc_errors::Applicability::HasPlaceholders,
rustc_errors::SuggestionStyle::ShowCode);
diag.restore_args();
}
SuggestLet::Else { end_span: __binding_0, count: __binding_1
} => {
let __code_10 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!(" else {{ todo!() }}"))
})].into_iter();
diag.store_args();
diag.arg("count", __binding_1);
let __message =
diag.eagerly_translate(crate::fluent_generated::mir_build_suggest_let_else);
diag.span_suggestions_with_style(__binding_0, __message,
__code_10, rustc_errors::Applicability::HasPlaceholders,
rustc_errors::SuggestionStyle::ShowCode);
diag.restore_args();
}
}
}
}
};Subdiagnostic)]
1074pub(crate) enum SuggestLet {
1075 #[multipart_suggestion(mir_build_suggest_if_let, applicability = "has-placeholders")]
1076 If {
1077 #[suggestion_part(code = "if ")]
1078 start_span: Span,
1079 #[suggestion_part(code = " {{ todo!() }}")]
1080 semi_span: Span,
1081 count: usize,
1082 },
1083 #[suggestion(
1084 mir_build_suggest_let_else,
1085 code = " else {{ todo!() }}",
1086 applicability = "has-placeholders"
1087 )]
1088 Else {
1089 #[primary_span]
1090 end_span: Span,
1091 count: usize,
1092 },
1093}
1094
1095#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for MiscPatternSuggestion {
fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
where __G: rustc_errors::EmissionGuarantee {
match self {
MiscPatternSuggestion::AttemptedIntegerLiteral {
start_span: __binding_0 } => {
let __code_11 =
[::alloc::__export::must_use({
::alloc::fmt::format(format_args!("_"))
})].into_iter();
diag.store_args();
let __message =
diag.eagerly_translate(crate::fluent_generated::mir_build_suggest_attempted_int_lit);
diag.span_suggestions_with_style(__binding_0, __message,
__code_11, rustc_errors::Applicability::MaybeIncorrect,
rustc_errors::SuggestionStyle::ShowCode);
diag.restore_args();
}
}
}
}
};Subdiagnostic)]
1096pub(crate) enum MiscPatternSuggestion {
1097 #[suggestion(
1098 mir_build_suggest_attempted_int_lit,
1099 code = "_",
1100 applicability = "maybe-incorrect"
1101 )]
1102 AttemptedIntegerLiteral {
1103 #[primary_span]
1104 start_span: Span,
1105 },
1106}
1107
1108#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
LoopMatchInvalidUpdate 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 {
LoopMatchInvalidUpdate {
lhs: __binding_0, scrutinee: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_loop_match_invalid_update);
;
diag.span(__binding_0);
diag.span_label(__binding_1,
crate::fluent_generated::_subdiag::label);
diag
}
}
}
}
};Diagnostic)]
1109#[diag(mir_build_loop_match_invalid_update)]
1110pub(crate) struct LoopMatchInvalidUpdate {
1111 #[primary_span]
1112 pub lhs: Span,
1113 #[label]
1114 pub scrutinee: Span,
1115}
1116
1117#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
LoopMatchInvalidMatch 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 {
LoopMatchInvalidMatch { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_loop_match_invalid_match);
diag.note(crate::fluent_generated::_subdiag::note);
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1118#[diag(mir_build_loop_match_invalid_match)]
1119#[note]
1120pub(crate) struct LoopMatchInvalidMatch {
1121 #[primary_span]
1122 pub span: Span,
1123}
1124
1125#[derive(const _: () =
{
impl<'_sess, 'tcx, G> rustc_errors::Diagnostic<'_sess, G> for
LoopMatchUnsupportedType<'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 {
LoopMatchUnsupportedType {
span: __binding_0, ty: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_loop_match_unsupported_type);
diag.note(crate::fluent_generated::_subdiag::note);
;
diag.arg("ty", __binding_1);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1126#[diag(mir_build_loop_match_unsupported_type)]
1127#[note]
1128pub(crate) struct LoopMatchUnsupportedType<'tcx> {
1129 #[primary_span]
1130 pub span: Span,
1131 pub ty: Ty<'tcx>,
1132}
1133
1134#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
LoopMatchBadStatements 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 {
LoopMatchBadStatements { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_loop_match_bad_statements);
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1135#[diag(mir_build_loop_match_bad_statements)]
1136pub(crate) struct LoopMatchBadStatements {
1137 #[primary_span]
1138 pub span: Span,
1139}
1140
1141#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
LoopMatchBadRhs 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 {
LoopMatchBadRhs { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_loop_match_bad_rhs);
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1142#[diag(mir_build_loop_match_bad_rhs)]
1143pub(crate) struct LoopMatchBadRhs {
1144 #[primary_span]
1145 pub span: Span,
1146}
1147
1148#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
LoopMatchMissingAssignment 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 {
LoopMatchMissingAssignment { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_loop_match_missing_assignment);
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1149#[diag(mir_build_loop_match_missing_assignment)]
1150pub(crate) struct LoopMatchMissingAssignment {
1151 #[primary_span]
1152 pub span: Span,
1153}
1154
1155#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
LoopMatchArmWithGuard 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 {
LoopMatchArmWithGuard { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_loop_match_arm_with_guard);
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1156#[diag(mir_build_loop_match_arm_with_guard)]
1157pub(crate) struct LoopMatchArmWithGuard {
1158 #[primary_span]
1159 pub span: Span,
1160}
1161
1162#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
ConstContinueNotMonomorphicConst 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 {
ConstContinueNotMonomorphicConst {
span: __binding_0, reason: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_const_continue_not_const);
diag.help(crate::fluent_generated::_subdiag::help);
;
diag.span(__binding_0);
diag.subdiagnostic(__binding_1);
diag
}
}
}
}
};Diagnostic)]
1163#[diag(mir_build_const_continue_not_const)]
1164#[help]
1165pub(crate) struct ConstContinueNotMonomorphicConst {
1166 #[primary_span]
1167 pub span: Span,
1168
1169 #[subdiagnostic]
1170 pub reason: ConstContinueNotMonomorphicConstReason,
1171}
1172
1173#[derive(const _: () =
{
impl rustc_errors::Subdiagnostic for
ConstContinueNotMonomorphicConstReason {
fn add_to_diag<__G>(self, diag: &mut rustc_errors::Diag<'_, __G>)
where __G: rustc_errors::EmissionGuarantee {
match self {
ConstContinueNotMonomorphicConstReason::ConstantParameter {
span: __binding_0 } => {
diag.store_args();
let __message =
diag.eagerly_translate(crate::fluent_generated::mir_build_const_continue_not_const_constant_parameter);
diag.span_label(__binding_0, __message);
diag.restore_args();
}
ConstContinueNotMonomorphicConstReason::ConstBlock {
span: __binding_0 } => {
diag.store_args();
let __message =
diag.eagerly_translate(crate::fluent_generated::mir_build_const_continue_not_const_const_block);
diag.span_label(__binding_0, __message);
diag.restore_args();
}
ConstContinueNotMonomorphicConstReason::Other {
span: __binding_0 } => {
diag.store_args();
let __message =
diag.eagerly_translate(crate::fluent_generated::mir_build_const_continue_not_const_const_other);
diag.span_label(__binding_0, __message);
diag.restore_args();
}
}
}
}
};Subdiagnostic)]
1174pub(crate) enum ConstContinueNotMonomorphicConstReason {
1175 #[label(mir_build_const_continue_not_const_constant_parameter)]
1176 ConstantParameter {
1177 #[primary_span]
1178 span: Span,
1179 },
1180
1181 #[label(mir_build_const_continue_not_const_const_block)]
1182 ConstBlock {
1183 #[primary_span]
1184 span: Span,
1185 },
1186
1187 #[label(mir_build_const_continue_not_const_const_other)]
1188 Other {
1189 #[primary_span]
1190 span: Span,
1191 },
1192}
1193
1194#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
ConstContinueBadConst 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 {
ConstContinueBadConst { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_const_continue_bad_const);
;
diag.span(__binding_0);
diag.span_label(__binding_0,
crate::fluent_generated::_subdiag::label);
diag
}
}
}
}
};Diagnostic)]
1195#[diag(mir_build_const_continue_bad_const)]
1196pub(crate) struct ConstContinueBadConst {
1197 #[primary_span]
1198 #[label]
1199 pub span: Span,
1200}
1201
1202#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
ConstContinueMissingLabelOrValue 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 {
ConstContinueMissingLabelOrValue { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_const_continue_missing_label_or_value);
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1203#[diag(mir_build_const_continue_missing_label_or_value)]
1204pub(crate) struct ConstContinueMissingLabelOrValue {
1205 #[primary_span]
1206 pub span: Span,
1207}
1208
1209#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
ConstContinueUnknownJumpTarget 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 {
ConstContinueUnknownJumpTarget { span: __binding_0 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::mir_build_const_continue_unknown_jump_target);
;
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
1210#[diag(mir_build_const_continue_unknown_jump_target)]
1211pub(crate) struct ConstContinueUnknownJumpTarget {
1212 #[primary_span]
1213 pub span: Span,
1214}