Skip to content

Conversation

Jules-Bertholet
Copy link
Contributor

This hard error serves no purpose.
Fixes #143143.

(Documentation of E0719: https://doc.rust-lang.org/stable/error_codes/E0719.html)

@rustbot label T-lang needs-fcp

@rustbot
Copy link
Collaborator

rustbot commented Jun 28, 2025

r? @compiler-errors

rustbot has assigned @compiler-errors.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@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 Jun 28, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jun 28, 2025

Some changes occurred in diagnostic error codes

cc @GuillaumeGomez

HIR ty lowering was modified

cc @fmease

@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 labels Jun 28, 2025
@rustbot

This comment has been minimized.

@fmease
Copy link
Member

fmease commented Jun 28, 2025

more importantly cc @rust-lang/types rather than T-lang

@fmease fmease added T-types Relevant to the types team, which will review and decide on the PR/issue. and removed T-lang Relevant to the language team T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 28, 2025
@fmease fmease changed the title Remove E0719 Allow specifying multiple associated type bindings for same GAT if gen args differ Jun 28, 2025
@fmease fmease changed the title Allow specifying multiple associated type bindings for same GAT if gen args differ Allow specifying multiple associated type bindings Jun 28, 2025
@Jules-Bertholet Jules-Bertholet changed the title Allow specifying multiple associated type bindings Allow specifying multiple bounds for same associated type (remove E0719) Jun 28, 2025
@fmease fmease changed the title Allow specifying multiple bounds for same associated type (remove E0719) Allow specifying multiple bounds for same associated item (remove E0719) Jun 28, 2025
@rust-log-analyzer

This comment has been minimized.

@Jules-Bertholet Jules-Bertholet requested a review from fmease June 28, 2025 17:20
Copy link
Member

@fmease fmease Jun 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(commenting on a random file so it's threaded)

Thanks for incorporating my suggestion about adding more tests!

What are the interactions with trait object types? It's possible that lower_trait_object_ty still ends up rejecting such dyn-Traits (e.g., dyn Trait<X = i32, X = u64>) due to its intricate and delicate logic but I might not be right. For example, we currently reject:

#![feature(trait_alias)]
trait Iter = Iterator<Item = ()>;
fn f(_: Box<dyn Iter<Item = u64>>) {} //~ ERROR conflicting associated type bounds for `Item` when expanding trait alias

I'm curious about whether that gets triggered for sth. like dyn Trait<X = i32, X = u64> 🤔 If not, I wonder if we should then also lift this trait alias restriction?

I don't know the soundness implications of allowing these equality predicates in trait object types since I haven't spent much thought on it. In my mind, a trait object type with "impossible" existential projection predicates should be fine, it would just be impossible to construct a value of it. Anyhow, I'm not qualified enough to draw a proper conclusion.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! It looks like we do trigger that error. I added tests, and tweaked the error message to be more generic.

Interestingly, it seems that if you do:

trait Sup {
    type Assoc;
}

trait Sub: Sup<Assoc = u32> {}

type Foo = dyn Sub<Assoc = i32>;

Then no error is emitted, but Foo does not implement Sub.

@compiler-errors
Copy link
Member

r? fmease

@rustbot rustbot assigned fmease and unassigned compiler-errors Jul 16, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jul 16, 2025

fmease is not on the review rotation at the moment.
They may take a while to respond.

@bors
Copy link
Collaborator

bors commented Jul 19, 2025

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

This hard error serves no purpose.
Fixes rust-lang#143143
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-fcp This change is insta-stable, or significant enough to need a team FCP to proceed. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-types Relevant to the types team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't specific multiple associated type bindings for same GAT even if args differ
6 participants