Repository navigation
Prohibit conflicting bounds in dyn, even with different generics. - #157710
theemathas wants to merge 6 commits into
Conversation
7792410 to
67244f1
Compare
This comment has been minimized.
This comment has been minimized.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
|
@bors try |
This comment has been minimized.
This comment has been minimized.
Prohibit conflicting bounds in `dyn`, even with different generics.
This comment has been minimized.
This comment has been minimized.
Prohibit conflicting bounds in `dyn`, even with different generics.
|
@craterbot check |
|
👌 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
|
@craterbot cancel See #157814 |
|
🗑️ Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
|
👌 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
|
🚧 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
|
🎉 Experiment
Footnotes
|
|
I am unsure what I should do with the tests that now no longer compile. Any suggestions? Also, I'm very unsure if I handled the binder stuff correctly. I'd like a closer look on those stuff. Also, what's up with the build failures in CI? It builds fine locally. r? @fmease |
|
HIR ty lowering was modified cc @fmease |
…ics. See rust-lang#154662 These tests will be fixed in a subsequent commit.
Fixes rust-lang#154662 In a `dyn` type, if multiple bounds are specified for the same associated item, then we previously accepted them if the relevant trait's generics are different, even if the bounds conflict. This was unsound, since those generics could end up being instantiated with identical concrete types, causing the `dyn` type to have two different "values" for the same bound. Thus, we prohibit multiple bounds for the same associated item, even if the trait's generics are different. As a side effect of this change, we also now allow duplicated bounds in a `dyn` type, as long as the bounds are syntactically identical. The now-unused `OverlappingAsssocItemConstraints` will be removed in a subsequent commit.
Fixes <rust-lang#150936> The last place where `OverlappingAsssocItemConstraints::Forbidden` was constructed was removed in a previous commit. As a result, this code path is now unreachable.
7a7f34c to
8bbea5e
Compare
|
This PR was rebased onto a different main 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. |
|
I've rebased. The previous CI failures were due to #157653 (since CI has to merge with the main branch before building). This has now been resolved. |
This comment has been minimized.
This comment has been minimized.
…ciated types in dyn. This issue previously only affected trait aliases. This PR causes the same issue to also affect supertraits.
0c0275a to
a186b79
Compare
This comment has been minimized.
This comment has been minimized.
|
The job Click to see the possible cause of the failure (guessed by this bot) |
| trait FooTrait {} | ||
| trait BarTrait {} | ||
|
|
There was a problem hiding this comment.
what are these two trait definitions doing in this snippet 😁 existing
There was a problem hiding this comment.
Seems to have been an oversight in 389907a (#146593)
|
☔ The latest upstream changes (presumably #158508) made this pull request unmergeable. Please resolve the merge conflicts by rebasing. |
View all comments
Fixes #154662, fixes #150936.
In a
dyntype, if multiple bounds are specified for the same associated item, then we previously accepted them if the relevant trait's generics are different, even if the bounds conflict.This was unsound, since those generics could end up being instantiated with identical concrete types, causing the
dyntype to have two different "values" for the same bound.Thus, we prohibit multiple bounds for the same associated item, even if the trait's generics are different.
As a side effect of this change, we also now allow duplicated bounds in a
dyntype, as long as the bounds are syntactically identical.