Port #[panic_handler] to the new attribute parsers
This commit is contained in:
parent
c61c2603cf
commit
ee8ca0a89f
3 changed files with 11 additions and 1 deletions
|
|
@ -668,6 +668,15 @@ impl<S: Stage> NoArgsAttributeParser<S> for RustcHasIncoherentInherentImplsParse
|
||||||
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcHasIncoherentInherentImpls;
|
const CREATE: fn(Span) -> AttributeKind = |_| AttributeKind::RustcHasIncoherentInherentImpls;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) struct PanicHandlerParser;
|
||||||
|
|
||||||
|
impl<S: Stage> NoArgsAttributeParser<S> for PanicHandlerParser {
|
||||||
|
const PATH: &[Symbol] = &[sym::panic_handler];
|
||||||
|
const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::Error;
|
||||||
|
const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(ALL_TARGETS); // Targets are checked per lang item in `rustc_passes`
|
||||||
|
const CREATE: fn(Span) -> AttributeKind = |span| AttributeKind::Lang(LangItem::PanicImpl, span);
|
||||||
|
}
|
||||||
|
|
||||||
pub(crate) struct RustcHiddenTypeOfOpaquesParser;
|
pub(crate) struct RustcHiddenTypeOfOpaquesParser;
|
||||||
|
|
||||||
impl<S: Stage> NoArgsAttributeParser<S> for RustcHiddenTypeOfOpaquesParser {
|
impl<S: Stage> NoArgsAttributeParser<S> for RustcHiddenTypeOfOpaquesParser {
|
||||||
|
|
|
||||||
|
|
@ -254,6 +254,7 @@ attribute_parsers!(
|
||||||
Single<WithoutArgs<NoMangleParser>>,
|
Single<WithoutArgs<NoMangleParser>>,
|
||||||
Single<WithoutArgs<NoStdParser>>,
|
Single<WithoutArgs<NoStdParser>>,
|
||||||
Single<WithoutArgs<NonExhaustiveParser>>,
|
Single<WithoutArgs<NonExhaustiveParser>>,
|
||||||
|
Single<WithoutArgs<PanicHandlerParser>>,
|
||||||
Single<WithoutArgs<PanicRuntimeParser>>,
|
Single<WithoutArgs<PanicRuntimeParser>>,
|
||||||
Single<WithoutArgs<ParenSugarParser>>,
|
Single<WithoutArgs<ParenSugarParser>>,
|
||||||
Single<WithoutArgs<PassByValueParser>>,
|
Single<WithoutArgs<PassByValueParser>>,
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
//! * Functions called by the compiler itself.
|
//! * Functions called by the compiler itself.
|
||||||
|
|
||||||
use rustc_ast as ast;
|
use rustc_ast as ast;
|
||||||
use rustc_ast::fmvisit;
|
use rustc_ast::visit;
|
||||||
use rustc_data_structures::fx::FxHashMap;
|
use rustc_data_structures::fx::FxHashMap;
|
||||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||||
use rustc_hir::lang_items::GenericRequirement;
|
use rustc_hir::lang_items::GenericRequirement;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue