Skip to content

Commit d890a70

Browse files
committed
update for is_null removal
1 parent c02988b commit d890a70

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/fn_call.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ impl<'a, 'mir, 'tcx: 'mir + 'a> EvalContextExt<'tcx, 'mir> for super::MiriEvalCo
132132

133133
"free" => {
134134
let ptr = self.read_scalar(args[0])?.not_undef()?.erase_tag(); // raw ptr operation, no tag
135-
if !ptr.is_null() {
135+
if !ptr.is_null_ptr(&self) {
136136
self.memory.deallocate(
137137
ptr.to_ptr()?.with_default_tag(),
138138
None,
@@ -353,7 +353,7 @@ impl<'a, 'mir, 'tcx: 'mir + 'a> EvalContextExt<'tcx, 'mir> for super::MiriEvalCo
353353
let mut success = None;
354354
{
355355
let name_ptr = self.read_scalar(args[0])?.not_undef()?.erase_tag(); // raw ptr operation
356-
if !name_ptr.is_null() {
356+
if !name_ptr.is_null_ptr(&self) {
357357
let name = self.memory.read_c_str(name_ptr.to_ptr()?.with_default_tag())?;
358358
if !name.is_empty() && !name.contains(&b'=') {
359359
success = Some(self.machine.env_vars.remove(name));
@@ -376,7 +376,7 @@ impl<'a, 'mir, 'tcx: 'mir + 'a> EvalContextExt<'tcx, 'mir> for super::MiriEvalCo
376376
let name_ptr = self.read_scalar(args[0])?.not_undef()?.erase_tag(); // raw ptr operation
377377
let value_ptr = self.read_scalar(args[1])?.to_ptr()?.erase_tag(); // raw ptr operation
378378
let value = self.memory.read_c_str(value_ptr.with_default_tag())?;
379-
if !name_ptr.is_null() {
379+
if !name_ptr.is_null_ptr(&self) {
380380
let name = self.memory.read_c_str(name_ptr.to_ptr()?.with_default_tag())?;
381381
if !name.is_empty() && !name.contains(&b'=') {
382382
new = Some((name.to_owned(), value.to_owned()));

src/intrinsic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ impl<'a, 'mir, 'tcx> EvalContextExt<'tcx> for super::MiriEvalContext<'a, 'mir, '
231231
let a = self.read_value(args[0])?;
232232
let b = self.read_value(args[1])?;
233233
// check x % y != 0
234-
if !self.binary_op_val(mir::BinOp::Rem, a, b)?.0.is_null() {
234+
if self.binary_op_val(mir::BinOp::Rem, a, b)?.0.to_bytes()? != 0 {
235235
return err!(ValidationFailure(format!("exact_div: {:?} cannot be divided by {:?}", a, b)));
236236
}
237237
self.binop_ignore_overflow(mir::BinOp::Div, a, b, dest)?;

src/tls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ impl<'tcx> TlsData<'tcx> {
121121
for (&key, &mut TlsEntry { ref mut data, dtor }) in
122122
thread_local.range_mut((start, Unbounded))
123123
{
124-
if !data.is_null() {
124+
if !data.is_null_ptr(cx) {
125125
if let Some(dtor) = dtor {
126126
let ret = Some((dtor, *data, key));
127127
*data = Scalar::ptr_null(cx);

0 commit comments

Comments
 (0)