Skip to content

Commit 1c31602

Browse files
committed
TB: rename Active → Unique to match paper
1 parent 0dac2f0 commit 1c31602

25 files changed

+95
-128
lines changed

src/tools/miri/src/borrow_tracker/tree_borrows/diagnostics.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,8 @@ pub(super) enum TransitionError {
244244
ChildAccessForbidden(Permission),
245245
/// A protector was triggered due to an invalid transition that loses
246246
/// too much permissions.
247-
/// For example, if a protected tag goes from `Active` to `Disabled` due
248-
/// to a foreign write this will produce a `ProtectedDisabled(Active)`.
247+
/// For example, if a protected tag goes from `Unique` to `Disabled` due
248+
/// to a foreign write this will produce a `ProtectedDisabled(Unique)`.
249249
/// This kind of error can only occur on foreign accesses.
250250
ProtectedDisabled(Permission),
251251
/// Cannot deallocate because some tag in the allocation is strongly protected.

src/tools/miri/src/borrow_tracker/tree_borrows/perms.rs

Lines changed: 51 additions & 51 deletions
Large diffs are not rendered by default.

src/tools/miri/src/borrow_tracker/tree_borrows/tree.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ pub(super) struct LocationState {
5757
impl LocationState {
5858
/// Constructs a new initial state. It has neither been accessed, nor been subjected
5959
/// to any foreign access yet.
60-
/// The permission is not allowed to be `Active`.
60+
/// The permission is not allowed to be `Unique`.
6161
/// `sifa` is the (strongest) idempotent foreign access, see `foreign_access_skipping.rs`
6262
pub fn new_non_accessed(permission: Permission, sifa: IdempotentForeignAccess) -> Self {
6363
assert!(permission.is_initial() || permission.is_disabled());
@@ -80,7 +80,7 @@ impl LocationState {
8080
/// Check if the state can exist as the initial permission of a pointer.
8181
///
8282
/// Do not confuse with `is_accessed`, the two are almost orthogonal
83-
/// as apart from `Active` which is not initial and must be accessed,
83+
/// as apart from `Unique` which is not initial and must be accessed,
8484
/// any other permission can have an arbitrary combination of being
8585
/// initial/accessed.
8686
/// FIXME: when the corresponding `assert` in `tree_borrows/mod.rs` finally
@@ -170,7 +170,7 @@ impl LocationState {
170170
}
171171
if self.permission.is_frozen() && access_kind == AccessKind::Read {
172172
// A foreign read to a `Frozen` tag will have almost no observable effect.
173-
// It's a theorem that `Frozen` nodes have no active children, so all children
173+
// It's a theorem that `Frozen` nodes have no `Unique` children, so all children
174174
// already survive foreign reads. Foreign reads in general have almost no
175175
// effect, the only further thing they could do is make protected `Reserved`
176176
// nodes become conflicted, i.e. make them reject child writes for the further
@@ -265,7 +265,7 @@ pub(super) struct Node {
265265
pub children: SmallVec<[UniIndex; 4]>,
266266
/// Either `Reserved`, `Frozen`, or `Disabled`, it is the permission this tag will
267267
/// lazily be initialized to on the first access.
268-
/// It is only ever `Disabled` for a tree root, since the root is initialized to `Active` by
268+
/// It is only ever `Disabled` for a tree root, since the root is initialized to `Unique` by
269269
/// its own separate mechanism.
270270
default_initial_perm: Permission,
271271
/// The default initial (strongest) idempotent foreign access.
@@ -598,14 +598,14 @@ impl Tree {
598598
};
599599
let rperms = {
600600
let mut perms = UniValMap::default();
601-
// We manually set it to `Active` on all in-bounds positions.
602-
// We also ensure that it is accessed, so that no `Active` but
601+
// We manually set it to `Unique` on all in-bounds positions.
602+
// We also ensure that it is accessed, so that no `Unique` but
603603
// not yet accessed nodes exist. Essentially, we pretend there
604-
// was a write that initialized these to `Active`.
604+
// was a write that initialized these to `Unique`.
605605
perms.insert(
606606
root_idx,
607607
LocationState::new_accessed(
608-
Permission::new_active(),
608+
Permission::new_unique(),
609609
IdempotentForeignAccess::None,
610610
),
611611
);
@@ -790,7 +790,7 @@ impl<'tcx> Tree {
790790
/// - the access will be applied only to accessed locations of the allocation,
791791
/// - it will not be visible to children,
792792
/// - it will be recorded as a `FnExit` diagnostic access
793-
/// - and it will be a read except if the location is `Active`, i.e. has been written to,
793+
/// - and it will be a read except if the location is `Unique`, i.e. has been written to,
794794
/// in which case it will be a write.
795795
///
796796
/// `LocationState::perform_access` will take care of raising transition

src/tools/miri/src/borrow_tracker/tree_borrows/tree/tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ mod spurious_read {
420420
/// `(LocStateProt, LocStateProt)` where the two states are not guaranteed
421421
/// to be updated at the same time.
422422
/// Some `LocStateProtPair` may be unreachable through normal means
423-
/// such as `x: Active, y: Active` in the case of mutually foreign pointers.
423+
/// such as `x: Unique, y: Unique` in the case of mutually foreign pointers.
424424
struct LocStateProtPair {
425425
xy_rel: RelPosXY,
426426
x: LocStateProt,
@@ -709,7 +709,7 @@ mod spurious_read {
709709
let mut err = 0;
710710
for pat in Pattern::exhaustive() {
711711
let Ok(initial_source) = pat.initial_state() else {
712-
// Failed to retag `x` in the source (e.g. `y` was protected Active)
712+
// Failed to retag `x` in the source (e.g. `y` was protected Unique)
713713
continue;
714714
};
715715
// `x` must stay protected, but the function protecting `y` might return here

src/tools/miri/tests/fail/async-shared-mutable.tree.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ LL | | Poll::<()>::Pending
1616
LL | | })
1717
LL | | .await
1818
| |______________^
19-
help: the accessed tag <TAG> later transitioned to Active due to a child write access at offsets [OFFSET]
19+
help: the accessed tag <TAG> later transitioned to Unique due to a child write access at offsets [OFFSET]
2020
--> tests/fail/async-shared-mutable.rs:LL:CC
2121
|
2222
LL | *x = 1;

src/tools/miri/tests/fail/both_borrows/box_noalias_violation.tree.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | *y
77
= help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental
88
= help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/tree-borrows.md for further information
99
= help: the accessed tag <TAG> is foreign to the protected tag <TAG> (i.e., it is not a child)
10-
= help: this foreign read access would cause the protected tag <TAG> (currently Active) to become Disabled
10+
= help: this foreign read access would cause the protected tag <TAG> (currently Unique) to become Disabled
1111
= help: protected tags must never be Disabled
1212
help: the accessed tag <TAG> was created here
1313
--> tests/fail/both_borrows/box_noalias_violation.rs:LL:CC
@@ -19,7 +19,7 @@ help: the protected tag <TAG> was created here, in the initial state Reserved
1919
|
2020
LL | unsafe fn test(mut x: Box<i32>, y: *const i32) -> i32 {
2121
| ^^^^^
22-
help: the protected tag <TAG> later transitioned to Active due to a child write access at offsets [0x0..0x4]
22+
help: the protected tag <TAG> later transitioned to Unique due to a child write access at offsets [0x0..0x4]
2323
--> tests/fail/both_borrows/box_noalias_violation.rs:LL:CC
2424
|
2525
LL | *x = 5;

src/tools/miri/tests/fail/both_borrows/illegal_write6.tree.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | unsafe { *y = 2 };
77
= help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental
88
= help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/tree-borrows.md for further information
99
= help: the accessed tag <TAG> is foreign to the protected tag <TAG> (i.e., it is not a child)
10-
= help: this foreign write access would cause the protected tag <TAG> (currently Active) to become Disabled
10+
= help: this foreign write access would cause the protected tag <TAG> (currently Unique) to become Disabled
1111
= help: protected tags must never be Disabled
1212
help: the accessed tag <TAG> was created here
1313
--> tests/fail/both_borrows/illegal_write6.rs:LL:CC
@@ -19,7 +19,7 @@ help: the protected tag <TAG> was created here, in the initial state Reserved
1919
|
2020
LL | fn foo(a: &mut u32, y: *mut u32) -> u32 {
2121
| ^
22-
help: the protected tag <TAG> later transitioned to Active due to a child write access at offsets [0x0..0x4]
22+
help: the protected tag <TAG> later transitioned to Unique due to a child write access at offsets [0x0..0x4]
2323
--> tests/fail/both_borrows/illegal_write6.rs:LL:CC
2424
|
2525
LL | *a = 1;

src/tools/miri/tests/fail/function_calls/arg_inplace_locals_alias.tree.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | Call(_unit = callee(Move(non_copy), Move(non_copy)), ReturnTo(a
77
= help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental
88
= help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/tree-borrows.md for further information
99
= help: the accessed tag <TAG> (root of the allocation) is foreign to the protected tag <TAG> (i.e., it is not a child)
10-
= help: this foreign read access would cause the protected tag <TAG> (currently Active) to become Disabled
10+
= help: this foreign read access would cause the protected tag <TAG> (currently Unique) to become Disabled
1111
= help: protected tags must never be Disabled
1212
help: the accessed tag <TAG> was created here
1313
--> tests/fail/function_calls/arg_inplace_locals_alias.rs:LL:CC
@@ -19,7 +19,7 @@ help: the protected tag <TAG> was created here, in the initial state Reserved
1919
|
2020
LL | y.0 = 0;
2121
| ^^^^^^^
22-
help: the protected tag <TAG> later transitioned to Active due to a child write access at offsets [0x0..0x4]
22+
help: the protected tag <TAG> later transitioned to Unique due to a child write access at offsets [0x0..0x4]
2323
--> tests/fail/function_calls/arg_inplace_locals_alias.rs:LL:CC
2424
|
2525
LL | y.0 = 0;

src/tools/miri/tests/fail/function_calls/arg_inplace_locals_alias_ret.tree.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | Call(_non_copy = callee(Move(_non_copy)), ReturnTo(after_call),
77
= help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental
88
= help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/tree-borrows.md for further information
99
= help: the accessed tag <TAG> (root of the allocation) is foreign to the protected tag <TAG> (i.e., it is not a child)
10-
= help: this reborrow (acting as a foreign read access) would cause the protected tag <TAG> (currently Active) to become Disabled
10+
= help: this reborrow (acting as a foreign read access) would cause the protected tag <TAG> (currently Unique) to become Disabled
1111
= help: protected tags must never be Disabled
1212
help: the accessed tag <TAG> was created here
1313
--> tests/fail/function_calls/arg_inplace_locals_alias_ret.rs:LL:CC
@@ -19,7 +19,7 @@ help: the protected tag <TAG> was created here, in the initial state Reserved
1919
|
2020
LL | x
2121
| ^
22-
help: the protected tag <TAG> later transitioned to Active due to a child write access at offsets [0x0..0x4]
22+
help: the protected tag <TAG> later transitioned to Unique due to a child write access at offsets [0x0..0x4]
2323
--> tests/fail/function_calls/arg_inplace_locals_alias_ret.rs:LL:CC
2424
|
2525
LL | x

src/tools/miri/tests/fail/function_calls/arg_inplace_mutate.tree.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | unsafe { ptr.write(S(0)) };
77
= help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental
88
= help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/tree-borrows.md for further information
99
= help: the accessed tag <TAG> (root of the allocation) is foreign to the protected tag <TAG> (i.e., it is not a child)
10-
= help: this foreign write access would cause the protected tag <TAG> (currently Active) to become Disabled
10+
= help: this foreign write access would cause the protected tag <TAG> (currently Unique) to become Disabled
1111
= help: protected tags must never be Disabled
1212
help: the accessed tag <TAG> was created here
1313
--> tests/fail/function_calls/arg_inplace_mutate.rs:LL:CC
@@ -24,7 +24,7 @@ help: the protected tag <TAG> was created here, in the initial state Reserved
2424
|
2525
LL | unsafe { ptr.write(S(0)) };
2626
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
27-
help: the protected tag <TAG> later transitioned to Active due to a child write access at offsets [0x0..0x4]
27+
help: the protected tag <TAG> later transitioned to Unique due to a child write access at offsets [0x0..0x4]
2828
--> tests/fail/function_calls/arg_inplace_mutate.rs:LL:CC
2929
|
3030
LL | unsafe { ptr.write(S(0)) };

0 commit comments

Comments
 (0)