Skip to content

Commit 9bb0011

Browse files
authored
Merge pull request PyO3#3813 from davidhewitt/nightly-2024-02-08
ci: allow some dead code warnings on nightly
2 parents 030a618 + bcb7b88 commit 9bb0011

File tree

5 files changed

+18
-12
lines changed

5 files changed

+18
-12
lines changed

guide/src/trait_bounds.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ class Model:
6464
The following wrapper will call the Python model from Rust, using a struct to hold the model as a `PyAny` object:
6565

6666
```rust
67+
# #![allow(dead_code)]
6768
use pyo3::prelude::*;
6869

6970
# pub trait Model {
@@ -162,6 +163,7 @@ However, we can write a second wrapper around these functions to call them direc
162163
This wrapper will also perform the type conversions between Python and Rust.
163164

164165
```rust
166+
# #![allow(dead_code)]
165167
# use pyo3::prelude::*;
166168
#
167169
# pub trait Model {
@@ -330,6 +332,7 @@ Let's modify the code performing the type conversion to give a helpful error mes
330332
We used in our `get_results` method the following call that performs the type conversion:
331333

332334
```rust
335+
# #![allow(dead_code)]
333336
# use pyo3::prelude::*;
334337
#
335338
# pub trait Model {
@@ -382,6 +385,7 @@ impl Model for UserModel {
382385
Let's break it down in order to perform better error handling:
383386

384387
```rust
388+
# #![allow(dead_code)]
385389
# use pyo3::prelude::*;
386390
#
387391
# pub trait Model {
@@ -460,6 +464,7 @@ Because of this, we can write a function wrapper that takes the `UserModel`--whi
460464
It is also required to make the struct public.
461465

462466
```rust
467+
# #![allow(dead_code)]
463468
use pyo3::prelude::*;
464469

465470
pub trait Model {

src/marker.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
//! defined as the following:
2020
//!
2121
//! ```rust
22+
//! # #![allow(dead_code)]
2223
//! pub unsafe trait Ungil {}
2324
//!
2425
//! unsafe impl<T: Send> Ungil for T {}

tests/ui/not_send.stderr

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,23 @@ error[E0277]: `*mut pyo3::Python<'static>` cannot be shared between threads safe
77
| required by a bound introduced by this call
88
|
99
= help: within `pyo3::Python<'_>`, the trait `Sync` is not implemented for `*mut pyo3::Python<'static>`
10-
note: required because it appears within the type `PhantomData<*mut Python<'static>>`
10+
note: required because it appears within the type `PhantomData<*mut pyo3::Python<'static>>`
1111
--> $RUST/core/src/marker.rs
1212
|
1313
| pub struct PhantomData<T: ?Sized>;
1414
| ^^^^^^^^^^^
15-
note: required because it appears within the type `NotSend`
15+
note: required because it appears within the type `impl_::not_send::NotSend`
1616
--> src/impl_/not_send.rs
1717
|
1818
| pub(crate) struct NotSend(PhantomData<*mut Python<'static>>);
1919
| ^^^^^^^
20-
= note: required because it appears within the type `(&GILGuard, NotSend)`
21-
note: required because it appears within the type `PhantomData<(&GILGuard, NotSend)>`
20+
= note: required because it appears within the type `(&pyo3::gil::GILGuard, impl_::not_send::NotSend)`
21+
note: required because it appears within the type `PhantomData<(&pyo3::gil::GILGuard, impl_::not_send::NotSend)>`
2222
--> $RUST/core/src/marker.rs
2323
|
2424
| pub struct PhantomData<T: ?Sized>;
2525
| ^^^^^^^^^^^
26-
note: required because it appears within the type `Python<'_>`
26+
note: required because it appears within the type `pyo3::Python<'_>`
2727
--> src/marker.rs
2828
|
2929
| pub struct Python<'py>(PhantomData<(&'py GILGuard, NotSend)>);

tests/ui/not_send2.stderr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,28 @@ error[E0277]: `*mut pyo3::Python<'static>` cannot be shared between threads safe
1010
| |_________^ `*mut pyo3::Python<'static>` cannot be shared between threads safely
1111
|
1212
= help: within `pyo3::Bound<'_, PyString>`, the trait `Sync` is not implemented for `*mut pyo3::Python<'static>`
13-
note: required because it appears within the type `PhantomData<*mut Python<'static>>`
13+
note: required because it appears within the type `PhantomData<*mut pyo3::Python<'static>>`
1414
--> $RUST/core/src/marker.rs
1515
|
1616
| pub struct PhantomData<T: ?Sized>;
1717
| ^^^^^^^^^^^
18-
note: required because it appears within the type `NotSend`
18+
note: required because it appears within the type `impl_::not_send::NotSend`
1919
--> src/impl_/not_send.rs
2020
|
2121
| pub(crate) struct NotSend(PhantomData<*mut Python<'static>>);
2222
| ^^^^^^^
23-
= note: required because it appears within the type `(&GILGuard, NotSend)`
24-
note: required because it appears within the type `PhantomData<(&GILGuard, NotSend)>`
23+
= note: required because it appears within the type `(&pyo3::gil::GILGuard, impl_::not_send::NotSend)`
24+
note: required because it appears within the type `PhantomData<(&pyo3::gil::GILGuard, impl_::not_send::NotSend)>`
2525
--> $RUST/core/src/marker.rs
2626
|
2727
| pub struct PhantomData<T: ?Sized>;
2828
| ^^^^^^^^^^^
29-
note: required because it appears within the type `Python<'_>`
29+
note: required because it appears within the type `pyo3::Python<'_>`
3030
--> src/marker.rs
3131
|
3232
| pub struct Python<'py>(PhantomData<(&'py GILGuard, NotSend)>);
3333
| ^^^^^^
34-
note: required because it appears within the type `Bound<'_, PyString>`
34+
note: required because it appears within the type `pyo3::Bound<'_, PyString>`
3535
--> src/instance.rs
3636
|
3737
| pub struct Bound<'py, T>(Python<'py>, ManuallyDrop<Py<T>>);

tests/ui/traverse.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ error[E0308]: mismatched types
1515
| |___________________^ expected fn pointer, found fn item
1616
|
1717
= note: expected fn pointer `for<'a, 'b> fn(&'a TraverseTriesToTakePyRef, PyVisit<'b>) -> Result<(), PyTraverseError>`
18-
found fn item `for<'a, 'b> fn(pyo3::PyRef<'a, TraverseTriesToTakePyRef>, PyVisit<'b>) {TraverseTriesToTakePyRef::__traverse__}`
18+
found fn item `for<'a, 'b> fn(pyo3::PyRef<'a, TraverseTriesToTakePyRef, >, PyVisit<'b>) {TraverseTriesToTakePyRef::__traverse__}`
1919
note: function defined here
2020
--> src/impl_/pymethods.rs
2121
|

0 commit comments

Comments
 (0)