fn handle_const_fn_call(&mut self,
                            expr: &hir::Expr,
                            def_id: DefId,
                            ret_ty: Ty<'tcx>)
                            -> bool {
        if let Some(fn_like) = const_eval::lookup_const_fn_by_id(self.tcx, def_id) {
            if
                // we are in a static/const initializer
                self.mode != Mode::Var &&

                // feature-gate is not enabled
                !self.tcx.sess.features.borrow().const_fn &&

                // this doesn't come from a macro that has #[allow_internal_unstable]
                !self.tcx.sess.codemap().span_allows_unstable(expr.span)
            {
                self.tcx.sess.span_err(
                    expr.span,
                    &format!("const fns are an unstable feature"));
                fileline_help!(
                    self.tcx.sess,
                    expr.span,
                    "in Nightly builds, add `#![feature(const_fn)]` to the crate \
                     attributes to enable");
            }

            let qualif = self.fn_like(fn_like.kind(),
                                      fn_like.decl(),
                                      fn_like.body(),
                                      fn_like.span(),
                                      fn_like.id());
            self.add_qualif(qualif);

            if ret_ty.type_contents(self.tcx).interior_unsafe() {
                self.add_qualif(ConstQualif::MUTABLE_MEM);
            }

            true
        } else {
            false
        }
    }
/// Returns true if the call is to a const fn or method.
Returns true if the call is to a const fn or method.
Returns true if the call is to a const fn or method .
fn handle_const_fn_call(&mut self,
                            expr: &hir::Expr,
                            def_id: DefId,
                            ret_ty: Ty<'tcx>)
                            -> bool {
        if let Some(fn_like) = const_eval::lookup_const_fn_by_id(self.tcx, def_id) {
            if
                // we are in a static/const initializer
                self.mode != Mode::Var &&
                // feature-gate is not enabled
                !self.tcx.sess.features.borrow().const_fn &&
                // this doesn't come from a macro that has #[allow_internal_unstable]
                !self.tcx.sess.codemap().span_allows_unstable(expr.span)
            {
                self.tcx.sess.span_err(
                    expr.span,
                    &format!("const fns are an unstable feature"));
                fileline_help!(
                    self.tcx.sess,
                    expr.span,
                    "in Nightly builds, add `#![feature(const_fn)]` to the crate \
                     attributes to enable");
            }
            let qualif = self.fn_like(fn_like.kind(),
                                      fn_like.decl(),
                                      fn_like.body(),
                                      fn_like.span(),
                                      fn_like.id());
            self.add_qualif(qualif);
            if ret_ty.type_contents(self.tcx).interior_unsafe() {
                self.add_qualif(ConstQualif::MUTABLE_MEM);
            }
            true
        } else {
            false
        }
    }
fn handle_const_fn_call ( & mut self , expr : & hir :: Expr , def_id : DefId , ret_ty : Ty < ' tcx > ) -> bool { if let Some ( fn_like ) = const_eval :: lookup_const_fn_by_id ( self . tcx , def_id ) { if // we are in a static/const initializer self . mode != Mode :: Var && // feature-gate is not enabled ! self . tcx . sess . features . borrow ( ) . const_fn && // this doesn't come from a macro that has #[allow_internal_unstable] ! self . tcx . sess . codemap ( ) . span_allows_unstable ( expr . span ) { self . tcx . sess . span_err ( expr . span , & format ! ( " " ) ) ; fileline_help ! ( self tcx sess expr span " \
 " ) ; } let qualif = self . fn_like ( fn_like . kind ( ) , fn_like . decl ( ) , fn_like . body ( ) , fn_like . span ( ) , fn_like . id ( ) ) ; self . add_qualif ( qualif ) ; if ret_ty . type_contents ( self . tcx ) . interior_unsafe ( ) { self . add_qualif ( ConstQualif :: MUTABLE_MEM ) ; } true } else { false } }
Returns true if the call is to a const fn or method.
Returns true if the call is to a const fn or method .
&mut self
expr
&hir::Expr
def_id
DefId
ret_ty
Ty<'tcx>
&mut self
expr
&hir::Expr
def_id
DefId
ret_ty
Ty<'tcx>