Skip to content

Conversation

davidhewitt
Copy link
Member

Following PyO3/rust-numpy#432 (reply in thread), I noticed that we could probably do a bit better on the various Python type objects to show where to find the new Bound functionality.

This is a first pass at adding that information. It's quite copy-and-paste, but I think it's better than nothing.

@LilyFirefly
Copy link
Contributor

Here's a more readable diff of the test failure (test tests/ui/invalid_pyfunctions.rs [should fail to compile] ... mismatch):

@@ -47,11 +47,11 @@ error: expected `&PyModule` or `Py<PyModule>` as first argument with `pass_modul
 32 | fn pass_module_but_no_arguments<'py>() {}
    |                                     ^^
 
-error[E0277]: the trait bound `&str: From<BoundRef<'_, '_, pyo3::prelude::PyModule>>` is not satisfied
+error[E0277]: the trait bound `&str: From<BoundRef<'_, '_, pyo3::types::PyModule>>` is not satisfied
   --> tests/ui/invalid_pyfunctions.rs:36:14
    |
 36 |     _string: &str,
-   |              ^ the trait `From<BoundRef<'_, '_, pyo3::prelude::PyModule>>` is not implemented for `&str`, which is required by `BoundRef<'_, '_, pyo3::prelude::PyModule>: Into<_>`
+   |              ^ the trait `From<BoundRef<'_, '_, pyo3::types::PyModule>>` is not implemented for `&str`, which is required by `BoundRef<'_, '_, pyo3::types::PyModule>: Into<_>`
    |
    = help: the following other types implement trait `From<T>`:
              <String as From<&String>>
@@ -60,4 +60,4 @@ error[E0277]: the trait bound `&str: From<BoundRef<'_, '_, pyo3::prelude::PyModu
              <String as From<Box<str>>>
              <String as From<Cow<'a, str>>>
              <String as From<char>>
-   = note: required for `BoundRef<'_, '_, pyo3::prelude::PyModule>` to implement `Into<&str>`
+   = note: required for `BoundRef<'_, '_, pyo3::types::PyModule>` to implement `Into<&str>`

@davidhewitt davidhewitt enabled auto-merge July 9, 2024 11:33
@davidhewitt davidhewitt added this pull request to the merge queue Jul 9, 2024
Merged via the queue into PyO3:main with commit 186c7d3 Jul 9, 2024
@davidhewitt davidhewitt deleted the bound-types-docs branch July 9, 2024 12:53
davidhewitt added a commit that referenced this pull request Jul 10, 2024
* docs: improve signposting to bound and traits

* update UI tests
davidhewitt added a commit that referenced this pull request Jul 17, 2024
* docs: improve signposting to bound and traits

* update UI tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants