@@ -25,7 +25,7 @@ pub struct CatchUnwindData<'tcx> {
25
25
/// The `catch_fn` callback to call in case of a panic.
26
26
catch_fn : Pointer ,
27
27
/// The `data` argument for that callback.
28
- data : Scalar ,
28
+ data : ImmTy < ' tcx > ,
29
29
/// The return place from the original call to `try`.
30
30
dest : MPlaceTy < ' tcx > ,
31
31
/// The return block from the original call to `try`.
@@ -48,9 +48,9 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
48
48
fn handle_miri_start_unwind ( & mut self , payload : & OpTy < ' tcx > ) -> InterpResult < ' tcx > {
49
49
let this = self . eval_context_mut ( ) ;
50
50
51
- trace ! ( "miri_start_unwind: {:?}" , this. frame( ) . instance) ;
51
+ trace ! ( "miri_start_unwind: {:?}" , this. frame( ) . instance( ) ) ;
52
52
53
- let payload = this. read_scalar ( payload) ?;
53
+ let payload = this. read_immediate ( payload) ?;
54
54
let thread = this. active_thread_mut ( ) ;
55
55
thread. panic_payloads . push ( payload) ;
56
56
@@ -80,7 +80,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
80
80
// Get all the arguments.
81
81
let [ try_fn, data, catch_fn] = check_arg_count ( args) ?;
82
82
let try_fn = this. read_pointer ( try_fn) ?;
83
- let data = this. read_scalar ( data) ?;
83
+ let data = this. read_immediate ( data) ?;
84
84
let catch_fn = this. read_pointer ( catch_fn) ?;
85
85
86
86
// 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> {
89
89
this. call_function (
90
90
f_instance,
91
91
Abi :: Rust ,
92
- & [ data. into ( ) ] ,
92
+ & [ data. clone ( ) ] ,
93
93
None ,
94
94
// Directly return to caller.
95
95
StackPopCleanup :: Goto { ret, unwind : mir:: UnwindAction :: Continue } ,
@@ -124,7 +124,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
124
124
// and we are unwinding, so we should catch that.
125
125
trace ! (
126
126
"unwinding: found catch_panic frame during unwinding: {:?}" ,
127
- this. frame( ) . instance
127
+ this. frame( ) . instance( )
128
128
) ;
129
129
130
130
// 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> {
140
140
this. call_function (
141
141
f_instance,
142
142
Abi :: Rust ,
143
- & [ catch_unwind. data . into ( ) , payload. into ( ) ] ,
143
+ & [ catch_unwind. data , payload] ,
144
144
None ,
145
145
// Directly return to caller of `try`.
146
146
StackPopCleanup :: Goto {
@@ -169,7 +169,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
169
169
this. call_function (
170
170
panic,
171
171
Abi :: Rust ,
172
- & [ msg . to_ref ( this ) ] ,
172
+ & [ this . mplace_to_ref ( & msg ) ? ] ,
173
173
None ,
174
174
StackPopCleanup :: Goto { ret : None , unwind } ,
175
175
)
@@ -188,7 +188,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
188
188
this. call_function (
189
189
panic,
190
190
Abi :: Rust ,
191
- & [ msg . to_ref ( this ) ] ,
191
+ & [ this . mplace_to_ref ( & msg ) ? ] ,
192
192
None ,
193
193
StackPopCleanup :: Goto { ret : None , unwind : mir:: UnwindAction :: Unreachable } ,
194
194
)
@@ -207,17 +207,17 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
207
207
// Forward to `panic_bounds_check` lang item.
208
208
209
209
// 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 ) ?) ?;
211
211
// 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 ) ?) ?;
213
213
214
214
// Call the lang item.
215
215
let panic_bounds_check = this. tcx . lang_items ( ) . panic_bounds_check_fn ( ) . unwrap ( ) ;
216
216
let panic_bounds_check = ty:: Instance :: mono ( this. tcx . tcx , panic_bounds_check) ;
217
217
this. call_function (
218
218
panic_bounds_check,
219
219
Abi :: Rust ,
220
- & [ index. into ( ) , len. into ( ) ] ,
220
+ & [ index, len] ,
221
221
None ,
222
222
StackPopCleanup :: Goto { ret : None , unwind } ,
223
223
) ?;
@@ -226,9 +226,9 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
226
226
// Forward to `panic_misaligned_pointer_dereference` lang item.
227
227
228
228
// 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 ) ?) ?;
230
230
// 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 ) ?) ?;
232
232
233
233
// Call the lang item.
234
234
let panic_misaligned_pointer_dereference =
@@ -238,7 +238,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
238
238
this. call_function (
239
239
panic_misaligned_pointer_dereference,
240
240
Abi :: Rust ,
241
- & [ required. into ( ) , found. into ( ) ] ,
241
+ & [ required, found] ,
242
242
None ,
243
243
StackPopCleanup :: Goto { ret : None , unwind } ,
244
244
) ?;
0 commit comments