@@ -104,7 +104,10 @@ impl<'tcx> GotocHook<'tcx> for Assume {
104104 let loc = tcx. codegen_span_option2 ( span) ;
105105
106106 Stmt :: block (
107- vec ! [ Stmt :: assume( cond, loc. clone( ) ) , Stmt :: goto( tcx. find_label( & target) , loc. clone( ) ) ] ,
107+ vec ! [
108+ Stmt :: assume( cond, loc. clone( ) ) ,
109+ Stmt :: goto( tcx. current_fn( ) . find_label( & target) , loc. clone( ) ) ,
110+ ] ,
108111 loc,
109112 )
110113 }
@@ -132,7 +135,7 @@ impl<'tcx> GotocHook<'tcx> for Nondet {
132135 let target = target. unwrap ( ) ;
133136 let pt = tcx. place_ty ( & p) ;
134137 if pt. is_unit ( ) {
135- Stmt :: goto ( tcx. find_label ( & target) , loc)
138+ Stmt :: goto ( tcx. current_fn ( ) . find_label ( & target) , loc)
136139 } else {
137140 let pe = tcx. codegen_place ( & p) . goto_expr ;
138141 Stmt :: block (
@@ -143,7 +146,7 @@ impl<'tcx> GotocHook<'tcx> for Nondet {
143146 None => Stmt :: skip( loc. clone( ) ) ,
144147 Some ( f) => Stmt :: assume( f. call( vec![ pe. address_of( ) ] ) , loc. clone( ) ) ,
145148 } ,
146- Stmt :: goto( tcx. find_label( & target) , loc. clone( ) ) ,
149+ Stmt :: goto( tcx. current_fn ( ) . find_label( & target) , loc. clone( ) ) ,
147150 ] ,
148151 loc,
149152 )
@@ -229,7 +232,7 @@ impl<'tcx> GotocHook<'tcx> for Intrinsic {
229232 Stmt :: block (
230233 vec ! [
231234 tcx. codegen_intrinsic( instance, fargs, & p, span) ,
232- Stmt :: goto( tcx. find_label( & target) , loc. clone( ) ) ,
235+ Stmt :: goto( tcx. current_fn ( ) . find_label( & target) , loc. clone( ) ) ,
233236 ] ,
234237 loc,
235238 )
@@ -263,7 +266,7 @@ impl<'tcx> GotocHook<'tcx> for MemReplace {
263266 let place_layout = tcx. layout_of ( place_type) ;
264267 let place_is_zst = place_layout. is_zst ( ) ;
265268 if place_is_zst {
266- Stmt :: block ( vec ! [ Stmt :: goto( tcx. find_label( & target) , loc. clone( ) ) ] , loc)
269+ Stmt :: block ( vec ! [ Stmt :: goto( tcx. current_fn ( ) . find_label( & target) , loc. clone( ) ) ] , loc)
267270 } else {
268271 let dest = fargs. remove ( 0 ) ;
269272 let src = fargs. remove ( 0 ) ;
@@ -273,7 +276,7 @@ impl<'tcx> GotocHook<'tcx> for MemReplace {
273276 . goto_expr
274277 . assign( dest. clone( ) . dereference( ) . with_location( loc. clone( ) ) , loc. clone( ) ) ,
275278 dest. dereference( ) . assign( src, loc. clone( ) ) ,
276- Stmt :: goto( tcx. find_label( & target) , loc. clone( ) ) ,
279+ Stmt :: goto( tcx. current_fn ( ) . find_label( & target) , loc. clone( ) ) ,
277280 ] ,
278281 loc,
279282 )
@@ -336,7 +339,7 @@ impl<'tcx> GotocHook<'tcx> for MemSwap {
336339 Stmt :: block (
337340 vec ! [
338341 tcx. find_function( & func_name) . unwrap( ) . call( vec![ x, y] ) . as_stmt( loc. clone( ) ) ,
339- Stmt :: goto( tcx. find_label( & target) , loc. clone( ) ) ,
342+ Stmt :: goto( tcx. current_fn ( ) . find_label( & target) , loc. clone( ) ) ,
340343 ] ,
341344 loc,
342345 )
@@ -374,7 +377,7 @@ impl<'tcx> GotocHook<'tcx> for PtrRead {
374377 tcx. codegen_place( & p)
375378 . goto_expr
376379 . assign( src. dereference( ) . with_location( loc. clone( ) ) , loc. clone( ) ) ,
377- Stmt :: goto( tcx. find_label( & target) , loc. clone( ) ) ,
380+ Stmt :: goto( tcx. current_fn ( ) . find_label( & target) , loc. clone( ) ) ,
378381 ] ,
379382 loc,
380383 )
@@ -410,7 +413,7 @@ impl<'tcx> GotocHook<'tcx> for PtrWrite {
410413 Stmt :: block (
411414 vec ! [
412415 dst. dereference( ) . assign( src, loc. clone( ) ) . with_location( loc. clone( ) ) ,
413- Stmt :: goto( tcx. find_label( & target) , loc. clone( ) ) ,
416+ Stmt :: goto( tcx. current_fn ( ) . find_label( & target) , loc. clone( ) ) ,
414417 ] ,
415418 loc,
416419 )
@@ -446,7 +449,7 @@ impl<'tcx> GotocHook<'tcx> for RustAlloc {
446449 . cast_to( Type :: unsigned_int( 8 ) . to_pointer( ) ) ,
447450 loc,
448451 ) ,
449- Stmt :: goto( tcx. find_label( & target) , Location :: none( ) ) ,
452+ Stmt :: goto( tcx. current_fn ( ) . find_label( & target) , Location :: none( ) ) ,
450453 ] ,
451454 Location :: none ( ) ,
452455 )
@@ -482,7 +485,7 @@ impl<'tcx> GotocHook<'tcx> for RustDealloc {
482485 BuiltinFn :: Free
483486 . call( vec![ ptr. cast_to( Type :: void_pointer( ) ) ] , loc. clone( ) )
484487 . as_stmt( loc. clone( ) ) ,
485- Stmt :: goto( tcx. find_label( & target) , Location :: none( ) ) ,
488+ Stmt :: goto( tcx. current_fn ( ) . find_label( & target) , Location :: none( ) ) ,
486489 ] ,
487490 loc,
488491 )
@@ -524,7 +527,7 @@ impl<'tcx> GotocHook<'tcx> for RustRealloc {
524527 . cast_to( Type :: unsigned_int( 8 ) . to_pointer( ) ) ,
525528 loc. clone( ) ,
526529 ) ,
527- Stmt :: goto( tcx. find_label( & target) , loc. clone( ) ) ,
530+ Stmt :: goto( tcx. current_fn ( ) . find_label( & target) , loc. clone( ) ) ,
528531 ] ,
529532 loc,
530533 )
@@ -560,7 +563,7 @@ impl<'tcx> GotocHook<'tcx> for RustAllocZeroed {
560563 . cast_to( Type :: unsigned_int( 8 ) . to_pointer( ) ) ,
561564 loc. clone( ) ,
562565 ) ,
563- Stmt :: goto( tcx. find_label( & target) , loc. clone( ) ) ,
566+ Stmt :: goto( tcx. current_fn ( ) . find_label( & target) , loc. clone( ) ) ,
564567 ] ,
565568 loc,
566569 )
@@ -601,7 +604,7 @@ impl<'tcx> GotocHook<'tcx> for SliceFromRawPart {
601604 loc. clone ( ) ,
602605 )
603606 . with_location ( loc. clone ( ) ) ;
604- Stmt :: block ( vec ! [ code, Stmt :: goto( tcx. find_label( & target) , loc. clone( ) ) ] , loc)
607+ Stmt :: block ( vec ! [ code, Stmt :: goto( tcx. current_fn ( ) . find_label( & target) , loc. clone( ) ) ] , loc)
605608 }
606609}
607610
0 commit comments