rust
rust copied to clipboard
Allow specialized const trait impls.
Fixes #95186. Fixes #95187.
I've done my best to create a comprehensive test suite for the interaction between min_specialization and const_trait_impls. I wouldn't be surprised if there are interesting cases I haven't tested, please let me know.
r? @lcnr
(rust-highfive has picked a reviewer for you, use r? to override)
@rustbot label +A-specialization +A-traits +F-specialization +F-const_trait_impls
EDIT: whoops i thought you could do that for PRs
marking this as blocked this on a general refactoring of const trait impls, see https://rust-lang.zulipchat.com/#narrow/stream/144729-wg-traits/topic/Review.3A.20specialized.20const.20trait.20impls/near/276581945
Not sure whether it would be sensible to close this issue for now or only merge the tests with their current behavior and a FIXME.
:umbrella: The latest upstream changes (presumably #98396) made this pull request unmergeable. Please resolve the merge conflicts.
At long last 🎉
I'll take a stab at it later today. I imagine it will be more involved than just a rebase, right? IIRC there was some sort of major refactor taking place over the last few months. I sort of expected that I would have to re-implement the fix from scratch.
EDIT: oh, after looking at the code on master, looks like PredicateKinds still have a constness. I thought I remember someone saying that that was gonna be reworked. But I'm not complaining!
@rustbot ready
@rustbot ready
@Rageking8: :key: Insufficient privileges: Not in reviewers
:umbrella: The latest upstream changes (presumably #102306) made this pull request unmergeable. Please resolve the merge conflicts.
ping from triage: @BGR360
Can you please post your status on this PR?
FYI: when a PR is ready for review, send a message containing
@rustbot ready to switch to S-waiting-on-review so the PR is in the reviewer's backlog.
@JohnCSimon the PR status is correct, I was requested to add an additional test and tweak the behavior of the code. I never got around to it. Let me see if it's an easy merge and if I can knock it out now.
@bors r=lcnr
@BGR360: :key: Insufficient privileges: Not in reviewers
@lcnr I don't have permission for bors
The job x86_64-gnu-llvm-13 failed! Check out the build log: (web) (plain)
Click to see the possible cause of the failure (guessed by this bot)
---- [ui] src/test/ui/rfc-2632-const-trait-impl/specializing-constness.rs stdout ----
diff of stderr:
4 LL | impl<T: Default + Sup> A for T {
6
6
- error: missing `~const` qualifier
+ error: missing `~const` qualifier for specialization
9 |
9 |
10 LL | impl<T: Default + Sup> A for T {
The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/rfc-2632-const-trait-impl/specializing-constness/specializing-constness.stderr
To update references, rerun the tests and pass the `--bless` flag
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args rfc-2632-const-trait-impl/specializing-constness.rs`
error: 1 errors occurred comparing output.
status: exit status: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/rfc-2632-const-trait-impl/specializing-constness.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/rfc-2632-const-trait-impl/specializing-constness" "-A" "unused" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/rfc-2632-const-trait-impl/specializing-constness/auxiliary"
stdout: none
--- stderr -------------------------------
error: cannot specialize on const impl with non-const impl
|
|
LL | impl<T: Default + Sup> A for T {
error: missing `~const` qualifier for specialization
|
|
LL | impl<T: Default + Sup> A for T {
error: aborting due to 2 previous errors
------------------------------------------
@bors r+ rollup
:pushpin: Commit 94f67e667be3efd1845bb95fcd25fcce11cf983c has been approved by lcnr
It is now in the queue for this repository.