update comment to explain the importance of this check more clearly

This commit is contained in:
Remy Rakic 2019-12-05 17:41:25 +01:00
parent 4a760c6ea1
commit 2d83b76080

View File

@ -79,8 +79,9 @@ pub fn for_item(tcx: TyCtxt<'tcx>, def_id: DefId) -> Option<Self> {
// Note: this is deliberately checking for `is_const_fn_raw`, as the `is_const_fn`
// checks take into account the `rustc_const_unstable` attribute combined with enabled
// feature gates. An unstable `const fn` could otherwise be considered "not const"
// by const qualification. See issue #67053 for more details.
// feature gates. Otherwise, const qualification would _not check_ whether this
// function body follows the `const fn` rules, as an unstable `const fn` would
// be considered "not const". More details are available in issue #67053.
HirKind::Fn if tcx.is_const_fn_raw(def_id) => ConstKind::ConstFn,
HirKind::Fn => return None,