diff options
| author | Cameron Steffen <cam.steffen94@gmail.com> | 2022-08-15 14:11:11 -0500 |
|---|---|---|
| committer | Cameron Steffen <cam.steffen94@gmail.com> | 2022-10-07 09:33:46 -0500 |
| commit | ff940db666daeae83c6c71685901c6c14df17018 (patch) | |
| tree | c37efc001506d87ff4547fdd8cbe0cb5768515e0 /compiler/rustc_query_impl/src/keys.rs | |
| parent | e42c4d7218b2596276152c5eb1e69335621f3086 (diff) | |
| download | rust-ff940db666daeae83c6c71685901c6c14df17018.tar.gz rust-ff940db666daeae83c6c71685901c6c14df17018.zip | |
Rewrite representability
Diffstat (limited to 'compiler/rustc_query_impl/src/keys.rs')
| -rw-r--r-- | compiler/rustc_query_impl/src/keys.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/compiler/rustc_query_impl/src/keys.rs b/compiler/rustc_query_impl/src/keys.rs index cdbf734cdbe..8be2e2be86b 100644 --- a/compiler/rustc_query_impl/src/keys.rs +++ b/compiler/rustc_query_impl/src/keys.rs @@ -27,6 +27,10 @@ pub trait Key { fn key_as_def_id(&self) -> Option<DefId> { None } + + fn ty_adt_id(&self) -> Option<DefId> { + None + } } impl Key for () { @@ -407,6 +411,12 @@ impl<'tcx> Key for Ty<'tcx> { fn default_span(&self, _: TyCtxt<'_>) -> Span { DUMMY_SP } + fn ty_adt_id(&self) -> Option<DefId> { + match self.kind() { + ty::Adt(adt, _) => Some(adt.did()), + _ => None, + } + } } impl<'tcx> Key for TyAndLayout<'tcx> { |
