Fix region-related unsafety in arc::get's signature
This commit is contained in:
parent
330311658f
commit
a831726b94
@ -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;
|
||||
|
@ -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) }
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user