Skip to content

Commit a9d4ec6

Browse files
Owen-CH-LeungngoldbaumIcxolu
authored andcommitted
ci: updates for Rust 1.84 (#4846)
* Fix failing ruff fmt test * Add newsfragments * remove changelog * use wasm32-wasip1 in CI * update ui tests * use `wasm32-wasip1` in noxfile * update one more ui test * fix clippy beta * bump `EMSCRIPTEN_VERSION` * emscripten link `sqlite3` * emscipten update node --------- Co-authored-by: Nathan Goldbaum <[email protected]> Co-authored-by: Icxolu <[email protected]>
1 parent 50f942f commit a9d4ec6

17 files changed

+30
-29
lines changed

.github/workflows/ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ jobs:
115115
{
116116
os: "ubuntu-latest",
117117
python-architecture: "x64",
118-
rust-target: "wasm32-wasi",
118+
rust-target: "wasm32-wasip1",
119119
},
120120
{
121121
os: "windows-latest",
@@ -489,7 +489,7 @@ jobs:
489489
components: rust-src
490490
- uses: actions/setup-node@v4
491491
with:
492-
node-version: 14
492+
node-version: 18
493493
- run: python -m pip install --upgrade pip && pip install nox
494494
- uses: actions/cache@v4
495495
id: cache

emscripten/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ CURDIR=$(abspath .)
44
BUILDROOT ?= $(CURDIR)/builddir
55
PYMAJORMINORMICRO ?= 3.11.0
66

7-
EMSCRIPTEN_VERSION=3.1.13
7+
EMSCRIPTEN_VERSION=3.1.68
88

99
export EMSDKDIR = $(BUILDROOT)/emsdk
1010

noxfile.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,7 @@ def test_emscripten(session: nox.Session):
339339
f"-C link-arg=-lpython{info.pymajorminor}",
340340
"-C link-arg=-lexpat",
341341
"-C link-arg=-lmpdec",
342+
"-C link-arg=-lsqlite3",
342343
"-C link-arg=-lz",
343344
"-C link-arg=-lbz2",
344345
"-C link-arg=-sALLOW_MEMORY_GROWTH=1",
@@ -351,7 +352,7 @@ def test_emscripten(session: nox.Session):
351352
session,
352353
"bash",
353354
"-c",
354-
f"source {info.builddir/'emsdk/emsdk_env.sh'} && cargo test",
355+
f"source {info.builddir / 'emsdk/emsdk_env.sh'} && cargo test",
355356
)
356357

357358

@@ -797,7 +798,7 @@ def _get_rust_default_target() -> str:
797798
def _get_feature_sets() -> Tuple[Tuple[str, ...], ...]:
798799
"""Returns feature sets to use for clippy job"""
799800
cargo_target = os.getenv("CARGO_BUILD_TARGET", "")
800-
if "wasm32-wasi" not in cargo_target:
801+
if "wasm32-wasip1" not in cargo_target:
801802
# multiple-pymethods not supported on wasm
802803
return (
803804
("--no-default-features",),
@@ -951,7 +952,7 @@ def set(
951952
f"""\
952953
implementation={implementation}
953954
version={version}
954-
build_flags={','.join(build_flags)}
955+
build_flags={",".join(build_flags)}
955956
suppress_build_script_link_lines=true
956957
"""
957958
)

pyo3-build-config/src/impl_.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2001,7 +2001,7 @@ fn unescape(escaped: &str) -> Vec<u8> {
20012001
}
20022002
}
20032003

2004-
bytes.push(unhex(chunk[0]) << 4 | unhex(chunk[1]));
2004+
bytes.push((unhex(chunk[0]) << 4) | unhex(chunk[1]));
20052005
}
20062006

20072007
bytes

pyo3-ffi/src/datetime.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ pub struct PyDateTime_DateTime {
119119
pub unsafe fn PyDateTime_GET_YEAR(o: *mut PyObject) -> c_int {
120120
// This should work for Date or DateTime
121121
let data = (*(o as *mut PyDateTime_Date)).data;
122-
c_int::from(data[0]) << 8 | c_int::from(data[1])
122+
(c_int::from(data[0]) << 8) | c_int::from(data[1])
123123
}
124124

125125
#[inline]

src/types/any.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,7 @@ impl<'py> PyAnyMethods<'py> for Bound<'py, PyAny> {
948948
}
949949
}
950950

951-
inner(self.py(), self.getattr(attr_name).map_err(Into::into))
951+
inner(self.py(), self.getattr(attr_name))
952952
}
953953

954954
fn getattr<N>(&self, attr_name: N) -> PyResult<Bound<'py, PyAny>>

src/types/module.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ impl<'py> PyModuleMethods<'py> for Bound<'py, PyModule> {
443443
Err(err) => {
444444
if err.is_instance_of::<exceptions::PyAttributeError>(self.py()) {
445445
let l = PyList::empty(self.py());
446-
self.setattr(__all__, &l).map_err(PyErr::from)?;
446+
self.setattr(__all__, &l)?;
447447
Ok(l)
448448
} else {
449449
Err(err)

tests/ui/invalid_cancel_handle.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ error[E0277]: the trait bound `CancelHandle: PyFunctionArgument<'_, '_>` is not
4242
--> tests/ui/invalid_cancel_handle.rs:20:50
4343
|
4444
20 | async fn missing_cancel_handle_attribute(_param: pyo3::coroutine::CancelHandle) {}
45-
| ^^^^ the trait `PyClass` is not implemented for `CancelHandle`, which is required by `CancelHandle: PyFunctionArgument<'_, '_>`
45+
| ^^^^ the trait `PyClass` is not implemented for `CancelHandle`
4646
|
4747
= help: the trait `PyClass` is implemented for `pyo3::coroutine::Coroutine`
4848
= note: required for `CancelHandle` to implement `FromPyObject<'_>`
@@ -61,7 +61,7 @@ error[E0277]: the trait bound `CancelHandle: PyFunctionArgument<'_, '_>` is not
6161
--> tests/ui/invalid_cancel_handle.rs:20:50
6262
|
6363
20 | async fn missing_cancel_handle_attribute(_param: pyo3::coroutine::CancelHandle) {}
64-
| ^^^^ the trait `Clone` is not implemented for `CancelHandle`, which is required by `CancelHandle: PyFunctionArgument<'_, '_>`
64+
| ^^^^ the trait `Clone` is not implemented for `CancelHandle`
6565
|
6666
= help: the following other types implement trait `PyFunctionArgument<'a, 'py>`:
6767
&'a mut pyo3::coroutine::Coroutine

tests/ui/invalid_property_args.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ error[E0277]: `PhantomData<i32>` cannot be converted to a Python object
5252
45 | value: ::std::marker::PhantomData<i32>,
5353
| ^ required by `#[pyo3(get)]` to create a readable property from a field of type `PhantomData<i32>`
5454
|
55-
= help: the trait `IntoPyObject<'_>` is not implemented for `PhantomData<i32>`, which is required by `for<'py> PhantomData<i32>: PyO3GetField<'py>`
55+
= help: the trait `IntoPyObject<'_>` is not implemented for `PhantomData<i32>`
5656
= note: implement `IntoPyObject` for `&PhantomData<i32>` or `IntoPyObject + Clone` for `PhantomData<i32>` to define the conversion
5757
= help: the following other types implement trait `IntoPyObject<'py>`:
5858
&&'a T

tests/ui/invalid_pyclass_args.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -100,21 +100,21 @@ error: expected one of: `get`, `set`, `name`
100100
85 | #[pyo3(pop)]
101101
| ^^^
102102

103-
error: invalid format string: expected `'}'` but string was terminated
103+
error: invalid format string: expected `}` but string was terminated
104104
--> tests/ui/invalid_pyclass_args.rs:105:19
105105
|
106106
105 | #[pyclass(str = "{")]
107-
| -^ expected `'}'` in format string
107+
| -^ expected `}` in format string
108108
| |
109109
| because of this opening brace
110110
|
111111
= note: if you intended to print `{`, you can escape it using `{{`
112112

113-
error: invalid format string: expected `'}'`, found `'$'`
113+
error: invalid format string: expected `}`, found `$`
114114
--> tests/ui/invalid_pyclass_args.rs:109:19
115115
|
116116
109 | #[pyclass(str = "{$}")]
117-
| -^ expected `'}'` in format string
117+
| -^ expected `}` in format string
118118
| |
119119
| because of this opening brace
120120
|

tests/ui/invalid_pyfunctions.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ error[E0277]: the trait bound `&str: From<BoundRef<'_, '_, pyo3::types::PyModule
5151
--> tests/ui/invalid_pyfunctions.rs:36:14
5252
|
5353
36 | _string: &str,
54-
| ^ the trait `From<BoundRef<'_, '_, pyo3::types::PyModule>>` is not implemented for `&str`, which is required by `BoundRef<'_, '_, pyo3::types::PyModule>: Into<_>`
54+
| ^ the trait `From<BoundRef<'_, '_, pyo3::types::PyModule>>` is not implemented for `&str`
5555
|
5656
= help: the following other types implement trait `From<T>`:
5757
`String` implements `From<&String>`

tests/ui/invalid_pymethod_receiver.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0277]: the trait bound `i32: TryFrom<BoundRef<'_, '_, MyClass>>` is not s
22
--> tests/ui/invalid_pymethod_receiver.rs:8:44
33
|
44
8 | fn method_with_invalid_self_type(_slf: i32, _py: Python<'_>, _index: u32) {}
5-
| ^^^ the trait `From<BoundRef<'_, '_, MyClass>>` is not implemented for `i32`, which is required by `i32: TryFrom<BoundRef<'_, '_, MyClass>>`
5+
| ^^^ the trait `From<BoundRef<'_, '_, MyClass>>` is not implemented for `i32`
66
|
77
= help: the following other types implement trait `From<T>`:
88
`i32` implements `From<bool>`

tests/ui/invalid_pymethods.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ error[E0277]: the trait bound `i32: From<BoundRef<'_, '_, PyType>>` is not satis
183183
--> tests/ui/invalid_pymethods.rs:46:45
184184
|
185185
46 | fn classmethod_wrong_first_argument(_x: i32) -> Self {
186-
| ^^^ the trait `From<BoundRef<'_, '_, PyType>>` is not implemented for `i32`, which is required by `BoundRef<'_, '_, PyType>: Into<_>`
186+
| ^^^ the trait `From<BoundRef<'_, '_, PyType>>` is not implemented for `i32`
187187
|
188188
= help: the following other types implement trait `From<T>`:
189189
`i32` implements `From<bool>`

tests/ui/invalid_result_conversion.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0277]: the trait bound `PyErr: From<MyError>` is not satisfied
22
--> tests/ui/invalid_result_conversion.rs:22:25
33
|
44
22 | fn should_not_work() -> Result<(), MyError> {
5-
| ^^^^^^ the trait `From<MyError>` is not implemented for `PyErr`, which is required by `MyError: Into<PyErr>`
5+
| ^^^^^^ the trait `From<MyError>` is not implemented for `PyErr`
66
|
77
= help: the following other types implement trait `From<T>`:
88
`PyErr` implements `From<AddrParseError>`

tests/ui/not_send.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ error[E0277]: `*mut pyo3::Python<'static>` cannot be shared between threads safe
66
| |
77
| required by a bound introduced by this call
88
|
9-
= help: within `pyo3::Python<'_>`, the trait `Sync` is not implemented for `*mut pyo3::Python<'static>`, which is required by `{closure@$DIR/tests/ui/not_send.rs:4:22: 4:24}: Ungil`
9+
= help: within `pyo3::Python<'_>`, the trait `Sync` is not implemented for `*mut pyo3::Python<'static>`
1010
note: required because it appears within the type `PhantomData<*mut pyo3::Python<'static>>`
1111
--> $RUST/core/src/marker.rs
1212
|

tests/ui/not_send2.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ error[E0277]: `*mut pyo3::Python<'static>` cannot be shared between threads safe
99
10 | | });
1010
| |_________^ `*mut pyo3::Python<'static>` cannot be shared between threads safely
1111
|
12-
= help: within `pyo3::Bound<'_, PyString>`, the trait `Sync` is not implemented for `*mut pyo3::Python<'static>`, which is required by `{closure@$DIR/tests/ui/not_send2.rs:8:26: 8:28}: Ungil`
12+
= help: within `pyo3::Bound<'_, PyString>`, the trait `Sync` is not implemented for `*mut pyo3::Python<'static>`
1313
note: required because it appears within the type `PhantomData<*mut pyo3::Python<'static>>`
1414
--> $RUST/core/src/marker.rs
1515
|

tests/ui/pyclass_send.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0277]: `*mut c_void` cannot be shared between threads safely
44
5 | struct NotSyncNotSend(*mut c_void);
55
| ^^^^^^^^^^^^^^ `*mut c_void` cannot be shared between threads safely
66
|
7-
= help: within `NotSyncNotSend`, the trait `Sync` is not implemented for `*mut c_void`, which is required by `NotSyncNotSend: Sync`
7+
= help: within `NotSyncNotSend`, the trait `Sync` is not implemented for `*mut c_void`
88
note: required because it appears within the type `NotSyncNotSend`
99
--> tests/ui/pyclass_send.rs:5:8
1010
|
@@ -25,7 +25,7 @@ error[E0277]: `*mut c_void` cannot be sent between threads safely
2525
4 | #[pyclass]
2626
| ^^^^^^^^^^ `*mut c_void` cannot be sent between threads safely
2727
|
28-
= help: within `NotSyncNotSend`, the trait `Send` is not implemented for `*mut c_void`, which is required by `SendablePyClass<NotSyncNotSend>: pyo3::impl_::pyclass::PyClassThreadChecker<NotSyncNotSend>`
28+
= help: within `NotSyncNotSend`, the trait `Send` is not implemented for `*mut c_void`
2929
= help: the trait `pyo3::impl_::pyclass::PyClassThreadChecker<T>` is implemented for `SendablePyClass<T>`
3030
note: required because it appears within the type `NotSyncNotSend`
3131
--> tests/ui/pyclass_send.rs:5:8
@@ -46,7 +46,7 @@ error[E0277]: `*mut c_void` cannot be shared between threads safely
4646
8 | struct SendNotSync(*mut c_void);
4747
| ^^^^^^^^^^^ `*mut c_void` cannot be shared between threads safely
4848
|
49-
= help: within `SendNotSync`, the trait `Sync` is not implemented for `*mut c_void`, which is required by `SendNotSync: Sync`
49+
= help: within `SendNotSync`, the trait `Sync` is not implemented for `*mut c_void`
5050
note: required because it appears within the type `SendNotSync`
5151
--> tests/ui/pyclass_send.rs:8:8
5252
|
@@ -67,7 +67,7 @@ error[E0277]: `*mut c_void` cannot be sent between threads safely
6767
11 | #[pyclass]
6868
| ^^^^^^^^^^ `*mut c_void` cannot be sent between threads safely
6969
|
70-
= help: within `SyncNotSend`, the trait `Send` is not implemented for `*mut c_void`, which is required by `SendablePyClass<SyncNotSend>: pyo3::impl_::pyclass::PyClassThreadChecker<SyncNotSend>`
70+
= help: within `SyncNotSend`, the trait `Send` is not implemented for `*mut c_void`
7171
= help: the trait `pyo3::impl_::pyclass::PyClassThreadChecker<T>` is implemented for `SendablePyClass<T>`
7272
note: required because it appears within the type `SyncNotSend`
7373
--> tests/ui/pyclass_send.rs:12:8
@@ -88,7 +88,7 @@ error[E0277]: `*mut c_void` cannot be sent between threads safely
8888
4 | #[pyclass]
8989
| ^^^^^^^^^^ `*mut c_void` cannot be sent between threads safely
9090
|
91-
= help: within `NotSyncNotSend`, the trait `Send` is not implemented for `*mut c_void`, which is required by `NotSyncNotSend: Send`
91+
= help: within `NotSyncNotSend`, the trait `Send` is not implemented for `*mut c_void`
9292
note: required because it appears within the type `NotSyncNotSend`
9393
--> tests/ui/pyclass_send.rs:5:8
9494
|
@@ -107,7 +107,7 @@ error[E0277]: `*mut c_void` cannot be sent between threads safely
107107
11 | #[pyclass]
108108
| ^^^^^^^^^^ `*mut c_void` cannot be sent between threads safely
109109
|
110-
= help: within `SyncNotSend`, the trait `Send` is not implemented for `*mut c_void`, which is required by `SyncNotSend: Send`
110+
= help: within `SyncNotSend`, the trait `Send` is not implemented for `*mut c_void`
111111
note: required because it appears within the type `SyncNotSend`
112112
--> tests/ui/pyclass_send.rs:12:8
113113
|

0 commit comments

Comments
 (0)