259
259
assert_eq ! ( l, 1 ) ;
260
260
261
261
let after_a_call: * const ForthOperation = after_a_call;
262
- let after_a_call: Cell = unsafe { std :: mem :: transmute ( after_a_call) } ;
262
+ let after_a_call: Cell = after_a_call as Cell ;
263
263
assert_eq ! (
264
264
something_from_return_stack, after_a_call,
265
265
"got from stack: ${:x} after_a_call: ${:x}" ,
@@ -449,10 +449,10 @@ test4
449
449
450
450
for number in [ 0 , 1 , -1 , Cell :: MAX / 2 , Cell :: MAX , Cell :: MIN , Cell :: MIN / 2 ] {
451
451
{
452
- let cell_to_modify: Cell = 0 ;
452
+ let mut cell_to_modify: Cell = 0 ;
453
453
environment
454
454
. data_stack
455
- . push ( unsafe { std :: mem :: transmute ( & cell_to_modify) } )
455
+ . push ( & mut cell_to_modify as * mut Cell as Cell )
456
456
. unwrap ( ) ;
457
457
environment. interpret_line ( format ! ( "{} swap !" , number) . as_bytes ( ) ) ;
458
458
assert_eq ! ( cell_to_modify, number) ;
@@ -462,7 +462,7 @@ test4
462
462
let cell_to_read: Cell = number;
463
463
environment
464
464
. data_stack
465
- . push ( unsafe { std :: mem :: transmute ( & cell_to_read) } )
465
+ . push ( & cell_to_read as * const Cell as Cell )
466
466
. unwrap ( ) ;
467
467
environment. interpret_line ( "@" . as_bytes ( ) ) ;
468
468
assert_eq ! ( cell_to_read, environment. data_stack. pop( ) . unwrap( ) ) ;
@@ -471,10 +471,10 @@ test4
471
471
472
472
for number in [ 0 , 1 , 26 , Byte :: MAX , Byte :: MAX / 2 ] {
473
473
{
474
- let byte_to_modify: Byte = 0 ;
474
+ let mut byte_to_modify: Byte = 0 ;
475
475
environment
476
476
. data_stack
477
- . push ( unsafe { std :: mem :: transmute ( & byte_to_modify) } )
477
+ . push ( & mut byte_to_modify as * mut Byte as Cell )
478
478
. unwrap ( ) ;
479
479
environment. interpret_line ( format ! ( "{} swap c!" , number) . as_bytes ( ) ) ;
480
480
assert_eq ! ( byte_to_modify, number) ;
@@ -484,7 +484,7 @@ test4
484
484
let byte_to_read: Byte = number;
485
485
environment
486
486
. data_stack
487
- . push ( unsafe { std :: mem :: transmute ( & byte_to_read) } )
487
+ . push ( & byte_to_read as * const Byte as Cell )
488
488
. unwrap ( ) ;
489
489
environment. interpret_line ( "c@" . as_bytes ( ) ) ;
490
490
assert_eq ! ( byte_to_read as Cell , environment. data_stack. pop( ) . unwrap( ) ) ;
@@ -510,7 +510,7 @@ test4
510
510
511
511
let counted_string_address = * environment. data_stack . last ( ) . unwrap ( ) ;
512
512
let counted_string: & CountedString = unsafe {
513
- std :: mem :: transmute :: < Cell , * const CountedString > ( counted_string_address )
513
+ ( counted_string_address as * const CountedString )
514
514
. as_ref ( )
515
515
. unwrap ( )
516
516
} ;
0 commit comments