Port #[rustc_dump_predicates]
This commit is contained in:
parent
a4c34b421c
commit
abcbf72bab
6 changed files with 24 additions and 3 deletions
|
|
@ -34,6 +34,21 @@ impl<S: Stage> NoArgsAttributeParser<S> for RustcDumpItemBounds {
|
|||
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcDumpItemBounds;
|
||||
}
|
||||
|
||||
pub(crate) struct RustcDumpPredicates;
|
||||
|
||||
impl<S: Stage> NoArgsAttributeParser<S> for RustcDumpPredicates {
|
||||
const PATH: &[Symbol] = &[sym::rustc_dump_predicates];
|
||||
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
|
||||
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[
|
||||
Allow(Target::Struct),
|
||||
Allow(Target::Enum),
|
||||
Allow(Target::Union),
|
||||
Allow(Target::Trait),
|
||||
Allow(Target::AssocTy),
|
||||
]);
|
||||
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcDumpPredicates;
|
||||
}
|
||||
|
||||
pub(crate) struct RustcDumpVtable;
|
||||
|
||||
impl<S: Stage> NoArgsAttributeParser<S> for RustcDumpVtable {
|
||||
|
|
|
|||
|
|
@ -64,7 +64,8 @@ use crate::attributes::proc_macro_attrs::{
|
|||
use crate::attributes::prototype::CustomMirParser;
|
||||
use crate::attributes::repr::{AlignParser, AlignStaticParser, ReprParser};
|
||||
use crate::attributes::rustc_dump::{
|
||||
RustcDumpDefParents, RustcDumpItemBounds, RustcDumpUserArgs, RustcDumpVtable,
|
||||
RustcDumpDefParents, RustcDumpItemBounds, RustcDumpPredicates, RustcDumpUserArgs,
|
||||
RustcDumpVtable,
|
||||
};
|
||||
use crate::attributes::rustc_internal::{
|
||||
RustcHasIncoherentInherentImplsParser, RustcLayoutScalarValidRangeEndParser,
|
||||
|
|
@ -272,6 +273,7 @@ attribute_parsers!(
|
|||
Single<WithoutArgs<RustcCoherenceIsCoreParser>>,
|
||||
Single<WithoutArgs<RustcDumpDefParents>>,
|
||||
Single<WithoutArgs<RustcDumpItemBounds>>,
|
||||
Single<WithoutArgs<RustcDumpPredicates>>,
|
||||
Single<WithoutArgs<RustcDumpUserArgs>>,
|
||||
Single<WithoutArgs<RustcDumpVtable>>,
|
||||
Single<WithoutArgs<RustcHasIncoherentInherentImplsParser>>,
|
||||
|
|
|
|||
|
|
@ -912,6 +912,9 @@ pub enum AttributeKind {
|
|||
/// Represents `#[rustc_dump_item_bounds]`
|
||||
RustcDumpItemBounds,
|
||||
|
||||
/// Represents `#[rustc_dump_predicates]`
|
||||
RustcDumpPredicates,
|
||||
|
||||
/// Represents `#[rustc_dump_user_args]`
|
||||
RustcDumpUserArgs,
|
||||
|
||||
|
|
|
|||
|
|
@ -99,6 +99,7 @@ impl AttributeKind {
|
|||
RustcCoherenceIsCore(..) => No,
|
||||
RustcDumpDefParents => No,
|
||||
RustcDumpItemBounds => No,
|
||||
RustcDumpPredicates => No,
|
||||
RustcDumpUserArgs => No,
|
||||
RustcDumpVtable(..) => No,
|
||||
RustcHasIncoherentInherentImpls => Yes,
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ pub(crate) fn opaque_hidden_types(tcx: TyCtxt<'_>) {
|
|||
|
||||
pub(crate) fn predicates_and_item_bounds(tcx: TyCtxt<'_>) {
|
||||
for id in tcx.hir_crate_items(()).owners() {
|
||||
if tcx.has_attr(id, sym::rustc_dump_predicates) {
|
||||
if find_attr!(tcx.get_all_attrs(id), AttributeKind::RustcDumpPredicates) {
|
||||
let preds = tcx.predicates_of(id).instantiate_identity(tcx).predicates;
|
||||
let span = tcx.def_span(id);
|
||||
|
||||
|
|
|
|||
|
|
@ -311,6 +311,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
|||
| AttributeKind::MustNotSupend { .. }
|
||||
| AttributeKind::RustcDumpUserArgs
|
||||
| AttributeKind::RustcDumpItemBounds
|
||||
| AttributeKind::RustcDumpPredicates
|
||||
| AttributeKind::RustcDumpDefParents
|
||||
| AttributeKind::RustcDumpVtable(..)
|
||||
) => { /* do nothing */ }
|
||||
|
|
@ -377,7 +378,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
|||
| sym::rustc_capture_analysis
|
||||
| sym::rustc_regions
|
||||
| sym::rustc_strict_coherence
|
||||
| sym::rustc_dump_predicates
|
||||
| sym::rustc_variance
|
||||
| sym::rustc_variance_of_opaques
|
||||
| sym::rustc_hidden_type_of_opaques
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue