Port #[used] to new attribute parsing infrastructure
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
This commit is contained in:
@@ -131,6 +131,17 @@ impl Deprecation {
|
||||
}
|
||||
}
|
||||
|
||||
/// There are three valid forms of the attribute:
|
||||
/// `#[used]`, which is semantically equivalent to `#[used(linker)]` except that the latter is currently unstable.
|
||||
/// `#[used(compiler)]`
|
||||
/// `#[used(linker)]`
|
||||
#[derive(Encodable, Decodable, Copy, Clone, Debug, PartialEq, Eq, Hash)]
|
||||
#[derive(HashStable_Generic, PrintAttribute)]
|
||||
pub enum UsedBy {
|
||||
Compiler,
|
||||
Linker,
|
||||
}
|
||||
|
||||
/// Represents parsed *built-in* inert attributes.
|
||||
///
|
||||
/// ## Overview
|
||||
@@ -285,5 +296,8 @@ pub enum AttributeKind {
|
||||
|
||||
/// Represents `#[track_caller]`
|
||||
TrackCaller(Span),
|
||||
|
||||
/// Represents `#[used]`
|
||||
Used { used_by: UsedBy, span: Span },
|
||||
// tidy-alphabetical-end
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ impl AttributeKind {
|
||||
PubTransparent(..) => Yes,
|
||||
SkipDuringMethodDispatch { .. } => No,
|
||||
TrackCaller(..) => Yes,
|
||||
Used { .. } => No,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user