diff options
| author | bors <bors@rust-lang.org> | 2023-12-22 04:07:40 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-12-22 04:07:40 +0000 |
| commit | ef1b78eabe713a2068a1b0451102853dd2475a7b (patch) | |
| tree | 053b0283bef381022a39b8e197b62dabc65eca2b | |
| parent | aaef5fe4971c42bae088b18e765339f3ec8853d0 (diff) | |
| parent | 828272ad37c6bdaba3c471f4417b92aaf034707b (diff) | |
| download | rust-ef1b78eabe713a2068a1b0451102853dd2475a7b.tar.gz rust-ef1b78eabe713a2068a1b0451102853dd2475a7b.zip | |
Auto merge of #119173 - compiler-errors:direct-coro-kind, r=TaKO8Ki
Encode `CoroutineKind` directly Probably a quick optimization? r? `@ghost`
| -rw-r--r-- | compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_metadata/src/rmeta/encoder.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_metadata/src/rmeta/mod.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_metadata/src/rmeta/table.rs | 15 |
4 files changed, 19 insertions, 4 deletions
diff --git a/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs b/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs index f6cd013d2ef..bb8f4af8e97 100644 --- a/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs +++ b/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs @@ -241,7 +241,7 @@ provide! { tcx, def_id, other, cdata, rendered_const => { table } asyncness => { table_direct } fn_arg_names => { table } - coroutine_kind => { table } + coroutine_kind => { table_direct } trait_def => { table } deduced_param_attrs => { table } is_type_alias_impl_trait => { diff --git a/compiler/rustc_metadata/src/rmeta/encoder.rs b/compiler/rustc_metadata/src/rmeta/encoder.rs index ad3fea65e82..057fb15ac3b 100644 --- a/compiler/rustc_metadata/src/rmeta/encoder.rs +++ b/compiler/rustc_metadata/src/rmeta/encoder.rs @@ -1428,9 +1428,9 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { } } 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 { self.encode_info_for_adt(local_id); diff --git a/compiler/rustc_metadata/src/rmeta/mod.rs b/compiler/rustc_metadata/src/rmeta/mod.rs index a8582284898..235f0e35cae 100644 --- a/compiler/rustc_metadata/src/rmeta/mod.rs +++ b/compiler/rustc_metadata/src/rmeta/mod.rs @@ -443,7 +443,7 @@ define_tables! { rendered_const: Table<DefIndex, LazyValue<String>>, asyncness: Table<DefIndex, ty::Asyncness>, 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_item_def_id: Table<DefIndex, RawDefId>, expn_that_defined: Table<DefIndex, LazyValue<ExpnId>>, diff --git a/compiler/rustc_metadata/src/rmeta/table.rs b/compiler/rustc_metadata/src/rmeta/table.rs index 3fc6d9db331..0f5d4d9476d 100644 --- a/compiler/rustc_metadata/src/rmeta/table.rs +++ b/compiler/rustc_metadata/src/rmeta/table.rs @@ -205,6 +205,21 @@ fixed_size_enum! { } 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! { ty::AssocItemContainer { ( TraitContainer ) ( ImplContainer ) |
