summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemy Rakic <remy.rakic@gmail.com>2019-12-05 14:59:56 +0100
committerRemy Rakic <remy.rakic@gmail.com>2019-12-05 14:59:56 +0100
commit0f12711dd0e51cc839c66407c77c83560019c224 (patch)
treeb8a4a97342c3665b5442bf380d2c237d70c04b30
parentAuto merge of #66520 - alexcrichton:disable-gdb-wasm, r=eddyb (diff)
downloadrust-0f12711dd0e51cc839c66407c77c83560019c224.tar.gz
rust-0f12711dd0e51cc839c66407c77c83560019c224.tar.bz2
rust-0f12711dd0e51cc839c66407c77c83560019c224.tar.xz
make const-qualif look at more `const fn`s
the unstables ones in libcore, with the unstable feature disabled, were not checked
-rw-r--r--src/librustc_mir/transform/check_consts/mod.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/librustc_mir/transform/check_consts/mod.rs b/src/librustc_mir/transform/check_consts/mod.rs
index 7095b3f..abad622 100644
--- a/src/librustc_mir/transform/check_consts/mod.rs
+++ b/src/librustc_mir/transform/check_consts/mod.rs
@@ -77,7 +77,11 @@ impl ConstKind {
77 let mode = match tcx.hir().body_owner_kind(hir_id) { 77 let mode = match tcx.hir().body_owner_kind(hir_id) {
78 HirKind::Closure => return None, 78 HirKind::Closure => return None,
79 79
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,
81 HirKind::Fn => return None, 85 HirKind::Fn => return None,
82 86
83 HirKind::Const => ConstKind::Const, 87 HirKind::Const => ConstKind::Const,