Port crate name to the new attribute system
This commit is contained in:
@@ -367,6 +367,9 @@ pub enum AttributeKind {
|
||||
/// Represents `#[coverage(..)]`.
|
||||
Coverage(Span, CoverageAttrKind),
|
||||
|
||||
/// Represents `#[crate_name = ...]`
|
||||
CrateName { name: Symbol, name_span: Span, attr_span: Span, style: AttrStyle },
|
||||
|
||||
/// Represents `#[custom_mir]`.
|
||||
CustomMir(Option<(MirDialect, Span)>, Option<(MirPhase, Span)>, Span),
|
||||
|
||||
|
||||
@@ -7,6 +7,11 @@ pub enum EncodeCrossCrate {
|
||||
}
|
||||
|
||||
impl AttributeKind {
|
||||
/// Whether this attribute should be encoded in metadata files.
|
||||
///
|
||||
/// If this is "Yes", then another crate can do `tcx.get_all_attrs(did)` for a did in this crate, and get the attribute.
|
||||
/// When this is No, the attribute is filtered out while encoding and other crate won't be able to observe it.
|
||||
/// This can be unexpectedly good for performance, so unless necessary for cross-crate compilation, prefer No.
|
||||
pub fn encode_cross_crate(&self) -> EncodeCrossCrate {
|
||||
use AttributeKind::*;
|
||||
use EncodeCrossCrate::*;
|
||||
@@ -31,6 +36,7 @@ impl AttributeKind {
|
||||
ConstTrait(..) => No,
|
||||
Coroutine(..) => No,
|
||||
Coverage(..) => No,
|
||||
CrateName { .. } => No,
|
||||
CustomMir(_, _, _) => Yes,
|
||||
DenyExplicitImpl(..) => No,
|
||||
Deprecation { .. } => Yes,
|
||||
|
||||
Reference in New Issue
Block a user