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_const_fn, 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};
let param_idx = (|| {
match p.skip_binders() {
ty::PredicateAtom::Trait(pred, _constness) => {
- if let ty::Param(param) = pred.self_ty().kind {
+ if let ty::Param(param) = pred.self_ty().kind() {
return Some(param.index);
}
}
ty::PredicateAtom::TypeOutlives(ty::OutlivesPredicate(ty, _reg)) => {
- if let ty::Param(param) = ty.kind {
+ if let ty::Param(param) = ty.kind() {
return Some(param.index);
}
}
ty::PredicateAtom::Projection(p) => {
- if let ty::Param(param) = p.projection_ty.self_ty().kind {
+ if let ty::Param(param) = p.projection_ty.self_ty().kind() {
projection = Some(ty::Binder::bind(p));
return Some(param.index);
}
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_const_fn(cx.tcx, did.to_def_id())
+ && !is_unstable_const_fn(cx.tcx, did.to_def_id()).is_some() {
hir::Constness::Const
} else {
hir::Constness::NotConst
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;
}
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;
}
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;
}
let self_arg_ty = sig.input(0).skip_binder();
if self_arg_ty == self_ty {
decl.inputs.values[0].type_ = Generic(String::from("Self"));
- } else if let ty::Ref(_, ty, _) = self_arg_ty.kind {
+ } else if let ty::Ref(_, ty, _) = *self_arg_ty.kind() {
if ty == self_ty {
match decl.inputs.values[0].type_ {
BorrowedRef { ref mut type_, .. } => {
TyKind::Path(hir::QPath::TypeRelative(ref qself, ref segment)) => {
let mut res = Res::Err;
let ty = hir_ty_to_ty(cx.tcx, self);
- if let ty::Projection(proj) = ty.kind {
+ if let ty::Projection(proj) = ty.kind() {
res = Res::Def(DefKind::Trait, proj.trait_ref(cx.tcx).def_id);
}
let trait_path = hir::Path { span: self.span, res, segments: &[] };
impl<'tcx> Clean<Type> for Ty<'tcx> {
fn clean(&self, cx: &DocContext<'_>) -> Type {
debug!("cleaning type: {:?}", self);
- match self.kind {
+ match *self.kind() {
ty::Never => Never,
ty::Bool => Primitive(PrimitiveType::Bool),
ty::Char => Primitive(PrimitiveType::Char),