You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following code fails to compile, with a somewhat confusing error message:
use pyo3::prelude::*;#[pyclass]structProbe{}
The error message is:
error[E0782]: expected a type, found a trait
--> src/lib.rs:4:8
|
4 | struct Probe {}
| ^^^^^
|
help: you can add the `dyn` keyword if you want a trait object
|
4 | struct dyn Probe {}
| +++
For more information about this error, try `rustc --explain E0782`.
error: could not compile `pyo3-repro` (lib) due to 1 previous error
rust-analyzer suggests that this might be due to the trait Probe here:
Bug Description
The following code fails to compile, with a somewhat confusing error message:
The error message is:
rust-analyzer suggests that this might be due to the
trait Probe
here:pyo3/src/impl_/pyclass/probes.rs
Line 16 in 926f5cf
I'm not sure if this can be fixed, but it would be nice to at least have a clearer error message to indicate that the struct can't be called
Probe
.Steps to Reproduce
Compile the code mentioned above.
Backtrace
No response
Your operating system and version
Ubuntu 24.04
Your Python version (
python --version
)Python 3.12.3
Your Rust version (
rustc --version
)rustc 1.83.0 (90b35a623 2024-11-26)
Your PyO3 version
0.23.3
How did you install python? Did you use a virtualenv?
apt
Additional Info
This was observed when updating PyO3 from version 0.21 to 0.22, so it seems to have changed in version 0.22.
The text was updated successfully, but these errors were encountered: