Port rustc_intrinsic_const_stable_indirect to the new attribute parser
This commit is contained in:
parent
9249e9f78a
commit
c42a581d2f
6 changed files with 20 additions and 2 deletions
|
|
@ -490,6 +490,7 @@ impl<S: Stage> CombineAttributeParser<S> for RustcMirParser {
|
|||
.collect()
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) struct RustcNonConstTraitMethodParser;
|
||||
|
||||
impl<S: Stage> NoArgsAttributeParser<S> for RustcNonConstTraitMethodParser {
|
||||
|
|
@ -819,3 +820,12 @@ impl<S: Stage> NoArgsAttributeParser<S> for RustcIntrinsicParser {
|
|||
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Fn)]);
|
||||
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcIntrinsic;
|
||||
}
|
||||
|
||||
pub(crate) struct RustcIntrinsicConstStableIndirectParser;
|
||||
|
||||
impl<S: Stage> NoArgsAttributeParser<S> for RustcIntrinsicConstStableIndirectParser {
|
||||
const PATH: &'static [Symbol] = &[sym::rustc_intrinsic_const_stable_indirect];
|
||||
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
|
||||
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Fn)]);
|
||||
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcIntrinsicConstStableIndirect;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -264,6 +264,7 @@ attribute_parsers!(
|
|||
Single<WithoutArgs<RustcEffectiveVisibilityParser>>,
|
||||
Single<WithoutArgs<RustcHasIncoherentInherentImplsParser>>,
|
||||
Single<WithoutArgs<RustcHiddenTypeOfOpaquesParser>>,
|
||||
Single<WithoutArgs<RustcIntrinsicConstStableIndirectParser>>,
|
||||
Single<WithoutArgs<RustcIntrinsicParser>>,
|
||||
Single<WithoutArgs<RustcLintOptTyParser>>,
|
||||
Single<WithoutArgs<RustcLintQueryInstabilityParser>>,
|
||||
|
|
|
|||
|
|
@ -1123,6 +1123,9 @@ pub enum AttributeKind {
|
|||
/// Represents `#[rustc_intrinsic]`
|
||||
RustcIntrinsic,
|
||||
|
||||
/// Represents `#[rustc_intrinsic_const_stable_indirect]`
|
||||
RustcIntrinsicConstStableIndirect,
|
||||
|
||||
/// Represents `#[rustc_layout]`
|
||||
RustcLayout(ThinVec<RustcLayoutType>),
|
||||
|
||||
|
|
|
|||
|
|
@ -119,6 +119,7 @@ impl AttributeKind {
|
|||
RustcHiddenTypeOfOpaques => No,
|
||||
RustcIfThisChanged(..) => No,
|
||||
RustcIntrinsic => Yes,
|
||||
RustcIntrinsicConstStableIndirect => No,
|
||||
RustcLayout(..) => No,
|
||||
RustcLayoutScalarValidRangeEnd(..) => Yes,
|
||||
RustcLayoutScalarValidRangeStart(..) => Yes,
|
||||
|
|
|
|||
|
|
@ -1691,7 +1691,10 @@ pub fn intrinsic_raw(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<ty::Intrinsi
|
|||
Some(ty::IntrinsicDef {
|
||||
name: tcx.item_name(def_id),
|
||||
must_be_overridden,
|
||||
const_stable: tcx.has_attr(def_id, sym::rustc_intrinsic_const_stable_indirect),
|
||||
const_stable: find_attr!(
|
||||
tcx.get_all_attrs(def_id),
|
||||
AttributeKind::RustcIntrinsicConstStableIndirect
|
||||
),
|
||||
})
|
||||
} else {
|
||||
None
|
||||
|
|
|
|||
|
|
@ -314,6 +314,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
|||
| AttributeKind::RustcHiddenTypeOfOpaques
|
||||
| AttributeKind::RustcIfThisChanged(..)
|
||||
| AttributeKind::RustcIntrinsic
|
||||
| AttributeKind::RustcIntrinsicConstStableIndirect
|
||||
| AttributeKind::RustcLayout(..)
|
||||
| AttributeKind::RustcLayoutScalarValidRangeEnd(..)
|
||||
| AttributeKind::RustcLayoutScalarValidRangeStart(..)
|
||||
|
|
@ -387,7 +388,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
|||
| sym::rustc_insignificant_dtor
|
||||
| sym::rustc_nonnull_optimization_guaranteed
|
||||
| sym::rustc_inherit_overflow_checks
|
||||
| sym::rustc_intrinsic_const_stable_indirect
|
||||
| sym::rustc_trivial_field_reads
|
||||
| sym::rustc_on_unimplemented
|
||||
| sym::rustc_do_not_const_check
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue