rustc_hir_analysis/errors/
precise_captures.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
use rustc_errors::E0799;
use rustc_macros::Diagnostic;
use rustc_span::{Span, Symbol};

#[derive(Diagnostic)]
#[diag(hir_analysis_param_not_captured)]
#[note]
pub(crate) struct ParamNotCaptured {
    #[primary_span]
    pub opaque_span: Span,
    #[label]
    pub param_span: Span,
    pub kind: &'static str,
}

#[derive(Diagnostic)]
#[diag(hir_analysis_self_ty_not_captured)]
#[note]
pub(crate) struct SelfTyNotCaptured {
    #[primary_span]
    pub opaque_span: Span,
    #[label]
    pub trait_span: Span,
}

#[derive(Diagnostic)]
#[diag(hir_analysis_lifetime_not_captured)]
pub(crate) struct LifetimeNotCaptured {
    #[primary_span]
    pub use_span: Span,
    #[label(hir_analysis_param_label)]
    pub param_span: Span,
    #[label]
    pub opaque_span: Span,
}

#[derive(Diagnostic)]
#[diag(hir_analysis_lifetime_implicitly_captured)]
pub(crate) struct LifetimeImplicitlyCaptured {
    #[primary_span]
    pub opaque_span: Span,
    #[label(hir_analysis_param_label)]
    pub param_span: Span,
}

#[derive(Diagnostic)]
#[diag(hir_analysis_bad_precise_capture)]
pub(crate) struct BadPreciseCapture {
    #[primary_span]
    pub span: Span,
    pub kind: &'static str,
    pub found: String,
}

#[derive(Diagnostic)]
#[diag(hir_analysis_precise_capture_self_alias, code = E0799)]
pub(crate) struct PreciseCaptureSelfAlias {
    #[primary_span]
    pub span: Span,
    #[label]
    pub self_span: Span,
    pub what: &'static str,
}

#[derive(Diagnostic)]
#[diag(hir_analysis_duplicate_precise_capture)]
pub(crate) struct DuplicatePreciseCapture {
    #[primary_span]
    pub first_span: Span,
    pub name: Symbol,
    #[label]
    pub second_span: Span,
}

#[derive(Diagnostic)]
#[diag(hir_analysis_lifetime_must_be_first)]
pub(crate) struct LifetimesMustBeFirst {
    #[primary_span]
    pub lifetime_span: Span,
    pub name: Symbol,
    #[label]
    pub other_span: Span,
}