rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
93.93k stars 12.09k forks source link

Stablize `const_binary_heap_constructor` #125211

Closed Coekjan closed 22 hours ago

Coekjan commented 2 weeks ago

This pr aims to stablize const_binary_heap_constructor.

BinaryHeap::new is able to be stablized, but BinaryHeap::new_in is not. Because the latter depends on Vec::new_in which is unstable.

The const_binary_heap_constructor feature contains the two functions, and I want to split this feature now. This pr creates const_binary_heap_new_in feature for BinaryHeap::new_in and stablizes const_binary_heap_constructor (now this original feature only contains one function).

rustbot commented 2 weeks ago

r? @cuviper

rustbot has assigned @cuviper. They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

cuviper commented 2 weeks ago

@rustbot label -T-libs +T-libs-api

r? libs-api

jhpratt commented 1 week ago

Has FCP been completed anywhere? I don't expect this to be controversial given all similar constructors are const, but it is still required.

Coekjan commented 1 week ago

Has FCP been completed anywhere? I don't expect this to be controversial given all similar constructors are const, but it is still required.

No FCP yet. Should I do it in a new issue? Or just do it in #112353?

jhpratt commented 1 week ago

That issue is preferable to this PR, as people would already be subscribed there.

jhpratt commented 1 week ago

@rustbot claim

r=me if and when FCP passes

Coekjan commented 1 day ago

@rustbot ready

@jhpratt FCP passed

rustbot commented 1 day ago

Could not assign reviewer from: jhpratt. User(s) jhpratt are either the PR author, already assigned, or on vacation, and there are no other candidates. Use r? to specify someone else to assign.

dtolnay commented 1 day ago

@bors r=jhpratt,dtolnay

bors commented 1 day ago

:pushpin: Commit ef23a5b139e34a1a344f878e96fa9d3ff1b705a8 has been approved by jhpratt,dtolnay

It is now in the queue for this repository.

bors commented 1 day ago

:hourglass: Testing commit ef23a5b139e34a1a344f878e96fa9d3ff1b705a8 with merge 179b6d75b490f8372a111ad6eaf0012435cf9a9b...

bors commented 1 day ago

:broken_heart: Test failed - checks-actions

rust-log-analyzer commented 1 day ago

The job aarch64-apple failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot) ```plain [TIMING] core::build_steps::tool::ToolBuild { compiler: Compiler { stage: 0, host: aarch64-apple-darwin }, target: aarch64-apple-darwin, tool: "tidy", path: "src/tools/tidy", mode: ToolBootstrap, source_type: InTree, extra_features: [], allow_features: "" } -- 24.841 [TIMING] core::build_steps::tool::Tidy { compiler: Compiler { stage: 0, host: aarch64-apple-darwin }, target: aarch64-apple-darwin } -- 0.000 fmt check fmt: skipped untracked file AWSCLIV2.pkg ##[error]Diff in /Users/runner/work/rust/rust/library/alloc/src/collections/binary_heap/mod.rs at line 440: /// heap.push(4); #[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_stable(feature = "const_binary_heap_constructor", since = "CURRENT_RUSTC_VERSION")] + #[rustc_const_stable( + feature = "const_binary_heap_constructor", + since = "CURRENT_RUSTC_VERSION" + )] #[must_use] pub const fn new() -> BinaryHeap { BinaryHeap { data: vec![] } fmt error: Running `"/Users/runner/work/rust/rust/build/aarch64-apple-darwin/rustfmt/bin/rustfmt" "--config-path" "/Users/runner/work/rust/rust" "--edition" "2021" "--unstable-features" "--skip-children" "--check" "/Users/runner/work/rust/rust/library/core/tests/const_ptr.rs" "/Users/runner/work/rust/rust/library/core/tests/pattern.rs" "/Users/runner/work/rust/rust/library/core/src/iter/adapters/map.rs" "/Users/runner/work/rust/rust/library/core/src/iter/adapters/zip.rs" "/Users/runner/work/rust/rust/library/core/src/iter/adapters/inspect.rs" "/Users/runner/work/rust/rust/library/core/src/iter/adapters/copied.rs" "/Users/runner/work/rust/rust/library/core/src/iter/adapters/map_while.rs" "/Users/runner/work/rust/rust/library/core/src/iter/adapters/scan.rs" "/Users/runner/work/rust/rust/library/core/src/iter/adapters/filter.rs" "/Users/runner/work/rust/rust/library/core/src/iter/adapters/take.rs" "/Users/runner/work/rust/rust/library/core/src/iter/adapters/filter_map.rs" "/Users/runner/work/rust/rust/library/core/src/iter/adapters/enumerate.rs" "/Users/runner/work/rust/rust/library/core/src/iter/adapters/intersperse.rs" "/Users/runner/work/rust/rust/library/core/src/iter/adapters/mod.rs" "/Users/runner/work/rust/rust/library/core/src/iter/adapters/fuse.rs" "/Users/runner/work/rust/rust/library/core/src/iter/adapters/cycle.rs" "/Users/runner/work/rust/rust/library/core/src/iter/adapters/map_windows.rs" "/Users/runner/work/rust/rust/library/core/src/iter/adapters/rev.rs" "/Users/runner/work/rust/rust/library/core/src/iter/adapters/array_chunks.rs" "/Users/runner/work/rust/rust/library/core/src/iter/adapters/skip.rs" "/Users/runner/work/rust/rust/library/core/src/iter/adapters/peekable.rs" "/Users/runner/work/rust/rust/library/core/src/iter/adapters/flatten.rs" "/Users/runner/work/rust/rust/library/core/src/iter/adapters/by_ref_sized.rs" "/Users/runner/work/rust/rust/library/core/src/iter/adapters/step_by.rs" "/Users/runner/work/rust/rust/library/core/src/iter/adapters/skip_while.rs" "/Users/runner/work/rust/rust/library/core/src/iter/adapters/chain.rs" "/Users/runner/work/rust/rust/library/core/src/iter/adapters/cloned.rs" "/Users/runner/work/rust/rust/library/core/src/iter/adapters/take_while.rs" "/Users/runner/work/rust/rust/library/alloc/src/rc/tests.rs" "/Users/runner/work/rust/rust/library/core/src/iter/traits/unchecked_iterator.rs" "/Users/runner/work/rust/rust/library/core/src/iter/traits/iterator.rs" "/Users/runner/work/rust/rust/library/core/src/iter/traits/marker.rs" "/Users/runner/work/rust/rust/library/core/src/iter/traits/mod.rs" "/Users/runner/work/rust/rust/library/core/src/iter/traits/collect.rs" "/Users/runner/work/rust/rust/library/core/src/iter/traits/accum.rs" "/Users/runner/work/rust/rust/library/core/src/iter/traits/double_ended.rs" "/Users/runner/work/rust/rust/library/core/src/iter/traits/exact_size.rs" "/Users/runner/work/rust/rust/library/core/src/iter/range.rs" "/Users/runner/work/rust/rust/library/alloc/src/collections/binary_heap/tests.rs" "/Users/runner/work/rust/rust/library/alloc/src/collections/binary_heap/mod.rs" "/Users/runner/work/rust/rust/library/core/src/net/display_buffer.rs" "/Users/runner/work/rust/rust/library/core/src/net/parser.rs" "/Users/runner/work/rust/rust/library/core/src/net/ip_addr.rs" "/Users/runner/work/rust/rust/library/core/src/net/socket_addr.rs" "/Users/runner/work/rust/rust/library/core/src/net/mod.rs" "/Users/runner/work/rust/rust/library/core/src/ascii.rs" "/Users/runner/work/rust/rust/library/core/src/bool.rs" "/Users/runner/work/rust/rust/library/alloc/src/testing/crash_test.rs" "/Users/runner/work/rust/rust/library/alloc/src/testing/mod.rs" "/Users/runner/work/rust/rust/library/alloc/src/testing/ord_chaos.rs" "/Users/runner/work/rust/rust/library/alloc/src/collections/btree/mem.rs" "/Users/runner/work/rust/rust/library/alloc/src/testing/rng.rs" "/Users/runner/work/rust/rust/library/alloc/src/collections/btree/split.rs" "/Users/runner/work/rust/rust/library/alloc/src/task.rs" "/Users/runner/work/rust/rust/library/alloc/src/collections/btree/map.rs" "/Users/runner/work/rust/rust/library/alloc/src/fmt.rs" "/Users/runner/work/rust/rust/library/alloc/src/collections/btree/search.rs" "/Users/runner/work/rust/rust/library/alloc/src/lib.miri.rs" "/Users/runner/work/rust/rust/library/alloc/src/collections/btree/dedup_sorted_iter.rs" "/Users/runner/work/rust/rust/library/alloc/src/boxed/thin.rs" "/Users/runner/work/rust/rust/library/alloc/src/collections/btree/node/tests.rs" "/Users/runner/work/rust/rust/library/alloc/src/boxed.rs" "/Users/runner/work/rust/rust/library/alloc/src/sync.rs" "/Users/runner/work/rust/rust/library/core/tests/waker.rs"` failed. If you're running `tidy`, try again with `--bless`. Or, if you just want to format code, run `./x.py fmt` instead. local time: Fri May 31 18:23:21 UTC 2024 network time: Fri, 31 May 2024 18:23:21 GMT ##[error]Process completed with exit code 1. Post job cleanup. ```
jhpratt commented 1 day ago

Looks like x fmt needs to be run.

@bors d+

jhpratt commented 1 day ago

@bors r- d+

@Coekjan You should be able to respond with @bors r=jhpratt once you format the code. I thought the bot usually responded when using d+. If it doesn't work, don't worry — I'll get to it soon afterwards.

Coekjan commented 1 day ago

@bors r=jhpratt

bors commented 1 day ago

@Coekjan: :key: Insufficient privileges: Not in reviewers

jhpratt commented 1 day ago

@bors r+

bors commented 1 day ago

:pushpin: Commit 7cee7c664befc25a4d3392e9fbdb6999b23b4619 has been approved by jhpratt

It is now in the queue for this repository.

jieyouxu commented 1 day ago

@bors r- d+

@Coekjan You should be able to respond with @bors r=jhpratt once you format the code. I thought the bot usually responded when using d+. If it doesn't work, don't worry — I'll get to it soon afterwards.

@jhpratt I think you need to spell out "delegate+", don't think "d+" is recognized

jhpratt commented 1 day ago

Ah, okay. I went by https://bors.tech/documentation, but I also know that Rust uses its own fork. Looking at https://bors.rust-lang.org, it seems you're correct.

bors commented 1 day ago

:hourglass: Testing commit 7cee7c664befc25a4d3392e9fbdb6999b23b4619 with merge 466be510af95d377a4e9997a6ab7c4db5f91e9ec...

bors commented 22 hours ago

:sunny: Test successful - checks-actions Approved by: jhpratt Pushing 466be510af95d377a4e9997a6ab7c4db5f91e9ec to master...

rust-timer commented 21 hours ago

Finished benchmarking commit (466be510af95d377a4e9997a6ab7c4db5f91e9ec): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results (primary -0.8%) This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment. | | mean | range | count | |:----------------------------------:|:-----:|:--------------:|:-----:| | Regressions ❌
(primary) | - | - | 0 | | Regressions ❌
(secondary) | - | - | 0 | | Improvements ✅
(primary) | -0.8% | [-0.8%, -0.8%] | 1 | | Improvements ✅
(secondary) | - | - | 0 | | All ❌✅ (primary) | -0.8% | [-0.8%, -0.8%] | 1 |

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 666.776s -> 668.037s (0.19%) Artifact size: 318.89 MiB -> 318.86 MiB (-0.01%)