Skip to content

compile error for latest releases of pyo3 and numpy #169

@kehlert

Description

@kehlert

Ran into the below error after I updated to the latest release of pyo3 and numpy. I also tried using the most recent versions directly from git (instead of through crates.io), and I got the same error.

error: no rules expected the token `,`
   --> /home/kurt/.cargo/git/checkouts/rust-numpy-ea13d29ac0b89ab6/49ac8e6/src/array.rs:113:42
    |
113 | pyobject_native_type_named!(PyArray<T, D>, T, D);
    |                                          ^ no rules expected this token in macro call

error: cannot find macro `pyobject_native_type_convert` in this scope
   --> /home/kurt/.cargo/git/checkouts/rust-numpy-ea13d29ac0b89ab6/49ac8e6/src/array.rs:104:1
    |
104 | pyobject_native_type_convert!(
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: a macro with a similar name exists: `pyobject_native_type_core`
    | 
   ::: /home/kurt/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.13.0/src/types/mod.rs:131:1
    |
131 | macro_rules! pyobject_native_type_core {
    | -------------------------------------- similarly named macro `pyobject_native_type_core` defined here

error: cannot find macro `pyobject_native_type_fmt` in this scope
   --> /home/kurt/.cargo/git/checkouts/rust-numpy-ea13d29ac0b89ab6/49ac8e6/src/array.rs:114:1
    |
114 | pyobject_native_type_fmt!(PyArray<T, D>, T, D);
    | ^^^^^^^^^^^^^^^^^^^^^^^^ help: a macro with a similar name exists: `pyobject_native_type`
    | 
   ::: /home/kurt/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.13.0/src/types/mod.rs:157:1
    |
157 | macro_rules! pyobject_native_type {
    | --------------------------------- similarly named macro `pyobject_native_type` defined here

error: cannot find macro `pyobject_native_type_fmt` in this scope
   --> /home/kurt/.cargo/git/checkouts/rust-numpy-ea13d29ac0b89ab6/49ac8e6/src/dtype.rs:35:1
    |
35  | pyobject_native_type_fmt!(PyArrayDescr);
    | ^^^^^^^^^^^^^^^^^^^^^^^^ help: a macro with a similar name exists: `pyobject_native_type`
    | 
   ::: /home/kurt/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.13.0/src/types/mod.rs:157:1
    |
157 | macro_rules! pyobject_native_type {
    | --------------------------------- similarly named macro `pyobject_native_type` defined here

error[E0277]: the trait bound `PyArray<T, D>: PyTypeInfo` is not satisfied
   --> /home/kurt/.cargo/git/checkouts/rust-numpy-ea13d29ac0b89ab6/49ac8e6/src/array.rs:101:19
    |
101 | unsafe impl<T, D> type_object::PyLayout<PyArray<T, D>> for npyffi::PyArrayObject {}
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `PyTypeInfo` is not implemented for `PyArray<T, D>`
    | 
   ::: /home/kurt/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.13.0/src/type_object.rs:18:30
    |
18  | pub unsafe trait PyLayout<T: PyTypeInfo> {
    |                              ---------- required by this bound in `PyLayout`

error[E0277]: the trait bound `PyArray<T, D>: PyTypeInfo` is not satisfied
   --> /home/kurt/.cargo/git/checkouts/rust-numpy-ea13d29ac0b89ab6/49ac8e6/src/array.rs:102:12
    |
102 | impl<T, D> type_object::PySizedLayout<PyArray<T, D>> for npyffi::PyArrayObject {}
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `PyTypeInfo` is not implemented for `PyArray<T, D>`
    | 
   ::: /home/kurt/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-0.13.0/src/type_object.rs:30:28
    |
30  | pub trait PySizedLayout<T: PyTypeInfo>: PyLayout<T> + Sized {}
    |                            ---------- required by this bound in `PySizedLayout`

error: aborting due to 6 previous errors

For more information about this error, try `rustc --explain E0277`.
error: could not compile `numpy`

To learn more, run the command again with --verbose.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions