File tree 1 file changed +12
-0
lines changed
src/tools/miri/tests/pass/tree_borrows
1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ fn main() {
11
11
string_as_mut_ptr ( ) ;
12
12
two_mut_protected_same_alloc ( ) ;
13
13
direct_mut_to_const_raw ( ) ;
14
+ local_addr_of_mut ( ) ;
14
15
15
16
// Stacked Borrows tests
16
17
read_does_not_invalidate1 ( ) ;
@@ -31,6 +32,17 @@ fn main() {
31
32
write_does_not_invalidate_all_aliases ( ) ;
32
33
}
33
34
35
+ #[ allow( unused_assignments) ]
36
+ fn local_addr_of_mut ( ) {
37
+ let mut local = 0 ;
38
+ let ptr = ptr:: addr_of_mut!( local) ;
39
+ // In SB, `local` and `*ptr` would have different tags, but in TB they have the same tag.
40
+ local = 1 ;
41
+ unsafe { * ptr = 2 } ;
42
+ local = 3 ;
43
+ unsafe { * ptr = 4 } ;
44
+ }
45
+
34
46
// Tree Borrows has no issue with several mutable references existing
35
47
// at the same time, as long as they are used only immutably.
36
48
// I.e. multiple Reserved can coexist.
You can’t perform that action at this time.
0 commit comments