-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Oibit send and friends #20119
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
Merged
Merged
Oibit send and friends #20119
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
fb803a8
Require types to opt-in Sync
flaper87 686ce66
Rename `OwnedPtr` to `UniquePtr`
flaper87 f436f9c
Make Send and Sync traits unsafe
flaper87 e2116c8
Move RacyCell to `std::comm`
flaper87 51d2fef
Implement `Sync` for some windows sys types
flaper87 7df17a2
Rename `UniquePtr` to `Unique`
flaper87 8818693
Relax `Arc` bounds don't require Sync+Send
flaper87 607f607
Keep track of the whole error chain
flaper87 d35ebcb
Make Barrier and Condvar Sync/Send
flaper87 84a6684
Impl Sync/Send for Rawlink
flaper87 29b3698
Implement Sync/Send for ArcInner and Weak
flaper87 52072de
Add a Racy type to bench tests
flaper87 bb315f2
Implement RaceBox for StdinReader
flaper87 f5d619c
Implement Sync/Send for windows TCP types
flaper87 11f71ec
Implement Sync/Send for windows' UnixStream
flaper87 1a73ccc
Make trait's impls consistent for unix/windows
flaper87 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,8 +27,9 @@ | |
|
||
extern crate libc; | ||
|
||
use std::c_vec::CVec; | ||
use libc::{c_void, size_t, c_int}; | ||
use std::c_vec::CVec; | ||
use std::ptr::Unique; | ||
|
||
#[link(name = "miniz", kind = "static")] | ||
extern { | ||
|
@@ -59,7 +60,8 @@ fn deflate_bytes_internal(bytes: &[u8], flags: c_int) -> Option<CVec<u8>> { | |
&mut outsz, | ||
flags); | ||
if !res.is_null() { | ||
Some(CVec::new_with_dtor(res as *mut u8, outsz as uint, move|:| libc::free(res))) | ||
let res = Unique(res); | ||
Some(CVec::new_with_dtor(res.0 as *mut u8, outsz as uint, move|:| libc::free(res.0))) | ||
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. You cast it to a |
||
} else { | ||
None | ||
} | ||
|
@@ -84,7 +86,8 @@ fn inflate_bytes_internal(bytes: &[u8], flags: c_int) -> Option<CVec<u8>> { | |
&mut outsz, | ||
flags); | ||
if !res.is_null() { | ||
Some(CVec::new_with_dtor(res as *mut u8, outsz as uint, move|:| libc::free(res))) | ||
let res = Unique(res); | ||
Some(CVec::new_with_dtor(res.0 as *mut u8, outsz as uint, move|:| libc::free(res.0))) | ||
} else { | ||
None | ||
} | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,5 +67,6 @@ register_diagnostics! { | |
E0173, | ||
E0174, | ||
E0177, | ||
E0178 | ||
E0178, | ||
E0179 | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
We may want to avoid constructors or functions on this pointer type for now in terms of stabilization. Some questions that arise:
null
constructor while not having constructors for other types of pointers?offset
function without the other array of functions on raw pointers?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.
I figured we would land
UniquePtr
can call it experimental or unstable for now until we had a chance to debate it. It's not user-visible in any case.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.
Kept
UniquePtr
as is based on @nikomatsakis comment.