Commit 7244769
authored
Fix aliasing in Clone by using a raw pointer (#523)
Previously, this code produced a &mut[u8] and a Box<[u8]> to the shared
allocation upon cloning it. If the underlying allocation were actually
shared, such as through a &[u8] from the Deref impl, creating either of
these types incorrectly asserted uniqueness of the allocation.
This fixes the example in #522, but Miri still does not pass on this
test suite with -Zmiri-tag-raw-pointers because Miri does not currently
understand int to pointer casts.1 parent 9e6edd1 commit 7244769
1 file changed
+18
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
6 | 12 | | |
7 | 13 | | |
8 | 14 | | |
| |||
941 | 947 | | |
942 | 948 | | |
943 | 949 | | |
944 | | - | |
945 | | - | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
946 | 953 | | |
947 | 954 | | |
948 | 955 | | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
949 | 962 | | |
950 | 963 | | |
951 | 964 | | |
| |||
1006 | 1019 | | |
1007 | 1020 | | |
1008 | 1021 | | |
1009 | | - | |
1010 | 1022 | | |
1011 | | - | |
| 1023 | + | |
| 1024 | + | |
1012 | 1025 | | |
1013 | 1026 | | |
1014 | 1027 | | |
| |||
0 commit comments