Skip to content

Commit 7fdbf5a

Browse files
committed
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`.
1 parent 06d2aff commit 7fdbf5a

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

tests/test_compile_error.rs

+1
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,5 @@ fn test_compile_errors() {
6767
t.compile_fail("tests/ui/duplicate_pymodule_submodule.rs");
6868
#[cfg(all(not(Py_LIMITED_API), Py_3_11))]
6969
t.compile_fail("tests/ui/invalid_base_class.rs");
70+
t.pass("tests/ui/ambiguous_associated_items.rs");
7071
}
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
use pyo3::prelude::*;
2+
3+
#[pyclass(eq)]
4+
#[derive(PartialEq)]
5+
pub enum Items {
6+
Error,
7+
Output,
8+
Target,
9+
}
10+
11+
fn main() {}

0 commit comments

Comments
 (0)