Merge pull request #4080 from youknowone/nightly

Fix nightly build
This commit is contained in:
Jeong YunWon
2022-08-16 09:44:29 +09:00
committed by GitHub
12 changed files with 45 additions and 27 deletions

View File

@@ -152,7 +152,7 @@ impl<L: Link> LinkedList<L, L::Target> {
pub fn push_front(&mut self, val: L::Handle) {
// The value should not be dropped, it is being inserted into the list
let val = ManuallyDrop::new(val);
let ptr = L::as_raw(&*val);
let ptr = L::as_raw(&val);
assert_ne!(self.head, Some(ptr));
unsafe {
L::pointers(ptr).as_mut().set_next(self.head);

View File

@@ -725,7 +725,7 @@ mod array {
if zelf.is(&obj) {
w.imul(2, vm)
} else if let Some(array) = obj.payload::<PyArray>() {
w.iadd(&*array.read(), vm)
w.iadd(&array.read(), vm)
} else {
let iter = ArgIterable::try_from_object(vm, obj)?;
// zelf.extend_from_iterable(iter, vm)
@@ -1029,7 +1029,7 @@ mod array {
fn add(&self, other: PyObjectRef, vm: &VirtualMachine) -> PyResult<PyRef<Self>> {
if let Some(other) = other.payload::<PyArray>() {
self.read()
.add(&*other.read(), vm)
.add(&other.read(), vm)
.map(|array| PyArray::from(array).into_ref(vm))
} else {
Err(vm.new_type_error(format!(
@@ -1048,7 +1048,7 @@ mod array {
if zelf.is(&other) {
zelf.try_resizable(vm)?.imul(2, vm)?;
} else if let Some(other) = other.payload::<PyArray>() {
zelf.try_resizable(vm)?.iadd(&*other.read(), vm)?;
zelf.try_resizable(vm)?.iadd(&other.read(), vm)?;
} else {
return Err(vm.new_type_error(format!(
"can only extend array with array (not \"{}\")",
@@ -1104,7 +1104,7 @@ mod array {
let array_b = other.read();
// fast path for same ArrayContentType type
if let Ok(ord) = array_a.cmp(&*array_b) {
if let Ok(ord) = array_a.cmp(&array_b) {
return Ok(ord == Some(Ordering::Equal));
}
@@ -1187,7 +1187,7 @@ mod array {
let array_a = zelf.read();
let array_b = other.read();
let res = match array_a.cmp(&*array_b) {
let res = match array_a.cmp(&array_b) {
// fast path for same ArrayContentType type
Ok(partial_ord) => partial_ord.map_or(false, |ord| op.eval_ord(ord)),
Err(()) => {

View File

@@ -116,7 +116,7 @@ mod _bisect {
} else {
a_mid
};
if x.rich_compare_bool(&*comp, PyComparisonOp::Lt, vm)? {
if x.rich_compare_bool(&comp, PyComparisonOp::Lt, vm)? {
hi = mid;
} else {
lo = mid + 1;

View File

@@ -69,7 +69,7 @@ mod fcntl {
arg_len = s.len();
buf.get_mut(..arg_len)
.ok_or_else(|| vm.new_value_error("fcntl string arg too long".to_owned()))?
.copy_from_slice(&*s)
.copy_from_slice(&s)
}
let ret = unsafe { libc::fcntl(fd, cmd, buf.as_mut_ptr()) };
if ret < 0 {

View File

@@ -146,7 +146,7 @@ impl PyByteArray {
#[pymethod(magic)]
fn add(&self, other: ArgBytesLike) -> Self {
self.inner().add(&*other.borrow_buf()).into()
self.inner().add(&other.borrow_buf()).into()
}
#[pymethod(magic)]

View File

@@ -151,7 +151,7 @@ impl PyBytes {
#[pymethod(magic)]
fn add(&self, other: ArgBytesLike) -> Vec<u8> {
self.inner.add(&*other.borrow_buf())
self.inner.add(&other.borrow_buf())
}
#[pymethod(magic)]

View File

@@ -150,7 +150,7 @@ impl PyList {
#[pymethod(magic)]
fn iadd(zelf: PyRef<Self>, other: PyObjectRef, vm: &VirtualMachine) -> PyResult<PyRef<Self>> {
let mut seq = extract_cloned(&*other, Ok, vm)?;
let mut seq = extract_cloned(&other, Ok, vm)?;
zelf.borrow_vec_mut().append(&mut seq);
Ok(zelf)
}
@@ -213,7 +213,7 @@ impl PyList {
match SequenceIndex::try_from_borrowed_object(vm, needle, "list")? {
SequenceIndex::Int(index) => self.borrow_vec_mut().setitem_by_index(vm, index, value),
SequenceIndex::Slice(slice) => {
let sec = extract_cloned(&*value, Ok, vm)?;
let sec = extract_cloned(&value, Ok, vm)?;
self.borrow_vec_mut().setitem_by_slice(vm, slice, &sec)
}
}

View File

@@ -910,18 +910,30 @@ fn system_exit_code(exc: PyBaseExceptionRef) -> Option<PyObjectRef> {
})
}
pub struct SerializeException<'s> {
vm: &'s VirtualMachine,
pub struct SerializeException<'vm, 's> {
vm: &'vm VirtualMachine,
exc: &'s PyBaseExceptionRef,
}
impl<'s> SerializeException<'s> {
pub fn new(vm: &'s VirtualMachine, exc: &'s PyBaseExceptionRef) -> Self {
impl<'vm, 's> SerializeException<'vm, 's> {
pub fn new(vm: &'vm VirtualMachine, exc: &'s PyBaseExceptionRef) -> Self {
SerializeException { vm, exc }
}
}
impl serde::Serialize for SerializeException<'_> {
pub struct SerializeExceptionOwned<'vm> {
vm: &'vm VirtualMachine,
exc: PyBaseExceptionRef,
}
impl serde::Serialize for SerializeExceptionOwned<'_> {
fn serialize<S: serde::Serializer>(&self, s: S) -> Result<S::Ok, S::Error> {
let Self { vm, exc } = self;
SerializeException::new(vm, exc).serialize(s)
}
}
impl serde::Serialize for SerializeException<'_, '_> {
fn serialize<S: serde::Serializer>(&self, s: S) -> Result<S::Ok, S::Error> {
use serde::ser::*;
@@ -943,11 +955,17 @@ impl serde::Serialize for SerializeException<'_> {
struc.serialize_field("traceback", &tbs)?;
struc.serialize_field(
"cause",
&self.exc.cause().as_ref().map(|e| Self::new(self.vm, e)),
&self
.exc
.cause()
.map(|exc| SerializeExceptionOwned { vm: self.vm, exc }),
)?;
struc.serialize_field(
"context",
&self.exc.context().as_ref().map(|e| Self::new(self.vm, e)),
&self
.exc
.context()
.map(|exc| SerializeExceptionOwned { vm: self.vm, exc }),
)?;
struc.serialize_field("suppress_context", &self.exc.get_suppress_context())?;

View File

@@ -18,7 +18,7 @@ impl PyObject {
f: impl FnOnce(&[u8]) -> R,
) -> PyResult<R> {
let buffer = PyBuffer::try_from_borrowed_object(vm, self)?;
buffer.as_contiguous().map(|x| f(&*x)).ok_or_else(|| {
buffer.as_contiguous().map(|x| f(&x)).ok_or_else(|| {
vm.new_type_error("non-contiguous buffer is not a bytes-like object".to_owned())
})
}
@@ -31,7 +31,7 @@ impl PyObject {
let buffer = PyBuffer::try_from_borrowed_object(vm, self)?;
buffer
.as_contiguous_mut()
.map(|mut x| f(&mut *x))
.map(|mut x| f(&mut x))
.ok_or_else(|| {
vm.new_type_error("buffer is not a read-write bytes-like object".to_owned())
})
@@ -47,7 +47,7 @@ impl ArgBytesLike {
where
F: FnOnce(&[u8]) -> R,
{
f(&*self.borrow_buf())
f(&self.borrow_buf())
}
pub fn len(&self) -> usize {
@@ -89,7 +89,7 @@ impl ArgMemoryBuffer {
where
F: FnOnce(&mut [u8]) -> R,
{
f(&mut *self.borrow_buf_mut())
f(&mut self.borrow_buf_mut())
}
pub fn len(&self) -> usize {

View File

@@ -837,7 +837,7 @@ impl fmt::Debug for PyObjectRef {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
// SAFETY: the vtable contains functions that accept payload types that always match up
// with the payload of the object
unsafe { ((*self).0.vtable.debug)(self, f) }
unsafe { (self.0.vtable.debug)(self, f) }
}
}

View File

@@ -2989,7 +2989,7 @@ mod _io {
if let Some((dec_buffer, dec_flags)) = dec_state {
// TODO: inplace append to bytes when refcount == 1
let mut next_input = dec_buffer.as_bytes().to_vec();
next_input.extend_from_slice(&*buf.borrow_buf());
next_input.extend_from_slice(&buf.borrow_buf());
self.snapshot = Some((dec_flags, PyBytes::from(next_input).into_ref(vm)));
}
@@ -3298,7 +3298,7 @@ mod _io {
let mut buf = self.buffer(vm)?;
let ret = buf
.cursor
.read(&mut *obj.borrow_buf_mut())
.read(&mut obj.borrow_buf_mut())
.map_err(|_| vm.new_value_error("Error readinto from Take".to_owned()))?;
Ok(ret)

View File

@@ -235,7 +235,7 @@ mod decl {
let mut cur = zelf.cur.write();
let step = zelf.step.clone();
let result = cur.clone();
*cur = vm._iadd(&*cur, step.as_object())?;
*cur = vm._iadd(&cur, step.as_object())?;
Ok(PyIterReturn::Return(result.to_pyobject(vm)))
}
}