Skip to content
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

collections: add append for binary heap #32987

Merged
merged 1 commit into from Apr 17, 2016

Conversation

xosmig
Copy link
Contributor

@xosmig xosmig commented Apr 15, 2016

No description provided.

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (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.

/// assert_eq!(a.into_sorted_vec(), [-20, -10, 1, 2, 3, 3, 5, 43]);
/// assert!(b.is_empty());
/// ```
#[stable(feature = "append", since = "1.9.0")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it'll be since = 1.10.0 now the 1.8.0 has been released.

Copy link
Contributor Author

@xosmig xosmig Apr 15, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GuillaumeGomez, Ok, I will fix it. I didn't find any strict rules for this line.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's the current release version + 2 (since there is beta between them).

@apasel422
Copy link
Contributor

@xosmig This looks great! Would it be possible to also add a specialization for Extend like the one in #32851?

@xosmig xosmig force-pushed the binary_heap_extension branch 2 times, most recently from f793686 to a7c5b8a Compare April 15, 2016 14:48
@alexcrichton
Copy link
Member

Looks like the append doctest may not be working?

---- binary_heap::BinaryHeap<T>::append_0 stdout ----
    <anon>:5:17: 5:33 error: failed to resolve. Use of undeclared type or module `BinaryHeap` [E0433]
<anon>:5     let mut a = BinaryHeap::from(v);
                         ^~~~~~~~~~~~~~~~
<anon>:8:17: 8:33 error: failed to resolve. Use of undeclared type or module `BinaryHeap` [E0433]
<anon>:8     let mut b = BinaryHeap::from(v);
                         ^~~~~~~~~~~~~~~~
<anon>:10:5: 10:21 error: the type of this value must be known in this context
<anon>:10     a.append(&mut b);
              ^~~~~~~~~~~~~~~~
<std macros>:5:8: 5:18 error: the type of this value must be known in this context
<std macros>:5 if ! ( * left_val == * right_val ) {
                      ^~~~~~~~~~
<anon>:12:5: 12:68 note: in this expansion of assert_eq! (defined in <std macros>)
<std macros>:5:22: 5:33 error: the type of this value must be known in this context
<std macros>:5 if ! ( * left_val == * right_val ) {
                                    ^~~~~~~~~~~
<anon>:12:5: 12:68 note: in this expansion of assert_eq! (defined in <std macros>)
<anon>:13:13: 13:25 error: the type of this value must be known in this context
<anon>:13     assert!(b.is_empty());
                      ^~~~~~~~~~~~
<anon>:13:5: 13:27 note: in this expansion of assert! (defined in <std macros>)
error: aborting due to previous error(s)
thread 'binary_heap::BinaryHeap<T>::append_0' panicked at 'Box<Any>', src/librustc/session/mod.rs:161
note: Run with `RUST_BACKTRACE=1` for a backtrace.


failures:
    binary_heap::BinaryHeap<T>::append_0

@bors: delegate=apasel422

@bors
Copy link
Contributor

bors commented Apr 15, 2016

✌️ @apasel422 can now approve this pull request

/// assert_eq!(a.into_sorted_vec(), [-20, -10, 1, 2, 3, 3, 5, 43]);
/// assert!(b.is_empty());
/// ```
#[stable(feature = "binary_heap_append", since = "1.10.0")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this start out as #[unstable] actually? It should be easily stabilized as it fits conventions but we try to avoid insta-stable methods wherever possible.

@xosmig
Copy link
Contributor Author

xosmig commented Apr 15, 2016

@alexcrichton Should I create a new issue for stabilization of it?

@apasel422
Copy link
Contributor

@xosmig You can use #32526 as the issue and remove "Closes #32526" from the PR description.

@xosmig
Copy link
Contributor Author

xosmig commented Apr 15, 2016

@apasel422 may be #28147 is more suitable? Can I use it?

@apasel422
Copy link
Contributor

@xosmig I don't think so. append already meets conventions, while push_pop and replace do not, so it is more likely for this new method to be stabilized as is.

@alexcrichton
Copy link
Member

Yeah #32526 seems good

@xosmig xosmig force-pushed the binary_heap_extension branch 5 times, most recently from c8045da to bbd3b8c Compare April 15, 2016 20:22
@apasel422
Copy link
Contributor

@xosmig Could you squash these commits? This looks ready to go otherwise.

@xosmig
Copy link
Contributor Author

xosmig commented Apr 15, 2016

@apasel422 Should I squash all three commits into one?

@apasel422
Copy link
Contributor

@xosmig Yes, thanks!

@apasel422
Copy link
Contributor

@bors: r+ faeba73

@bors
Copy link
Contributor

bors commented Apr 17, 2016

⌛ Testing commit faeba73 with merge d8d7174...

bors added a commit that referenced this pull request Apr 17, 2016
collections: add append for binary heap
@bors bors merged commit faeba73 into rust-lang:master Apr 17, 2016
@xosmig xosmig deleted the binary_heap_extension branch May 18, 2016 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants