Skip to content

Commit ff73fd8

Browse files
committed
---
yaml --- r: 23671 b: refs/heads/master c: f03ed73 h: refs/heads/master i: 23669: c3fabd9 23667: db3bff3 23663: bde60ee v: v3
1 parent 3c3a3be commit ff73fd8

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
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 1397c83f11c647ba6f9e1362ac551d4454682947
2+
refs/heads/master: f03ed73c5efdd209907ad353b334a0c6cf474bc7
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
55
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be

trunk/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)