# Function rustc_const_eval::transform::check_consts::is_const_stable_const_fn

source ·

    pub fn is_const_stable_const_fn(tcx: TyCtxt<'_>, def_id: DefId) -> bool

Expand description

Returns `true` if the given `const fn` is “const-stable”.

Panics if the given `DefId` does not refer to a `const fn`.

Const-stability is only relevant for `const fn` within a `staged_api` crate. Only “const-stable” functions can be called in a const-context by users of the stable compiler. “const-stable” functions are subject to more stringent restrictions than “const-unstable” functions: They cannot use unstable features and can only call other “const-stable” functions.