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 ambiguous associated item error #4725

Merged
merged 2 commits into from
Nov 23, 2024

Conversation

LilyFoote
Copy link
Contributor

Fixes #4723.

@LilyFoote LilyFoote added bugfix rust Pull requests that update Rust code labels Nov 21, 2024
@LilyFoote LilyFoote requested a review from Icxolu November 21, 2024 22:12
@LilyFoote LilyFoote self-assigned this Nov 21, 2024
Copy link
Contributor

@alex alex left a comment

Choose a reason for hiding this comment

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

Incredible

Copy link
Contributor

@Icxolu Icxolu left a comment

Choose a reason for hiding this comment

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

Thanks! So many edge cases to look out for 😅

pyo3-macros-backend/src/pyclass.rs Outdated Show resolved Hide resolved
@LilyFoote LilyFoote force-pushed the fix-ambiguous-associated-item-error branch 2 times, most recently from a858c2e to d7d5b54 Compare November 22, 2024 08:01
@davidhewitt davidhewitt mentioned this pull request Nov 22, 2024
The `#[pyclass]` macro implements `IntoPyObject` for the annotated enum.
When the enum has any of `Error`, `Output` or `Target` as members, this
clashes with the associated types of `IntoPyObject`.

This also happens when deriving `IntoPyObject` directly.
@LilyFoote LilyFoote force-pushed the fix-ambiguous-associated-item-error branch from d7d5b54 to 5335b28 Compare November 23, 2024 18:19
This uses the fix described in rust-lang/rust#57644

Also apply fix to `#[derive(IntoPyObject)]`.
@LilyFoote LilyFoote force-pushed the fix-ambiguous-associated-item-error branch from 5335b28 to f82ca32 Compare November 23, 2024 19:41
Copy link
Member

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

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

Thanks, I think this seems complete to me too 👍

@davidhewitt davidhewitt added this pull request to the merge queue Nov 23, 2024
Merged via the queue into main with commit 9681b54 Nov 23, 2024
46 checks passed
@davidhewitt davidhewitt deleted the fix-ambiguous-associated-item-error branch November 23, 2024 22:50
davidhewitt pushed a commit that referenced this pull request Nov 25, 2024
* Add test for ambiguous associated item

The `#[pyclass]` macro implements `IntoPyObject` for the annotated enum.
When the enum has any of `Error`, `Output` or `Target` as members, this
clashes with the associated types of `IntoPyObject`.

This also happens when deriving `IntoPyObject` directly.

* Fix #4723: ambiguous associated item in #[pyclass]

This uses the fix described in rust-lang/rust#57644

Also apply fix to `#[derive(IntoPyObject)]`.
davidhewitt pushed a commit that referenced this pull request Nov 25, 2024
* Add test for ambiguous associated item

The `#[pyclass]` macro implements `IntoPyObject` for the annotated enum.
When the enum has any of `Error`, `Output` or `Target` as members, this
clashes with the associated types of `IntoPyObject`.

This also happens when deriving `IntoPyObject` directly.

* Fix #4723: ambiguous associated item in #[pyclass]

This uses the fix described in rust-lang/rust#57644

Also apply fix to `#[derive(IntoPyObject)]`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix rust Pull requests that update Rust code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ambiguous associated item 'Error' since 0.23
4 participants