@@ -17,31 +17,31 @@ fn main() {
17
17
let base = vec ! [ 0u8 , 1 ] ;
18
18
let alloc_id = alloc_id ! ( base. as_ptr( ) ) ;
19
19
20
- // The usage of `-Zmiri-unique-is-unique` disturbs the internal
21
- // structure of the tree: pointers that used to have the same tag
22
- // under `-Zmiri-tree-borrows` are now cousins under
23
- // `-Zmiri-tree-borrows -Zmiri-unique-is-unique`.
20
+ // With `-Zmiri-unique-is-unique`, `Unique::as_ptr` (which is called by
21
+ // `Vec::as_ptr`) generates pointers with a fresh tag, so to name the actual
22
+ // `base` pointer we care about we have to walk up the tree a bit.
24
23
//
25
- // This is an unintended consequence of the way we currently
26
- // retag `Unique`, and we should look for a way to make these return
27
- // the same pointer. In the meantime we hardcode the distance at which
28
- // we expect the nearest common ancestor to be (which is the tag of
29
- // the actual root `Unique` pointer) and name that.
24
+ // We care about naming this specific parent tag because it is the one
25
+ // that stays `Active` during the entire execution, unlike the leaves
26
+ // that will be invalidated the next time `as_ptr` is called.
30
27
//
31
28
// (We name it twice so that we have an indicator in the output of
32
29
// whether we got the distance correct:
33
- //
34
30
// If the output shows
35
31
//
36
- // |- <XYZ: base.as_ptr() >
37
- // '- <XYZ: base.as_ptr() >
32
+ // |- <XYZ: uniq >
33
+ // '- <XYZ: uniq >
38
34
//
39
35
// then `nth_parent` is not big enough.
40
36
// The correct value for `nth_parent` should be the minimum
41
37
// integer for which the output shows
42
38
//
43
- // '- <XYZ: base.as_ptr(), base.as_ptr() >
39
+ // '- <XYZ: uniq, uniq >
44
40
// )
41
+ //
42
+ // Ultimately we want pointers obtained through independent
43
+ // calls of `as_ptr` to be able to alias, which will probably involve
44
+ // a new permission that allows aliasing when there is no protector.
45
45
let nth_parent = if cfg ! ( uniq) { 2 } else { 0 } ;
46
46
name ! ( base. as_ptr( ) =>nth_parent) ;
47
47
name ! ( base. as_ptr( ) =>nth_parent) ;
0 commit comments