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.

@traviscross
Copy link
Contributor

@rust-lang/lang what are your thoughts on the fact that this PR causes us to accept this code without any lints:

...

I think it would be nice to warn users when they've written an item that can never actually be used due to unsatisfiable where clauses.

Even though it was previously possibly to write T: Trait<Assoc = u32> + Trait<Assoc = u64> with the same behaviour...

For my part, it doesn't change what I want to do here, but I'd be separately open to seeing a proposal for a lint that would flag both T: Tr<Ty = u32, Ty = u64> and T: Tr<Ty = u32> + Tr<Ty = u64>.

@rust-rfcbot rust-rfcbot added finished-final-comment-period The final comment period is finished for this PR / Issue. and removed final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. labels Sep 25, 2025
@rust-rfcbot
Copy link
Collaborator

The final comment period, with a disposition to merge, as per the review above, is now complete.

As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

This will be merged soon.

@rust-rfcbot rust-rfcbot added the to-announce Announce this issue on triage meeting label Sep 25, 2025
@traviscross traviscross added the relnotes Marks issues that should be documented in the release notes of the next release. label Sep 26, 2025
@BoxyUwU
Copy link
Member

BoxyUwU commented Oct 1, 2025

@bors r+

I think this is fine lang wise and we don't need to get Official:tm: sign off on this happening before some kind of lint. My understanding from the previous PR is that this also doesn't need any reference docs as we never documented this restriction in the first place :')

@bors
Copy link
Collaborator

bors commented Oct 1, 2025

📌 Commit 9f667cd has been approved by BoxyUwU

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 1, 2025
@scottmcm
Copy link
Member

scottmcm commented Oct 1, 2025

@rfcbot reviewed

I agree that if we can write it in the other form anyway we might as well just accept this.

I also agree with @BoxyUwU that this seems like a place where it might be interesting to lint, but I don't think the PR needs to be blocked on that. (Indeed, I'd generally rather it not be the same PR for separation of concern reasons.)

@nikomatsakis
Copy link
Contributor

@rfcbot reviewed

@traviscross traviscross removed I-lang-nominated Nominated for discussion during a lang team meeting. P-lang-drag-1 Lang team prioritization drag level 1. https://rust-lang.zulipchat.com/#narrow/channel/410516-t-lang labels Oct 1, 2025
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Oct 1, 2025
…BoxyUwU

Allow specifying multiple bounds for same associated item, except in trait objects

Supersedes rust-lang#143146, fixes rust-lang#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 rust-lang#143146 (comment) for the reason why.

`@rustbot` label T-lang T-types needs-fcp
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Oct 1, 2025
…BoxyUwU

Allow specifying multiple bounds for same associated item, except in trait objects

Supersedes rust-lang#143146, fixes rust-lang#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 rust-lang#143146 (comment) for the reason why.

``@rustbot`` label T-lang T-types needs-fcp
bors added a commit that referenced this pull request Oct 1, 2025
Rollup of 8 pull requests

Successful merges:

 - #146593 (Allow specifying multiple bounds for same associated item, except in trait objects)
 - #147177 ([DebugInfo] Fix MSVC tuple child creation)
 - #147195 (iter repeat: add tests for new count and last behavior)
 - #147202 (Swap order of `resolve_coroutine_interiors` and `handle_opaque_type_uses`)
 - #147204 (Refactor ArrayWindows to use a slice)
 - #147219 (Add proper error handling for closure in impl)
 - #147226 (include `outer_inclusive_binder` of pattern types)
 - #147230 (Fix typo in 'unfulfilled_lint_expectation' to plural)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 15b7792 into rust-lang:master Oct 1, 2025
10 checks passed
@rustbot rustbot added this to the 1.92.0 milestone Oct 1, 2025
rust-timer added a commit that referenced this pull request Oct 1, 2025
Rollup merge of #146593 - Jules-Bertholet:restrict-e0719, r=BoxyUwU

Allow specifying multiple bounds for same associated item, except in trait objects

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
github-actions bot pushed a commit to model-checking/verify-rust-std that referenced this pull request Oct 9, 2025
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#146593 (Allow specifying multiple bounds for same associated item, except in trait objects)
 - rust-lang#147177 ([DebugInfo] Fix MSVC tuple child creation)
 - rust-lang#147195 (iter repeat: add tests for new count and last behavior)
 - rust-lang#147202 (Swap order of `resolve_coroutine_interiors` and `handle_opaque_type_uses`)
 - rust-lang#147204 (Refactor ArrayWindows to use a slice)
 - rust-lang#147219 (Add proper error handling for closure in impl)
 - rust-lang#147226 (include `outer_inclusive_binder` of pattern types)
 - rust-lang#147230 (Fix typo in 'unfulfilled_lint_expectation' to plural)

r? `@ghost`
`@rustbot` modify labels: rollup
@apiraino apiraino removed the to-announce Announce this issue on triage meeting label Nov 27, 2025
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Dec 12, 2025
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [rust](https://github.com/rust-lang/rust) | minor | `1.91.1` -> `1.92.0` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>rust-lang/rust (rust)</summary>

### [`v1.92.0`](https://github.com/rust-lang/rust/blob/HEAD/RELEASES.md#Version-1920-2025-12-11)

[Compare Source](rust-lang/rust@1.91.1...1.92.0)

\==========================

<a id="1.92.0-Language"></a>

## Language

- [Document `MaybeUninit` representation and validity](rust-lang/rust#140463)
- [Allow `&raw [mut | const]` for union field in safe code](rust-lang/rust#141469)
- [Prefer item bounds of associated types over where-bounds for auto-traits and `Sized`](rust-lang/rust#144064)
- [Do not materialize `X` in `[X; 0]` when `X` is unsizing a const](rust-lang/rust#145277)
- [Support combining `#[track_caller]` and `#[no_mangle]` (requires every declaration specifying `#[track_caller]` as well)](rust-lang/rust#145724)
- [Make never type lints `never_type_fallback_flowing_into_unsafe` and `dependency_on_unit_never_type_fallback` deny-by-default](rust-lang/rust#146167)
- [Allow specifying multiple bounds for same associated item, except in trait objects](rust-lang/rust#146593)
- [Slightly strengthen higher-ranked region handling in coherence](rust-lang/rust#146725)
- [The `unused_must_use` lint no longer warns on `Result<(), Uninhabited>` (for instance, `Result<(), !>`), or `ControlFlow<Uninhabited, ()>`](rust-lang/rust#147382). This avoids having to check for an error that can never happen.

<a id="1.92.0-Compiler"></a>

## Compiler

- [Make `mips64el-unknown-linux-muslabi64` link dynamically](rust-lang/rust#146858)
- [Remove current code for embedding command-line args in PDB](rust-lang/rust#147022)
  Command-line information is typically not needed by debugging tools, and the removed code
  was causing problems for incremental builds even on targets that don't use PDB debuginfo.

<a id="1.92.0-Libraries"></a>

## Libraries

- [Specialize `Iterator::eq{_by}` for `TrustedLen` iterators](rust-lang/rust#137122)
- [Simplify `Extend` for tuples](rust-lang/rust#138799)
- [Added details to `Debug` for `EncodeWide`](rust-lang/rust#140153).
- [`iter::Repeat::last`](rust-lang/rust#147258) and [`count`](rust-lang/rust#146410) will now panic, rather than looping infinitely.

<a id="1.92.0-Stabilized-APIs"></a>

## Stabilized APIs

- [`NonZero<u{N}>::div_ceil`](https://doc.rust-lang.org/stable/std/num/struct.NonZero.html#method.div_ceil)
- [`Location::file_as_c_str`](https://doc.rust-lang.org/stable/std/panic/struct.Location.html#method.file_as_c_str)
- [`RwLockWriteGuard::downgrade`](https://doc.rust-lang.org/stable/std/sync/struct.RwLockWriteGuard.html#method.downgrade)
- [`Box::new_zeroed`](https://doc.rust-lang.org/stable/std/boxed/struct.Box.html#method.new_zeroed)
- [`Box::new_zeroed_slice`](https://doc.rust-lang.org/stable/std/boxed/struct.Box.html#method.new_zeroed_slice)
- [`Rc::new_zeroed`](https://doc.rust-lang.org/stable/std/rc/struct.Rc.html#method.new_zeroed)
- [`Rc::new_zeroed_slice`](https://doc.rust-lang.org/stable/std/rc/struct.Rc.html#method.new_zeroed_slice)
- [`Arc::new_zeroed`](https://doc.rust-lang.org/stable/std/sync/struct.Arc.html#method.new_zeroed)
- [`Arc::new_zeroed_slice`](https://doc.rust-lang.org/stable/std/sync/struct.Arc.html#method.new_zeroed_slice)
- [`btree_map::Entry::insert_entry`](https://doc.rust-lang.org/stable/std/collections/btree_map/enum.Entry.html#method.insert_entry)
- [`btree_map::VacantEntry::insert_entry`](https://doc.rust-lang.org/stable/std/collections/btree_map/struct.VacantEntry.html#method.insert_entry)
- [`impl Extend<proc_macro::Group> for proc_macro::TokenStream`](https://doc.rust-lang.org/stable/proc_macro/struct.TokenStream.html#impl-Extend%3CGroup%3E-for-TokenStream)
- [`impl Extend<proc_macro::Literal> for proc_macro::TokenStream`](https://doc.rust-lang.org/stable/proc_macro/struct.TokenStream.html#impl-Extend%3CLiteral%3E-for-TokenStream)
- [`impl Extend<proc_macro::Punct> for proc_macro::TokenStream`](https://doc.rust-lang.org/stable/proc_macro/struct.TokenStream.html#impl-Extend%3CPunct%3E-for-TokenStream)
- [`impl Extend<proc_macro::Ident> for proc_macro::TokenStream`](https://doc.rust-lang.org/stable/proc_macro/struct.TokenStream.html#impl-Extend%3CIdent%3E-for-TokenStream)

These previously stable APIs are now stable in const contexts:

- [`<[_]>::rotate_left`](https://doc.rust-lang.org/stable/std/primitive.slice.html#method.rotate_left)
- [`<[_]>::rotate_right`](https://doc.rust-lang.org/stable/std/primitive.slice.html#method.rotate_right)

<a id="1.92.0-Cargo"></a>

## Cargo

- [Added a new chapter](rust-lang/cargo#16119) to the Cargo book, ["Optimizing Build Performance"](https://doc.rust-lang.org/stable/cargo/guide/build-performance.html).

<a id="1.92.0-Rustdoc"></a>

## Rustdoc

- [If a trait item appears in rustdoc search, hide the corresponding impl items](rust-lang/rust#145898).  Previously a search for "last" would show both `Iterator::last` as well as impl methods like `std::vec::IntoIter::last`.  Now these impl methods will be hidden, freeing up space for inherent methods like `BTreeSet::last`.
- [Relax rules for identifiers in search](rust-lang/rust#147860).  Previously you could only search for identifiers that were valid in rust code, now searches only need to be valid as part of an identifier.  For example, you can now perform a search that starts with a digit.

<a id="1.92.0-Compatibility-Notes"></a>

## Compatibility Notes

- [Fix backtraces with `-C panic=abort` on Linux by generating unwind tables by default](rust-lang/rust#143613). Build with `-C force-unwind-tables=no` to keep omitting unwind tables.

* As part of the larger effort refactoring compiler built-in attributes and their diagnostics, [the future-compatibility lint `invalid_macro_export_arguments` is upgraded to deny-by-default and will be reported in dependencies too.](rust-lang/rust#143857)
* [Update the minimum external LLVM to 20](rust-lang/rust#145071)
* [Prevent downstream `impl DerefMut for Pin<LocalType>`](rust-lang/rust#145608)
* [Don't apply temporary lifetime extension rules to the arguments of non-extended `pin!` and formatting macros](rust-lang/rust#145838)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi40Ny4wIiwidXBkYXRlZEluVmVyIjoiNDIuNDcuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90Il19-->
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. finished-final-comment-period The final comment period is finished for this PR / Issue. 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. relnotes Marks issues that should be documented in the release notes of the next release. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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