@@ -25,7 +25,7 @@ pub struct CatchUnwindData<'tcx> {
2525 /// The `catch_fn` callback to call in case of a panic.
2626 catch_fn : Pointer ,
2727 /// The `data` argument for that callback.
28- data : Scalar ,
28+ data : ImmTy < ' tcx > ,
2929 /// The return place from the original call to `try`.
3030 dest : MPlaceTy < ' tcx > ,
3131 /// The return block from the original call to `try`.
@@ -48,9 +48,9 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
4848 fn handle_miri_start_unwind ( & mut self , payload : & OpTy < ' tcx > ) -> InterpResult < ' tcx > {
4949 let this = self . eval_context_mut ( ) ;
5050
51- trace ! ( "miri_start_unwind: {:?}" , this. frame( ) . instance) ;
51+ trace ! ( "miri_start_unwind: {:?}" , this. frame( ) . instance( ) ) ;
5252
53- let payload = this. read_scalar ( payload) ?;
53+ let payload = this. read_immediate ( payload) ?;
5454 let thread = this. active_thread_mut ( ) ;
5555 thread. panic_payloads . push ( payload) ;
5656
@@ -80,7 +80,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
8080 // Get all the arguments.
8181 let [ try_fn, data, catch_fn] = check_arg_count ( args) ?;
8282 let try_fn = this. read_pointer ( try_fn) ?;
83- let data = this. read_scalar ( data) ?;
83+ let data = this. read_immediate ( data) ?;
8484 let catch_fn = this. read_pointer ( catch_fn) ?;
8585
8686 // Now we make a function call, and pass `data` as first and only argument.
@@ -89,7 +89,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
8989 this. call_function (
9090 f_instance,
9191 Abi :: Rust ,
92- & [ data. into ( ) ] ,
92+ & [ data. clone ( ) ] ,
9393 None ,
9494 // Directly return to caller.
9595 StackPopCleanup :: Goto { ret, unwind : mir:: UnwindAction :: Continue } ,
@@ -124,7 +124,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
124124 // and we are unwinding, so we should catch that.
125125 trace ! (
126126 "unwinding: found catch_panic frame during unwinding: {:?}" ,
127- this. frame( ) . instance
127+ this. frame( ) . instance( )
128128 ) ;
129129
130130 // We set the return value of `try` to 1, since there was a panic.
@@ -140,7 +140,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
140140 this. call_function (
141141 f_instance,
142142 Abi :: Rust ,
143- & [ catch_unwind. data . into ( ) , payload. into ( ) ] ,
143+ & [ catch_unwind. data , payload] ,
144144 None ,
145145 // Directly return to caller of `try`.
146146 StackPopCleanup :: Goto {
@@ -169,7 +169,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
169169 this. call_function (
170170 panic,
171171 Abi :: Rust ,
172- & [ msg . to_ref ( this ) ] ,
172+ & [ this . mplace_to_ref ( & msg ) ? ] ,
173173 None ,
174174 StackPopCleanup :: Goto { ret : None , unwind } ,
175175 )
@@ -188,7 +188,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
188188 this. call_function (
189189 panic,
190190 Abi :: Rust ,
191- & [ msg . to_ref ( this ) ] ,
191+ & [ this . mplace_to_ref ( & msg ) ? ] ,
192192 None ,
193193 StackPopCleanup :: Goto { ret : None , unwind : mir:: UnwindAction :: Unreachable } ,
194194 )
@@ -207,17 +207,17 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
207207 // Forward to `panic_bounds_check` lang item.
208208
209209 // First arg: index.
210- let index = this. read_scalar ( & this. eval_operand ( index, None ) ?) ?;
210+ let index = this. read_immediate ( & this. eval_operand ( index, None ) ?) ?;
211211 // Second arg: len.
212- let len = this. read_scalar ( & this. eval_operand ( len, None ) ?) ?;
212+ let len = this. read_immediate ( & this. eval_operand ( len, None ) ?) ?;
213213
214214 // Call the lang item.
215215 let panic_bounds_check = this. tcx . lang_items ( ) . panic_bounds_check_fn ( ) . unwrap ( ) ;
216216 let panic_bounds_check = ty:: Instance :: mono ( this. tcx . tcx , panic_bounds_check) ;
217217 this. call_function (
218218 panic_bounds_check,
219219 Abi :: Rust ,
220- & [ index. into ( ) , len. into ( ) ] ,
220+ & [ index, len] ,
221221 None ,
222222 StackPopCleanup :: Goto { ret : None , unwind } ,
223223 ) ?;
@@ -226,9 +226,9 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
226226 // Forward to `panic_misaligned_pointer_dereference` lang item.
227227
228228 // First arg: required.
229- let required = this. read_scalar ( & this. eval_operand ( required, None ) ?) ?;
229+ let required = this. read_immediate ( & this. eval_operand ( required, None ) ?) ?;
230230 // Second arg: found.
231- let found = this. read_scalar ( & this. eval_operand ( found, None ) ?) ?;
231+ let found = this. read_immediate ( & this. eval_operand ( found, None ) ?) ?;
232232
233233 // Call the lang item.
234234 let panic_misaligned_pointer_dereference =
@@ -238,7 +238,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
238238 this. call_function (
239239 panic_misaligned_pointer_dereference,
240240 Abi :: Rust ,
241- & [ required. into ( ) , found. into ( ) ] ,
241+ & [ required, found] ,
242242 None ,
243243 StackPopCleanup :: Goto { ret : None , unwind } ,
244244 ) ?;
0 commit comments