diff options
| author | Jana Dönszelmann <jana@donsz.nl> | 2025-06-12 13:52:23 +0200 | 
|---|---|---|
| committer | Jana Dönszelmann <jana@donsz.nl> | 2025-06-20 15:06:29 +0200 | 
| commit | de0fd27f347c783b45fc9764baa944455369cd33 (patch) | |
| tree | 120641693fe8b5dc067306b04808b44f27ceb138 /compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs | |
| parent | 3b97f1308ff72016a4aaa93fbe6d09d4d6427815 (diff) | |
| download | rust-de0fd27f347c783b45fc9764baa944455369cd33.tar.gz rust-de0fd27f347c783b45fc9764baa944455369cd33.zip  | |
cold
Diffstat (limited to 'compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs')
| -rw-r--r-- | compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs | 18 | 
1 files changed, 18 insertions, 0 deletions
diff --git a/compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs b/compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs index ddcf82cbf7c..1509531ca98 100644 --- a/compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs +++ b/compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs @@ -38,3 +38,21 @@ impl<S: Stage> SingleAttributeParser<S> for OptimizeParser { Some(AttributeKind::Optimize(res, cx.attr_span)) } } + +pub(crate) struct ColdParser; + +impl<S: Stage> SingleAttributeParser<S> for ColdParser { + const PATH: &[rustc_span::Symbol] = &[sym::cold]; + const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepLast; + const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Warn; + const TEMPLATE: AttributeTemplate = template!(Word); + + fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser<'_>) -> Option<AttributeKind> { + if !args.no_args() { + cx.expected_no_args(cx.attr_span); + return None; + }; + + Some(AttributeKind::Cold(cx.attr_span)) + } +}  | 
