diff options
| author | lcnr <rust@lcnr.de> | 2022-03-15 16:30:30 +0100 |
|---|---|---|
| committer | lcnr <rust@lcnr.de> | 2022-03-30 11:23:58 +0200 |
| commit | bef6f3e895beede5bfd5ba4bb12898615c156d59 (patch) | |
| tree | 724e0593725707bbff014409e6b495142830315b /compiler/rustc_metadata/src/rmeta/decoder | |
| parent | 4558a125b6108f3c080e88d7746e1d422b969bef (diff) | |
rework implementation for inherent impls for builtin types
Diffstat (limited to 'compiler/rustc_metadata/src/rmeta/decoder')
| -rw-r--r-- | compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs b/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs index 5ae965ff7fa..7fac668f072 100644 --- a/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs +++ b/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs @@ -81,30 +81,42 @@ macro_rules! provide { // small trait to work around different signature queries all being defined via // the macro above. trait IntoArgs { - fn into_args(self) -> (DefId, DefId); + type Other; + fn into_args(self) -> (DefId, Self::Other); } impl IntoArgs for DefId { - fn into_args(self) -> (DefId, DefId) { - (self, self) + type Other = (); + fn into_args(self) -> (DefId, ()) { + (self, ()) } } impl IntoArgs for CrateNum { - fn into_args(self) -> (DefId, DefId) { - (self.as_def_id(), self.as_def_id()) + type Other = (); + fn into_args(self) -> (DefId, ()) { + (self.as_def_id(), ()) } } impl IntoArgs for (CrateNum, DefId) { + type Other = DefId; fn into_args(self) -> (DefId, DefId) { (self.0.as_def_id(), self.1) } } impl<'tcx> IntoArgs for ty::InstanceDef<'tcx> { - fn into_args(self) -> (DefId, DefId) { - (self.def_id(), self.def_id()) + type Other = (); + fn into_args(self) -> (DefId, ()) { + (self.def_id(), ()) + } +} + +impl IntoArgs for (CrateNum, SimplifiedType) { + type Other = SimplifiedType; + fn into_args(self) -> (DefId, SimplifiedType) { + (self.0.as_def_id(), self.1) } } @@ -199,6 +211,7 @@ provide! { <'tcx> tcx, def_id, other, cdata, traits_in_crate => { tcx.arena.alloc_from_iter(cdata.get_traits()) } implementations_of_trait => { cdata.get_implementations_of_trait(tcx, other) } + crate_incoherent_impls => { cdata.get_incoherent_impls(tcx, other) } dep_kind => { let r = *cdata.dep_kind.lock(); @@ -371,7 +384,6 @@ pub(in crate::rmeta) fn provide(providers: &mut Providers) { .alloc_slice(&CStore::from_tcx(tcx).crate_dependencies_in_postorder(LOCAL_CRATE)) }, crates: |tcx, ()| tcx.arena.alloc_from_iter(CStore::from_tcx(tcx).crates_untracked()), - ..*providers }; } |
