diff options
| author | Georg Semmler <github@weiznich.de> | 2024-09-06 18:47:22 +0200 |
|---|---|---|
| committer | Georg Semmler <github@weiznich.de> | 2024-09-06 19:01:45 +0200 |
| commit | 717a11788d49a960c94509ec97d35114fa4b3a7f (patch) | |
| tree | 2373b07ff87ae770dd749ab4738ac295a97ac08f /compiler/rustc_feature/src/lib.rs | |
| parent | 59d4114b2d1aaac9a6dfe770997f2e79ccfd28ab (diff) | |
| download | rust-717a11788d49a960c94509ec97d35114fa4b3a7f.tar.gz rust-717a11788d49a960c94509ec97d35114fa4b3a7f.zip | |
Correctly handle stability of `#[diagnostic]` attributes
This commit changes the way we treat the stability of attributes in the `#[diagnostic]` namespace. Instead of relaying on ad-hoc checks to ensure at call side that a certain attribute is really usable at that location it centralises the logic to one place. For diagnostic attributes comming from other crates it just skips serializing attributes that are not stable and that do not have the corresponding feature enabled. For attributes from the current crate we can just use the feature information provided by `TyCtx`.
Diffstat (limited to 'compiler/rustc_feature/src/lib.rs')
| -rw-r--r-- | compiler/rustc_feature/src/lib.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/rustc_feature/src/lib.rs b/compiler/rustc_feature/src/lib.rs index adaaba3cd23..fe12930e6b9 100644 --- a/compiler/rustc_feature/src/lib.rs +++ b/compiler/rustc_feature/src/lib.rs @@ -130,8 +130,9 @@ pub fn find_feature_issue(feature: Symbol, issue: GateIssue) -> Option<NonZero<u pub use accepted::ACCEPTED_FEATURES; pub use builtin_attrs::{ deprecated_attributes, encode_cross_crate, find_gated_cfg, is_builtin_attr_name, - is_valid_for_get_attr, AttributeDuplicates, AttributeGate, AttributeSafety, AttributeTemplate, - AttributeType, BuiltinAttribute, GatedCfg, BUILTIN_ATTRIBUTES, BUILTIN_ATTRIBUTE_MAP, + is_stable_diagnostic_attribute, is_valid_for_get_attr, AttributeDuplicates, AttributeGate, + AttributeSafety, AttributeTemplate, AttributeType, BuiltinAttribute, GatedCfg, + BUILTIN_ATTRIBUTES, BUILTIN_ATTRIBUTE_MAP, }; pub use removed::REMOVED_FEATURES; pub use unstable::{Features, INCOMPATIBLE_FEATURES, UNSTABLE_FEATURES}; |
