rigetti / qcs-sdk-rust

Rust SDK for Rigetti Quantum Cloud Services (QCS)
https://docs.rs/qcs
12 stars 5 forks source link

error[E0277]: the trait bound `Duration: rigetti_pyo3::PyTryFrom<pyo3::Py<PyDelta>>` is not satisfied #475

Closed yurivict closed 3 months ago

yurivict commented 3 months ago

The build fails:

error[E0277]: the trait bound `Duration: rigetti_pyo3::PyTryFrom<pyo3::Py<PyDelta>>` is not satisfied
  --> crates/python/src/execution_data.rs:72:1
   |
72 | / py_wrap_data_struct! {
73 | |     #[pyo3(module = "qcs_sdk")]
74 | |     #[derive(Debug, PartialEq)]
75 | |     PyExecutionData(ExecutionData) as "ExecutionData" {
...  |
78 | |     }
79 | | }     
   | |_^ the trait `rigetti_pyo3::PyTryFrom<pyo3::Py<PyDelta>>` is not implemented for `Duration`, which is required by `std::option::Option<Duration>: rigetti_pyo3::PyTryFrom<std::option::Option<pyo3::Py<PyDelta>>>`
   |
   = help: the following other types implement trait `rigetti_pyo3::PyTryFrom<P>`:
             <bool as rigetti_pyo3::PyTryFrom<bool>>
             <bool as rigetti_pyo3::PyTryFrom<pyo3::Py<PyBool>>>
             <bool as rigetti_pyo3::PyTryFrom<PyAny>>
             <bool as rigetti_pyo3::PyTryFrom<PyBool>>
             <isize as rigetti_pyo3::PyTryFrom<isize>>
             <isize as rigetti_pyo3::PyTryFrom<pyo3::Py<PyInt>>>
             <isize as rigetti_pyo3::PyTryFrom<PyAny>>
             <isize as rigetti_pyo3::PyTryFrom<PyInt>>
           and 273 others
   = note: required for `std::option::Option<Duration>` to implement `rigetti_pyo3::PyTryFrom<std::option::Option<pyo3::Py<PyDelta>>>`
   = note: this error originates in the macro `$crate::private_intermediate_try_from_python` which comes from the expansion of the macro `py_wrap_data_struct` (in Nightly builds, run with -Z macro-backtrace for more info)

Version: 0.17.9 rust-1.78.0 FreeBSD 14.1

antalsz commented 3 months ago

Thanks for catching this – looks like the change I made in rigetti/rigetti-pyo3#45 was breaking, which I didn't realize. I think the fix for this is as simple as adding the time feature to rigetti-pyo3; I'll put up a PR for that immediately!

antalsz commented 3 months ago

@yurivict I think #476 should fix your problems, but give us a shout if there's still anything going wrong!