Skip to content

Commit

Permalink
Use is_unstable_const_fn where appropriate
Browse files Browse the repository at this point in the history
  • Loading branch information
slightlyoutofphase committed Sep 12, 2020
1 parent 9911160 commit 9500067
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/librustdoc/clean/mod.rs
Expand Up @@ -23,7 +23,7 @@ use rustc_middle::middle::stability;
use rustc_middle::ty::fold::TypeFolder;
use rustc_middle::ty::subst::InternalSubsts;
use rustc_middle::ty::{self, AdtKind, Lift, Ty, TyCtxt};
use rustc_mir::const_eval::is_min_const_fn;
use rustc_mir::const_eval::{is_min_const_fn, is_unstable_const_fn};
use rustc_span::hygiene::MacroKind;
use rustc_span::symbol::{kw, sym, Ident, Symbol};
use rustc_span::{self, Pos};
Expand Down Expand Up @@ -900,7 +900,7 @@ impl Clean<Item> for doctree::Function<'_> {
enter_impl_trait(cx, || (self.generics.clean(cx), (self.decl, self.body).clean(cx)));

let did = cx.tcx.hir().local_def_id(self.id);
let constness = if is_min_const_fn(cx.tcx, did.to_def_id()) {
let constness = if !is_unstable_const_fn(cx.tcx, did.to_def_id()).is_some() {
hir::Constness::Const
} else {
hir::Constness::NotConst
Expand Down Expand Up @@ -1108,7 +1108,7 @@ impl Clean<Item> for hir::TraitItem<'_> {
hir::TraitItemKind::Fn(ref sig, hir::TraitFn::Provided(body)) => {
let mut m = (sig, &self.generics, body, None).clean(cx);
if m.header.constness == hir::Constness::Const
&& !is_min_const_fn(cx.tcx, local_did.to_def_id())
&& is_unstable_const_fn(cx.tcx, local_did.to_def_id()).is_some()
{
m.header.constness = hir::Constness::NotConst;
}
Expand All @@ -1121,7 +1121,7 @@ impl Clean<Item> for hir::TraitItem<'_> {
let (all_types, ret_types) = get_all_types(&generics, &decl, cx);
let mut t = TyMethod { header: sig.header, decl, generics, all_types, ret_types };
if t.header.constness == hir::Constness::Const
&& !is_min_const_fn(cx.tcx, local_did.to_def_id())
&& is_unstable_const_fn(cx.tcx, local_did.to_def_id()).is_some()
{
t.header.constness = hir::Constness::NotConst;
}
Expand Down Expand Up @@ -1154,7 +1154,7 @@ impl Clean<Item> for hir::ImplItem<'_> {
hir::ImplItemKind::Fn(ref sig, body) => {
let mut m = (sig, &self.generics, body, Some(self.defaultness)).clean(cx);
if m.header.constness == hir::Constness::Const
&& !is_min_const_fn(cx.tcx, local_did.to_def_id())
&& is_unstable_const_fn(cx.tcx, local_did.to_def_id()).is_some()
{
m.header.constness = hir::Constness::NotConst;
}
Expand Down

0 comments on commit 9500067

Please sign in to comment.