-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Introduce AliasKind::Inherent
for inherent associated types
#109410
Conversation
Some changes occurred to the core trait solver cc @rust-lang/initiative-trait-system-refactor Some changes occurred in src/tools/clippy cc @rust-lang/clippy |
6e8db37
to
1c2dafd
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.
first round of comments, need to think more about some things like wf and implied bounds
@@ -395,6 +395,8 @@ pub(super) fn trait_explicit_predicates_and_bounds( | |||
gather_explicit_predicates_of(tcx, def_id.to_def_id()) | |||
} | |||
|
|||
// FIXME(fmease): Needs investigation: Do & can we need to handle inherent associated types more | |||
// ‘precisely’ here? E.g. to break cycles. |
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.
Would be nice to link to an issue or known-bug ui test that explains when we get cycles here.
@@ -196,6 +196,7 @@ fn insert_required_predicates_to_be_wf<'tcx>( | |||
} | |||
} | |||
|
|||
// FIXME(fmease): Do we need to handle inherent projections similarly here? |
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.
Probably? it would be nice to create a test exercising this behavior... maybe something like:
struct Foo;
impl Foo {
type IAT<'a, T> = &'a T;
}
struct Bar<'a, T>(Foo::IAT<'a, T>);
Unless I'm getting this mixed up with other implicit outlives code 🙃
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.
Right now I have a negative behavior test for type IAT<'a, T> = &'a T;
(i.e. no implied bounds).
This comment has been minimized.
This comment has been minimized.
1c2dafd
to
bc1001c
Compare
This comment has been minimized.
This comment has been minimized.
bc1001c
to
fc7ed4a
Compare
This comment has been minimized.
This comment has been minimized.
This comment was marked as resolved.
This comment was marked as resolved.
fc7ed4a
to
3e187fc
Compare
…-in-self-ty, r=compiler-errors Use region-erased self type during IAT selection Split off from rust-lang#109410 as discussed. Fixes rust-lang#109299. Re UI test: I use a reproducer of rust-lang#109299 that contains a name resolution error instead of reproducer [`regionck-2.rs`](https://github.com/rust-lang/rust/blob/fc7ed4af165c27ab5914b93251194f826920cc65/tests/ui/associated-inherent-types/regionck-2.rs) (as found in the `AliasKind::Inherent` PR) since it would (incorrectly) pass typeck in this PR due to the lack of regionck and I'd rather not make *that* a regression test (with or without `known-bug`). `@rustbot` label F-inherent_associated_types r? `@compiler-errors`
3e187fc
to
97600b0
Compare
Noting so I don't forget -- @fmease can you change these Of course, the ones that are really notes-to-self are fine, but ones that are follow-ups for the actual feature itself could be changed. I didn't look too hard so if they're all just notes-to-self that's fine too. |
👍 I tagged most of the FIXMEs with my name to signal that I want to see them solved in this PR. However, there are definitely several of those that should instead be |
…-in-self-ty, r=compiler-errors Use region-erased self type during IAT selection Split off from rust-lang#109410 as discussed. Fixes rust-lang#109299. Re UI test: I use a reproducer of rust-lang#109299 that contains a name resolution error instead of reproducer [`regionck-2.rs`](https://github.com/rust-lang/rust/blob/fc7ed4af165c27ab5914b93251194f826920cc65/tests/ui/associated-inherent-types/regionck-2.rs) (as found in the `AliasKind::Inherent` PR) since it would (incorrectly) pass typeck in this PR due to the lack of regionck and I'd rather not make *that* a regression test (with or without `known-bug`). ``@rustbot`` label F-inherent_associated_types r? ``@compiler-errors``
☔ The latest upstream changes (presumably #109552) made this pull request unmergeable. Please resolve the merge conflicts. |
97600b0
to
d2bd1b6
Compare
Some changes occurred in src/librustdoc/clean/types.rs cc @camelid rustdoc-json-types is a public (although nightly-only) API. If possible, consider changing |
@bors r+ This is fine for now, given that this is probably not the final approach and we've identified all of the existing limitations with |
…mpiler-errors Rollup of 6 pull requests Successful merges: - rust-lang#104070 (Prevent aborting guard from aborting the process in a forced unwind) - rust-lang#109410 (Introduce `AliasKind::Inherent` for inherent associated types) - rust-lang#111004 (Migrate `mir_transform` to translatable diagnostics) - rust-lang#111118 (Suggest struct when we get colon in fileds in enum) - rust-lang#111170 (Diagnostic args are still args if they're documented) - rust-lang#111354 (Fix miscompilation when calling default methods on `Future`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
The bump adds rustdoc JSON support for inherent associated types [1]. Note that that is only supported in unstable Rust, so it is too early for us to add a regression test. [1]: rust-lang/rust#109410
The bump adds rustdoc JSON support for inherent associated types [1]. Note that that is only supported in unstable Rust, so it is too early for us to add a regression test. [1]: rust-lang/rust#109410
…illaumeGomez rustdoc-json: Add tests for `#![feature(inherent_associated_types)]` Follow up to rust-lang#109410, CC `@fmease` r? `@GuillaumeGomez`
The bump adds rustdoc JSON support for inherent associated types [1]. Note that that is only supported in unstable Rust, so it is too early for us to add a regression test. [1]: rust-lang/rust#109410
The bump adds rustdoc JSON support for inherent associated types [1]. Note that that is only supported in unstable Rust, so it is too early for us to add a regression test. [1]: rust-lang/rust#109410
…s, r=compiler-errors Exclude inherent projections from some alias type `match`es Updating (hopefully) all remaining `match`es which I overlooked to update when adding `AliasKind::Inherent` in rust-lang#109410. Fixes rust-lang#111399. Sadly the regression test is a clippy test instead of a rustc one as I don't know of another way to test that a trait bound like `Ty::InhProj: Trait` doesn't cause a crash without reaching a cycle error first (this is getting old ^^'). `@rustbot` label F-inherent_associated_types r? `@compiler-errors`
…compiler-errors Introduce `AliasKind::Inherent` for inherent associated types Allows us to check (possibly generic) inherent associated types for well-formedness. Type inference now also works properly. Follow-up to rust-lang#105961. Supersedes rust-lang#108430. Fixes rust-lang#106722. Fixes rust-lang#108957. Fixes rust-lang#109768. Fixes rust-lang#109789. Fixes rust-lang#109790. ~Not to be merged before rust-lang#108860 (`AliasKind::Weak`).~ CC `@jackh726` r? `@compiler-errors` `@rustbot` label T-types F-inherent_associated_types
Allows us to check (possibly generic) inherent associated types for well-formedness.
Type inference now also works properly.
Follow-up to #105961. Supersedes #108430.
Fixes #106722.
Fixes #108957.
Fixes #109768.
Fixes #109789.
Fixes #109790.
Not to be merged before #108860 (AliasKind::Weak
).CC @jackh726
r? @compiler-errors
@rustbot label T-types F-inherent_associated_types