Skip to content

Commit 0f12711

Browse files
committed
make const-qualif look at more const fns
the unstables ones in libcore, with the unstable feature disabled, were not checked
1 parent d825e35 commit 0f12711

File tree

1 file changed

+5
-1
lines changed
  • src/librustc_mir/transform/check_consts

1 file changed

+5
-1
lines changed

src/librustc_mir/transform/check_consts/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,11 @@ impl ConstKind {
7777
let mode = match tcx.hir().body_owner_kind(hir_id) {
7878
HirKind::Closure => return None,
7979

80-
HirKind::Fn if tcx.is_const_fn(def_id) => ConstKind::ConstFn,
80+
// Note: this is deliberately checking for `is_const_fn_raw`, as the `is_const_fn`
81+
// checks take into account the `rustc_const_unstable` attribute combined with enabled
82+
// feature gates. An unstable `const fn` could otherwise be considered "not const"
83+
// by const qualification. See issue #67053 for more details.
84+
HirKind::Fn if tcx.is_const_fn_raw(def_id) => ConstKind::ConstFn,
8185
HirKind::Fn => return None,
8286

8387
HirKind::Const => ConstKind::Const,

0 commit comments

Comments
 (0)