diff options
| author | Ralf Jung <post@ralfj.de> | 2021-04-25 12:53:55 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2021-04-25 12:54:34 +0200 |
| commit | 1ecdaa29f9bbe33b8ea701fb691c7001894dc83a (patch) | |
| tree | efef8198d33c3cc60bda5e76309b48022acb61f5 | |
| parent | 9082078a26b3f8c6e8c9b55a966b2a6d6f410ea2 (diff) | |
| download | rust-1ecdaa29f9bbe33b8ea701fb691c7001894dc83a.tar.gz rust-1ecdaa29f9bbe33b8ea701fb691c7001894dc83a.zip | |
remove now-unused 'is_min_const_fn'
| -rw-r--r-- | compiler/rustc_mir/src/const_eval/fn_queries.rs | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/compiler/rustc_mir/src/const_eval/fn_queries.rs b/compiler/rustc_mir/src/const_eval/fn_queries.rs index 8c18dfcb8d0..40419a4d201 100644 --- a/compiler/rustc_mir/src/const_eval/fn_queries.rs +++ b/compiler/rustc_mir/src/const_eval/fn_queries.rs @@ -1,4 +1,3 @@ -use rustc_attr as attr; use rustc_hir as hir; use rustc_hir::def_id::{DefId, LocalDefId}; use rustc_middle::hir::map::blocks::FnLikeNode; @@ -34,54 +33,6 @@ pub fn is_unstable_const_fn(tcx: TyCtxt<'_>, def_id: DefId) -> Option<Symbol> { } } -/// Returns `true` if this function must conform to `min_const_fn` -pub fn is_min_const_fn(tcx: TyCtxt<'_>, def_id: DefId) -> bool { - // Bail out if the signature doesn't contain `const` - if !tcx.is_const_fn_raw(def_id) { - return false; - } - - if tcx.features().staged_api { - // In order for a libstd function to be considered min_const_fn - // it needs to be stable and have no `rustc_const_unstable` attribute. - match tcx.lookup_const_stability(def_id) { - // `rustc_const_unstable` functions don't need to conform. - Some(&attr::ConstStability { ref level, .. }) if level.is_unstable() => false, - None => { - if let Some(stab) = tcx.lookup_stability(def_id) { - if stab.level.is_stable() { - tcx.sess.delay_span_bug( - tcx.def_span(def_id), - "stable const functions must have either `rustc_const_stable` or \ - `rustc_const_unstable` attribute", - ); - // While we errored above, because we don't know if we need to conform, we - // err on the "safe" side and require min_const_fn. - true - } else { - // Unstable functions need not conform to min_const_fn. - false - } - } else { - // Internal functions are forced to conform to min_const_fn. - // Annotate the internal function with a const stability attribute if - // you need to use unstable features. - // Note: this is an arbitrary choice that does not affect stability or const - // safety or anything, it just changes whether we need to annotate some - // internal functions with `rustc_const_stable` or with `rustc_const_unstable` - true - } - } - // Everything else needs to conform, because it would be callable from - // other `min_const_fn` functions. - _ => true, - } - } else { - // users enabling the `const_fn` feature gate can do what they want - !tcx.features().const_fn - } -} - pub fn is_parent_const_impl_raw(tcx: TyCtxt<'_>, hir_id: hir::HirId) -> bool { let parent_id = tcx.hir().get_parent_did(hir_id); if !parent_id.is_top_level_module() { is_const_impl_raw(tcx, parent_id) } else { false } |
