@@ -15,7 +15,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
15
15
& mut self ,
16
16
clk_id_op : & OpTy < ' tcx , Provenance > ,
17
17
tp_op : & OpTy < ' tcx , Provenance > ,
18
- ) -> InterpResult < ' tcx , i32 > {
18
+ ) -> InterpResult < ' tcx , Scalar < Provenance > > {
19
19
// This clock support is deliberately minimal because a lot of clock types have fiddly
20
20
// properties (is it possible for Miri to be suspended independently of the host?). If you
21
21
// have a use for another clock type, please open an issue.
@@ -46,15 +46,15 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
46
46
} else {
47
47
let einval = this. eval_libc ( "EINVAL" ) ?;
48
48
this. set_last_error ( einval) ?;
49
- return Ok ( - 1 ) ;
49
+ return Ok ( Scalar :: from_i32 ( - 1 ) ) ;
50
50
} ;
51
51
52
52
let tv_sec = duration. as_secs ( ) ;
53
53
let tv_nsec = duration. subsec_nanos ( ) ;
54
54
55
55
this. write_int_fields ( & [ tv_sec. into ( ) , tv_nsec. into ( ) ] , & this. deref_operand ( tp_op) ?) ?;
56
56
57
- Ok ( 0 )
57
+ Ok ( Scalar :: from_i32 ( 0 ) )
58
58
}
59
59
60
60
fn gettimeofday (
@@ -160,7 +160,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
160
160
Ok ( -1 ) // Return non-zero on success
161
161
}
162
162
163
- fn mach_absolute_time ( & self ) -> InterpResult < ' tcx , u64 > {
163
+ fn mach_absolute_time ( & self ) -> InterpResult < ' tcx , Scalar < Provenance > > {
164
164
let this = self . eval_context_ref ( ) ;
165
165
166
166
this. assert_target_os ( "macos" , "mach_absolute_time" ) ;
@@ -169,13 +169,16 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
169
169
// This returns a u64, with time units determined dynamically by `mach_timebase_info`.
170
170
// We return plain nanoseconds.
171
171
let duration = Instant :: now ( ) . duration_since ( this. machine . time_anchor ) ;
172
- u64:: try_from ( duration. as_nanos ( ) ) . map_err ( |_| {
172
+ let res = u64:: try_from ( duration. as_nanos ( ) ) . map_err ( |_| {
173
173
err_unsup_format ! ( "programs running longer than 2^64 nanoseconds are not supported" )
174
- . into ( )
175
- } )
174
+ } ) ? ;
175
+ Ok ( Scalar :: from_u64 ( res ) )
176
176
}
177
177
178
- fn mach_timebase_info ( & mut self , info_op : & OpTy < ' tcx , Provenance > ) -> InterpResult < ' tcx , i32 > {
178
+ fn mach_timebase_info (
179
+ & mut self ,
180
+ info_op : & OpTy < ' tcx , Provenance > ,
181
+ ) -> InterpResult < ' tcx , Scalar < Provenance > > {
179
182
let this = self . eval_context_mut ( ) ;
180
183
181
184
this. assert_target_os ( "macos" , "mach_timebase_info" ) ;
@@ -188,7 +191,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
188
191
let ( numer, denom) = ( 1 , 1 ) ;
189
192
this. write_int_fields ( & [ numer. into ( ) , denom. into ( ) ] , & info) ?;
190
193
191
- Ok ( 0 ) // KERN_SUCCESS
194
+ Ok ( Scalar :: from_i32 ( 0 ) ) // KERN_SUCCESS
192
195
}
193
196
194
197
fn nanosleep (
0 commit comments