diff options
| author | bors <bors@rust-lang.org> | 2025-06-21 14:48:43 +0000 | 
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-06-21 14:48:43 +0000 | 
| commit | ea34650916887b5075812d0f11c1d3209e7f94ab (patch) | |
| tree | a2878d9eb8695942e89b47c8e9fdb76ce59e5edc /compiler/rustc_attr_parsing/src | |
| parent | 6d0c9e2a1c80e350c50f5fb9338ea9e585ec603b (diff) | |
| parent | c693bc268acd4826faa2d1fa7908aaafc36a7e02 (diff) | |
| download | rust-ea34650916887b5075812d0f11c1d3209e7f94ab.tar.gz rust-ea34650916887b5075812d0f11c1d3209e7f94ab.zip | |
Auto merge of #142826 - jdonszelmann:rollup-1wxomvb, r=jdonszelmann
Rollup of 3 pull requests Successful merges: - rust-lang/rust#142539 (Port `#[may_dangle]` to the new attribute system) - rust-lang/rust#142690 (expand: Remove some unnecessary generic parameters) - rust-lang/rust#142698 (Improve diagnostics for `concat_bytes!` with C string literals) Failed merges: - rust-lang/rust#142600 (Port `#[rustc_pub_transparent]` to the new attribute system) - rust-lang/rust#142776 (All HIR attributes are outer) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_attr_parsing/src')
| -rw-r--r-- | compiler/rustc_attr_parsing/src/attributes/mod.rs | 1 | ||||
| -rw-r--r-- | compiler/rustc_attr_parsing/src/attributes/semantics.rs | 19 | ||||
| -rw-r--r-- | compiler/rustc_attr_parsing/src/context.rs | 2 | 
3 files changed, 22 insertions, 0 deletions
| diff --git a/compiler/rustc_attr_parsing/src/attributes/mod.rs b/compiler/rustc_attr_parsing/src/attributes/mod.rs index 78a696afa27..1bb5edba326 100644 --- a/compiler/rustc_attr_parsing/src/attributes/mod.rs +++ b/compiler/rustc_attr_parsing/src/attributes/mod.rs @@ -34,6 +34,7 @@ pub(crate) mod deprecation; pub(crate) mod inline; pub(crate) mod lint_helpers; pub(crate) mod repr; +pub(crate) mod semantics; pub(crate) mod stability; pub(crate) mod transparency; pub(crate) mod util; diff --git a/compiler/rustc_attr_parsing/src/attributes/semantics.rs b/compiler/rustc_attr_parsing/src/attributes/semantics.rs new file mode 100644 index 00000000000..071574a5612 --- /dev/null +++ b/compiler/rustc_attr_parsing/src/attributes/semantics.rs @@ -0,0 +1,19 @@ +use rustc_attr_data_structures::AttributeKind; +use rustc_feature::{AttributeTemplate, template}; +use rustc_span::{Symbol, sym}; + +use crate::attributes::{AttributeOrder, OnDuplicate, SingleAttributeParser}; +use crate::context::{AcceptContext, Stage}; +use crate::parser::ArgParser; + +pub(crate) struct MayDangleParser; +impl<S: Stage> SingleAttributeParser<S> for MayDangleParser { + const PATH: &[Symbol] = &[sym::may_dangle]; + const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepFirst; + const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Warn; + const TEMPLATE: AttributeTemplate = template!(Word); + + fn convert(cx: &mut AcceptContext<'_, '_, S>, _args: &ArgParser<'_>) -> Option<AttributeKind> { + Some(AttributeKind::MayDangle(cx.attr_span)) + } +} diff --git a/compiler/rustc_attr_parsing/src/context.rs b/compiler/rustc_attr_parsing/src/context.rs index 8311fccacd8..1bcf500459d 100644 --- a/compiler/rustc_attr_parsing/src/context.rs +++ b/compiler/rustc_attr_parsing/src/context.rs @@ -21,6 +21,7 @@ use crate::attributes::deprecation::DeprecationParser; use crate::attributes::inline::{InlineParser, RustcForceInlineParser}; use crate::attributes::lint_helpers::AsPtrParser; use crate::attributes::repr::{AlignParser, ReprParser}; +use crate::attributes::semantics::MayDangleParser; use crate::attributes::stability::{ BodyStabilityParser, ConstStabilityIndirectParser, ConstStabilityParser, StabilityParser, }; @@ -110,6 +111,7 @@ attribute_parsers!( Single<ConstStabilityIndirectParser>, Single<DeprecationParser>, Single<InlineParser>, + Single<MayDangleParser>, Single<OptimizeParser>, Single<RustcForceInlineParser>, Single<TransparencyParser>, | 
