-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Update orphan and overlap rules for RFC 1023 #23867
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Update orphan and overlap rules for RFC 1023 #23867
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
The integration of coherence checking into trait matching is a bit less clean than I would like -- it preserves the existing "intercrate mode". I'd like to rework select to remove that mode and instead consider that an impl like |
Ah, and I just remembered a potential bug around subtyping in the way that I implemented the orphan check. I'll patch that. But it shouldn't really affect much, so I'll leave the PR open to use for reference while considering rust-lang/rfcs#1023. |
r? @pnkfelix Since we will remove variance for trait matching, that complication is resolved the easy way. My concern was that the overlap checking wasn't checking all 4 combinations that seem to be necessary with variance (that is, instantiate impl A with skolemized parameters, then check whether A <: B or B <: A, and vice versa). But with invariance you need only check whether A = B, which is reflexive. |
6f214c6
to
1451d80
Compare
Okay, I left some notes, but its all truly minor nits that I only recommend you do if you already are rebasing this PR for some other reason. So r+ from me. |
@bors r+ 6ba9692 |
6ba9692
to
67abce2
Compare
Addressed nits. |
@bors r=pnkfelix 67abce2 |
☔ The latest upstream changes (presumably #23936) made this pull request unmergeable. Please resolve the merge conflicts. |
local only if matches `FUNDAMENTAL(LocalType)`, where `FUNDAMENTAL` includes `&T` and types marked as fundamental (which includes `Box`). Also apply these tests to negative reasoning.
`Fn` traits are considered fundamental, along with `Box` (though that is mostly for show; the real type is `~T` in the compiler).
probing the specifics of `Fundamental`. Fixes rust-lang#23086. Fixes rust-lang#23516.
since `Option` is not fundamental and hence the old impls run afoul of the orphan rules.
67abce2
to
15b58fe
Compare
…pnkfelix This PR implements rust-lang/rfcs#1023. In the process it fixes rust-lang#23086 and rust-lang#23516. A few impls in libcore had to be updated, but the impact is generally pretty minimal. Most of the fallout is in the tests that probed the limits of today's coherence. I tested and we were able to build the most popular crates along with iron (modulo errors around errors being sendable). Fixes rust-lang#23918.
sidesteps a coherence difficulty where `liballoc` had to prove that `&str: !Error`, which didn't involve any local types.
This PR implements rust-lang/rfcs#1023. In the process it fixes rust-lang#23086 and rust-lang#23516. A few impls in libcore had to be updated, but the impact is generally pretty minimal. Most of the fallout is in the tests that probed the limits of today's coherence. I tested and we were able to build the most popular crates along with iron (modulo errors around errors being sendable). Fixes rust-lang#23918.
⌛ Testing commit 19d3dab with merge 2b42de0... |
This should have been marked breaking-change? |
Yup. Broke something for rust-ascii. |
This PR implements rust-lang/rfcs#1023. In the process it fixes #23086 and #23516. A few impls in libcore had to be updated, but the impact is generally pretty minimal. Most of the fallout is in the tests that probed the limits of today's coherence.
I tested and we were able to build the most popular crates along with iron (modulo errors around errors being sendable).
Fixes #23918.