Skip to content

Commit

Permalink
Add test for ambiguous associated item
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
LilyFoote committed Nov 21, 2024
1 parent 06d2aff commit 7fdbf5a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/test_compile_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,5 @@ fn test_compile_errors() {
t.compile_fail("tests/ui/duplicate_pymodule_submodule.rs");
#[cfg(all(not(Py_LIMITED_API), Py_3_11))]
t.compile_fail("tests/ui/invalid_base_class.rs");
t.pass("tests/ui/ambiguous_associated_items.rs");
}
11 changes: 11 additions & 0 deletions tests/ui/ambiguous_associated_items.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
use pyo3::prelude::*;

#[pyclass(eq)]
#[derive(PartialEq)]
pub enum Items {
Error,
Output,
Target,
}

fn main() {}

0 comments on commit 7fdbf5a

Please sign in to comment.