Skip to content

Commit 167e5dc

Browse files
committed
Auto merge of #2403 - RalfJung:rustup, r=RalfJung
rustup
2 parents 7975391 + ff4666f commit 167e5dc

Some content is hidden

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

42 files changed

+627
-520
lines changed

rust-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
29c5a028b0c92aa5da6a8eb6d6585a389fcf1035
1+
a7468c60f8dbf5feb23ad840b174d7e57113a846

src/concurrency/data_race.rs

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -439,11 +439,11 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: MiriEvalContextExt<'mir, 'tcx> {
439439
/// Atomic variant of read_scalar_at_offset.
440440
fn read_scalar_at_offset_atomic(
441441
&self,
442-
op: &OpTy<'tcx, Tag>,
442+
op: &OpTy<'tcx, Provenance>,
443443
offset: u64,
444444
layout: TyAndLayout<'tcx>,
445445
atomic: AtomicReadOrd,
446-
) -> InterpResult<'tcx, ScalarMaybeUninit<Tag>> {
446+
) -> InterpResult<'tcx, ScalarMaybeUninit<Provenance>> {
447447
let this = self.eval_context_ref();
448448
let value_place = this.deref_operand_and_offset(op, offset, layout)?;
449449
this.read_scalar_atomic(&value_place, atomic)
@@ -452,9 +452,9 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: MiriEvalContextExt<'mir, 'tcx> {
452452
/// Atomic variant of write_scalar_at_offset.
453453
fn write_scalar_at_offset_atomic(
454454
&mut self,
455-
op: &OpTy<'tcx, Tag>,
455+
op: &OpTy<'tcx, Provenance>,
456456
offset: u64,
457-
value: impl Into<ScalarMaybeUninit<Tag>>,
457+
value: impl Into<ScalarMaybeUninit<Provenance>>,
458458
layout: TyAndLayout<'tcx>,
459459
atomic: AtomicWriteOrd,
460460
) -> InterpResult<'tcx> {
@@ -466,9 +466,9 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: MiriEvalContextExt<'mir, 'tcx> {
466466
/// Perform an atomic read operation at the memory location.
467467
fn read_scalar_atomic(
468468
&self,
469-
place: &MPlaceTy<'tcx, Tag>,
469+
place: &MPlaceTy<'tcx, Provenance>,
470470
atomic: AtomicReadOrd,
471-
) -> InterpResult<'tcx, ScalarMaybeUninit<Tag>> {
471+
) -> InterpResult<'tcx, ScalarMaybeUninit<Provenance>> {
472472
let this = self.eval_context_ref();
473473
// This will read from the last store in the modification order of this location. In case
474474
// weak memory emulation is enabled, this may not be the store we will pick to actually read from and return.
@@ -485,8 +485,8 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: MiriEvalContextExt<'mir, 'tcx> {
485485
/// Perform an atomic write operation at the memory location.
486486
fn write_scalar_atomic(
487487
&mut self,
488-
val: ScalarMaybeUninit<Tag>,
489-
dest: &MPlaceTy<'tcx, Tag>,
488+
val: ScalarMaybeUninit<Provenance>,
489+
dest: &MPlaceTy<'tcx, Provenance>,
490490
atomic: AtomicWriteOrd,
491491
) -> InterpResult<'tcx> {
492492
let this = self.eval_context_mut();
@@ -504,12 +504,12 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: MiriEvalContextExt<'mir, 'tcx> {
504504
/// Perform an atomic operation on a memory location.
505505
fn atomic_op_immediate(
506506
&mut self,
507-
place: &MPlaceTy<'tcx, Tag>,
508-
rhs: &ImmTy<'tcx, Tag>,
507+
place: &MPlaceTy<'tcx, Provenance>,
508+
rhs: &ImmTy<'tcx, Provenance>,
509509
op: mir::BinOp,
510510
neg: bool,
511511
atomic: AtomicRwOrd,
512-
) -> InterpResult<'tcx, ImmTy<'tcx, Tag>> {
512+
) -> InterpResult<'tcx, ImmTy<'tcx, Provenance>> {
513513
let this = self.eval_context_mut();
514514

515515
this.validate_overlapping_atomic(place)?;
@@ -535,10 +535,10 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: MiriEvalContextExt<'mir, 'tcx> {
535535
/// scalar value, the old value is returned.
536536
fn atomic_exchange_scalar(
537537
&mut self,
538-
place: &MPlaceTy<'tcx, Tag>,
539-
new: ScalarMaybeUninit<Tag>,
538+
place: &MPlaceTy<'tcx, Provenance>,
539+
new: ScalarMaybeUninit<Provenance>,
540540
atomic: AtomicRwOrd,
541-
) -> InterpResult<'tcx, ScalarMaybeUninit<Tag>> {
541+
) -> InterpResult<'tcx, ScalarMaybeUninit<Provenance>> {
542542
let this = self.eval_context_mut();
543543

544544
this.validate_overlapping_atomic(place)?;
@@ -555,11 +555,11 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: MiriEvalContextExt<'mir, 'tcx> {
555555
/// scalar value, the old value is returned.
556556
fn atomic_min_max_scalar(
557557
&mut self,
558-
place: &MPlaceTy<'tcx, Tag>,
559-
rhs: ImmTy<'tcx, Tag>,
558+
place: &MPlaceTy<'tcx, Provenance>,
559+
rhs: ImmTy<'tcx, Provenance>,
560560
min: bool,
561561
atomic: AtomicRwOrd,
562-
) -> InterpResult<'tcx, ImmTy<'tcx, Tag>> {
562+
) -> InterpResult<'tcx, ImmTy<'tcx, Provenance>> {
563563
let this = self.eval_context_mut();
564564

565565
this.validate_overlapping_atomic(place)?;
@@ -595,13 +595,13 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: MiriEvalContextExt<'mir, 'tcx> {
595595
/// identical.
596596
fn atomic_compare_exchange_scalar(
597597
&mut self,
598-
place: &MPlaceTy<'tcx, Tag>,
599-
expect_old: &ImmTy<'tcx, Tag>,
600-
new: ScalarMaybeUninit<Tag>,
598+
place: &MPlaceTy<'tcx, Provenance>,
599+
expect_old: &ImmTy<'tcx, Provenance>,
600+
new: ScalarMaybeUninit<Provenance>,
601601
success: AtomicRwOrd,
602602
fail: AtomicReadOrd,
603603
can_fail_spuriously: bool,
604-
) -> InterpResult<'tcx, Immediate<Tag>> {
604+
) -> InterpResult<'tcx, Immediate<Provenance>> {
605605
use rand::Rng as _;
606606
let this = self.eval_context_mut();
607607

@@ -651,7 +651,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: MiriEvalContextExt<'mir, 'tcx> {
651651
/// associated memory-place and on the current thread.
652652
fn validate_atomic_load(
653653
&self,
654-
place: &MPlaceTy<'tcx, Tag>,
654+
place: &MPlaceTy<'tcx, Provenance>,
655655
atomic: AtomicReadOrd,
656656
) -> InterpResult<'tcx> {
657657
let this = self.eval_context_ref();
@@ -674,7 +674,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: MiriEvalContextExt<'mir, 'tcx> {
674674
/// associated memory-place and on the current thread.
675675
fn validate_atomic_store(
676676
&mut self,
677-
place: &MPlaceTy<'tcx, Tag>,
677+
place: &MPlaceTy<'tcx, Provenance>,
678678
atomic: AtomicWriteOrd,
679679
) -> InterpResult<'tcx> {
680680
let this = self.eval_context_mut();
@@ -697,7 +697,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: MiriEvalContextExt<'mir, 'tcx> {
697697
/// at the associated memory place and on the current thread.
698698
fn validate_atomic_rmw(
699699
&mut self,
700-
place: &MPlaceTy<'tcx, Tag>,
700+
place: &MPlaceTy<'tcx, Provenance>,
701701
atomic: AtomicRwOrd,
702702
) -> InterpResult<'tcx> {
703703
use AtomicRwOrd::*;
@@ -1047,7 +1047,7 @@ trait EvalContextPrivExt<'mir, 'tcx: 'mir>: MiriEvalContextExt<'mir, 'tcx> {
10471047
/// Generic atomic operation implementation
10481048
fn validate_atomic_op<A: Debug + Copy>(
10491049
&self,
1050-
place: &MPlaceTy<'tcx, Tag>,
1050+
place: &MPlaceTy<'tcx, Provenance>,
10511051
atomic: A,
10521052
description: &str,
10531053
mut op: impl FnMut(

src/concurrency/weak_memory.rs

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ use rustc_const_eval::interpret::{
8383
use rustc_data_structures::fx::FxHashMap;
8484

8585
use crate::{
86-
AtomicReadOrd, AtomicRwOrd, AtomicWriteOrd, Tag, ThreadManager, VClock, VTimestamp, VectorIdx,
86+
AtomicReadOrd, AtomicRwOrd, AtomicWriteOrd, Provenance, ThreadManager, VClock, VTimestamp,
87+
VectorIdx,
8788
};
8889

8990
use super::{
@@ -127,7 +128,7 @@ struct StoreElement {
127128
// FIXME: this means the store is either fully initialized or fully uninitialized;
128129
// we will have to change this if we want to support atomics on
129130
// partially initialized data.
130-
val: ScalarMaybeUninit<Tag>,
131+
val: ScalarMaybeUninit<Provenance>,
131132

132133
/// Timestamp of first loads from this store element by each thread
133134
/// Behind a RefCell to keep load op take &self
@@ -174,7 +175,7 @@ impl StoreBufferAlloc {
174175
fn get_or_create_store_buffer<'tcx>(
175176
&self,
176177
range: AllocRange,
177-
init: ScalarMaybeUninit<Tag>,
178+
init: ScalarMaybeUninit<Provenance>,
178179
) -> InterpResult<'tcx, Ref<'_, StoreBuffer>> {
179180
let access_type = self.store_buffers.borrow().access_type(range);
180181
let pos = match access_type {
@@ -199,7 +200,7 @@ impl StoreBufferAlloc {
199200
fn get_or_create_store_buffer_mut<'tcx>(
200201
&mut self,
201202
range: AllocRange,
202-
init: ScalarMaybeUninit<Tag>,
203+
init: ScalarMaybeUninit<Provenance>,
203204
) -> InterpResult<'tcx, &mut StoreBuffer> {
204205
let buffers = self.store_buffers.get_mut();
205206
let access_type = buffers.access_type(range);
@@ -220,7 +221,7 @@ impl StoreBufferAlloc {
220221
}
221222

222223
impl<'mir, 'tcx: 'mir> StoreBuffer {
223-
fn new(init: ScalarMaybeUninit<Tag>) -> Self {
224+
fn new(init: ScalarMaybeUninit<Provenance>) -> Self {
224225
let mut buffer = VecDeque::new();
225226
buffer.reserve(STORE_BUFFER_LIMIT);
226227
let mut ret = Self { buffer };
@@ -253,7 +254,7 @@ impl<'mir, 'tcx: 'mir> StoreBuffer {
253254
is_seqcst: bool,
254255
rng: &mut (impl rand::Rng + ?Sized),
255256
validate: impl FnOnce() -> InterpResult<'tcx>,
256-
) -> InterpResult<'tcx, ScalarMaybeUninit<Tag>> {
257+
) -> InterpResult<'tcx, ScalarMaybeUninit<Provenance>> {
257258
// Having a live borrow to store_buffer while calling validate_atomic_load is fine
258259
// because the race detector doesn't touch store_buffer
259260

@@ -278,7 +279,7 @@ impl<'mir, 'tcx: 'mir> StoreBuffer {
278279

279280
fn buffered_write(
280281
&mut self,
281-
val: ScalarMaybeUninit<Tag>,
282+
val: ScalarMaybeUninit<Provenance>,
282283
global: &DataRaceState,
283284
thread_mgr: &ThreadManager<'_, '_>,
284285
is_seqcst: bool,
@@ -366,7 +367,7 @@ impl<'mir, 'tcx: 'mir> StoreBuffer {
366367
/// ATOMIC STORE IMPL in the paper (except we don't need the location's vector clock)
367368
fn store_impl(
368369
&mut self,
369-
val: ScalarMaybeUninit<Tag>,
370+
val: ScalarMaybeUninit<Provenance>,
370371
index: VectorIdx,
371372
thread_clock: &VClock,
372373
is_seqcst: bool,
@@ -408,7 +409,11 @@ impl StoreElement {
408409
/// buffer regardless of subsequent loads by the same thread; if the earliest load of another
409410
/// thread doesn't happen before the current one, then no subsequent load by the other thread
410411
/// can happen before the current one.
411-
fn load_impl(&self, index: VectorIdx, clocks: &ThreadClockSet) -> ScalarMaybeUninit<Tag> {
412+
fn load_impl(
413+
&self,
414+
index: VectorIdx,
415+
clocks: &ThreadClockSet,
416+
) -> ScalarMaybeUninit<Provenance> {
412417
let _ = self.loads.borrow_mut().try_insert(index, clocks.clock[index]);
413418
self.val
414419
}
@@ -421,7 +426,10 @@ pub(super) trait EvalContextExt<'mir, 'tcx: 'mir>:
421426
// If weak memory emulation is enabled, check if this atomic op imperfectly overlaps with a previous
422427
// atomic read or write. If it does, then we require it to be ordered (non-racy) with all previous atomic
423428
// accesses on all the bytes in range
424-
fn validate_overlapping_atomic(&self, place: &MPlaceTy<'tcx, Tag>) -> InterpResult<'tcx> {
429+
fn validate_overlapping_atomic(
430+
&self,
431+
place: &MPlaceTy<'tcx, Provenance>,
432+
) -> InterpResult<'tcx> {
425433
let this = self.eval_context_ref();
426434
let (alloc_id, base_offset, ..) = this.ptr_get_alloc_id(place.ptr)?;
427435
if let crate::AllocExtra {
@@ -448,10 +456,10 @@ pub(super) trait EvalContextExt<'mir, 'tcx: 'mir>:
448456

449457
fn buffered_atomic_rmw(
450458
&mut self,
451-
new_val: ScalarMaybeUninit<Tag>,
452-
place: &MPlaceTy<'tcx, Tag>,
459+
new_val: ScalarMaybeUninit<Provenance>,
460+
place: &MPlaceTy<'tcx, Provenance>,
453461
atomic: AtomicRwOrd,
454-
init: ScalarMaybeUninit<Tag>,
462+
init: ScalarMaybeUninit<Provenance>,
455463
) -> InterpResult<'tcx> {
456464
let this = self.eval_context_mut();
457465
let (alloc_id, base_offset, ..) = this.ptr_get_alloc_id(place.ptr)?;
@@ -474,11 +482,11 @@ pub(super) trait EvalContextExt<'mir, 'tcx: 'mir>:
474482

475483
fn buffered_atomic_read(
476484
&self,
477-
place: &MPlaceTy<'tcx, Tag>,
485+
place: &MPlaceTy<'tcx, Provenance>,
478486
atomic: AtomicReadOrd,
479-
latest_in_mo: ScalarMaybeUninit<Tag>,
487+
latest_in_mo: ScalarMaybeUninit<Provenance>,
480488
validate: impl FnOnce() -> InterpResult<'tcx>,
481-
) -> InterpResult<'tcx, ScalarMaybeUninit<Tag>> {
489+
) -> InterpResult<'tcx, ScalarMaybeUninit<Provenance>> {
482490
let this = self.eval_context_ref();
483491
if let Some(global) = &this.machine.data_race {
484492
let (alloc_id, base_offset, ..) = this.ptr_get_alloc_id(place.ptr)?;
@@ -510,10 +518,10 @@ pub(super) trait EvalContextExt<'mir, 'tcx: 'mir>:
510518

511519
fn buffered_atomic_write(
512520
&mut self,
513-
val: ScalarMaybeUninit<Tag>,
514-
dest: &MPlaceTy<'tcx, Tag>,
521+
val: ScalarMaybeUninit<Provenance>,
522+
dest: &MPlaceTy<'tcx, Provenance>,
515523
atomic: AtomicWriteOrd,
516-
init: ScalarMaybeUninit<Tag>,
524+
init: ScalarMaybeUninit<Provenance>,
517525
) -> InterpResult<'tcx> {
518526
let this = self.eval_context_mut();
519527
let (alloc_id, base_offset, ..) = this.ptr_get_alloc_id(dest.ptr)?;
@@ -555,9 +563,9 @@ pub(super) trait EvalContextExt<'mir, 'tcx: 'mir>:
555563
/// to perform load_impl on the latest store element
556564
fn perform_read_on_buffered_latest(
557565
&self,
558-
place: &MPlaceTy<'tcx, Tag>,
566+
place: &MPlaceTy<'tcx, Provenance>,
559567
atomic: AtomicReadOrd,
560-
init: ScalarMaybeUninit<Tag>,
568+
init: ScalarMaybeUninit<Provenance>,
561569
) -> InterpResult<'tcx> {
562570
let this = self.eval_context_ref();
563571

src/diagnostics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ pub enum NonHaltingDiagnostic {
6565
CreatedPointerTag(NonZeroU64, Option<(AllocId, AllocRange)>),
6666
/// This `Item` was popped from the borrow stack, either due to an access with the given tag or
6767
/// a deallocation when the second argument is `None`.
68-
PoppedPointerTag(Item, Option<(SbTagExtra, AccessKind)>),
68+
PoppedPointerTag(Item, Option<(ProvenanceExtra, AccessKind)>),
6969
CreatedCallId(CallId),
7070
CreatedAlloc(AllocId, Size, Align, MemoryKind<MiriMemoryKind>),
7171
FreedAlloc(AllocId),

src/eval.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ pub fn create_ecx<'mir, 'tcx: 'mir>(
165165
entry_id: DefId,
166166
entry_type: EntryFnType,
167167
config: &MiriConfig,
168-
) -> InterpResult<'tcx, (InterpCx<'mir, 'tcx, Evaluator<'mir, 'tcx>>, MPlaceTy<'tcx, Tag>)> {
168+
) -> InterpResult<'tcx, (InterpCx<'mir, 'tcx, Evaluator<'mir, 'tcx>>, MPlaceTy<'tcx, Provenance>)> {
169169
let param_env = ty::ParamEnv::reveal_all();
170170
let layout_cx = LayoutCx { tcx, param_env };
171171
let mut ecx = InterpCx::new(
@@ -202,7 +202,7 @@ pub fn create_ecx<'mir, 'tcx: 'mir>(
202202
// Third argument (`argv`): created from `config.args`.
203203
let argv = {
204204
// Put each argument in memory, collect pointers.
205-
let mut argvs = Vec::<Immediate<Tag>>::new();
205+
let mut argvs = Vec::<Immediate<Provenance>>::new();
206206
for arg in config.args.iter() {
207207
// Make space for `0` terminator.
208208
let size = u64::try_from(arg.len()).unwrap().checked_add(1).unwrap();

0 commit comments

Comments
 (0)