diff options
| author | Pavel Grigorenko <GrigorenkoPV@ya.ru> | 2025-06-24 00:51:16 +0300 |
|---|---|---|
| committer | Pavel Grigorenko <GrigorenkoPV@ya.ru> | 2025-07-09 01:06:29 +0300 |
| commit | 813ec60744a4cc85740b73fb5bc2aba14bce41da (patch) | |
| tree | 084cc9319a7fa3e96c70b59df3aa4095d72ae6a2 /compiler/rustc_attr_parsing/src | |
| parent | 6f8e92d5aaa717773e38c1be547a0c4556ed9145 (diff) | |
| download | rust-813ec60744a4cc85740b73fb5bc2aba14bce41da.tar.gz rust-813ec60744a4cc85740b73fb5bc2aba14bce41da.zip | |
Port `#[type_const]` to the new attribute system
Diffstat (limited to 'compiler/rustc_attr_parsing/src')
| -rw-r--r-- | compiler/rustc_attr_parsing/src/attributes/traits.rs | 7 | ||||
| -rw-r--r-- | compiler/rustc_attr_parsing/src/context.rs | 3 |
2 files changed, 9 insertions, 1 deletions
diff --git a/compiler/rustc_attr_parsing/src/attributes/traits.rs b/compiler/rustc_attr_parsing/src/attributes/traits.rs index e6f50761caa..5f9d182b00f 100644 --- a/compiler/rustc_attr_parsing/src/attributes/traits.rs +++ b/compiler/rustc_attr_parsing/src/attributes/traits.rs @@ -82,3 +82,10 @@ impl<S: Stage> NoArgsAttributeParser<S> for CoinductiveParser { const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error; const CREATE: fn(Span) -> AttributeKind = AttributeKind::Coinductive; } + +pub(crate) struct TypeConstParser; +impl<S: Stage> NoArgsAttributeParser<S> for TypeConstParser { + const PATH: &[Symbol] = &[sym::type_const]; + const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error; + const CREATE: fn(Span) -> AttributeKind = AttributeKind::TypeConst; +} diff --git a/compiler/rustc_attr_parsing/src/context.rs b/compiler/rustc_attr_parsing/src/context.rs index c1584cd878f..f86f5c7a1f4 100644 --- a/compiler/rustc_attr_parsing/src/context.rs +++ b/compiler/rustc_attr_parsing/src/context.rs @@ -45,7 +45,7 @@ use crate::attributes::stability::{ use crate::attributes::test_attrs::IgnoreParser; use crate::attributes::traits::{ CoinductiveParser, ConstTraitParser, DenyExplicitImplParser, DoNotImplementViaObjectParser, - SkipDuringMethodDispatchParser, + SkipDuringMethodDispatchParser, TypeConstParser, }; use crate::attributes::transparency::TransparencyParser; use crate::attributes::{AttributeParser as _, Combine, Single, WithoutArgs}; @@ -169,6 +169,7 @@ attribute_parsers!( Single<WithoutArgs<PubTransparentParser>>, Single<WithoutArgs<StdInternalSymbolParser>>, Single<WithoutArgs<TrackCallerParser>>, + Single<WithoutArgs<TypeConstParser>>, // tidy-alphabetical-end ]; ); |
