Skip to content

Commit 43126f3

Browse files
committed
get rid of min_const_fn references in library/ and rustdoc
1 parent 1ecdaa2 commit 43126f3

File tree

3 files changed

+7
-14
lines changed

3 files changed

+7
-14
lines changed

library/alloc/src/raw_vec.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,11 @@ pub struct RawVec<T, A: Allocator = Global> {
5353
}
5454

5555
impl<T> RawVec<T, Global> {
56-
/// HACK(Centril): This exists because `#[unstable]` `const fn`s needn't conform
57-
/// to `min_const_fn` and so they cannot be called in `min_const_fn`s either.
56+
/// HACK(Centril): This exists because stable `const fn` can only call stable `const fn`, so
57+
/// they cannot call `Self::new()`.
5858
///
59-
/// If you change `RawVec<T>::new` or dependencies, please take care to not
60-
/// introduce anything that would truly violate `min_const_fn`.
61-
///
62-
/// NOTE: We could avoid this hack and check conformance with some
63-
/// `#[rustc_force_min_const_fn]` attribute which requires conformance
64-
/// with `min_const_fn` but does not necessarily allow calling it in
65-
/// `stable(...) const fn` / user code not enabling `foo` when
66-
/// `#[rustc_const_unstable(feature = "foo", issue = "01234")]` is present.
59+
/// If you change `RawVec<T>::new` or dependencies, please take care to not introduce anything
60+
/// that would truly const-call something unstable.
6761
pub const NEW: Self = Self::new();
6862

6963
/// Creates the biggest possible `RawVec` (on the system heap)

src/librustdoc/clean/inline.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ use rustc_hir::def_id::DefId;
1010
use rustc_hir::Mutability;
1111
use rustc_metadata::creader::LoadedMacro;
1212
use rustc_middle::ty::{self, TyCtxt};
13-
use rustc_mir::const_eval::is_min_const_fn;
1413
use rustc_span::hygiene::MacroKind;
1514
use rustc_span::symbol::{kw, sym, Symbol};
1615
use rustc_span::Span;
@@ -210,7 +209,7 @@ fn build_external_function(cx: &mut DocContext<'_>, did: DefId) -> clean::Functi
210209
let sig = cx.tcx.fn_sig(did);
211210

212211
let constness =
213-
if is_min_const_fn(cx.tcx, did) { hir::Constness::Const } else { hir::Constness::NotConst };
212+
if cx.tcx.is_const_fn_raw(did) { hir::Constness::Const } else { hir::Constness::NotConst };
214213
let asyncness = cx.tcx.asyncness(did);
215214
let predicates = cx.tcx.predicates_of(did);
216215
let (generics, decl) = clean::enter_impl_trait(cx, |cx| {

src/librustdoc/clean/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use rustc_middle::middle::resolve_lifetime as rl;
2222
use rustc_middle::ty::fold::TypeFolder;
2323
use rustc_middle::ty::subst::{InternalSubsts, Subst};
2424
use rustc_middle::ty::{self, AdtKind, Lift, Ty, TyCtxt};
25-
use rustc_mir::const_eval::{is_const_fn, is_min_const_fn, is_unstable_const_fn};
25+
use rustc_mir::const_eval::{is_const_fn, is_unstable_const_fn};
2626
use rustc_span::hygiene::{AstPass, MacroKind};
2727
use rustc_span::symbol::{kw, sym, Ident, Symbol};
2828
use rustc_span::{self, ExpnKind};
@@ -1048,7 +1048,7 @@ impl Clean<Item> for ty::AssocItem {
10481048
ty::TraitContainer(_) => self.defaultness.has_value(),
10491049
};
10501050
if provided {
1051-
let constness = if is_min_const_fn(tcx, self.def_id) {
1051+
let constness = if tcx.is_const_fn_raw(self.def_id) {
10521052
hir::Constness::Const
10531053
} else {
10541054
hir::Constness::NotConst

0 commit comments

Comments
 (0)