1
Fork 0

Improve code per PR comments

- Simplified DefTy::internal
 - Break down place::ty() method
This commit is contained in:
Celina G. Val 2023-11-20 06:27:35 -08:00
parent d3fa6a0e35
commit d94df62398
3 changed files with 37 additions and 35 deletions

View file

@ -262,11 +262,7 @@ impl<'tcx> RustcInternal<'tcx> for ClosureKind {
impl<'tcx> RustcInternal<'tcx> for AdtDef {
type T = rustc_ty::AdtDef<'tcx>;
fn internal(&self, tables: &mut Tables<'tcx>) -> Self::T {
let ty = tables.tcx.type_of(self.0.internal(&mut *tables)).instantiate_identity().kind();
let rustc_ty::TyKind::Adt(def, _) = ty else {
panic!("Expected an ADT definition, but found: {ty:?}")
};
*def
tables.tcx.adt_def(self.0.internal(&mut *tables))
}
}