rustc_hir_analysis/errors/
precise_captures.rs1use rustc_errors::E0799;
2use rustc_macros::Diagnostic;
3use rustc_span::{Span, Symbol};
4
5#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
ParamNotCaptured 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 {
ParamNotCaptured {
opaque_span: __binding_0,
param_span: __binding_1,
kind: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::hir_analysis_param_not_captured);
diag.note(crate::fluent_generated::_subdiag::note);
;
diag.arg("kind", __binding_2);
diag.span(__binding_0);
diag.span_label(__binding_1,
crate::fluent_generated::_subdiag::label);
diag
}
}
}
}
};Diagnostic)]
6#[diag(hir_analysis_param_not_captured)]
7#[note]
8pub(crate) struct ParamNotCaptured {
9 #[primary_span]
10 pub opaque_span: Span,
11 #[label]
12 pub param_span: Span,
13 pub kind: &'static str,
14}
15
16#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
SelfTyNotCaptured 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 {
SelfTyNotCaptured {
opaque_span: __binding_0, trait_span: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::hir_analysis_self_ty_not_captured);
diag.note(crate::fluent_generated::_subdiag::note);
;
diag.span(__binding_0);
diag.span_label(__binding_1,
crate::fluent_generated::_subdiag::label);
diag
}
}
}
}
};Diagnostic)]
17#[diag(hir_analysis_self_ty_not_captured)]
18#[note]
19pub(crate) struct SelfTyNotCaptured {
20 #[primary_span]
21 pub opaque_span: Span,
22 #[label]
23 pub trait_span: Span,
24}
25
26#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
LifetimeNotCaptured 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 {
LifetimeNotCaptured {
use_span: __binding_0,
param_span: __binding_1,
opaque_span: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::hir_analysis_lifetime_not_captured);
;
diag.span(__binding_0);
diag.span_label(__binding_1,
crate::fluent_generated::hir_analysis_param_label);
diag.span_label(__binding_2,
crate::fluent_generated::_subdiag::label);
diag
}
}
}
}
};Diagnostic)]
27#[diag(hir_analysis_lifetime_not_captured)]
28pub(crate) struct LifetimeNotCaptured {
29 #[primary_span]
30 pub use_span: Span,
31 #[label(hir_analysis_param_label)]
32 pub param_span: Span,
33 #[label]
34 pub opaque_span: Span,
35}
36
37#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
LifetimeImplicitlyCaptured 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 {
LifetimeImplicitlyCaptured {
opaque_span: __binding_0, param_span: __binding_1 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::hir_analysis_lifetime_implicitly_captured);
;
diag.span(__binding_0);
diag.span_label(__binding_1,
crate::fluent_generated::hir_analysis_param_label);
diag
}
}
}
}
};Diagnostic)]
38#[diag(hir_analysis_lifetime_implicitly_captured)]
39pub(crate) struct LifetimeImplicitlyCaptured {
40 #[primary_span]
41 pub opaque_span: Span,
42 #[label(hir_analysis_param_label)]
43 pub param_span: Span,
44}
45
46#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
BadPreciseCapture 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 {
BadPreciseCapture {
span: __binding_0, kind: __binding_1, found: __binding_2 }
=> {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::hir_analysis_bad_precise_capture);
;
diag.arg("kind", __binding_1);
diag.arg("found", __binding_2);
diag.span(__binding_0);
diag
}
}
}
}
};Diagnostic)]
47#[diag(hir_analysis_bad_precise_capture)]
48pub(crate) struct BadPreciseCapture {
49 #[primary_span]
50 pub span: Span,
51 pub kind: &'static str,
52 pub found: String,
53}
54
55#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
PreciseCaptureSelfAlias 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 {
PreciseCaptureSelfAlias {
span: __binding_0, self_span: __binding_1, what: __binding_2
} => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::hir_analysis_precise_capture_self_alias);
diag.code(E0799);
;
diag.arg("what", __binding_2);
diag.span(__binding_0);
diag.span_label(__binding_1,
crate::fluent_generated::_subdiag::label);
diag
}
}
}
}
};Diagnostic)]
56#[diag(hir_analysis_precise_capture_self_alias, code = E0799)]
57pub(crate) struct PreciseCaptureSelfAlias {
58 #[primary_span]
59 pub span: Span,
60 #[label]
61 pub self_span: Span,
62 pub what: &'static str,
63}
64
65#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
DuplicatePreciseCapture 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 {
DuplicatePreciseCapture {
first_span: __binding_0,
name: __binding_1,
second_span: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::hir_analysis_duplicate_precise_capture);
;
diag.arg("name", __binding_1);
diag.span(__binding_0);
diag.span_label(__binding_2,
crate::fluent_generated::_subdiag::label);
diag
}
}
}
}
};Diagnostic)]
66#[diag(hir_analysis_duplicate_precise_capture)]
67pub(crate) struct DuplicatePreciseCapture {
68 #[primary_span]
69 pub first_span: Span,
70 pub name: Symbol,
71 #[label]
72 pub second_span: Span,
73}
74
75#[derive(const _: () =
{
impl<'_sess, G> rustc_errors::Diagnostic<'_sess, G> for
LifetimesMustBeFirst 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 {
LifetimesMustBeFirst {
lifetime_span: __binding_0,
name: __binding_1,
other_span: __binding_2 } => {
let mut diag =
rustc_errors::Diag::new(dcx, level,
crate::fluent_generated::hir_analysis_lifetime_must_be_first);
;
diag.arg("name", __binding_1);
diag.span(__binding_0);
diag.span_label(__binding_2,
crate::fluent_generated::_subdiag::label);
diag
}
}
}
}
};Diagnostic)]
76#[diag(hir_analysis_lifetime_must_be_first)]
77pub(crate) struct LifetimesMustBeFirst {
78 #[primary_span]
79 pub lifetime_span: Span,
80 pub name: Symbol,
81 #[label]
82 pub other_span: Span,
83}