-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Constify Eq, Ord, PartialOrd #144847
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
Constify Eq, Ord, PartialOrd #144847
Conversation
r? @ibraheemdev rustbot has assigned @ibraheemdev. Use |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Squash this into one commit please @rustbot author |
Reminder, once the PR becomes ready for a review, use |
@rustbot ready |
Not a review but just a question as I don't know the contexts very well 😅 |
This comment has been minimized.
This comment has been minimized.
Fair enough, I've added |
Sorry for taking a long time to review this. I'm actually somewhat uncomfortable by the scope of this PR. Could you please limit the number of types that this adds const impls for to just types that seem relevant for const programming? Specifically, things like:
Don't seem really relevant here. I think this constification could probably just stick to constifying some impls for built-in types and other important types, and not just try to constify everything that can be constified in the standard library. Also, since this adds new bounds to things, let's run a perf test. @bors2 try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Constify Eq, Ord, PartialOrd
@rustbot author |
This comment has been minimized.
This comment has been minimized.
💔 Test failed - checks-actions |
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
Sorry I pushed the wrong version |
TypeId ord is a special topic. I think we could special case it to internally compare the hash like at runtime, without exposing the actual value. Please open a dedicated issue for it so we can make a decision on whether to never allow it or whether to allow it by exposing the hash order |
@bors r+ |
☀️ Test successful - checks-actions |
What is this?This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.Comparing a171994 (parent) -> 5c11fb8 (this PR) Test differencesShow 2632 test diffs2632 doctest diffs were found. These are ignored, as they are noisy. Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard 5c11fb842afc9876e985886c30292a227caee632 --output-dir test-dashboard And then open Job duration changes
How to interpret the job duration changes?Job durations can vary a lot, based on the actual runner instance |
Finished benchmarking commit (5c11fb8): comparison URL. Overall result: ❌✅ regressions and improvements - please read the text belowOur benchmarks found a performance regression caused by this PR. Next Steps:
@rustbot label: +perf-regression Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary 2.4%, secondary 3.3%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 469.518s -> 468.518s (-0.21%) |
Are there supposed to be an |
It is in my PR (linked above). I'm currently rebasing in top of this merge. |
perf triage: Slight regression in doc benchmarks, similar to pre-merge results. Expected because of more const handling (looks like more time is spent in const related queries from brief look at the detailed results of hellp-world: https://perf.rust-lang.org/detailed-query.html?commit=5c11fb842afc9876e985886c30292a227caee632&benchmark=helloworld-doc&scenario=full&base_commit=a171994070dc18c3a32fc1aa2d98cf03ae96b63e) Justified by #144847 (comment), if I understand correctly. @rustbot label: +perf-regression-triaged |
Adds
#[const_trait]
and impls forEq
,Ord
,PartialOrd
. Impl for some other traits (e.g., slices and arrays) are blocked mainly on const closures (#106003).For TypeId Ord we need const pointer comparison (#53020)
Tracking issue #143800