1
Fork 0

Change only_local to enum type and change the macros to always require a variant of that enum.

This commit is contained in:
surechen 2024-03-19 00:05:18 +08:00
parent 3cdcdaf31b
commit db48dfcd03
4 changed files with 279 additions and 215 deletions

View file

@ -817,8 +817,8 @@ struct AnalyzeAttrState {
#[inline]
fn analyze_attr(attr: &Attribute, state: &mut AnalyzeAttrState) -> bool {
let mut should_encode = false;
if rustc_feature::is_builtin_only_local(attr.name_or_empty()) {
// Attributes marked local-only don't need to be encoded for downstream crates.
if !rustc_feature::encode_cross_crate(attr.name_or_empty()) {
// Attributes not marked encode-cross-crate don't need to be encoded for downstream crates.
} else if attr.doc_str().is_some() {
// We keep all doc comments reachable to rustdoc because they might be "imported" into
// downstream crates if they use `#[doc(inline)]` to copy an item's documentation into