1
Fork 0

Fix BinOp ty assertion and fn_sig for closures

Also added a few more util methods to TyKind to check for specific types.
This commit is contained in:
Celina G. Val 2023-12-11 14:53:39 -08:00
parent 8a3765582c
commit 2f790af726
4 changed files with 167 additions and 12 deletions

View file

@ -213,6 +213,11 @@ impl<'tcx> Context for TablesWrapper<'tcx> {
def.internal(&mut *tables).is_box()
}
fn adt_is_simd(&self, def: AdtDef) -> bool {
let mut tables = self.0.borrow_mut();
def.internal(&mut *tables).repr().simd()
}
fn fn_sig(&self, def: FnDef, args: &GenericArgs) -> PolyFnSig {
let mut tables = self.0.borrow_mut();
let def_id = def.0.internal(&mut *tables);
@ -220,6 +225,13 @@ impl<'tcx> Context for TablesWrapper<'tcx> {
sig.stable(&mut *tables)
}
fn closure_sig(&self, args: &GenericArgs) -> PolyFnSig {
let mut tables = self.0.borrow_mut();
let args_ref = args.internal(&mut *tables);
let sig = args_ref.as_closure().sig();
sig.stable(&mut *tables)
}
fn adt_variants_len(&self, def: AdtDef) -> usize {
let mut tables = self.0.borrow_mut();
def.internal(&mut *tables).variants().len()