Skip to content

Commit 1ecdaa2

Browse files
committed
remove now-unused 'is_min_const_fn'
1 parent 9082078 commit 1ecdaa2

File tree

1 file changed

+0
-49
lines changed

1 file changed

+0
-49
lines changed

compiler/rustc_mir/src/const_eval/fn_queries.rs

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use rustc_attr as attr;
21
use rustc_hir as hir;
32
use rustc_hir::def_id::{DefId, LocalDefId};
43
use rustc_middle::hir::map::blocks::FnLikeNode;
@@ -34,54 +33,6 @@ pub fn is_unstable_const_fn(tcx: TyCtxt<'_>, def_id: DefId) -> Option<Symbol> {
3433
}
3534
}
3635

37-
/// Returns `true` if this function must conform to `min_const_fn`
38-
pub fn is_min_const_fn(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
39-
// Bail out if the signature doesn't contain `const`
40-
if !tcx.is_const_fn_raw(def_id) {
41-
return false;
42-
}
43-
44-
if tcx.features().staged_api {
45-
// In order for a libstd function to be considered min_const_fn
46-
// it needs to be stable and have no `rustc_const_unstable` attribute.
47-
match tcx.lookup_const_stability(def_id) {
48-
// `rustc_const_unstable` functions don't need to conform.
49-
Some(&attr::ConstStability { ref level, .. }) if level.is_unstable() => false,
50-
None => {
51-
if let Some(stab) = tcx.lookup_stability(def_id) {
52-
if stab.level.is_stable() {
53-
tcx.sess.delay_span_bug(
54-
tcx.def_span(def_id),
55-
"stable const functions must have either `rustc_const_stable` or \
56-
`rustc_const_unstable` attribute",
57-
);
58-
// While we errored above, because we don't know if we need to conform, we
59-
// err on the "safe" side and require min_const_fn.
60-
true
61-
} else {
62-
// Unstable functions need not conform to min_const_fn.
63-
false
64-
}
65-
} else {
66-
// Internal functions are forced to conform to min_const_fn.
67-
// Annotate the internal function with a const stability attribute if
68-
// you need to use unstable features.
69-
// Note: this is an arbitrary choice that does not affect stability or const
70-
// safety or anything, it just changes whether we need to annotate some
71-
// internal functions with `rustc_const_stable` or with `rustc_const_unstable`
72-
true
73-
}
74-
}
75-
// Everything else needs to conform, because it would be callable from
76-
// other `min_const_fn` functions.
77-
_ => true,
78-
}
79-
} else {
80-
// users enabling the `const_fn` feature gate can do what they want
81-
!tcx.features().const_fn
82-
}
83-
}
84-
8536
pub fn is_parent_const_impl_raw(tcx: TyCtxt<'_>, hir_id: hir::HirId) -> bool {
8637
let parent_id = tcx.hir().get_parent_did(hir_id);
8738
if !parent_id.is_top_level_module() { is_const_impl_raw(tcx, parent_id) } else { false }

0 commit comments

Comments
 (0)