Skip to content

Commit 828272a

Browse files
Encode CoroutineKind directly
1 parent 3a539c0 commit 828272a

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

Diff for: compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ provide! { tcx, def_id, other, cdata,
241241
rendered_const => { table }
242242
asyncness => { table_direct }
243243
fn_arg_names => { table }
244-
coroutine_kind => { table }
244+
coroutine_kind => { table_direct }
245245
trait_def => { table }
246246
deduced_param_attrs => { table }
247247
is_type_alias_impl_trait => {

Diff for: compiler/rustc_metadata/src/rmeta/encoder.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1428,9 +1428,9 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
14281428
}
14291429
}
14301430
if def_kind == DefKind::Closure
1431-
&& let Some(data) = self.tcx.coroutine_kind(def_id)
1431+
&& let Some(coroutine_kind) = self.tcx.coroutine_kind(def_id)
14321432
{
1433-
record!(self.tables.coroutine_kind[def_id] <- data);
1433+
self.tables.coroutine_kind.set(def_id.index, Some(coroutine_kind));
14341434
}
14351435
if let DefKind::Enum | DefKind::Struct | DefKind::Union = def_kind {
14361436
self.encode_info_for_adt(local_id);

Diff for: compiler/rustc_metadata/src/rmeta/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ define_tables! {
443443
rendered_const: Table<DefIndex, LazyValue<String>>,
444444
asyncness: Table<DefIndex, ty::Asyncness>,
445445
fn_arg_names: Table<DefIndex, LazyArray<Ident>>,
446-
coroutine_kind: Table<DefIndex, LazyValue<hir::CoroutineKind>>,
446+
coroutine_kind: Table<DefIndex, hir::CoroutineKind>,
447447
trait_def: Table<DefIndex, LazyValue<ty::TraitDef>>,
448448
trait_item_def_id: Table<DefIndex, RawDefId>,
449449
expn_that_defined: Table<DefIndex, LazyValue<ExpnId>>,

Diff for: compiler/rustc_metadata/src/rmeta/table.rs

+15
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,21 @@ fixed_size_enum! {
204204
}
205205
}
206206

207+
fixed_size_enum! {
208+
hir::CoroutineKind {
209+
( Coroutine )
210+
( Gen(hir::CoroutineSource::Block) )
211+
( Gen(hir::CoroutineSource::Fn) )
212+
( Gen(hir::CoroutineSource::Closure) )
213+
( Async(hir::CoroutineSource::Block) )
214+
( Async(hir::CoroutineSource::Fn) )
215+
( Async(hir::CoroutineSource::Closure) )
216+
( AsyncGen(hir::CoroutineSource::Block) )
217+
( AsyncGen(hir::CoroutineSource::Fn) )
218+
( AsyncGen(hir::CoroutineSource::Closure) )
219+
}
220+
}
221+
207222
fixed_size_enum! {
208223
ty::AssocItemContainer {
209224
( TraitContainer )

0 commit comments

Comments
 (0)