Skip to content

Commit ae5f1d6

Browse files
committed
---
yaml --- r: 32333 b: refs/heads/dist-snap c: f03ed73 h: refs/heads/master i: 32331: a175774 v: v3
1 parent 08a90ce commit ae5f1d6

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
99
refs/heads/incoming: d9317a174e434d4c99fc1a37fd7dc0d2f5328d37
10-
refs/heads/dist-snap: 1397c83f11c647ba6f9e1362ac551d4454682947
10+
refs/heads/dist-snap: f03ed73c5efdd209907ad353b334a0c6cf474bc7
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/dist-snap/src/libcore/ptr.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
33
export addr_of;
44
export to_unsafe_ptr;
5+
export to_mut_unsafe_ptr;
56
export mut_addr_of;
67
export offset;
78
export const_offset;
@@ -132,14 +133,22 @@ unsafe fn memset<T>(dst: *mut T, c: int, count: uint) {
132133
Transform a region pointer - &T - to an unsafe pointer - *T.
133134
This is safe, but is implemented with an unsafe block due to
134135
reinterpret_cast.
135-
136-
("assimilate" because it makes the pointer forget its region.)
137136
*/
138137
#[inline(always)]
139138
fn to_unsafe_ptr<T>(thing: &T) -> *T unsafe {
140139
unsafe::reinterpret_cast(&thing)
141140
}
142141

142+
/**
143+
Transform a mutable region pointer - &mut T - to a mutable unsafe pointer -
144+
*mut T. This is safe, but is implemented with an unsafe block due to
145+
reinterpret_cast.
146+
*/
147+
#[inline(always)]
148+
fn to_mut_unsafe_ptr<T>(thing: &mut T) -> *mut T unsafe {
149+
unsafe::reinterpret_cast(thing)
150+
}
151+
143152
/**
144153
Cast a region pointer - &T - to a uint.
145154
This is safe, but is implemented with an unsafe block due to

0 commit comments

Comments
 (0)