@@ -45,7 +45,7 @@ fn test_stable_mir() -> ControlFlow<()> {
4545    assert ! ( stable_mir:: find_crates( "std" ) . len( )  == 1 ) ; 
4646
4747    let  bar = get_item ( & items,  ( DefKind :: Fn ,  "bar" ) ) . unwrap ( ) ; 
48-     let  body = bar. body ( ) ; 
48+     let  body = bar. expect_body ( ) ; 
4949    assert_eq ! ( body. locals( ) . len( ) ,  2 ) ; 
5050    assert_eq ! ( body. blocks. len( ) ,  1 ) ; 
5151    let  block = & body. blocks [ 0 ] ; 
@@ -60,7 +60,7 @@ fn test_stable_mir() -> ControlFlow<()> {
6060    } 
6161
6262    let  foo_bar = get_item ( & items,  ( DefKind :: Fn ,  "foo_bar" ) ) . unwrap ( ) ; 
63-     let  body = foo_bar. body ( ) ; 
63+     let  body = foo_bar. expect_body ( ) ; 
6464    assert_eq ! ( body. locals( ) . len( ) ,  5 ) ; 
6565    assert_eq ! ( body. blocks. len( ) ,  4 ) ; 
6666    let  block = & body. blocks [ 0 ] ; 
@@ -70,7 +70,7 @@ fn test_stable_mir() -> ControlFlow<()> {
7070    } 
7171
7272    let  types = get_item ( & items,  ( DefKind :: Fn ,  "types" ) ) . unwrap ( ) ; 
73-     let  body = types. body ( ) ; 
73+     let  body = types. expect_body ( ) ; 
7474    assert_eq ! ( body. locals( ) . len( ) ,  6 ) ; 
7575    assert_matches ! ( 
7676        body. locals( ) [ 0 ] . ty. kind( ) , 
@@ -100,7 +100,7 @@ fn test_stable_mir() -> ControlFlow<()> {
100100    ) ; 
101101
102102    let  drop = get_item ( & items,  ( DefKind :: Fn ,  "drop" ) ) . unwrap ( ) ; 
103-     let  body = drop. body ( ) ; 
103+     let  body = drop. expect_body ( ) ; 
104104    assert_eq ! ( body. blocks. len( ) ,  2 ) ; 
105105    let  block = & body. blocks [ 0 ] ; 
106106    match  & block. terminator . kind  { 
@@ -109,7 +109,7 @@ fn test_stable_mir() -> ControlFlow<()> {
109109    } 
110110
111111    let  assert = get_item ( & items,  ( DefKind :: Fn ,  "assert" ) ) . unwrap ( ) ; 
112-     let  body = assert. body ( ) ; 
112+     let  body = assert. expect_body ( ) ; 
113113    assert_eq ! ( body. blocks. len( ) ,  2 ) ; 
114114    let  block = & body. blocks [ 0 ] ; 
115115    match  & block. terminator . kind  { 
@@ -123,7 +123,8 @@ fn test_stable_mir() -> ControlFlow<()> {
123123        match  & block. terminator . kind  { 
124124            stable_mir:: mir:: TerminatorKind :: Call  {  func,  .. }  => { 
125125                let  TyKind :: RigidTy ( ty)  = func. ty ( & body. locals ( ) ) . unwrap ( ) . kind ( )  else  { 
126-                     unreachable ! ( )  } ; 
126+                     unreachable ! ( ) 
127+                 } ; 
127128                let  RigidTy :: FnDef ( def,  args)  = ty else  {  unreachable ! ( )  } ; 
128129                let  next_func = Instance :: resolve ( def,  & args) . unwrap ( ) ; 
129130                match  next_func. body ( ) . unwrap ( ) . locals ( ) [ 1 ] . ty . kind ( )  { 
@@ -138,10 +139,10 @@ fn test_stable_mir() -> ControlFlow<()> {
138139
139140    let  foo_const = get_item ( & items,  ( DefKind :: Const ,  "FOO" ) ) . unwrap ( ) ; 
140141    // Ensure we don't panic trying to get the body of a constant. 
141-     foo_const. body ( ) ; 
142+     foo_const. expect_body ( ) ; 
142143
143144    let  locals_fn = get_item ( & items,  ( DefKind :: Fn ,  "locals" ) ) . unwrap ( ) ; 
144-     let  body = locals_fn. body ( ) ; 
145+     let  body = locals_fn. expect_body ( ) ; 
145146    assert_eq ! ( body. locals( ) . len( ) ,  4 ) ; 
146147    assert_matches ! ( 
147148        body. ret_local( ) . ty. kind( ) , 
@@ -172,8 +173,10 @@ fn get_item<'a>(
172173    item :  ( DefKind ,  & str ) , 
173174)  -> Option < & ' a  stable_mir:: CrateItem >  { 
174175    items. iter ( ) . find ( |crate_item| { 
175-         matches ! ( ( item. 0 ,  crate_item. kind( ) ) ,  ( DefKind :: Fn ,  ItemKind :: Fn )  | ( DefKind :: Const , 
176-             ItemKind :: Const ) )  && crate_item. name ( )  == item. 1 
176+         matches ! ( 
177+             ( item. 0 ,  crate_item. kind( ) ) , 
178+             ( DefKind :: Fn ,  ItemKind :: Fn )  | ( DefKind :: Const ,  ItemKind :: Const ) 
179+         )  && crate_item. name ( )  == item. 1 
177180    } ) 
178181} 
179182
0 commit comments