Add generator_kind table.
This commit is contained in:
parent
381d32e7d6
commit
7afcf9fcd1
4 changed files with 5 additions and 10 deletions
|
@ -1439,13 +1439,6 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn generator_kind(self, id: DefIndex) -> Option<hir::GeneratorKind> {
|
|
||||||
match self.kind(id) {
|
|
||||||
EntryKind::Generator(data) => Some(data),
|
|
||||||
_ => None,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn def_key(self, index: DefIndex) -> DefKey {
|
fn def_key(self, index: DefIndex) -> DefKey {
|
||||||
*self
|
*self
|
||||||
|
|
|
@ -140,6 +140,7 @@ provide! { <'tcx> tcx, def_id, other, cdata,
|
||||||
rendered_const => { table }
|
rendered_const => { table }
|
||||||
asyncness => { table }
|
asyncness => { table }
|
||||||
fn_arg_names => { table }
|
fn_arg_names => { table }
|
||||||
|
generator_kind => { table }
|
||||||
|
|
||||||
trait_def => { cdata.get_trait_def(def_id.index, tcx.sess) }
|
trait_def => { cdata.get_trait_def(def_id.index, tcx.sess) }
|
||||||
adt_def => { cdata.get_adt_def(def_id.index, tcx) }
|
adt_def => { cdata.get_adt_def(def_id.index, tcx) }
|
||||||
|
@ -153,7 +154,6 @@ provide! { <'tcx> tcx, def_id, other, cdata,
|
||||||
is_const_fn_raw => { cdata.is_const_fn_raw(def_id.index) }
|
is_const_fn_raw => { cdata.is_const_fn_raw(def_id.index) }
|
||||||
is_foreign_item => { cdata.is_foreign_item(def_id.index) }
|
is_foreign_item => { cdata.is_foreign_item(def_id.index) }
|
||||||
static_mutability => { cdata.static_mutability(def_id.index) }
|
static_mutability => { cdata.static_mutability(def_id.index) }
|
||||||
generator_kind => { cdata.generator_kind(def_id.index) }
|
|
||||||
item_attrs => { tcx.arena.alloc_from_iter(cdata.get_item_attrs(def_id.index, tcx.sess)) }
|
item_attrs => { tcx.arena.alloc_from_iter(cdata.get_item_attrs(def_id.index, tcx.sess)) }
|
||||||
trait_of_item => { cdata.get_trait_of_item(def_id.index) }
|
trait_of_item => { cdata.get_trait_of_item(def_id.index) }
|
||||||
is_mir_available => { cdata.is_item_mir_available(def_id.index) }
|
is_mir_available => { cdata.is_item_mir_available(def_id.index) }
|
||||||
|
|
|
@ -1569,7 +1569,8 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
|
||||||
match ty.kind() {
|
match ty.kind() {
|
||||||
ty::Generator(..) => {
|
ty::Generator(..) => {
|
||||||
let data = self.tcx.generator_kind(def_id).unwrap();
|
let data = self.tcx.generator_kind(def_id).unwrap();
|
||||||
record!(self.tables.kind[def_id.to_def_id()] <- EntryKind::Generator(data));
|
record!(self.tables.kind[def_id.to_def_id()] <- EntryKind::Generator);
|
||||||
|
record!(self.tables.generator_kind[def_id.to_def_id()] <- data);
|
||||||
}
|
}
|
||||||
|
|
||||||
ty::Closure(..) => {
|
ty::Closure(..) => {
|
||||||
|
|
|
@ -312,6 +312,7 @@ define_tables! {
|
||||||
rendered_const: Table<DefIndex, Lazy!(String)>,
|
rendered_const: Table<DefIndex, Lazy!(String)>,
|
||||||
asyncness: Table<DefIndex, Lazy!(hir::IsAsync)>,
|
asyncness: Table<DefIndex, Lazy!(hir::IsAsync)>,
|
||||||
fn_arg_names: Table<DefIndex, Lazy!([Ident])>,
|
fn_arg_names: Table<DefIndex, Lazy!([Ident])>,
|
||||||
|
generator_kind: Table<DefIndex, Lazy!(hir::GeneratorKind)>,
|
||||||
|
|
||||||
trait_item_def_id: Table<DefIndex, Lazy<DefId>>,
|
trait_item_def_id: Table<DefIndex, Lazy<DefId>>,
|
||||||
inherent_impls: Table<DefIndex, Lazy<[DefIndex]>>,
|
inherent_impls: Table<DefIndex, Lazy<[DefIndex]>>,
|
||||||
|
@ -352,7 +353,7 @@ enum EntryKind {
|
||||||
MacroDef(Lazy<MacroDef>),
|
MacroDef(Lazy<MacroDef>),
|
||||||
ProcMacro(MacroKind),
|
ProcMacro(MacroKind),
|
||||||
Closure,
|
Closure,
|
||||||
Generator(hir::GeneratorKind),
|
Generator,
|
||||||
Trait(Lazy<TraitData>),
|
Trait(Lazy<TraitData>),
|
||||||
Impl,
|
Impl,
|
||||||
AssocFn(Lazy<AssocFnData>),
|
AssocFn(Lazy<AssocFnData>),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue