Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 12d65c2

Browse files
committedDec 19, 2019
Split up ptr/mod.rs in libcore, one with implementation detail for const ptr and the other with mut ptr
1 parent c605199 commit 12d65c2

File tree

4 files changed

+1695
-1701
lines changed

4 files changed

+1695
-1701
lines changed
 

‎src/libcore/ptr/const_ptr.rs

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

‎src/libcore/ptr/mod.rs

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

‎src/libcore/ptr/mut_ptr.rs

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

‎src/test/ui/consts/offset_from_ub.stderr

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error: any use of this value will cause an error
2-
--> $SRC_DIR/libcore/ptr/mod.rs:LL:COL
2+
--> $SRC_DIR/libcore/ptr/const_ptr.rs:LL:COL
33
|
44
LL | intrinsics::ptr_offset_from(self, origin)
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
| |
77
| ptr_offset_from cannot compute offset of pointers into different allocations.
8-
| inside call to `std::ptr::<impl *const Struct>::offset_from` at $DIR/offset_from_ub.rs:19:27
8+
| inside call to `std::ptr::const_ptr::<impl *const Struct>::offset_from` at $DIR/offset_from_ub.rs:19:27
99
|
1010
::: $DIR/offset_from_ub.rs:13:1
1111
|
@@ -21,13 +21,13 @@ LL | | };
2121
= note: `#[deny(const_err)]` on by default
2222

2323
error: any use of this value will cause an error
24-
--> $SRC_DIR/libcore/ptr/mod.rs:LL:COL
24+
--> $SRC_DIR/libcore/ptr/const_ptr.rs:LL:COL
2525
|
2626
LL | intrinsics::ptr_offset_from(self, origin)
2727
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2828
| |
2929
| a memory access tried to interpret some bytes as a pointer
30-
| inside call to `std::ptr::<impl *const u8>::offset_from` at $DIR/offset_from_ub.rs:25:14
30+
| inside call to `std::ptr::const_ptr::<impl *const u8>::offset_from` at $DIR/offset_from_ub.rs:25:14
3131
|
3232
::: $DIR/offset_from_ub.rs:23:1
3333
|
@@ -38,13 +38,13 @@ LL | | };
3838
| |__-
3939

4040
error: any use of this value will cause an error
41-
--> $SRC_DIR/libcore/ptr/mod.rs:LL:COL
41+
--> $SRC_DIR/libcore/ptr/const_ptr.rs:LL:COL
4242
|
4343
LL | intrinsics::ptr_offset_from(self, origin)
4444
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4545
| |
4646
| exact_div: 1 cannot be divided by 2 without remainder
47-
| inside call to `std::ptr::<impl *const u16>::offset_from` at $DIR/offset_from_ub.rs:33:14
47+
| inside call to `std::ptr::const_ptr::<impl *const u16>::offset_from` at $DIR/offset_from_ub.rs:33:14
4848
|
4949
::: $DIR/offset_from_ub.rs:28:1
5050
|
@@ -58,13 +58,13 @@ LL | | };
5858
| |__-
5959

6060
error: any use of this value will cause an error
61-
--> $SRC_DIR/libcore/ptr/mod.rs:LL:COL
61+
--> $SRC_DIR/libcore/ptr/const_ptr.rs:LL:COL
6262
|
6363
LL | intrinsics::ptr_offset_from(self, origin)
6464
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6565
| |
6666
| invalid use of NULL pointer
67-
| inside call to `std::ptr::<impl *const u8>::offset_from` at $DIR/offset_from_ub.rs:39:14
67+
| inside call to `std::ptr::const_ptr::<impl *const u8>::offset_from` at $DIR/offset_from_ub.rs:39:14
6868
|
6969
::: $DIR/offset_from_ub.rs:36:1
7070
|
@@ -76,13 +76,13 @@ LL | | };
7676
| |__-
7777

7878
error: any use of this value will cause an error
79-
--> $SRC_DIR/libcore/ptr/mod.rs:LL:COL
79+
--> $SRC_DIR/libcore/ptr/const_ptr.rs:LL:COL
8080
|
8181
LL | intrinsics::ptr_offset_from(self, origin)
8282
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
8383
| |
8484
| a memory access tried to interpret some bytes as a pointer
85-
| inside call to `std::ptr::<impl *const u8>::offset_from` at $DIR/offset_from_ub.rs:46:14
85+
| inside call to `std::ptr::const_ptr::<impl *const u8>::offset_from` at $DIR/offset_from_ub.rs:46:14
8686
|
8787
::: $DIR/offset_from_ub.rs:42:1
8888
|

0 commit comments

Comments
 (0)
Please sign in to comment.