-
Notifications
You must be signed in to change notification settings - Fork 450
rust: update Ref
to use the kernel's refcount_t
.
#377
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ | |
const_panic, | ||
const_raw_ptr_deref, | ||
const_unreachable_unchecked, | ||
receiver_trait, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This feature is not meant to eventually be stabilized. It doesn't have a tracking issue and There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given that we are going to have a in-tree copy of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To add some more context to what Gary already said: we had a technical meeting on the A replacement for |
||
try_reserve | ||
)] | ||
#![deny(clippy::complexity)] | ||
|
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.
Is the support for an initialization closure only there to support easy initialization of
Pin
ned structures? Or do you believe it's more generally useful? Just asking out of general interest.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.
See wedsonaf@61397b0 -- this allows us to obviate
get_mut
, which allows us to safely claim thatRef
is in fact pinned.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.
Ah I see ! Yes, getting rid of
get_mut()
looks very good. Not sure why you'd need amut
closure for initialization, though?Arc
also provides shared references only, but we are still able to initialize theMutex
es inside of it?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.
See wedsonaf@e201bf1 -- allowing
init
on just&self
(as opposed to&mut self
) was an oversight that leads to unsafety (e.g., someone callinginit
on a synchronisation primitive that is in use).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.
Holy smoke! I was already wondering about that, but I'm coming from profound ignorance on
Pin
ning and everything around it.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.
The best way to avoid
get_mut
is through a wrapper type likeUniqueArc
https://doc.servo.org/servo_arc/struct.UniqueArc.htmlThere 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.
PS do we have an Issue to keep track of this?
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.
Nice, I like it.
Something for another PR though. (The reason I'm removing
get_mut
in this PR is that we don't have arefcount_t
function with the right barriers forget_mut
and I want this code to be simple wrappers aroundrefcount_t
).I don't think so. Feel free to open one.