-
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
Deny associated type bindings within associated type bindings #102338
Deny associated type bindings within associated type bindings #102338
Conversation
r? @jackh726 (rust-highfive has picked a reviewer for you, use r? to override) |
Does this mean we should backport this PR to beta? |
Probably. |
☔ The latest upstream changes (presumably #102306) made this pull request unmergeable. Please resolve the merge conflicts. |
5ee0422
to
ca2e0bb
Compare
); | ||
|
||
let assoc_bindings = self.create_assoc_bindings_for_generic_args(item_segment.args()); | ||
if let Some(b) = assoc_bindings.first() { |
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.
I seems wasteful to convert all bindings, just to err on the first one later. This could as well be implemented as
if let Some(b) = item_segment.args().bindings.first()
Probably better as a follow-up, as there are several instances of this pattern in the file.
@bors r+ |
Rollup of 8 pull requests Successful merges: - rust-lang#100747 (Add long description and test for E0311) - rust-lang#102232 (Stabilize bench_black_box) - rust-lang#102288 (Suggest unwrapping `???<T>` if a method cannot be found on it but is present on `T`.) - rust-lang#102338 (Deny associated type bindings within associated type bindings) - rust-lang#102347 (Unescaping cleanups) - rust-lang#102348 (Tweak `FulfillProcessor`.) - rust-lang#102378 (Use already resolved `self_ty` in `confirm_fn_pointer_candidate`) - rust-lang#102380 (rustdoc: remove redundant mobile `.source > .sidebar` CSS) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
The test crashes in rustdoc apparently 😅 #102467 |
…c-bindings, r=cjgillot Don't lower assoc bindings just to deny them Some clean-up: rust-lang#102338 (comment)
[beta] backports * Avoid duplicating StorageLive in let-else rust-lang#101894 * Re-add HRTB implied static bug note rust-lang#101924 * Revert "Copy stage0 binaries into stage0-sysroot" rust-lang#101942 * implied_bounds: deal with inference vars rust-lang#102016 * fix ConstProp handling of written_only_inside_own_block_locals rust-lang#102045 * Fix wrongly refactored Lift impl rust-lang#102088 * Fix a typo “pararmeter” in error message rust-lang#102119 * Deny associated type bindings within associated type bindings rust-lang#102338 * Continue migration of CSS themes rust-lang#101934 * Fix search result colors rust-lang#102369 * Fix unwind drop glue for if-then scopes rust-lang#102394 * Revert "Use getentropy when possible on all Apple platforms" rust-lang#102693 * Fix associated type bindings with anon const in GAT position rust-lang#102336 * Revert perf-regression 101620 rust-lang#102064 * `EscapeAscii` is not an `ExactSizeIterator` rust-lang#99880
…n-assoc-ty-binding, r=cjgillot Deny associated type bindings within associated type bindings Fixes rust-lang#102335 This was made worse by rust-lang#100865, which unified the way we generate substs for GATs and non-generic associated types. However, the issue was not _caused_ by rust-lang#100865, evidenced by the test I added for GATs: ```rust trait T { type A: S<C<(), i32 = ()> = ()>; //~^ ERROR associated type bindings are not allowed here } trait Q {} trait S { type C<T>: Q; } fn main() {} ``` ^ which passes on beta (where GATs are stable) and presumably ever since GATs support was added to `create_substs_for_associated_item` in astconv.
Rollup of 8 pull requests Successful merges: - rust-lang#100747 (Add long description and test for E0311) - rust-lang#102232 (Stabilize bench_black_box) - rust-lang#102288 (Suggest unwrapping `???<T>` if a method cannot be found on it but is present on `T`.) - rust-lang#102338 (Deny associated type bindings within associated type bindings) - rust-lang#102347 (Unescaping cleanups) - rust-lang#102348 (Tweak `FulfillProcessor`.) - rust-lang#102378 (Use already resolved `self_ty` in `confirm_fn_pointer_candidate`) - rust-lang#102380 (rustdoc: remove redundant mobile `.source > .sidebar` CSS) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Fixes #102335
This was made worse by #100865, which unified the way we generate substs for GATs and non-generic associated types. However, the issue was not caused by #100865, evidenced by the test I added for GATs:
^ which passes on beta (where GATs are stable) and presumably ever since GATs support was added to
create_substs_for_associated_item
in astconv.