@@ -291,7 +291,6 @@ pub struct Terminator<'tcx> {
291291    pub  kind :  TerminatorKind < ' tcx > , 
292292} 
293293
294- pub  type  Successors < ' a >  = impl  DoubleEndedIterator < Item  = BasicBlock >  + ' a ; 
295294pub  type  SuccessorsMut < ' a >  =
296295    iter:: Chain < std:: option:: IntoIter < & ' a  mut  BasicBlock > ,  slice:: IterMut < ' a ,  BasicBlock > > ; 
297296
@@ -317,47 +316,57 @@ impl<'tcx> TerminatorKind<'tcx> {
317316    pub  fn  if_ ( cond :  Operand < ' tcx > ,  t :  BasicBlock ,  f :  BasicBlock )  -> TerminatorKind < ' tcx >  { 
318317        TerminatorKind :: SwitchInt  {  discr :  cond,  targets :  SwitchTargets :: static_if ( 0 ,  f,  t)  } 
319318    } 
319+ } 
320320
321-     pub  fn  successors ( & self )  -> Successors < ' _ >  { 
322-         use  self :: TerminatorKind :: * ; 
323-         match  * self  { 
324-             Call  {  target :  Some ( t) ,  unwind :  UnwindAction :: Cleanup ( ref  u) ,  .. } 
325-             | Yield  {  resume :  t,  drop :  Some ( ref  u) ,  .. } 
326-             | Drop  {  target :  t,  unwind :  UnwindAction :: Cleanup ( ref  u) ,  .. } 
327-             | Assert  {  target :  t,  unwind :  UnwindAction :: Cleanup ( ref  u) ,  .. } 
328-             | FalseUnwind  {  real_target :  t,  unwind :  UnwindAction :: Cleanup ( ref  u)  } 
329-             | InlineAsm  {  destination :  Some ( t) ,  unwind :  UnwindAction :: Cleanup ( ref  u) ,  .. }  => { 
330-                 Some ( t) . into_iter ( ) . chain ( slice:: from_ref ( u) . into_iter ( ) . copied ( ) ) 
331-             } 
332-             Goto  {  target :  t } 
333-             | Call  {  target :  None ,  unwind :  UnwindAction :: Cleanup ( t) ,  .. } 
334-             | Call  {  target :  Some ( t) ,  unwind :  _,  .. } 
335-             | Yield  {  resume :  t,  drop :  None ,  .. } 
336-             | Drop  {  target :  t,  unwind :  _,  .. } 
337-             | Assert  {  target :  t,  unwind :  _,  .. } 
338-             | FalseUnwind  {  real_target :  t,  unwind :  _ } 
339-             | InlineAsm  {  destination :  None ,  unwind :  UnwindAction :: Cleanup ( t) ,  .. } 
340-             | InlineAsm  {  destination :  Some ( t) ,  unwind :  _,  .. }  => { 
341-                 Some ( t) . into_iter ( ) . chain ( ( & [ ] ) . into_iter ( ) . copied ( ) ) 
342-             } 
343-             UnwindResume 
344-             | UnwindTerminate ( _) 
345-             | CoroutineDrop 
346-             | Return 
347-             | Unreachable 
348-             | Call  {  target :  None ,  unwind :  _,  .. } 
349-             | InlineAsm  {  destination :  None ,  unwind :  _,  .. }  => { 
350-                 None . into_iter ( ) . chain ( ( & [ ] ) . into_iter ( ) . copied ( ) ) 
351-             } 
352-             SwitchInt  {  ref  targets,  .. }  => { 
353-                 None . into_iter ( ) . chain ( targets. targets . iter ( ) . copied ( ) ) 
321+ pub  use  helper:: * ; 
322+ 
323+ mod  helper { 
324+     use  super :: * ; 
325+     pub  type  Successors < ' a >  = impl  DoubleEndedIterator < Item  = BasicBlock >  + ' a ; 
326+     impl < ' tcx >  TerminatorKind < ' tcx >  { 
327+         pub  fn  successors ( & self )  -> Successors < ' _ >  { 
328+             use  self :: TerminatorKind :: * ; 
329+             match  * self  { 
330+                 Call  {  target :  Some ( t) ,  unwind :  UnwindAction :: Cleanup ( ref  u) ,  .. } 
331+                 | Yield  {  resume :  t,  drop :  Some ( ref  u) ,  .. } 
332+                 | Drop  {  target :  t,  unwind :  UnwindAction :: Cleanup ( ref  u) ,  .. } 
333+                 | Assert  {  target :  t,  unwind :  UnwindAction :: Cleanup ( ref  u) ,  .. } 
334+                 | FalseUnwind  {  real_target :  t,  unwind :  UnwindAction :: Cleanup ( ref  u)  } 
335+                 | InlineAsm  { 
336+                     destination :  Some ( t) ,  unwind :  UnwindAction :: Cleanup ( ref  u) ,  ..
337+                 }  => Some ( t) . into_iter ( ) . chain ( slice:: from_ref ( u) . into_iter ( ) . copied ( ) ) , 
338+                 Goto  {  target :  t } 
339+                 | Call  {  target :  None ,  unwind :  UnwindAction :: Cleanup ( t) ,  .. } 
340+                 | Call  {  target :  Some ( t) ,  unwind :  _,  .. } 
341+                 | Yield  {  resume :  t,  drop :  None ,  .. } 
342+                 | Drop  {  target :  t,  unwind :  _,  .. } 
343+                 | Assert  {  target :  t,  unwind :  _,  .. } 
344+                 | FalseUnwind  {  real_target :  t,  unwind :  _ } 
345+                 | InlineAsm  {  destination :  None ,  unwind :  UnwindAction :: Cleanup ( t) ,  .. } 
346+                 | InlineAsm  {  destination :  Some ( t) ,  unwind :  _,  .. }  => { 
347+                     Some ( t) . into_iter ( ) . chain ( ( & [ ] ) . into_iter ( ) . copied ( ) ) 
348+                 } 
349+                 UnwindResume 
350+                 | UnwindTerminate ( _) 
351+                 | CoroutineDrop 
352+                 | Return 
353+                 | Unreachable 
354+                 | Call  {  target :  None ,  unwind :  _,  .. } 
355+                 | InlineAsm  {  destination :  None ,  unwind :  _,  .. }  => { 
356+                     None . into_iter ( ) . chain ( ( & [ ] ) . into_iter ( ) . copied ( ) ) 
357+                 } 
358+                 SwitchInt  {  ref  targets,  .. }  => { 
359+                     None . into_iter ( ) . chain ( targets. targets . iter ( ) . copied ( ) ) 
360+                 } 
361+                 FalseEdge  {  real_target,  ref  imaginary_target }  => Some ( real_target) 
362+                     . into_iter ( ) 
363+                     . chain ( slice:: from_ref ( imaginary_target) . into_iter ( ) . copied ( ) ) , 
354364            } 
355-             FalseEdge  {  real_target,  ref  imaginary_target }  => Some ( real_target) 
356-                 . into_iter ( ) 
357-                 . chain ( slice:: from_ref ( imaginary_target) . into_iter ( ) . copied ( ) ) , 
358365        } 
359366    } 
367+ } 
360368
369+ impl < ' tcx >  TerminatorKind < ' tcx >  { 
361370    pub  fn  successors_mut ( & mut  self )  -> SuccessorsMut < ' _ >  { 
362371        use  self :: TerminatorKind :: * ; 
363372        match  * self  { 
0 commit comments