Skip to content

Commit

Permalink
ui test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhewitt committed Aug 23, 2022
1 parent 5c74ddf commit 30211a6
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 23 deletions.
16 changes: 12 additions & 4 deletions tests/test_compile_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ fn _test_compile_errors() {
tests_rust_1_57(&t);
tests_rust_1_58(&t);
tests_rust_1_62(&t);
tests_rust_1_63(&t);

#[rustversion::since(1.49)]
fn tests_rust_1_49(t: &trybuild::TestCases) {
Expand Down Expand Up @@ -81,9 +82,6 @@ fn _test_compile_errors() {
fn tests_rust_1_58(t: &trybuild::TestCases) {
t.compile_fail("tests/ui/invalid_pyfunctions.rs");
t.compile_fail("tests/ui/invalid_pymethods.rs");
t.compile_fail("tests/ui/not_send.rs");
t.compile_fail("tests/ui/not_send2.rs");
t.compile_fail("tests/ui/not_send3.rs");
#[cfg(Py_LIMITED_API)]
t.compile_fail("tests/ui/abi3_nativetype_inheritance.rs");
}
Expand All @@ -94,11 +92,21 @@ fn _test_compile_errors() {
#[rustversion::since(1.62)]
fn tests_rust_1_62(t: &trybuild::TestCases) {
t.compile_fail("tests/ui/invalid_pymethod_receiver.rs");
t.compile_fail("tests/ui/invalid_result_conversion.rs");
}

#[rustversion::before(1.62)]
fn tests_rust_1_62(_t: &trybuild::TestCases) {}

#[rustversion::since(1.63)]
fn tests_rust_1_63(t: &trybuild::TestCases) {
t.compile_fail("tests/ui/not_send.rs");
t.compile_fail("tests/ui/not_send2.rs");
t.compile_fail("tests/ui/not_send3.rs");
t.compile_fail("tests/ui/invalid_result_conversion.rs");
}

#[rustversion::before(1.63)]
fn tests_rust_1_63(_t: &trybuild::TestCases) {}
}

#[cfg(feature = "nightly")]
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/invalid_result_conversion.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ error[E0277]: the trait bound `Result<(), MyError>: IntoPyCallbackOutput<_>` is
|
= help: the trait `IntoPyCallbackOutput<U>` is implemented for `Result<T, E>`
note: required by a bound in `pyo3::callback::convert`
--> src/callback.rs:182:8
--> src/callback.rs
|
182 | T: IntoPyCallbackOutput<U>,
| T: IntoPyCallbackOutput<U>,
| ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `pyo3::callback::convert`
= note: this error originates in the attribute macro `pyfunction` (in Nightly builds, run with -Z macro-backtrace for more info)
6 changes: 5 additions & 1 deletion tests/ui/not_send.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ error[E0277]: `*mut pyo3::Python<'static>` cannot be shared between threads safe
= note: required because it appears within the type `PhantomData<(&GILGuard, impl_::not_send::NotSend)>`
= note: required because it appears within the type `pyo3::Python<'_>`
= note: required because of the requirements on the impl of `Send` for `&pyo3::Python<'_>`
= note: required because it appears within the type `[closure@$DIR/tests/ui/not_send.rs:4:22: 4:38]`
note: required because it's used within this closure
--> tests/ui/not_send.rs:4:22
|
4 | py.allow_threads(|| { drop(py); });
| ^^^^^^^^^^^^^^^^
= note: required because of the requirements on the impl of `Ungil` for `[closure@$DIR/tests/ui/not_send.rs:4:22: 4:38]`
note: required by a bound in `pyo3::Python::<'py>::allow_threads`
--> src/marker.rs
Expand Down
9 changes: 8 additions & 1 deletion tests/ui/not_send2.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@ error[E0277]: `UnsafeCell<PyObject>` cannot be shared between threads safely
= note: required because it appears within the type `PyString`
= note: required because it appears within the type `&PyString`
= note: required because of the requirements on the impl of `Send` for `&&PyString`
= note: required because it appears within the type `[closure@$DIR/tests/ui/not_send2.rs:8:26: 10:10]`
note: required because it's used within this closure
--> tests/ui/not_send2.rs:8:26
|
8 | py.allow_threads(|| {
| __________________________^
9 | | println!("{:?}", string);
10 | | });
| |_________^
= note: required because of the requirements on the impl of `Ungil` for `[closure@$DIR/tests/ui/not_send2.rs:8:26: 10:10]`
note: required by a bound in `pyo3::Python::<'py>::allow_threads`
--> src/marker.rs
Expand Down
9 changes: 8 additions & 1 deletion tests/ui/not_send3.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@ error[E0277]: `Rc<i32>` cannot be shared between threads safely
|
= help: the trait `Sync` is not implemented for `Rc<i32>`
= note: required because of the requirements on the impl of `Send` for `&Rc<i32>`
= note: required because it appears within the type `[closure@$DIR/tests/ui/not_send3.rs:8:26: 10:10]`
note: required because it's used within this closure
--> tests/ui/not_send3.rs:8:26
|
8 | py.allow_threads(|| {
| __________________________^
9 | | println!("{:?}", rc);
10 | | });
| |_________^
= note: required because of the requirements on the impl of `Ungil` for `[closure@$DIR/tests/ui/not_send3.rs:8:26: 10:10]`
note: required by a bound in `pyo3::Python::<'py>::allow_threads`
--> src/marker.rs
Expand Down
10 changes: 6 additions & 4 deletions tests/ui/not_send_auto_trait.stderr
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
error[E0277]: the trait bound `pyo3::Python<'_>: Ungil` is not satisfied in `[closure@$DIR/tests/ui/not_send_auto_trait.rs:4:22: 4:24]`
--> tests/ui/not_send_auto_trait.rs:4:8
--> tests/ui/not_send_auto_trait.rs:4:22
|
4 | py.allow_threads(|| { drop(py); });
| ^^^^^^^^^^^^^ -- within this `[closure@$DIR/tests/ui/not_send_auto_trait.rs:4:22: 4:24]`
| |
| within `[closure@$DIR/tests/ui/not_send_auto_trait.rs:4:22: 4:24]`, the trait `Ungil` is not implemented for `pyo3::Python<'_>`
| ------------- --^^^^^^^^^^^^^^
| | |
| | within `[closure@$DIR/tests/ui/not_send_auto_trait.rs:4:22: 4:24]`, the trait `Ungil` is not implemented for `pyo3::Python<'_>`
| | within this `[closure@$DIR/tests/ui/not_send_auto_trait.rs:4:22: 4:24]`
| required by a bound introduced by this call
|
= note: required because it appears within the type `&pyo3::Python<'_>`
note: required because it's used within this closure
Expand Down
15 changes: 10 additions & 5 deletions tests/ui/not_send_auto_trait2.stderr
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
error[E0277]: the trait bound `PyAny: Ungil` is not satisfied in `[closure@$DIR/tests/ui/not_send_auto_trait2.rs:8:26: 8:28]`
--> tests/ui/not_send_auto_trait2.rs:8:12
--> tests/ui/not_send_auto_trait2.rs:8:26
|
8 | py.allow_threads(|| {
| ^^^^^^^^^^^^^ -- within this `[closure@$DIR/tests/ui/not_send_auto_trait2.rs:8:26: 8:28]`
| |
| within `[closure@$DIR/tests/ui/not_send_auto_trait2.rs:8:26: 8:28]`, the trait `Ungil` is not implemented for `PyAny`
8 | py.allow_threads(|| {
| ------------- ^-
| | |
| ____________|_____________within this `[closure@$DIR/tests/ui/not_send_auto_trait2.rs:8:26: 8:28]`
| | |
| | required by a bound introduced by this call
9 | | println!("{:?}", string);
10 | | });
| |_________^ within `[closure@$DIR/tests/ui/not_send_auto_trait2.rs:8:26: 8:28]`, the trait `Ungil` is not implemented for `PyAny`
|
= note: required because it appears within the type `PyString`
= note: required because it appears within the type `&PyString`
Expand Down
16 changes: 11 additions & 5 deletions tests/ui/send_wrapper.stderr
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
error[E0277]: the trait bound `PyAny: Ungil` is not satisfied in `[closure@$DIR/tests/ui/send_wrapper.rs:11:26: 11:28]`
--> tests/ui/send_wrapper.rs:11:12
--> tests/ui/send_wrapper.rs:11:26
|
11 | py.allow_threads(|| {
| ^^^^^^^^^^^^^ -- within this `[closure@$DIR/tests/ui/send_wrapper.rs:11:26: 11:28]`
| |
| within `[closure@$DIR/tests/ui/send_wrapper.rs:11:26: 11:28]`, the trait `Ungil` is not implemented for `PyAny`
11 | py.allow_threads(|| {
| ------------- ^-
| | |
| ____________|_____________within this `[closure@$DIR/tests/ui/send_wrapper.rs:11:26: 11:28]`
| | |
| | required by a bound introduced by this call
12 | | let smuggled: &PyString = *wrapped;
13 | | println!("{:?}", smuggled);
14 | | });
| |_________^ within `[closure@$DIR/tests/ui/send_wrapper.rs:11:26: 11:28]`, the trait `Ungil` is not implemented for `PyAny`
|
= note: required because it appears within the type `PyString`
= note: required because it appears within the type `&PyString`
Expand Down

0 comments on commit 30211a6

Please sign in to comment.