Skip to content

Commit ce1206e

Browse files
committed
---
yaml --- r: 22494 b: refs/heads/master c: 6e98416 h: refs/heads/master v: v3
1 parent deb1d74 commit ce1206e

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 81ecd272d349a744a3a5f21b7eb4ef3c79d9188f
2+
refs/heads/master: 6e9841666285f0d928f35906a903d4a1e2aa6ffe
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
55
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be

trunk/src/libcore/vec.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,6 +1420,11 @@ mod unsafe {
14201420
data: u8
14211421
};
14221422

1423+
type slice_repr = {
1424+
mut data: *u8,
1425+
mut len: uint
1426+
};
1427+
14231428
/**
14241429
* Constructs a vector from an unsafe pointer to a buffer
14251430
*
@@ -1465,6 +1470,13 @@ mod unsafe {
14651470
}
14661471

14671472

1473+
#[inline(always)]
1474+
unsafe fn to_ptr_slice<T>(v: &[const T]) -> *T {
1475+
let repr: **slice_repr = ::unsafe::reinterpret_cast(addr_of(v));
1476+
ret ::unsafe::reinterpret_cast(addr_of((**repr).data));
1477+
}
1478+
1479+
14681480
/**
14691481
* Form a slice from a pointer and length (as a number of units,
14701482
* not bytes).

0 commit comments

Comments
 (0)