Skip to content
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

fix: Wrong Self: Sized predicate for trait assoc items #17948

Merged
merged 1 commit into from
Aug 23, 2024

Conversation

ShoyuVanilla
Copy link
Member

Again while implementing object safety like #17939 😅

If we call generic_predicates_query on fn foo in the following code;

trait Foo {
    fn foo();
}

It returns implicit bound Self: Sized, even though Self is not appearing as a generic parameter inside angle brackets, but as a parent generic parameter, "trait self".

This PR prevent pushing "implicit" Self: Sized predicates in such cases

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 23, 2024
let get_trait_self_idx = |container: ItemContainerId| {
if matches!(container, ItemContainerId::TraitId(_)) {
let generics = generics(db.upcast(), def);
Some(generics.len_self())
Copy link
Member Author

Choose a reason for hiding this comment

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

parent generics are comming after self ones

@Veykril
Copy link
Member

Veykril commented Aug 23, 2024

@bors r+

@bors
Copy link
Collaborator

bors commented Aug 23, 2024

📌 Commit ad05705 has been approved by Veykril

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Aug 23, 2024

⌛ Testing commit ad05705 with merge ab34fdd...

@bors
Copy link
Collaborator

bors commented Aug 23, 2024

☀️ Test successful - checks-actions
Approved by: Veykril
Pushing ab34fdd to master...

@bors bors merged commit ab34fdd into rust-lang:master Aug 23, 2024
11 checks passed
@ShoyuVanilla ShoyuVanilla deleted the parent-self-sized branch August 24, 2024 01:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants