I get the following error (after copying it into its own directory and updating Cargo.toml to use version 0.2 of pyo3).
...
Fresh pyo3 v0.2.2
Compiling word-count v0.1.0 (file:///Users/curry/src/pyo3-word-count-cls)
Running `rustc --crate-name word_count src/lib.rs --crate-type cdylib --emit=dep-info,link -C debuginfo=2 -C metadata=e3a8e3fd2660855e --out-dir /Users/curry/src/pyo3-word-count-cls/target/debug/deps -L dependency=/Users/curry/src/pyo3-word-count-cls/target/debug/deps --extern pyo3=/Users/curry/src/pyo3-word-count-cls/target/debug/deps/libpyo3-ec1dbed1e4ea7ef7.rlib --extern rayon=/Users/curry/src/pyo3-word-count-cls/target/debug/deps/librayon-79ca7c2d302b4d4c.rlib`
error[E0308]: mismatched types
--> src/lib.rs:19:1
|
19 | #[py::methods]
| ^^^^^^^^^^^^^^ expected struct `pyo3::PyType`, found struct `pyo3::PyRawObject`
|
= note: expected type `&pyo3::PyType`
found type `&pyo3::PyRawObject`
= help: here are some functions which might fulfill your needs:
- .as_ref()
- .type_object()
error: aborting due to previous error
error: Could not compile `word-count`.
Caused by:
process didn't exit successfully: `rustc --crate-name word_count src/lib.rs --crate-type cdylib --emit=dep-info,link -C debuginfo=2 -C metadata=e3a8e3fd2660855e --out-dir /Users/curry/src/pyo3-word-count-cls/target/debug/deps -L dependency=/Users/curry/src/pyo3-word-count-cls/target/debug/deps --extern pyo3=/Users/curry/src/pyo3-word-count-cls/target/debug/deps/libpyo3-ec1dbed1e4ea7ef7.rlib --extern rayon=/Users/curry/src/pyo3-word-count-cls/target/debug/deps/librayon-79ca7c2d302b4d4c.rlib` (exit code: 101)
Compiling word_count (which uses just a function instead of a class) works fine.
Relevant information:
$ rustc --version
rustc 1.23.0-nightly (d0f8e2913 2017-11-16)
this is on a developer beta of macOS 10.13.2, with Python 3.6 via anaconda (although things don't seem to be getting far enough for the Python version to matter).
Any advice? Any way I can help narrow this down?
i fixed example, it was slightly outdated. you should pull new version
Most helpful comment
i fixed example, it was slightly outdated. you should pull new version