forked from Rust-related/RustPython
Updates for Rust 1.83
This commit is contained in:
8
.github/workflows/ci.yaml
vendored
8
.github/workflows/ci.yaml
vendored
@@ -407,7 +407,7 @@ jobs:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
target: wasm32-wasi
|
||||
target: wasm32-wasip1
|
||||
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- name: Setup Wasmer
|
||||
@@ -415,8 +415,8 @@ jobs:
|
||||
- name: Install clang
|
||||
run: sudo apt-get update && sudo apt-get install clang -y
|
||||
- name: build rustpython
|
||||
run: cargo build --release --target wasm32-wasi --features freeze-stdlib,stdlib --verbose
|
||||
run: cargo build --release --target wasm32-wasip1 --features freeze-stdlib,stdlib --verbose
|
||||
- name: run snippets
|
||||
run: wasmer run --dir `pwd` target/wasm32-wasi/release/rustpython.wasm -- `pwd`/extra_tests/snippets/stdlib_random.py
|
||||
run: wasmer run --dir `pwd` target/wasm32-wasip1/release/rustpython.wasm -- `pwd`/extra_tests/snippets/stdlib_random.py
|
||||
- name: run cpython unittest
|
||||
run: wasmer run --dir `pwd` target/wasm32-wasi/release/rustpython.wasm -- `pwd`/Lib/test/test_int.py
|
||||
run: wasmer run --dir `pwd` target/wasm32-wasip1/release/rustpython.wasm -- `pwd`/Lib/test/test_int.py
|
||||
|
||||
@@ -105,7 +105,7 @@ members = [
|
||||
version = "0.4.0"
|
||||
authors = ["RustPython Team"]
|
||||
edition = "2021"
|
||||
rust-version = "1.82.0"
|
||||
rust-version = "1.83.0"
|
||||
repository = "https://github.com/RustPython/RustPython"
|
||||
license = "MIT"
|
||||
|
||||
|
||||
@@ -91,13 +91,13 @@ You can compile RustPython to a standalone WebAssembly WASI module so it can run
|
||||
Build
|
||||
|
||||
```bash
|
||||
cargo build --target wasm32-wasi --no-default-features --features freeze-stdlib,stdlib --release
|
||||
cargo build --target wasm32-wasip1 --no-default-features --features freeze-stdlib,stdlib --release
|
||||
```
|
||||
|
||||
Run by wasmer
|
||||
|
||||
```bash
|
||||
wasmer run --dir `pwd` -- target/wasm32-wasi/release/rustpython.wasm `pwd`/extra_tests/snippets/stdlib_random.py
|
||||
wasmer run --dir `pwd` -- target/wasm32-wasip1/release/rustpython.wasm `pwd`/extra_tests/snippets/stdlib_random.py
|
||||
```
|
||||
|
||||
Run by wapm
|
||||
@@ -114,10 +114,10 @@ $ wapm run rustpython
|
||||
You can build the WebAssembly WASI file with:
|
||||
|
||||
```bash
|
||||
cargo build --release --target wasm32-wasi --features="freeze-stdlib"
|
||||
cargo build --release --target wasm32-wasip1 --features="freeze-stdlib"
|
||||
```
|
||||
|
||||
> Note: we use the `freeze-stdlib` to include the standard library inside the binary. You also have to run once `rustup target add wasm32-wasi`.
|
||||
> Note: we use the `freeze-stdlib` to include the standard library inside the binary. You also have to run once `rustup target add wasm32-wasip1`.
|
||||
|
||||
### JIT (Just in time) compiler
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
//! An unresizable vector backed by a `Box<[T]>`
|
||||
|
||||
#![allow(clippy::needless_lifetimes)]
|
||||
|
||||
use std::{
|
||||
borrow::{Borrow, BorrowMut},
|
||||
cmp, fmt,
|
||||
|
||||
@@ -293,7 +293,7 @@ impl<T: Link> LinkedList<T, T::Target> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, T, F> Iterator for DrainFilter<'a, T, F>
|
||||
impl<T, F> Iterator for DrainFilter<'_, T, F>
|
||||
where
|
||||
T: Link,
|
||||
F: FnMut(&mut T::Target) -> bool,
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#![allow(clippy::needless_lifetimes)]
|
||||
|
||||
use lock_api::{MutexGuard, RawMutex};
|
||||
use std::{fmt, marker::PhantomData, ops::Deref};
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#![allow(clippy::needless_lifetimes)]
|
||||
|
||||
use lock_api::{GetThreadId, GuardNoSend, RawMutex};
|
||||
use std::{
|
||||
cell::UnsafeCell,
|
||||
|
||||
@@ -334,9 +334,7 @@ macro_rules! ascii {
|
||||
($x:expr $(,)?) => {{
|
||||
let s = const {
|
||||
let s: &str = $x;
|
||||
if !s.is_ascii() {
|
||||
panic!("ascii!() argument is not an ascii string");
|
||||
}
|
||||
assert!(s.is_ascii(), "ascii!() argument is not an ascii string");
|
||||
s
|
||||
};
|
||||
unsafe { $crate::vendored::ascii::AsciiStr::from_ascii_unchecked(s.as_bytes()) }
|
||||
|
||||
@@ -341,7 +341,7 @@ pub struct Args<'a> {
|
||||
code: &'a CompiledCode,
|
||||
}
|
||||
|
||||
impl<'a> Args<'a> {
|
||||
impl Args<'_> {
|
||||
pub fn invoke(&self) -> Option<AbiValue> {
|
||||
unsafe { self.code.invoke_raw(&self.cif_args) }
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ struct CharPtrSlice<'a> {
|
||||
slice: [*const libc::c_char],
|
||||
}
|
||||
|
||||
impl<'a> CharPtrSlice<'a> {
|
||||
impl CharPtrSlice<'_> {
|
||||
fn as_ptr(&self) -> *const *const libc::c_char {
|
||||
self.slice.as_ptr()
|
||||
}
|
||||
|
||||
@@ -500,21 +500,21 @@ pub struct PyLease<'a, T: PyObjectPayload> {
|
||||
inner: PyRwLockReadGuard<'a, PyRef<T>>,
|
||||
}
|
||||
|
||||
impl<'a, T: PyObjectPayload + PyPayload> PyLease<'a, T> {
|
||||
impl<T: PyObjectPayload + PyPayload> PyLease<'_, T> {
|
||||
#[inline(always)]
|
||||
pub fn into_owned(self) -> PyRef<T> {
|
||||
self.inner.clone()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, T: PyObjectPayload + PyPayload> Borrow<PyObject> for PyLease<'a, T> {
|
||||
impl<T: PyObjectPayload + PyPayload> Borrow<PyObject> for PyLease<'_, T> {
|
||||
#[inline(always)]
|
||||
fn borrow(&self) -> &PyObject {
|
||||
self.inner.as_ref()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, T: PyObjectPayload + PyPayload> Deref for PyLease<'a, T> {
|
||||
impl<T: PyObjectPayload + PyPayload> Deref for PyLease<'_, T> {
|
||||
type Target = PyRef<T>;
|
||||
#[inline(always)]
|
||||
fn deref(&self) -> &Self::Target {
|
||||
@@ -522,7 +522,7 @@ impl<'a, T: PyObjectPayload + PyPayload> Deref for PyLease<'a, T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, T> fmt::Display for PyLease<'a, T>
|
||||
impl<T> fmt::Display for PyLease<'_, T>
|
||||
where
|
||||
T: PyPayload + fmt::Display,
|
||||
{
|
||||
|
||||
@@ -179,7 +179,7 @@ impl<'a> IOErrorBuilder<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> ToPyException for IOErrorBuilder<'a> {
|
||||
impl ToPyException for IOErrorBuilder<'_> {
|
||||
fn to_pyexception(&self, vm: &VirtualMachine) -> PyBaseExceptionRef {
|
||||
let excp = self.error.to_pyexception(vm);
|
||||
|
||||
|
||||
@@ -229,7 +229,7 @@ where
|
||||
_phantom: std::marker::PhantomData<T>,
|
||||
}
|
||||
|
||||
unsafe impl<'a, T, O> Traverse for PyIterIter<'a, T, O>
|
||||
unsafe impl<T, O> Traverse for PyIterIter<'_, T, O>
|
||||
where
|
||||
O: Traverse + Borrow<PyObject>,
|
||||
{
|
||||
@@ -252,7 +252,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, T, O> Iterator for PyIterIter<'a, T, O>
|
||||
impl<T, O> Iterator for PyIterIter<'_, T, O>
|
||||
where
|
||||
T: TryFromObject,
|
||||
O: Borrow<PyObject>,
|
||||
|
||||
@@ -432,7 +432,7 @@ unsafe impl Traverse for PyNumber<'_> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Deref for PyNumber<'a> {
|
||||
impl Deref for PyNumber<'_> {
|
||||
type Target = PyObject;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
|
||||
@@ -23,7 +23,7 @@ impl<'vm> ReprGuard<'vm> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'vm> Drop for ReprGuard<'vm> {
|
||||
impl Drop for ReprGuard<'_> {
|
||||
fn drop(&mut self) {
|
||||
self.vm.repr_guards.borrow_mut().remove(&self.id);
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ mod _codecs {
|
||||
PyStr::is_ascii(self)
|
||||
}
|
||||
}
|
||||
impl<'vm> encodings::ErrorHandler for ErrorsHandler<'vm> {
|
||||
impl encodings::ErrorHandler for ErrorsHandler<'_> {
|
||||
type Error = PyBaseExceptionRef;
|
||||
type StrBuf = PyStrRef;
|
||||
type BytesBuf = PyBytesRef;
|
||||
|
||||
@@ -236,7 +236,7 @@ pub struct SearchIter<'a, S: StrDrive> {
|
||||
pub state: State,
|
||||
}
|
||||
|
||||
impl<'a, S: StrDrive> Iterator for SearchIter<'a, S> {
|
||||
impl<S: StrDrive> Iterator for SearchIter<'_, S> {
|
||||
type Item = ();
|
||||
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
|
||||
@@ -25,7 +25,7 @@ pub trait StrDrive: Copy {
|
||||
fn back_skip(cursor: &mut StringCursor, n: usize);
|
||||
}
|
||||
|
||||
impl<'a> StrDrive for &'a [u8] {
|
||||
impl StrDrive for &[u8] {
|
||||
#[inline]
|
||||
fn count(&self) -> usize {
|
||||
self.len()
|
||||
|
||||
Reference in New Issue
Block a user