Fix region-related unsafety in arc::get's signature

This commit is contained in:
Ben Blum 2012-08-27 14:03:23 -04:00
parent 330311658f
commit a831726b94
2 changed files with 5 additions and 5 deletions

View file

@ -203,8 +203,8 @@ unsafe fn shared_mutable_state<T: send>(+data: T) -> SharedMutableState<T> {
}
#[inline(always)]
unsafe fn get_shared_mutable_state<T: send>(rc: &SharedMutableState<T>)
-> &mut T {
unsafe fn get_shared_mutable_state<T: send>(rc: &a/SharedMutableState<T>)
-> &a/mut T {
unsafe {
let ptr: ~ArcData<T> = unsafe::reinterpret_cast((*rc).data);
assert ptr.count > 0;
@ -215,8 +215,8 @@ unsafe fn get_shared_mutable_state<T: send>(rc: &SharedMutableState<T>)
}
}
#[inline(always)]
unsafe fn get_shared_immutable_state<T: send>(rc: &SharedMutableState<T>)
-> &T {
unsafe fn get_shared_immutable_state<T: send>(rc: &a/SharedMutableState<T>)
-> &a/T {
unsafe {
let ptr: ~ArcData<T> = unsafe::reinterpret_cast((*rc).data);
assert ptr.count > 0;

View file

@ -81,7 +81,7 @@ fn arc<T: const send>(+data: T) -> ARC<T> {
* Access the underlying data in an atomically reference counted
* wrapper.
*/
fn get<T: const send>(rc: &ARC<T>) -> &T {
fn get<T: const send>(rc: &a/ARC<T>) -> &a/T {
unsafe { get_shared_immutable_state(&rc.x) }
}