-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unsafe reasoning in ArrayArena #379
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
전반적으로 좋은 것 같습니다. 제가 이해 안되는 부분(...) 하나만 찍어서 review드립니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bors r+
unsafe { (*handle.ptr).refcnt += 1 }; | ||
Self::Handle { | ||
// It is safe becuase of the invariant of ArrayPtr. | ||
unsafe { (*handle.ptr.as_ptr()).refcnt += 1 }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아주 사소한건데 ... += 1;
이렇게 가는게 어떨까 합니다
Build succeeded: |
Arena
의 unsafe reasoning을 위한 PR입니다.일단ArrayPtr
과MruPtr
이 가지고 있는 포인터를*mut
에서NonNull
로 바꾸었습니다.코드를 보다 보니Arena
구현에 관련된 질문이 몇 가지 생겼는데 해당 위치에 comment로 달아 두겠습니다.edited
ArrayArena
의 unsafe reasoning을 위한 PR입니다.ArrayPtr
과MruPtr
이 가지고 있는 포인터를*mut
에서NonNull
로 바꾸었습니다.impl<A: Arena, T: Clone + Deref<Target = A>> Arena for T
를 없애고Arena
트레잇에Rc
를 반환하는 메서드를 추가했습니다.ArrayPtr
이 해당 핸들을 만든ArrayArena
가 살아 있는 동안만 살아 있도록ArrayPtr
에 lifetime parameter를 추가했습니다. 이에 따라Rc
에도 lifetime parameter가 추가되었습니다.MruArena
는 이 PR에서 다루지 않습니다.