File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed
compiler/rustc_middle/src/ty Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -661,12 +661,10 @@ fn polymorphize<'tcx>(
661661 // the unpolymorphized upvar closure would result in a polymorphized closure producing
662662 // multiple mono items (and eventually symbol clashes).
663663 let def_id = instance. def_id ( ) ;
664- let upvars_ty = if tcx. is_closure_or_coroutine ( def_id) {
665- Some ( args. as_closure ( ) . tupled_upvars_ty ( ) )
666- } else if tcx. type_of ( def_id) . skip_binder ( ) . is_coroutine ( ) {
667- Some ( args. as_coroutine ( ) . tupled_upvars_ty ( ) )
668- } else {
669- None
664+ let upvars_ty = match tcx. type_of ( def_id) . skip_binder ( ) . kind ( ) {
665+ ty:: Closure ( ..) => Some ( args. as_closure ( ) . tupled_upvars_ty ( ) ) ,
666+ ty:: Coroutine ( ..) => Some ( args. as_coroutine ( ) . tupled_upvars_ty ( ) ) ,
667+ _ => None ,
670668 } ;
671669 let has_upvars = upvars_ty. is_some_and ( |ty| !ty. tuple_fields ( ) . is_empty ( ) ) ;
672670 debug ! ( "polymorphize: upvars_ty={:?} has_upvars={:?}" , upvars_ty, has_upvars) ;
You can’t perform that action at this time.
0 commit comments