3102: Actually set target when running Clippy builds. r=davidhewitt a=adamreichold



Co-authored-by: Adam Reichold <adam.reichold@t-online.de>
This commit is contained in:
bors[bot] 2023-04-18 07:25:22 +00:00 committed by GitHub
commit f08098f9b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 21 additions and 15 deletions

View File

@ -96,7 +96,7 @@ jobs:
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
targets: ${{ matrix.rust-target }}
targets: ${{ matrix.platform.rust-target }}
components: clippy
- uses: actions/setup-python@v4
with:
@ -106,6 +106,8 @@ jobs:
name: Prepare minimal package versions (MSRV only)
run: nox -s set-minimal-package-versions
- run: nox -s clippy-all
env:
CARGO_BUILD_TARGET: ${{ matrix.platform.rust-target }}
build-pr:
if: github.event_name == 'pull_request'

View File

@ -540,8 +540,9 @@ def _get_rust_target() -> str:
def _get_feature_sets() -> Tuple[Tuple[str, ...], ...]:
"""Returns feature sets to use for clippy job"""
rust_version = _get_rust_version()
if rust_version[:2] >= (1, 62):
# multiple-pymethods feature not supported before 1.62
cargo_target = os.getenv("CARGO_BUILD_TARGET", "")
if rust_version[:2] >= (1, 62) and "wasm32-wasi" not in cargo_target:
# multiple-pymethods feature not supported before 1.62 or on WASI
return (
("--no-default-features",),
(

View File

@ -402,12 +402,12 @@ impl<'a> FunctionSignature<'a> {
SignatureItem::Varargs(varargs) => {
let fn_arg = next_non_py_argument_checked(&varargs.ident)?;
fn_arg.is_varargs = true;
parse_state.add_varargs(&mut python_signature, &varargs)?;
parse_state.add_varargs(&mut python_signature, varargs)?;
}
SignatureItem::Kwargs(kwargs) => {
let fn_arg = next_non_py_argument_checked(&kwargs.ident)?;
fn_arg.is_kwargs = true;
parse_state.add_kwargs(&mut python_signature, &kwargs)?;
parse_state.add_kwargs(&mut python_signature, kwargs)?;
}
SignatureItem::PosargsSep(sep) => {
parse_state.finish_pos_only_args(&mut python_signature, sep.span())?

View File

@ -207,7 +207,7 @@ pub fn gen_py_method(
GeneratedPyMethod::Proto(impl_call_slot(cls, method.spec)?)
}
PyMethodProtoKind::Traverse => {
GeneratedPyMethod::Proto(impl_traverse_slot(cls, &spec.name))
GeneratedPyMethod::Proto(impl_traverse_slot(cls, spec.name))
}
PyMethodProtoKind::SlotFragment(slot_fragment_def) => {
let proto = slot_fragment_def.generate_pyproto_fragment(cls, spec)?;
@ -219,19 +219,19 @@ pub fn gen_py_method(
(_, FnType::Fn(_)) => GeneratedPyMethod::Method(impl_py_method_def(
cls,
spec,
&create_doc(meth_attrs, &spec),
&create_doc(meth_attrs, spec),
None,
)?),
(_, FnType::FnClass) => GeneratedPyMethod::Method(impl_py_method_def(
cls,
spec,
&create_doc(meth_attrs, &spec),
&create_doc(meth_attrs, spec),
Some(quote!(_pyo3::ffi::METH_CLASS)),
)?),
(_, FnType::FnStatic) => GeneratedPyMethod::Method(impl_py_method_def(
cls,
spec,
&create_doc(meth_attrs, &spec),
&create_doc(meth_attrs, spec),
Some(quote!(_pyo3::ffi::METH_STATIC)),
)?),
// special prototypes
@ -242,7 +242,7 @@ pub fn gen_py_method(
PropertyType::Function {
self_type,
spec,
doc: create_doc(meth_attrs, &spec),
doc: create_doc(meth_attrs, spec),
},
)?),
(_, FnType::Setter(self_type)) => GeneratedPyMethod::Method(impl_py_setter_def(
@ -250,7 +250,7 @@ pub fn gen_py_method(
PropertyType::Function {
self_type,
spec,
doc: create_doc(meth_attrs, &spec),
doc: create_doc(meth_attrs, spec),
},
)?),
(_, FnType::FnModule) => {
@ -794,7 +794,7 @@ impl PropertyType<'_> {
PropertyType::Descriptor { field, .. } => {
Cow::Owned(utils::get_doc(&field.attrs, None))
}
PropertyType::Function { doc, .. } => Cow::Borrowed(&doc),
PropertyType::Function { doc, .. } => Cow::Borrowed(doc),
}
}
}

View File

@ -847,14 +847,12 @@ mod tests {
check_time("non fold", 3, 5, 7, 999_999, 999_999, false);
}
#[cfg(test)]
#[cfg(all(test, not(target_arch = "wasm32")))]
mod proptests {
use super::*;
#[cfg(not(target_arch = "wasm32"))]
use proptest::prelude::*;
#[cfg(not(target_arch = "wasm32"))]
proptest! {
#[test]
fn test_duration_roundtrip(days in -999999999i64..=999999999i64) {

View File

@ -360,6 +360,7 @@ nonzero_int_impl!(NonZeroUsize, usize);
#[cfg(test)]
mod test_128bit_integers {
use super::*;
#[cfg(not(target_arch = "wasm32"))]
use crate::types::PyDict;
#[cfg(not(target_arch = "wasm32"))]

View File

@ -522,6 +522,7 @@ impl EnsureGIL {
mod tests {
use super::{gil_is_acquired, GILPool, GIL_COUNT, OWNED_OBJECTS, POOL};
use crate::{ffi, gil, AsPyPointer, IntoPyPointer, PyObject, Python, ToPyObject};
#[cfg(not(target_arch = "wasm32"))]
use parking_lot::{const_mutex, Condvar, Mutex};
use std::{ptr::NonNull, sync::atomic::Ordering};
@ -543,6 +544,7 @@ mod tests {
!POOL.dirty.load(Ordering::SeqCst)
}
#[cfg(not(target_arch = "wasm32"))]
fn pool_dirty_with(
inc_refs: Vec<NonNull<ffi::PyObject>>,
dec_refs: Vec<NonNull<ffi::PyObject>>,
@ -766,11 +768,13 @@ mod tests {
assert_eq!(count + 1, c.get_refcnt(py));
}
#[cfg(not(target_arch = "wasm32"))]
struct Event {
set: Mutex<bool>,
wait: Condvar,
}
#[cfg(not(target_arch = "wasm32"))]
impl Event {
const fn new() -> Self {
Self {