|  | 
| 12 | 12 | //! | 
| 13 | 13 | //! [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/mir/index.html | 
| 14 | 14 | 
 | 
| 15 |  | -use graphviz::IntoCow; | 
| 16 | 15 | use hir::def::CtorKind; | 
| 17 | 16 | use hir::def_id::DefId; | 
| 18 | 17 | use hir::{self, HirId, InlineAsm}; | 
| @@ -327,22 +326,20 @@ impl<'tcx> Mir<'tcx> { | 
| 327 | 326 |         if idx < stmts.len() { | 
| 328 | 327 |             &stmts[idx].source_info | 
| 329 | 328 |         } else { | 
| 330 |  | -            assert!(idx == stmts.len()); | 
|  | 329 | +            assert_eq!(idx, stmts.len()); | 
| 331 | 330 |             &block.terminator().source_info | 
| 332 | 331 |         } | 
| 333 | 332 |     } | 
| 334 | 333 | 
 | 
| 335 | 334 |     /// Check if `sub` is a sub scope of `sup` | 
| 336 | 335 |     pub fn is_sub_scope(&self, mut sub: SourceScope, sup: SourceScope) -> bool { | 
| 337 |  | -        loop { | 
| 338 |  | -            if sub == sup { | 
| 339 |  | -                return true; | 
| 340 |  | -            } | 
|  | 336 | +        while sub != sup { | 
| 341 | 337 |             match self.source_scopes[sub].parent_scope { | 
| 342 | 338 |                 None => return false, | 
| 343 | 339 |                 Some(p) => sub = p, | 
| 344 | 340 |             } | 
| 345 | 341 |         } | 
|  | 342 | +        true | 
| 346 | 343 |     } | 
| 347 | 344 | 
 | 
| 348 | 345 |     /// Return the return type, it always return first element from `local_decls` array | 
| @@ -526,9 +523,7 @@ impl BorrowKind { | 
| 526 | 523 |     pub fn allows_two_phase_borrow(&self) -> bool { | 
| 527 | 524 |         match *self { | 
| 528 | 525 |             BorrowKind::Shared | BorrowKind::Shallow | BorrowKind::Unique => false, | 
| 529 |  | -            BorrowKind::Mut { | 
| 530 |  | -                allow_two_phase_borrow, | 
| 531 |  | -            } => allow_two_phase_borrow, | 
|  | 526 | +            BorrowKind::Mut { allow_two_phase_borrow } => allow_two_phase_borrow, | 
| 532 | 527 |         } | 
| 533 | 528 |     } | 
| 534 | 529 | } | 
| @@ -1574,42 +1569,42 @@ impl<'tcx> TerminatorKind<'tcx> { | 
| 1574 | 1569 |                         }; | 
| 1575 | 1570 |                         fmt_const_val(&mut s, &c).unwrap(); | 
| 1576 | 1571 |                         s.into() | 
| 1577 |  | -                    }).chain(iter::once(String::from("otherwise").into())) | 
|  | 1572 | +                    }).chain(iter::once("otherwise".into())) | 
| 1578 | 1573 |                     .collect() | 
| 1579 | 1574 |             } | 
| 1580 | 1575 |             Call { | 
| 1581 | 1576 |                 destination: Some(_), | 
| 1582 | 1577 |                 cleanup: Some(_), | 
| 1583 | 1578 |                 .. | 
| 1584 |  | -            } => vec!["return".into_cow(), "unwind".into_cow()], | 
|  | 1579 | +            } => vec!["return".into(), "unwind".into()], | 
| 1585 | 1580 |             Call { | 
| 1586 | 1581 |                 destination: Some(_), | 
| 1587 | 1582 |                 cleanup: None, | 
| 1588 | 1583 |                 .. | 
| 1589 |  | -            } => vec!["return".into_cow()], | 
|  | 1584 | +            } => vec!["return".into()], | 
| 1590 | 1585 |             Call { | 
| 1591 | 1586 |                 destination: None, | 
| 1592 | 1587 |                 cleanup: Some(_), | 
| 1593 | 1588 |                 .. | 
| 1594 |  | -            } => vec!["unwind".into_cow()], | 
|  | 1589 | +            } => vec!["unwind".into()], | 
| 1595 | 1590 |             Call { | 
| 1596 | 1591 |                 destination: None, | 
| 1597 | 1592 |                 cleanup: None, | 
| 1598 | 1593 |                 .. | 
| 1599 | 1594 |             } => vec![], | 
| 1600 |  | -            Yield { drop: Some(_), .. } => vec!["resume".into_cow(), "drop".into_cow()], | 
| 1601 |  | -            Yield { drop: None, .. } => vec!["resume".into_cow()], | 
|  | 1595 | +            Yield { drop: Some(_), .. } => vec!["resume".into(), "drop".into()], | 
|  | 1596 | +            Yield { drop: None, .. } => vec!["resume".into()], | 
| 1602 | 1597 |             DropAndReplace { unwind: None, .. } | Drop { unwind: None, .. } => { | 
| 1603 |  | -                vec!["return".into_cow()] | 
|  | 1598 | +                vec!["return".into()] | 
| 1604 | 1599 |             } | 
| 1605 | 1600 |             DropAndReplace { | 
| 1606 | 1601 |                 unwind: Some(_), .. | 
| 1607 | 1602 |             } | 
| 1608 | 1603 |             | Drop { | 
| 1609 | 1604 |                 unwind: Some(_), .. | 
| 1610 |  | -            } => vec!["return".into_cow(), "unwind".into_cow()], | 
|  | 1605 | +            } => vec!["return".into(), "unwind".into()], | 
| 1611 | 1606 |             Assert { cleanup: None, .. } => vec!["".into()], | 
| 1612 |  | -            Assert { .. } => vec!["success".into_cow(), "unwind".into_cow()], | 
|  | 1607 | +            Assert { .. } => vec!["success".into(), "unwind".into()], | 
| 1613 | 1608 |             FalseEdges { | 
| 1614 | 1609 |                 ref imaginary_targets, | 
| 1615 | 1610 |                 .. | 
|  | 
0 commit comments