@@ -6,23 +6,6 @@ use rustc_middle::ty::TyCtxt;
6
6
use rustc_span:: symbol:: Symbol ;
7
7
use rustc_target:: spec:: abi:: Abi ;
8
8
9
- /// Whether the `def_id` counts as const fn in your current crate, considering all active
10
- /// feature gates
11
- pub fn is_const_fn ( tcx : TyCtxt < ' _ > , def_id : DefId ) -> bool {
12
- tcx. is_const_fn_raw ( def_id)
13
- && match is_unstable_const_fn ( tcx, def_id) {
14
- Some ( feature_name) => {
15
- // has a `rustc_const_unstable` attribute, check whether the user enabled the
16
- // corresponding feature gate.
17
- tcx. features ( ) . declared_lib_features . iter ( ) . any ( |& ( sym, _) | sym == feature_name)
18
- }
19
- // functions without const stability are either stable user written
20
- // const fn or the user is using feature gates and we thus don't
21
- // care what they do
22
- None => true ,
23
- }
24
- }
25
-
26
9
/// Whether the `def_id` is an unstable const fn and what feature gate is necessary to enable it
27
10
pub fn is_unstable_const_fn ( tcx : TyCtxt < ' _ > , def_id : DefId ) -> Option < Symbol > {
28
11
if tcx. is_const_fn_raw ( def_id) {
@@ -77,7 +60,7 @@ fn is_const_fn_raw(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
77
60
}
78
61
79
62
fn is_promotable_const_fn ( tcx : TyCtxt < ' _ > , def_id : DefId ) -> bool {
80
- is_const_fn ( tcx , def_id)
63
+ tcx . is_const_fn ( def_id)
81
64
&& match tcx. lookup_const_stability ( def_id) {
82
65
Some ( stab) => {
83
66
if cfg ! ( debug_assertions) && stab. promotable {
0 commit comments