-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Rollup of 6 pull requests #39833
Rollup of 6 pull requests #39833
Conversation
frewsxcv
commented
Feb 15, 2017
- Successful merges: Dont segfault if btree range is not in order #39457, std: Add retain method for HashMap and HashSet #39560, Conversions between CStr, OsStr, Path and boxes #39594, save-analysis: emit info about impls and super-traits in JSON #39781, Allow more Cell methods for non-Copy types #39793, Show five traits implementation in help when there are exactly five #39804
- Failed merges: [beta] Another round of backporting PRs to beta #39750
Contributes to rust-lang#39264
Contributes to rust-lang#39264
Dont segfault if btree range is not in order This is a first attempt to fix issue rust-lang#33197. The issue is that the BTree iterator uses next_unchecked for fast iteration, but it can be tricked into running off the end of the tree and segfaulting if range is called with a maximum that is less than the minimum. Since a user defined Ord should not determine the safety of BTreeMap, and we still want fast iteration, I've implemented the idea of @gereeter and walk the tree simultaneously searching for both keys to make sure that if our keys diverge, the min key is to the left of our max key. I currently panic if that is not the case. Open questions: 1. Do we want to panic in this error case or do we want to return an empty iterator? The drain API panics if the range is bad, but drain is given a range of index values, while this is a generic key type. Panicking is brittle and returning an empty iterator is probably the most flexible and matches what people would want it to do... but artificially returning a BTreeMap::Range with start==end seems like a pretty weird and unnatural thing to do, although it's doable since those fields are not accessible. The same question for other weird cases: 2. (Included(101), Excluded(100)) on a map that contains [1,2,3]. Both BTree edges end up on the same part of the map, but comparing the keys shows the range is backwards. 3. (Excluded(5), Excluded(5)). The keys are equal but BTree edges end up backwards if the map contains 5. 4. (Included(5), Excluded(5)). Should naturally produce an empty iterator, right?
std: Add retain method for HashMap and HashSet Fix rust-lang#36648 r? @bluss
Conversions between CStr, OsStr, Path and boxes This closes a bit of the inconsistencies between `CStr`, `OsStr`, `Path`, and `str`, allowing people to create boxed versions of DSTs other than `str` and `[T]`. Full list of additions: * `Default` for `Box<str>`, `Box<CStr>`, `Box<OsStr>`, and `Box<Path>` (note: `Default` for `PathBuf` is already implemented) * `CString::into_boxed_c_str` (feature gated) * `OsString::into_boxed_os_str` (feature gated) * `Path::into_boxed_path` (feature gated) * `From<&CStr> for Box<CStr>` * `From<&OsStr> for Box<OsStr>` * `From<&Path> for Box<Path>` This also includes adding the internal methods: * `sys::*::os_str::Buf::into_box` * `sys::*::os_str::Slice::{into_box, empty_box}` * `sys_common::wtf8::Wtf8Buf::into_box` * `sys_common::wtf8::Wtf8::{into_box, empty_box}`
save-analysis: emit info about impls and super-traits in JSON
Allow more Cell methods for non-Copy types Clearly, `get_mut` is safe for any `T`. The other two only provide unsafe pointers anyway. The only remaining inherent method with `Copy` bound is `get`, which sounds about right to me. I found the order if `impl` blocks in the file a little weird (first inherent impl, then some trait impls, then another inherent impl), but didn't change it to keep the diff small. Contributes to rust-lang#39264
…jonathandturner Show five traits implementation in help when there are exactly five Fixes rust-lang#39802
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @sfackler (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
@bors r+ p=10 |
📌 Commit 9829137 has been approved by |
⌛ Testing commit 9829137 with merge 209443d... |
💔 Test failed - status-appveyor |