forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.rs
More file actions
35 lines (32 loc) · 1003 Bytes
/
errors.rs
File metadata and controls
35 lines (32 loc) · 1003 Bytes
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
use rustc_errors::MultiSpan;
use rustc_macros::{Diagnostic, Subdiagnostic};
use rustc_span::{Span, Symbol};
#[derive(Diagnostic)]
#[diag("`{$name}` attribute cannot be used at crate level")]
pub(crate) struct InvalidAttrAtCrateLevel {
#[primary_span]
pub span: Span,
#[suggestion(
"perhaps you meant to use an outer attribute",
code = "#[",
applicability = "machine-applicable",
style = "verbose"
)]
pub pound_to_opening_bracket: Span,
pub name: Symbol,
#[subdiagnostic]
pub item: Option<ItemFollowingInnerAttr>,
}
#[derive(Clone, Copy, Subdiagnostic)]
#[label("the inner attribute doesn't annotate this item")]
pub(crate) struct ItemFollowingInnerAttr {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag("most attributes are not supported in `where` clauses")]
#[help("only `#[cfg]` and `#[cfg_attr]` are supported")]
pub(crate) struct UnsupportedAttributesInWhere {
#[primary_span]
pub span: MultiSpan,
}