@@ -8,7 +8,7 @@ use std::iter;
8
8
use std:: ops:: { ControlFlow , Range } ;
9
9
10
10
use hir:: def:: { CtorKind , DefKind } ;
11
- use rustc_abi:: { ExternAbi , FIRST_VARIANT , FieldIdx , VariantIdx } ;
11
+ use rustc_abi:: { FIRST_VARIANT , FieldIdx , VariantIdx } ;
12
12
use rustc_errors:: { ErrorGuaranteed , MultiSpan } ;
13
13
use rustc_hir as hir;
14
14
use rustc_hir:: LangItem ;
@@ -1441,23 +1441,7 @@ impl<'tcx> Ty<'tcx> {
1441
1441
1442
1442
#[ tracing:: instrument( level = "trace" , skip( tcx) ) ]
1443
1443
pub fn fn_sig ( self , tcx : TyCtxt < ' tcx > ) -> PolyFnSig < ' tcx > {
1444
- match self . kind ( ) {
1445
- FnDef ( def_id, args) => tcx. fn_sig ( * def_id) . instantiate ( tcx, args) ,
1446
- FnPtr ( sig_tys, hdr) => sig_tys. with ( * hdr) ,
1447
- Error ( _) => {
1448
- // ignore errors (#54954)
1449
- Binder :: dummy ( ty:: FnSig {
1450
- inputs_and_output : ty:: List :: empty ( ) ,
1451
- c_variadic : false ,
1452
- safety : hir:: Safety :: Safe ,
1453
- abi : ExternAbi :: Rust ,
1454
- } )
1455
- }
1456
- Closure ( ..) => bug ! (
1457
- "to get the signature of a closure, use `args.as_closure().sig()` not `fn_sig()`" ,
1458
- ) ,
1459
- _ => bug ! ( "Ty::fn_sig() called on non-fn type: {:?}" , self ) ,
1460
- }
1444
+ rustc_type_ir:: inherent:: Ty :: fn_sig ( self , tcx)
1461
1445
}
1462
1446
1463
1447
#[ inline]
@@ -2043,32 +2027,7 @@ impl<'tcx> Ty<'tcx> {
2043
2027
/// nested types may be further simplified, the outermost [`TyKind`] or
2044
2028
/// type constructor remains the same.
2045
2029
pub fn is_known_rigid ( self ) -> bool {
2046
- match self . kind ( ) {
2047
- Bool
2048
- | Char
2049
- | Int ( _)
2050
- | Uint ( _)
2051
- | Float ( _)
2052
- | Adt ( _, _)
2053
- | Foreign ( _)
2054
- | Str
2055
- | Array ( _, _)
2056
- | Pat ( _, _)
2057
- | Slice ( _)
2058
- | RawPtr ( _, _)
2059
- | Ref ( _, _, _)
2060
- | FnDef ( _, _)
2061
- | FnPtr ( ..)
2062
- | Dynamic ( _, _, _)
2063
- | Closure ( _, _)
2064
- | CoroutineClosure ( _, _)
2065
- | Coroutine ( _, _)
2066
- | CoroutineWitness ( ..)
2067
- | Never
2068
- | Tuple ( _)
2069
- | UnsafeBinder ( _) => true ,
2070
- Error ( _) | Infer ( _) | Alias ( _, _) | Param ( _) | Bound ( _, _) | Placeholder ( _) => false ,
2071
- }
2030
+ rustc_type_ir:: inherent:: Ty :: is_known_rigid ( self )
2072
2031
}
2073
2032
}
2074
2033
0 commit comments