-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Allow specialized const trait impls. #95292
Conversation
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. |
☔ The latest upstream changes (presumably #98396) made this pull request unmergeable. Please resolve the merge conflicts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please rebase? I believe this should be unblocked now. Thank you for working on this.
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 |
d912178
to
92cb72b
Compare
@rustbot ready |
src/test/ui/rfc-2632-const-trait-impl/specialization/const-default-non-const-specialized.rs
Outdated
Show resolved
Hide resolved
src/test/ui/rfc-2632-const-trait-impl/specialization/non-const-default-const-specialized.rs
Show resolved
Hide resolved
@rustbot ready |
a2fea02
to
f380b39
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
compiler/rustc_hir_analysis/src/impl_wf_check/min_specialization.rs
Outdated
Show resolved
Hide resolved
// bgr360: I was only able to exercise the code path that raises the | ||
// "missing ~const qualifier" error by making this base impl non-const, even | ||
// though that doesn't really make sense to do. As seen below, if the base impl | ||
// is made const, rustc fails earlier with an overlapping impl failure. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some last nits, then r=me
compiler/rustc_hir_analysis/src/impl_wf_check/min_specialization.rs
Outdated
Show resolved
Hide resolved
compiler/rustc_hir_analysis/src/impl_wf_check/min_specialization.rs
Outdated
Show resolved
Hide resolved
…resent in base impl.
f380b39
to
fe53cac
Compare
@bors r=lcnr |
@BGR360: 🔑 Insufficient privileges: Not in reviewers |
@lcnr I don't have permission for bors |
This comment has been minimized.
This comment has been minimized.
@bors r+ rollup |
…earth Rollup of 8 pull requests Successful merges: - rust-lang#95292 (Allow specialized const trait impls.) - rust-lang#100386 (Make `Sized` coinductive, again) - rust-lang#102215 (Implement the `+whole-archive` modifier for `wasm-ld`) - rust-lang#103468 (Fix unused lint and parser caring about spaces to won't produce invalid code) - rust-lang#103531 (Suggest calling the instance method of the same name when method not found) - rust-lang#103960 (piece of diagnostic migrate) - rust-lang#104051 (update Miri) - rust-lang#104129 (rustdoc: use javascript to layout notable traits popups) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Allow specialized const trait impls. Fixes rust-lang#95186. Fixes rust-lang#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.
…earth Rollup of 8 pull requests Successful merges: - rust-lang#95292 (Allow specialized const trait impls.) - rust-lang#100386 (Make `Sized` coinductive, again) - rust-lang#102215 (Implement the `+whole-archive` modifier for `wasm-ld`) - rust-lang#103468 (Fix unused lint and parser caring about spaces to won't produce invalid code) - rust-lang#103531 (Suggest calling the instance method of the same name when method not found) - rust-lang#103960 (piece of diagnostic migrate) - rust-lang#104051 (update Miri) - rust-lang#104129 (rustdoc: use javascript to layout notable traits popups) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Fixes #95186.
Fixes #95187.
I've done my best to create a comprehensive test suite for the interaction between
min_specialization
andconst_trait_impls
. I wouldn't be surprised if there are interesting cases I haven't tested, please let me know.