add new rustc_const_stable_intrinsic attribute for const-stable intrinsics
This commit is contained in:
parent
10723c2896
commit
1f0ed2b0f5
9 changed files with 80 additions and 68 deletions
|
@ -9,6 +9,8 @@ pub struct IntrinsicDef {
|
|||
pub name: Symbol,
|
||||
/// Whether the intrinsic has no meaningful body and all backends need to shim all calls to it.
|
||||
pub must_be_overridden: bool,
|
||||
/// Whether the intrinsic can be invoked from stable const fn
|
||||
pub const_stable: bool,
|
||||
}
|
||||
|
||||
impl TyCtxt<'_> {
|
||||
|
|
|
@ -1789,6 +1789,8 @@ pub fn intrinsic_raw(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<ty::Intrinsi
|
|||
Some(ty::IntrinsicDef {
|
||||
name: tcx.item_name(def_id.into()),
|
||||
must_be_overridden: tcx.has_attr(def_id, sym::rustc_intrinsic_must_be_overridden),
|
||||
const_stable: tcx.has_attr(def_id, sym::rustc_const_stable_intrinsic)
|
||||
|| tcx.lookup_const_stability(def_id).is_some_and(|s| s.is_const_stable()),
|
||||
})
|
||||
} else {
|
||||
None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue