Skip to content

Commit b0c7418

Browse files
committed
Auto merge of #1194 - RalfJung:no-to-bits, r=RalfJung
avoid Scalar::to_bits
2 parents c0934e1 + 5187e5d commit b0c7418

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/shims/foreign_items/posix.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,18 +205,18 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
205205
this.write_null(dest)?;
206206
}
207207
"pthread_key_delete" => {
208-
let key = this.read_scalar(args[0])?.to_bits(args[0].layout.size)?;
208+
let key = this.force_bits(this.read_scalar(args[0])?.not_undef()?, args[0].layout.size)?;
209209
this.machine.tls.delete_tls_key(key)?;
210210
// Return success (0)
211211
this.write_null(dest)?;
212212
}
213213
"pthread_getspecific" => {
214-
let key = this.read_scalar(args[0])?.to_bits(args[0].layout.size)?;
214+
let key = this.force_bits(this.read_scalar(args[0])?.not_undef()?, args[0].layout.size)?;
215215
let ptr = this.machine.tls.load_tls(key, tcx)?;
216216
this.write_scalar(ptr, dest)?;
217217
}
218218
"pthread_setspecific" => {
219-
let key = this.read_scalar(args[0])?.to_bits(args[0].layout.size)?;
219+
let key = this.force_bits(this.read_scalar(args[0])?.not_undef()?, args[0].layout.size)?;
220220
let new_ptr = this.read_scalar(args[1])?.not_undef()?;
221221
this.machine.tls.store_tls(key, this.test_null(new_ptr)?)?;
222222

0 commit comments

Comments
 (0)