Skip to content

Commit a7b01ce

Browse files
committedOct 3, 2024
Auto merge of rust-lang#3935 - RalfJung:rustup, r=RalfJung
Rustup
2 parents 483eb7d + a07399b commit a7b01ce

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+1054
-1002
lines changed
 

‎rust-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
76ed7a1fa40c3f54d3fd3f834e12bf9c932d0146
1+
ad9c494835e746fb7c8a26eeed0ad90e4e834058

‎src/alloc_addresses/mod.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
200200
AllocKind::Dead => unreachable!(),
201201
};
202202
// Ensure this pointer's provenance is exposed, so that it can be used by FFI code.
203-
return Ok(base_ptr.expose_provenance().try_into().unwrap());
203+
return interp_ok(base_ptr.expose_provenance().try_into().unwrap());
204204
}
205205
// We are not in native lib mode, so we control the addresses ourselves.
206206
if let Some((reuse_addr, clock)) =
@@ -209,7 +209,7 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
209209
if let Some(clock) = clock {
210210
ecx.acquire_clock(&clock);
211211
}
212-
Ok(reuse_addr)
212+
interp_ok(reuse_addr)
213213
} else {
214214
// We have to pick a fresh address.
215215
// Leave some space to the previous allocation, to give it some chance to be less aligned.
@@ -234,7 +234,7 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
234234
throw_exhaust!(AddressSpaceFull);
235235
}
236236

237-
Ok(base_addr)
237+
interp_ok(base_addr)
238238
}
239239
}
240240

@@ -248,7 +248,7 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
248248
let global_state = &mut *global_state;
249249

250250
match global_state.base_addr.get(&alloc_id) {
251-
Some(&addr) => Ok(addr),
251+
Some(&addr) => interp_ok(addr),
252252
None => {
253253
// First time we're looking for the absolute address of this allocation.
254254
let base_addr =
@@ -274,7 +274,7 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
274274
};
275275
global_state.int_to_ptr_map.insert(pos, (base_addr, alloc_id));
276276

277-
Ok(base_addr)
277+
interp_ok(base_addr)
278278
}
279279
}
280280
}
@@ -287,20 +287,20 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
287287
let global_state = ecx.machine.alloc_addresses.get_mut();
288288
// In strict mode, we don't need this, so we can save some cycles by not tracking it.
289289
if global_state.provenance_mode == ProvenanceMode::Strict {
290-
return Ok(());
290+
return interp_ok(());
291291
}
292292
// Exposing a dead alloc is a no-op, because it's not possible to get a dead allocation
293293
// via int2ptr.
294294
if !ecx.is_alloc_live(alloc_id) {
295-
return Ok(());
295+
return interp_ok(());
296296
}
297297
trace!("Exposing allocation id {alloc_id:?}");
298298
let global_state = ecx.machine.alloc_addresses.get_mut();
299299
global_state.exposed.insert(alloc_id);
300300
if ecx.machine.borrow_tracker.is_some() {
301301
ecx.expose_tag(alloc_id, tag)?;
302302
}
303-
Ok(())
303+
interp_ok(())
304304
}
305305

306306
fn ptr_from_addr_cast(&self, addr: u64) -> InterpResult<'tcx, Pointer> {
@@ -337,7 +337,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
337337
// cast is fairly irrelevant. Instead we generate this as a "wildcard" pointer, such that
338338
// *every time the pointer is used*, we do an `AllocId` lookup to find the (exposed)
339339
// allocation it might be referencing.
340-
Ok(Pointer::new(Some(Provenance::Wildcard), Size::from_bytes(addr)))
340+
interp_ok(Pointer::new(Some(Provenance::Wildcard), Size::from_bytes(addr)))
341341
}
342342

343343
/// Convert a relative (tcx) pointer to a Miri pointer.
@@ -359,7 +359,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
359359
Size::from_bytes(base_addr),
360360
);
361361
// Add offset with the right kind of pointer-overflowing arithmetic.
362-
Ok(base_ptr.wrapping_offset(offset, ecx))
362+
interp_ok(base_ptr.wrapping_offset(offset, ecx))
363363
}
364364

365365
// This returns some prepared `MiriAllocBytes`, either because `addr_from_alloc_id` reserved
@@ -390,9 +390,9 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
390390
assert_eq!(prepared_alloc_bytes.len(), bytes.len());
391391
// Copy allocation contents into prepared memory.
392392
prepared_alloc_bytes.copy_from_slice(bytes);
393-
Ok(prepared_alloc_bytes)
393+
interp_ok(prepared_alloc_bytes)
394394
} else {
395-
Ok(MiriAllocBytes::from_bytes(std::borrow::Cow::Borrowed(bytes), align))
395+
interp_ok(MiriAllocBytes::from_bytes(std::borrow::Cow::Borrowed(bytes), align))
396396
}
397397
}
398398

0 commit comments

Comments
 (0)
Please sign in to comment.