Auto merge of #119173 - compiler-errors:direct-coro-kind, r=TaKO8Ki
Encode `CoroutineKind` directly Probably a quick optimization? r? `@ghost`
This commit is contained in:
commit
ef1b78eabe
@ -241,7 +241,7 @@ fn into_args(self) -> (DefId, SimplifiedType) {
|
|||||||
rendered_const => { table }
|
rendered_const => { table }
|
||||||
asyncness => { table_direct }
|
asyncness => { table_direct }
|
||||||
fn_arg_names => { table }
|
fn_arg_names => { table }
|
||||||
coroutine_kind => { table }
|
coroutine_kind => { table_direct }
|
||||||
trait_def => { table }
|
trait_def => { table }
|
||||||
deduced_param_attrs => { table }
|
deduced_param_attrs => { table }
|
||||||
is_type_alias_impl_trait => {
|
is_type_alias_impl_trait => {
|
||||||
|
@ -1428,9 +1428,9 @@ fn encode_def_ids(&mut self) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if def_kind == DefKind::Closure
|
if def_kind == DefKind::Closure
|
||||||
&& let Some(data) = self.tcx.coroutine_kind(def_id)
|
&& let Some(coroutine_kind) = self.tcx.coroutine_kind(def_id)
|
||||||
{
|
{
|
||||||
record!(self.tables.coroutine_kind[def_id] <- data);
|
self.tables.coroutine_kind.set(def_id.index, Some(coroutine_kind));
|
||||||
}
|
}
|
||||||
if let DefKind::Enum | DefKind::Struct | DefKind::Union = def_kind {
|
if let DefKind::Enum | DefKind::Struct | DefKind::Union = def_kind {
|
||||||
self.encode_info_for_adt(local_id);
|
self.encode_info_for_adt(local_id);
|
||||||
|
@ -443,7 +443,7 @@ fn encode(&self, buf: &mut FileEncoder) -> LazyTables {
|
|||||||
rendered_const: Table<DefIndex, LazyValue<String>>,
|
rendered_const: Table<DefIndex, LazyValue<String>>,
|
||||||
asyncness: Table<DefIndex, ty::Asyncness>,
|
asyncness: Table<DefIndex, ty::Asyncness>,
|
||||||
fn_arg_names: Table<DefIndex, LazyArray<Ident>>,
|
fn_arg_names: Table<DefIndex, LazyArray<Ident>>,
|
||||||
coroutine_kind: Table<DefIndex, LazyValue<hir::CoroutineKind>>,
|
coroutine_kind: Table<DefIndex, hir::CoroutineKind>,
|
||||||
trait_def: Table<DefIndex, LazyValue<ty::TraitDef>>,
|
trait_def: Table<DefIndex, LazyValue<ty::TraitDef>>,
|
||||||
trait_item_def_id: Table<DefIndex, RawDefId>,
|
trait_item_def_id: Table<DefIndex, RawDefId>,
|
||||||
expn_that_defined: Table<DefIndex, LazyValue<ExpnId>>,
|
expn_that_defined: Table<DefIndex, LazyValue<ExpnId>>,
|
||||||
|
@ -204,6 +204,21 @@ impl FixedSizeEncoding for Option<$ty> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fixed_size_enum! {
|
||||||
|
hir::CoroutineKind {
|
||||||
|
( Coroutine )
|
||||||
|
( Gen(hir::CoroutineSource::Block) )
|
||||||
|
( Gen(hir::CoroutineSource::Fn) )
|
||||||
|
( Gen(hir::CoroutineSource::Closure) )
|
||||||
|
( Async(hir::CoroutineSource::Block) )
|
||||||
|
( Async(hir::CoroutineSource::Fn) )
|
||||||
|
( Async(hir::CoroutineSource::Closure) )
|
||||||
|
( AsyncGen(hir::CoroutineSource::Block) )
|
||||||
|
( AsyncGen(hir::CoroutineSource::Fn) )
|
||||||
|
( AsyncGen(hir::CoroutineSource::Closure) )
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fixed_size_enum! {
|
fixed_size_enum! {
|
||||||
ty::AssocItemContainer {
|
ty::AssocItemContainer {
|
||||||
( TraitContainer )
|
( TraitContainer )
|
||||||
|
Loading…
Reference in New Issue
Block a user