about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2023-01-22 18:26:38 +0000
committerCamille GILLOT <gillot.camille@gmail.com>2023-06-26 16:45:41 +0000
commit3d9ba07a0e0a0b42a75536a6712affb61e2f2bf1 (patch)
treeccb0e5f62571b4263900c3caa674f59fde370397
parentcbe1578690b8967fbad44ad2210369d7cbec96cb (diff)
downloadrust-3d9ba07a0e0a0b42a75536a6712affb61e2f2bf1.tar.gz
rust-3d9ba07a0e0a0b42a75536a6712affb61e2f2bf1.zip
Use constness query to encode constness.
-rw-r--r--compiler/rustc_metadata/src/rmeta/encoder.rs8
1 files changed, 1 insertions, 7 deletions
diff --git a/compiler/rustc_metadata/src/rmeta/encoder.rs b/compiler/rustc_metadata/src/rmeta/encoder.rs
index f50467ab531..0c5e7d68dae 100644
--- a/compiler/rustc_metadata/src/rmeta/encoder.rs
+++ b/compiler/rustc_metadata/src/rmeta/encoder.rs
@@ -1317,14 +1317,8 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
             }
             if let DefKind::Fn | DefKind::AssocFn = def_kind {
                 self.tables.asyncness.set_some(def_id.index, tcx.asyncness(def_id));
+                self.tables.constness.set_some(def_id.index, tcx.constness(def_id));
                 record_array!(self.tables.fn_arg_names[def_id] <- tcx.fn_arg_names(def_id));
-                let constness = if self.tcx.is_const_fn_raw(def_id) {
-                    hir::Constness::Const
-                } else {
-                    hir::Constness::NotConst
-                };
-                self.tables.constness.set_some(def_id.index, constness);
-
                 record!(self.tables.fn_sig[def_id] <- tcx.fn_sig(def_id));
                 self.tables.is_intrinsic.set(def_id.index, tcx.is_intrinsic(def_id));
             }