remove 'static in some places

This commit is contained in:
Jana Dönszelmann 2025-03-07 15:34:14 +01:00
parent e6a5f281ec
commit e2afe04e2e
No known key found for this signature in database
7 changed files with 13 additions and 13 deletions

View File

@ -10,7 +10,7 @@ use crate::session_diagnostics;
pub(crate) struct AllowInternalUnstableParser; pub(crate) struct AllowInternalUnstableParser;
impl<S: Stage> CombineAttributeParser<S> for AllowInternalUnstableParser { impl<S: Stage> CombineAttributeParser<S> for AllowInternalUnstableParser {
const PATH: &'static [Symbol] = &[sym::allow_internal_unstable]; const PATH: &[Symbol] = &[sym::allow_internal_unstable];
type Item = (Symbol, Span); type Item = (Symbol, Span);
const CONVERT: ConvertFn<Self::Item> = AttributeKind::AllowInternalUnstable; const CONVERT: ConvertFn<Self::Item> = AttributeKind::AllowInternalUnstable;
@ -26,7 +26,7 @@ impl<S: Stage> CombineAttributeParser<S> for AllowInternalUnstableParser {
pub(crate) struct AllowConstFnUnstableParser; pub(crate) struct AllowConstFnUnstableParser;
impl<S: Stage> CombineAttributeParser<S> for AllowConstFnUnstableParser { impl<S: Stage> CombineAttributeParser<S> for AllowConstFnUnstableParser {
const PATH: &'static [Symbol] = &[sym::rustc_allow_const_fn_unstable]; const PATH: &[Symbol] = &[sym::rustc_allow_const_fn_unstable];
type Item = Symbol; type Item = Symbol;
const CONVERT: ConvertFn<Self::Item> = AttributeKind::AllowConstFnUnstable; const CONVERT: ConvertFn<Self::Item> = AttributeKind::AllowConstFnUnstable;

View File

@ -42,7 +42,7 @@ fn get<S: Stage>(
} }
impl<S: Stage> SingleAttributeParser<S> for DeprecationParser { impl<S: Stage> SingleAttributeParser<S> for DeprecationParser {
const PATH: &'static [Symbol] = &[sym::deprecated]; const PATH: &[Symbol] = &[sym::deprecated];
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepFirst; const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepFirst;
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error; const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;

View File

@ -12,7 +12,7 @@
//! - [`CombineAttributeParser`]: makes it easy to implement an attribute which should combine the //! - [`CombineAttributeParser`]: makes it easy to implement an attribute which should combine the
//! contents of attributes, if an attribute appear multiple times in a list //! contents of attributes, if an attribute appear multiple times in a list
//! //!
//! Attributes should be added to [`ATTRIBUTE_PARSERS`](crate::context::ATTRIBUTE_PARSERS) to be parsed. //! Attributes should be added to `crate::context::ATTRIBUTE_PARSERS` to be parsed.
use std::marker::PhantomData; use std::marker::PhantomData;
@ -83,7 +83,7 @@ pub(crate) trait AttributeParser<S: Stage>: Default + 'static {
/// [`SingleAttributeParser`] can only convert attributes one-to-one, and cannot combine multiple /// [`SingleAttributeParser`] can only convert attributes one-to-one, and cannot combine multiple
/// attributes together like is necessary for `#[stable()]` and `#[unstable()]` for example. /// attributes together like is necessary for `#[stable()]` and `#[unstable()]` for example.
pub(crate) trait SingleAttributeParser<S: Stage>: 'static { pub(crate) trait SingleAttributeParser<S: Stage>: 'static {
const PATH: &'static [Symbol]; const PATH: &[Symbol];
const ATTRIBUTE_ORDER: AttributeOrder; const ATTRIBUTE_ORDER: AttributeOrder;
const ON_DUPLICATE: OnDuplicate<S>; const ON_DUPLICATE: OnDuplicate<S>;
@ -151,7 +151,7 @@ pub(crate) enum OnDuplicate<S: Stage> {
/// Custom function called when a duplicate attribute is found. /// Custom function called when a duplicate attribute is found.
/// ///
/// - `unused` is the span of the attribute that was unused or bad because of some /// - `unused` is the span of the attribute that was unused or bad because of some
/// duplicate reason (see [`AttributeDuplicates`]) /// duplicate reason (see [`AttributeOrder`])
/// - `used` is the span of the attribute that was used in favor of the unused attribute /// - `used` is the span of the attribute that was used in favor of the unused attribute
Custom(fn(cx: &AcceptContext<'_, '_, S>, used: Span, unused: Span)), Custom(fn(cx: &AcceptContext<'_, '_, S>, used: Span, unused: Span)),
} }
@ -217,7 +217,7 @@ type ConvertFn<E> = fn(ThinVec<E>) -> AttributeKind;
/// [`CombineAttributeParser`] can only convert a single kind of attribute, and cannot combine multiple /// [`CombineAttributeParser`] can only convert a single kind of attribute, and cannot combine multiple
/// attributes together like is necessary for `#[stable()]` and `#[unstable()]` for example. /// attributes together like is necessary for `#[stable()]` and `#[unstable()]` for example.
pub(crate) trait CombineAttributeParser<S: Stage>: 'static { pub(crate) trait CombineAttributeParser<S: Stage>: 'static {
const PATH: &'static [Symbol]; const PATH: &[rustc_span::Symbol];
type Item; type Item;
const CONVERT: ConvertFn<Self::Item>; const CONVERT: ConvertFn<Self::Item>;

View File

@ -21,7 +21,7 @@ pub(crate) struct ReprParser;
impl<S: Stage> CombineAttributeParser<S> for ReprParser { impl<S: Stage> CombineAttributeParser<S> for ReprParser {
type Item = (ReprAttr, Span); type Item = (ReprAttr, Span);
const PATH: &'static [Symbol] = &[sym::repr]; const PATH: &[Symbol] = &[sym::repr];
const CONVERT: ConvertFn<Self::Item> = AttributeKind::Repr; const CONVERT: ConvertFn<Self::Item> = AttributeKind::Repr;
fn extend<'c>( fn extend<'c>(

View File

@ -117,7 +117,7 @@ impl<S: Stage> AttributeParser<S> for BodyStabilityParser {
pub(crate) struct ConstStabilityIndirectParser; pub(crate) struct ConstStabilityIndirectParser;
// FIXME(jdonszelmann): single word attribute group when we have these // FIXME(jdonszelmann): single word attribute group when we have these
impl<S: Stage> SingleAttributeParser<S> for ConstStabilityIndirectParser { impl<S: Stage> SingleAttributeParser<S> for ConstStabilityIndirectParser {
const PATH: &'static [Symbol] = &[sym::rustc_const_stable_indirect]; const PATH: &[Symbol] = &[sym::rustc_const_stable_indirect];
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepFirst; const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepFirst;
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Ignore; const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Ignore;

View File

@ -2,8 +2,8 @@ use rustc_attr_data_structures::AttributeKind;
use rustc_span::hygiene::Transparency; use rustc_span::hygiene::Transparency;
use rustc_span::{Symbol, sym}; use rustc_span::{Symbol, sym};
use super::{AcceptContext, AttributeOrder, OnDuplicate, SingleAttributeParser}; use super::{AttributeOrder, OnDuplicate, SingleAttributeParser};
use crate::context::Stage; use crate::context::{AcceptContext, Stage};
use crate::parser::ArgParser; use crate::parser::ArgParser;
pub(crate) struct TransparencyParser; pub(crate) struct TransparencyParser;

View File

@ -62,7 +62,7 @@
//! a "stability" of an item. So, the stability attribute has an //! a "stability" of an item. So, the stability attribute has an
//! [`AttributeParser`](attributes::AttributeParser) that recognizes both the `#[stable()]` //! [`AttributeParser`](attributes::AttributeParser) that recognizes both the `#[stable()]`
//! and `#[unstable()]` syntactic attributes, and at the end produce a single //! and `#[unstable()]` syntactic attributes, and at the end produce a single
//! [`AttributeKind::Stability`]. //! [`AttributeKind::Stability`](rustc_attr_data_structures::AttributeKind::Stability).
//! //!
//! When multiple instances of the same attribute are allowed, they're combined into a single //! When multiple instances of the same attribute are allowed, they're combined into a single
//! semantic attribute. For example: //! semantic attribute. For example:
@ -85,7 +85,7 @@
#[macro_use] #[macro_use]
mod attributes; mod attributes;
mod context; pub(crate) mod context;
mod lints; mod lints;
pub mod parser; pub mod parser;
mod session_diagnostics; mod session_diagnostics;