Merge pull request #3813 from davidhewitt/nightly-2024-02-08

ci: allow some dead code warnings on nightly
This commit is contained in:
David Hewitt 2024-02-08 21:32:57 +00:00 committed by GitHub
commit 9bb001108b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 18 additions and 12 deletions

View File

@ -64,6 +64,7 @@ class Model:
The following wrapper will call the Python model from Rust, using a struct to hold the model as a `PyAny` object:
```rust
# #![allow(dead_code)]
use pyo3::prelude::*;
# pub trait Model {
@ -162,6 +163,7 @@ However, we can write a second wrapper around these functions to call them direc
This wrapper will also perform the type conversions between Python and Rust.
```rust
# #![allow(dead_code)]
# use pyo3::prelude::*;
#
# pub trait Model {
@ -330,6 +332,7 @@ Let's modify the code performing the type conversion to give a helpful error mes
We used in our `get_results` method the following call that performs the type conversion:
```rust
# #![allow(dead_code)]
# use pyo3::prelude::*;
#
# pub trait Model {
@ -382,6 +385,7 @@ impl Model for UserModel {
Let's break it down in order to perform better error handling:
```rust
# #![allow(dead_code)]
# use pyo3::prelude::*;
#
# pub trait Model {
@ -460,6 +464,7 @@ Because of this, we can write a function wrapper that takes the `UserModel`--whi
It is also required to make the struct public.
```rust
# #![allow(dead_code)]
use pyo3::prelude::*;
pub trait Model {

View File

@ -19,6 +19,7 @@
//! defined as the following:
//!
//! ```rust
//! # #![allow(dead_code)]
//! pub unsafe trait Ungil {}
//!
//! unsafe impl<T: Send> Ungil for T {}

View File

@ -7,23 +7,23 @@ error[E0277]: `*mut pyo3::Python<'static>` cannot be shared between threads safe
| required by a bound introduced by this call
|
= help: within `pyo3::Python<'_>`, the trait `Sync` is not implemented for `*mut pyo3::Python<'static>`
note: required because it appears within the type `PhantomData<*mut Python<'static>>`
note: required because it appears within the type `PhantomData<*mut pyo3::Python<'static>>`
--> $RUST/core/src/marker.rs
|
| pub struct PhantomData<T: ?Sized>;
| ^^^^^^^^^^^
note: required because it appears within the type `NotSend`
note: required because it appears within the type `impl_::not_send::NotSend`
--> src/impl_/not_send.rs
|
| pub(crate) struct NotSend(PhantomData<*mut Python<'static>>);
| ^^^^^^^
= note: required because it appears within the type `(&GILGuard, NotSend)`
note: required because it appears within the type `PhantomData<(&GILGuard, NotSend)>`
= note: required because it appears within the type `(&pyo3::gil::GILGuard, impl_::not_send::NotSend)`
note: required because it appears within the type `PhantomData<(&pyo3::gil::GILGuard, impl_::not_send::NotSend)>`
--> $RUST/core/src/marker.rs
|
| pub struct PhantomData<T: ?Sized>;
| ^^^^^^^^^^^
note: required because it appears within the type `Python<'_>`
note: required because it appears within the type `pyo3::Python<'_>`
--> src/marker.rs
|
| pub struct Python<'py>(PhantomData<(&'py GILGuard, NotSend)>);

View File

@ -10,28 +10,28 @@ error[E0277]: `*mut pyo3::Python<'static>` cannot be shared between threads safe
| |_________^ `*mut pyo3::Python<'static>` cannot be shared between threads safely
|
= help: within `pyo3::Bound<'_, PyString>`, the trait `Sync` is not implemented for `*mut pyo3::Python<'static>`
note: required because it appears within the type `PhantomData<*mut Python<'static>>`
note: required because it appears within the type `PhantomData<*mut pyo3::Python<'static>>`
--> $RUST/core/src/marker.rs
|
| pub struct PhantomData<T: ?Sized>;
| ^^^^^^^^^^^
note: required because it appears within the type `NotSend`
note: required because it appears within the type `impl_::not_send::NotSend`
--> src/impl_/not_send.rs
|
| pub(crate) struct NotSend(PhantomData<*mut Python<'static>>);
| ^^^^^^^
= note: required because it appears within the type `(&GILGuard, NotSend)`
note: required because it appears within the type `PhantomData<(&GILGuard, NotSend)>`
= note: required because it appears within the type `(&pyo3::gil::GILGuard, impl_::not_send::NotSend)`
note: required because it appears within the type `PhantomData<(&pyo3::gil::GILGuard, impl_::not_send::NotSend)>`
--> $RUST/core/src/marker.rs
|
| pub struct PhantomData<T: ?Sized>;
| ^^^^^^^^^^^
note: required because it appears within the type `Python<'_>`
note: required because it appears within the type `pyo3::Python<'_>`
--> src/marker.rs
|
| pub struct Python<'py>(PhantomData<(&'py GILGuard, NotSend)>);
| ^^^^^^
note: required because it appears within the type `Bound<'_, PyString>`
note: required because it appears within the type `pyo3::Bound<'_, PyString>`
--> src/instance.rs
|
| pub struct Bound<'py, T>(Python<'py>, ManuallyDrop<Py<T>>);

View File

@ -15,7 +15,7 @@ error[E0308]: mismatched types
| |___________________^ expected fn pointer, found fn item
|
= note: expected fn pointer `for<'a, 'b> fn(&'a TraverseTriesToTakePyRef, PyVisit<'b>) -> Result<(), PyTraverseError>`
found fn item `for<'a, 'b> fn(pyo3::PyRef<'a, TraverseTriesToTakePyRef>, PyVisit<'b>) {TraverseTriesToTakePyRef::__traverse__}`
found fn item `for<'a, 'b> fn(pyo3::PyRef<'a, TraverseTriesToTakePyRef, >, PyVisit<'b>) {TraverseTriesToTakePyRef::__traverse__}`
note: function defined here
--> src/impl_/pymethods.rs
|