Use constness query to encode constness.

This commit is contained in:
Camille GILLOT 2023-01-22 18:26:38 +00:00
parent cbe1578690
commit 3d9ba07a0e

View File

@ -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));
}