Skip to content

Conversation

Jules-Bertholet
Copy link
Contributor

Supersedes #143146, fixes #143143.

This PR proposes to stop enforcing E0719 in all contexts other than trait object types.

E0719 forbids constraining the same associated item twice within the same angle-bracket delimited associated item bound list (the inside T: Trait<…>). For example, the following are forbidden:

Forbidden Working alternative
T: Trait<Gat<u32> = u32, Gat<u64> = u64> T: Trait<Gat<u32> = u32> + Trait<Gat<u64> = u64>
T: Iterator<Item = u32, Item = i32> T: Iterator<Item = u32> + Iterator<Item = i32> (trivially false)
T: Iterator<Item = u32, Item = u32> T: Iterator<Item = u32>
T: Iterator<Item: Send, Item: Sync> T: Iterator<Item: Send + Sync>
T: Trait<ASSOC = 3, ASSOC = 4> T: Trait<ASSOC = 3> + Trait<ASSOC = 4> (trivially false)
T: Trait<ASSOC = 3, ASSOC = 3> T: Trait<ASSOC = 3>

With this PR, all those previously forbidden examples would start working, as well as their APIT and RPIT equivalents.

Types like dyn Iterator<Item = u32, Item = u32> will continue to be rejected, however. See #143146 (comment) for the reason why.

@rustbot label T-lang T-types needs-fcp

@rustbot
Copy link
Collaborator

rustbot commented Sep 15, 2025

HIR ty lowering was modified

cc @fmease

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 15, 2025
@rustbot

This comment has been minimized.

@rustbot rustbot added needs-fcp This change is insta-stable, or significant enough to need a team FCP to proceed. T-lang Relevant to the language team T-types Relevant to the types team, which will review and decide on the PR/issue. labels Sep 15, 2025
@Jules-Bertholet Jules-Bertholet changed the title Enforce E0719 only for trait aliases Enforce E0719 only for trait objects Sep 15, 2025
@fmease
Copy link
Member

fmease commented Sep 15, 2025

Nobody knows what E0719 is when they're just scrolling by and reading the title, it's as if you put a GH issue number there; please make the title more descriptive.

@Jules-Bertholet Jules-Bertholet changed the title Enforce E0719 only for trait objects Allow specifying multiple bounds for same associated item, except in trait objects Sep 15, 2025
@BoxyUwU
Copy link
Member

BoxyUwU commented Sep 15, 2025

r? BoxyUwU

@rustbot rustbot assigned BoxyUwU and unassigned fee1-dead Sep 15, 2025
@traviscross traviscross added I-lang-nominated Nominated for discussion during a lang team meeting. I-lang-radar Items that are on lang's radar and will need eventual work or consideration. P-lang-drag-1 Lang team prioritization drag level 1. https://rust-lang.zulipchat.com/#narrow/channel/410516-t-lang and removed T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-types Relevant to the types team, which will review and decide on the PR/issue. labels Sep 15, 2025
@traviscross
Copy link
Contributor

Over in #143146, we had proposed FCP and then filed a concern related to dyn following @lcnr's comment in #143146 (comment). This PR removes the dyn part of this, so I'll go ahead and propose FCP again and check the boxes of those who had checked off there (@joshtriplett and @tmandry) as this is a strict subset of the other PR.

@rfcbot fcp merge

cc @rust-lang/types

@rust-rfcbot
Copy link
Collaborator

rust-rfcbot commented Sep 15, 2025

Team member @traviscross has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

cc @rust-lang/lang-advisors: FCP proposed for lang, please feel free to register concerns.
See this document for info about what commands tagged team members can give me.

@rust-rfcbot rust-rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. labels Sep 15, 2025
@traviscross
Copy link
Contributor

@rfcbot ping

@rust-rfcbot rust-rfcbot added final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. and removed proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. labels Sep 15, 2025
@rust-rfcbot
Copy link
Collaborator

🔔 This is now entering its final comment period, as per the review above. 🔔

@bors
Copy link
Collaborator

bors commented Sep 18, 2025

☔ The latest upstream changes (presumably #146698) made this pull request unmergeable. Please resolve the merge conflicts.

@rustbot
Copy link
Collaborator

rustbot commented Sep 18, 2025

This PR was rebased onto a different master 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. I-lang-nominated Nominated for discussion during a lang team meeting. I-lang-radar Items that are on lang's radar and will need eventual work or consideration. needs-fcp This change is insta-stable, or significant enough to need a team FCP to proceed. P-lang-drag-1 Lang team prioritization drag level 1. https://rust-lang.zulipchat.com/#narrow/channel/410516-t-lang S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-lang Relevant to the language team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't specify multiple associated type bindings for same GAT even if args differ
8 participants