mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-21 17:52:12 +03:00
Port #[rustc_dump_item_bounds]
This commit is contained in:
@@ -24,3 +24,12 @@ impl<S: Stage> NoArgsAttributeParser<S> for RustcDumpDefParents {
|
||||
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::Fn)]);
|
||||
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcDumpDefParents;
|
||||
}
|
||||
|
||||
pub(crate) struct RustcDumpItemBounds;
|
||||
|
||||
impl<S: Stage> NoArgsAttributeParser<S> for RustcDumpItemBounds {
|
||||
const PATH: &[Symbol] = &[sym::rustc_dump_item_bounds];
|
||||
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
|
||||
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[Allow(Target::AssocTy)]);
|
||||
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcDumpItemBounds;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
};
|
||||
use crate::attributes::prototype::CustomMirParser;
|
||||
use crate::attributes::repr::{AlignParser, AlignStaticParser, ReprParser};
|
||||
use crate::attributes::rustc_dump::{RustcDumpUserArgs, RustcDumpDefParents};
|
||||
use crate::attributes::rustc_dump::{RustcDumpDefParents, RustcDumpItemBounds, RustcDumpUserArgs};
|
||||
use crate::attributes::rustc_internal::{
|
||||
RustcHasIncoherentInherentImplsParser, RustcLayoutScalarValidRangeEndParser,
|
||||
RustcLayoutScalarValidRangeStartParser, RustcLegacyConstGenericsParser,
|
||||
@@ -268,7 +268,8 @@ mod late {
|
||||
Single<WithoutArgs<ProcMacroParser>>,
|
||||
Single<WithoutArgs<PubTransparentParser>>,
|
||||
Single<WithoutArgs<RustcCoherenceIsCoreParser>>,
|
||||
Single<WithoutArgs<RustcDumpDefParents >>,
|
||||
Single<WithoutArgs<RustcDumpDefParents>>,
|
||||
Single<WithoutArgs<RustcDumpItemBounds>>,
|
||||
Single<WithoutArgs<RustcDumpUserArgs>>,
|
||||
Single<WithoutArgs<RustcHasIncoherentInherentImplsParser>>,
|
||||
Single<WithoutArgs<RustcLintDiagnosticsParser>>,
|
||||
|
||||
@@ -908,7 +908,10 @@ pub enum AttributeKind {
|
||||
|
||||
/// Represents `#[rustc_dump_def_parents]`
|
||||
RustcDumpDefParents,
|
||||
|
||||
|
||||
/// Represents `#[rustc_dump_item_bounds]`
|
||||
RustcDumpItemBounds,
|
||||
|
||||
/// Represents `#[rustc_dump_user_args]`
|
||||
RustcDumpUserArgs,
|
||||
|
||||
|
||||
@@ -98,6 +98,7 @@ pub fn encode_cross_crate(&self) -> EncodeCrossCrate {
|
||||
RustcBuiltinMacro { .. } => Yes,
|
||||
RustcCoherenceIsCore(..) => No,
|
||||
RustcDumpDefParents => No,
|
||||
RustcDumpItemBounds => No,
|
||||
RustcDumpUserArgs => No,
|
||||
RustcHasIncoherentInherentImpls => Yes,
|
||||
RustcLayoutScalarValidRangeEnd(..) => Yes,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::attrs::AttributeKind;
|
||||
use rustc_hir::def_id::{CRATE_DEF_ID, LocalDefId};
|
||||
use rustc_hir::{find_attr, intravisit};
|
||||
use rustc_hir::attrs::AttributeKind;
|
||||
use rustc_middle::hir::nested_filter;
|
||||
use rustc_middle::ty::{self, TyCtxt, TypeVisitableExt};
|
||||
use rustc_span::sym;
|
||||
@@ -39,7 +39,7 @@ pub(crate) fn predicates_and_item_bounds(tcx: TyCtxt<'_>) {
|
||||
}
|
||||
diag.emit();
|
||||
}
|
||||
if tcx.has_attr(id, sym::rustc_dump_item_bounds) {
|
||||
if find_attr!(tcx.get_all_attrs(id), AttributeKind::RustcDumpItemBounds) {
|
||||
let bounds = tcx.item_bounds(id).instantiate_identity();
|
||||
let span = tcx.def_span(id);
|
||||
|
||||
|
||||
@@ -310,6 +310,7 @@ fn check_attributes(
|
||||
| AttributeKind::RustcHasIncoherentInherentImpls
|
||||
| AttributeKind::MustNotSupend { .. }
|
||||
| AttributeKind::RustcDumpUserArgs
|
||||
| AttributeKind::RustcDumpItemBounds
|
||||
| AttributeKind::RustcDumpDefParents
|
||||
) => { /* do nothing */ }
|
||||
Attribute::Unparsed(attr_item) => {
|
||||
@@ -386,7 +387,6 @@ fn check_attributes(
|
||||
| sym::rustc_evaluate_where_clauses
|
||||
| sym::rustc_dump_vtable
|
||||
| sym::rustc_delayed_bug_from_inside_query
|
||||
| sym::rustc_dump_item_bounds
|
||||
| sym::rustc_def_path
|
||||
| sym::rustc_partition_reused
|
||||
| sym::rustc_partition_codegened
|
||||
|
||||
Reference in New Issue
Block a user