Return ConstAllocation from eval_static_initializer query directly
This commit is contained in:
parent
be6ccf13e3
commit
e2386270df
18 changed files with 53 additions and 82 deletions
|
@ -250,14 +250,14 @@ provide! { tcx, def_id, other, cdata,
|
|||
fn_arg_names => { table }
|
||||
coroutine_kind => { table_direct }
|
||||
coroutine_for_closure => { table }
|
||||
eval_static_initializer_raw => {
|
||||
eval_static_initializer => {
|
||||
Ok(cdata
|
||||
.root
|
||||
.tables
|
||||
.eval_static_initializer_raw
|
||||
.eval_static_initializer
|
||||
.get(cdata, def_id.index)
|
||||
.map(|lazy| lazy.decode((cdata, tcx)))
|
||||
.unwrap_or_else(|| panic!("{def_id:?} does not have eval_static_initializer_raw")))
|
||||
.unwrap_or_else(|| panic!("{def_id:?} does not have eval_static_initializer")))
|
||||
}
|
||||
trait_def => { table }
|
||||
deduced_param_attrs => { table }
|
||||
|
|
|
@ -1454,8 +1454,8 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
|
|||
}
|
||||
if let DefKind::Static(_) = def_kind {
|
||||
if !self.tcx.is_foreign_item(def_id) {
|
||||
let data = self.tcx.eval_static_initializer_raw(def_id).unwrap();
|
||||
record!(self.tables.eval_static_initializer_raw[def_id] <- data);
|
||||
let data = self.tcx.eval_static_initializer(def_id).unwrap();
|
||||
record!(self.tables.eval_static_initializer[def_id] <- data);
|
||||
}
|
||||
}
|
||||
if let DefKind::Enum | DefKind::Struct | DefKind::Union = def_kind {
|
||||
|
|
|
@ -443,7 +443,7 @@ define_tables! {
|
|||
fn_arg_names: Table<DefIndex, LazyArray<Ident>>,
|
||||
coroutine_kind: Table<DefIndex, hir::CoroutineKind>,
|
||||
coroutine_for_closure: Table<DefIndex, RawDefId>,
|
||||
eval_static_initializer_raw: Table<DefIndex, LazyValue<mir::interpret::AllocId>>,
|
||||
eval_static_initializer: Table<DefIndex, LazyValue<mir::interpret::ConstAllocation<'static>>>,
|
||||
trait_def: Table<DefIndex, LazyValue<ty::TraitDef>>,
|
||||
trait_item_def_id: Table<DefIndex, RawDefId>,
|
||||
expn_that_defined: Table<DefIndex, LazyValue<ExpnId>>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue