1
Fork 0

Introduce new-style attribute parsers for several attributes

note: compiler compiles but librustdoc and clippy don't
This commit is contained in:
Jana Dönszelmann 2025-02-09 22:49:33 +01:00
parent dbd3b7928e
commit 7e0f5b5016
No known key found for this signature in database
50 changed files with 1519 additions and 1342 deletions

View file

@ -4,12 +4,13 @@
//! has interior mutability or needs to be dropped, as well as the visitor that emits errors when
//! it finds operations that are invalid in a certain context.
use rustc_attr_parsing::{AttributeKind, find_attr};
use rustc_errors::DiagCtxtHandle;
use rustc_hir as hir;
use rustc_hir::def_id::{DefId, LocalDefId};
use rustc_middle::ty::{self, PolyFnSig, TyCtxt};
use rustc_middle::{bug, mir};
use rustc_span::Symbol;
use {rustc_attr_parsing as attr, rustc_hir as hir};
pub use self::qualifs::Qualif;
@ -81,7 +82,8 @@ pub fn rustc_allow_const_fn_unstable(
feature_gate: Symbol,
) -> bool {
let attrs = tcx.hir().attrs(tcx.local_def_id_to_hir_id(def_id));
attr::rustc_allow_const_fn_unstable(tcx.sess, attrs).any(|name| name == feature_gate)
find_attr!(attrs, AttributeKind::AllowConstFnUnstable(syms) if syms.contains(&feature_gate))
}
/// Returns `true` if the given `def_id` (trait or function) is "safe to expose on stable".