File tree Expand file tree Collapse file tree 1 file changed +20
-12
lines changed
compiler/rustc_middle/src Expand file tree Collapse file tree 1 file changed +20
-12
lines changed Original file line number Diff line number Diff line change @@ -138,18 +138,26 @@ impl<'tcx> Value<TyCtxt<'tcx>> for &[ty::Variance] {
138138 cycle_error : & CycleError ,
139139 _guar : ErrorGuaranteed ,
140140 ) -> Self {
141- if let Some ( frame) = cycle_error. cycle . get ( 0 )
142- && frame. query . dep_kind == dep_kinds:: variances_of
143- && let Some ( def_id) = frame. query . def_id
144- {
145- let n = tcx. generics_of ( def_id) . own_params . len ( ) ;
146- vec ! [ ty:: Bivariant ; n] . leak ( )
147- } else {
148- span_bug ! (
149- cycle_error. usage. as_ref( ) . unwrap( ) . 0 ,
150- "only `variances_of` returns `&[ty::Variance]`"
151- ) ;
152- }
141+ search_for_cycle_permutation (
142+ & cycle_error. cycle ,
143+ |cycle| {
144+ if let Some ( frame) = cycle. get ( 0 )
145+ && frame. query . dep_kind == dep_kinds:: variances_of
146+ && let Some ( def_id) = frame. query . def_id
147+ {
148+ let n = tcx. generics_of ( def_id) . own_params . len ( ) ;
149+ ControlFlow :: Break ( vec ! [ ty:: Bivariant ; n] . leak ( ) )
150+ } else {
151+ ControlFlow :: Continue ( ( ) )
152+ }
153+ } ,
154+ || {
155+ span_bug ! (
156+ cycle_error. usage. as_ref( ) . unwrap( ) . 0 ,
157+ "only `variances_of` returns `&[ty::Variance]`"
158+ )
159+ } ,
160+ )
153161 }
154162}
155163
You can’t perform that action at this time.
0 commit comments