Rollup merge of #118846 - celinval:smir-ty-methods, r=compiler-errors
Fix BinOp `ty()` assertion and `fn_sig()` for closures `BinOp::ty()` was asserting that the argument types were primitives. However, the primitive check doesn't include pointers, which can be used in a `BinaryOperation`. Thus extend the arguments to include them. Since I had to add methods to check for pointers in TyKind, I just went ahead and added a bunch more utility checks that can be handy for our users and fixed the `fn_sig()` method to also include closures. `@compiler-errors` just wanted to confirm that today no `BinaryOperation` accept SIMD types. Is that correct? r? `@compiler-errors`
This commit is contained in:
commit
d67e80f12d
4 changed files with 156 additions and 13 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue