mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-26 14:43:24 +00:00
Add generator_kind table.
This commit is contained in:
parent
381d32e7d6
commit
7afcf9fcd1
@ -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]
|
||||
fn def_key(self, index: DefIndex) -> DefKey {
|
||||
*self
|
||||
|
@ -140,6 +140,7 @@ provide! { <'tcx> tcx, def_id, other, cdata,
|
||||
rendered_const => { table }
|
||||
asyncness => { table }
|
||||
fn_arg_names => { table }
|
||||
generator_kind => { table }
|
||||
|
||||
trait_def => { cdata.get_trait_def(def_id.index, tcx.sess) }
|
||||
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_foreign_item => { cdata.is_foreign_item(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)) }
|
||||
trait_of_item => { cdata.get_trait_of_item(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() {
|
||||
ty::Generator(..) => {
|
||||
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(..) => {
|
||||
|
@ -312,6 +312,7 @@ define_tables! {
|
||||
rendered_const: Table<DefIndex, Lazy!(String)>,
|
||||
asyncness: Table<DefIndex, Lazy!(hir::IsAsync)>,
|
||||
fn_arg_names: Table<DefIndex, Lazy!([Ident])>,
|
||||
generator_kind: Table<DefIndex, Lazy!(hir::GeneratorKind)>,
|
||||
|
||||
trait_item_def_id: Table<DefIndex, Lazy<DefId>>,
|
||||
inherent_impls: Table<DefIndex, Lazy<[DefIndex]>>,
|
||||
@ -352,7 +353,7 @@ enum EntryKind {
|
||||
MacroDef(Lazy<MacroDef>),
|
||||
ProcMacro(MacroKind),
|
||||
Closure,
|
||||
Generator(hir::GeneratorKind),
|
||||
Generator,
|
||||
Trait(Lazy<TraitData>),
|
||||
Impl,
|
||||
AssocFn(Lazy<AssocFnData>),
|
||||
|
Loading…
Reference in New Issue
Block a user