Improve code per PR comments
- Simplified DefTy::internal - Break down place::ty() method
This commit is contained in:
parent
d3fa6a0e35
commit
d94df62398
3 changed files with 37 additions and 35 deletions
|
@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue