about summary refs log tree commit diff
path: root/tests/ui/issues/issue-25089.rs
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-10-01 18:42:34 +0200
committerGitHub <noreply@github.com>2025-10-01 18:42:34 +0200
commit15b7792a65a5f50d22f77c02cff75f8015c48bc8 (patch)
treefecf7a676803cc87c864fbc49faf120f7e9e195c /tests/ui/issues/issue-25089.rs
parent1e1a39441bd11aba541a48ba714d939490fc7b85 (diff)
parent9f667cdd243d905848ccfc031f4c1373828c9a7d (diff)
downloadrust-15b7792a65a5f50d22f77c02cff75f8015c48bc8.tar.gz
rust-15b7792a65a5f50d22f77c02cff75f8015c48bc8.zip
Rollup merge of #146593 - Jules-Bertholet:restrict-e0719, r=BoxyUwU
Allow specifying multiple bounds for same associated item, except in trait objects

Supersedes https://github.com/rust-lang/rust/pull/143146, fixes https://github.com/rust-lang/rust/issues/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 https://github.com/rust-lang/rust/pull/143146#issuecomment-3274421752 for the reason why.

```@rustbot``` label T-lang T-types needs-fcp
Diffstat (limited to 'tests/ui/issues/issue-25089.rs')
0 files changed, 0 insertions, 0 deletions