@@ -11,22 +11,21 @@ use std::{hint::unreachable_unchecked, marker::PhantomData, ptr::NonNull};
1111use hir_def:: { GenericDefId , GenericParamId } ;
1212use intern:: InternedRef ;
1313use rustc_type_ir:: {
14- ClosureArgs , ConstVid , CoroutineArgs , CoroutineClosureArgs , FallibleTypeFolder , FnSigTys ,
15- GenericTypeVisitable , Interner , TyKind , TyVid , TypeFoldable , TypeFolder , TypeVisitable ,
16- TypeVisitor , Variance ,
14+ ClosureArgs , ConstVid , CoroutineArgs , CoroutineClosureArgs , FallibleTypeFolder ,
15+ GenericTypeVisitable , Interner , TyVid , TypeFoldable , TypeFolder , TypeVisitable , TypeVisitor ,
16+ Variance ,
1717 inherent:: { GenericArg as _, GenericsOf , IntoKind , SliceLike , Term as _, Ty as _} ,
1818 relate:: { Relate , VarianceDiagInfo } ,
1919 walk:: TypeWalker ,
2020} ;
2121use smallvec:: SmallVec ;
2222
2323use crate :: next_solver:: {
24- ConstInterned , PolyFnSig , RegionInterned , TyInterned , impl_foldable_for_interned_slice,
25- interned_slice,
24+ ConstInterned , RegionInterned , TyInterned , impl_foldable_for_interned_slice, interned_slice,
2625} ;
2726
2827use super :: {
29- Const , DbInterner , EarlyParamRegion , ErrorGuaranteed , ParamConst , Region , SolverDefId , Ty , Tys ,
28+ Const , DbInterner , EarlyParamRegion , ErrorGuaranteed , ParamConst , Region , SolverDefId , Ty ,
3029 generics:: Generics ,
3130} ;
3231
@@ -566,33 +565,6 @@ impl<'db> GenericArgs<'db> {
566565 }
567566 }
568567
569- pub fn closure_sig_untupled ( self ) -> PolyFnSig < ' db > {
570- let TyKind :: FnPtr ( inputs_and_output, hdr) =
571- self . split_closure_args_untupled ( ) . closure_sig_as_fn_ptr_ty . kind ( )
572- else {
573- unreachable ! ( "not a function pointer" )
574- } ;
575- inputs_and_output. with ( hdr)
576- }
577-
578- /// A "sensible" `.split_closure_args()`, where the arguments are not in a tuple.
579- pub fn split_closure_args_untupled ( self ) -> rustc_type_ir:: ClosureArgsParts < DbInterner < ' db > > {
580- // FIXME: should use `ClosureSubst` when possible
581- match self . as_slice ( ) {
582- [ parent_args @ .., closure_kind_ty, sig_ty, tupled_upvars_ty] => {
583- rustc_type_ir:: ClosureArgsParts {
584- parent_args,
585- closure_sig_as_fn_ptr_ty : sig_ty. expect_ty ( ) ,
586- closure_kind_ty : closure_kind_ty. expect_ty ( ) ,
587- tupled_upvars_ty : tupled_upvars_ty. expect_ty ( ) ,
588- }
589- }
590- _ => {
591- unreachable ! ( "unexpected closure sig" ) ;
592- }
593- }
594- }
595-
596568 pub fn types ( self ) -> impl Iterator < Item = Ty < ' db > > {
597569 self . iter ( ) . filter_map ( |it| it. as_type ( ) )
598570 }
@@ -688,27 +660,9 @@ impl<'db> rustc_type_ir::inherent::GenericArgs<DbInterner<'db>> for GenericArgs<
688660 // FIXME: should use `ClosureSubst` when possible
689661 match self . as_slice ( ) {
690662 [ parent_args @ .., closure_kind_ty, sig_ty, tupled_upvars_ty] => {
691- let interner = DbInterner :: conjure ( ) ;
692- // This is stupid, but the next solver expects the first input to actually be a tuple
693- let sig_ty = match sig_ty. expect_ty ( ) . kind ( ) {
694- TyKind :: FnPtr ( sig_tys, header) => Ty :: new (
695- interner,
696- TyKind :: FnPtr (
697- sig_tys. map_bound ( |s| {
698- let inputs = Ty :: new_tup ( interner, s. inputs ( ) ) ;
699- let output = s. output ( ) ;
700- FnSigTys {
701- inputs_and_output : Tys :: new_from_slice ( & [ inputs, output] ) ,
702- }
703- } ) ,
704- header,
705- ) ,
706- ) ,
707- _ => unreachable ! ( "sig_ty should be last" ) ,
708- } ;
709663 rustc_type_ir:: ClosureArgsParts {
710664 parent_args,
711- closure_sig_as_fn_ptr_ty : sig_ty,
665+ closure_sig_as_fn_ptr_ty : sig_ty. expect_ty ( ) ,
712666 closure_kind_ty : closure_kind_ty. expect_ty ( ) ,
713667 tupled_upvars_ty : tupled_upvars_ty. expect_ty ( ) ,
714668 }
0 commit comments