Compare commits

...

4 Commits

Author SHA1 Message Date
John Nunley cd159e6a1c m: Use Cargo.toml lint fix instead of build.rs
https://github.com/smol-rs/event-listener/pull/135#discussion_r1606080083

Signed-off-by: John Nunley <dev@notgull.net>
2024-05-19 20:35:20 -07:00
John Nunley eb54e95aca m: Fix new nightly Clippy warnings
- Suppress warning from the cfg(loom) directive by having it emit
  "rustc-check-cfg" in build.rs
- Remove usage of legacy "std::usize" module.
- Ignore "clippy::multiple_bound_locations". We use multiple bounds as a
  workaround for an issue in pin-project-lite where only one bound can be
  assigned per location. The phrasing of pin-project-lite's README implies that
  this issue is WONTFIX. To quote:

> This library does not tackle as expansive of a range of use cases as
> pin-project does. If your use case is not already covered, please use
> pin-project.

Signed-off-by: John Nunley <dev@notgull.net>
2024-05-19 11:18:16 -07:00
John Nunley 2493d3c595 ci: Also add MIRI tests
Signed-off-by: John Nunley <dev@notgull.net>
2024-04-08 14:27:51 -07:00
John Nunley c56420dcf4 ci: Add CI tests for dependent crates
This commit adds tests to CI that tests new patches for event-listener
with dependent crates. Examples of these dependent crates are:

- event-listener-strategy
- async-channel
- async-lock

Signed-off-by: John Nunley <dev@notgull.net>
2024-04-08 14:27:51 -07:00
7 changed files with 51 additions and 6 deletions

View File

@ -63,6 +63,27 @@ jobs:
- run: wasm-pack test --node
- run: wasm-pack test --node --no-default-features
- run: wasm-pack test --node --no-default-features --features portable-atomic
- name: Clone some dependent crates
run: |
git clone https://github.com/smol-rs/event-listener-strategy.git
git clone https://github.com/smol-rs/async-channel.git
git clone https://github.com/smol-rs/async-lock.git
- name: Patch dependent crates
run: |
echo '[patch.crates-io]' >> event-listener-strategy/Cargo.toml
echo 'event-listener = { path = ".." }' >> event-listener-strategy/Cargo.toml
echo '[patch.crates-io]' >> async-channel/Cargo.toml
echo 'event-listener = { path = ".." }' >> async-channel/Cargo.toml
echo 'event-listener-strategy = { path = "../event-listener-strategy" }' >> async-channel/Cargo.toml
echo '[patch.crates-io]' >> async-lock/Cargo.toml
echo 'event-listener = { path = ".." }' >> async-lock/Cargo.toml
echo 'event-listener-strategy = { path = "../event-listener-strategy" }' >> async-lock/Cargo.toml
echo 'async-channel = { path = "../async-channel" }' >> async-lock/Cargo.toml
- name: Test dependent crates
run: |
cargo test --manifest-path=event-listener-strategy/Cargo.toml
cargo test --manifest-path=async-channel/Cargo.toml
cargo test --manifest-path=async-lock/Cargo.toml
msrv:
runs-on: ubuntu-latest
@ -101,6 +122,28 @@ jobs:
- run: cargo miri test --all
- run: cargo miri test --no-default-features --tests
- run: cargo miri test --no-default-features --features portable-atomic --tests
- name: Clone some dependent crates
run: |
git clone https://github.com/smol-rs/event-listener-strategy.git
git clone https://github.com/smol-rs/async-channel.git
git clone https://github.com/smol-rs/async-lock.git
- name: Patch dependent crates
run: |
echo '[patch.crates-io]' >> event-listener-strategy/Cargo.toml
echo 'event-listener = { path = ".." }' >> event-listener-strategy/Cargo.toml
echo '[patch.crates-io]' >> async-channel/Cargo.toml
echo 'event-listener = { path = ".." }' >> async-channel/Cargo.toml
echo 'event-listener-strategy = { path = "../event-listener-strategy" }' >> async-channel/Cargo.toml
echo '[patch.crates-io]' >> async-lock/Cargo.toml
echo 'event-listener = { path = ".." }' >> async-lock/Cargo.toml
echo 'event-listener-strategy = { path = "../event-listener-strategy" }' >> async-lock/Cargo.toml
echo 'async-channel = { path = "../async-channel" }' >> async-lock/Cargo.toml
- name: Test dependent crates
# async-channel isn't included here as it appears to be broken on MIRI.
# See https://github.com/smol-rs/async-channel/issues/85
run: |
cargo miri test --manifest-path=event-listener-strategy/Cargo.toml
cargo miri test --manifest-path=async-lock/Cargo.toml
security_audit:
permissions:

View File

@ -20,6 +20,9 @@ std = ["concurrent-queue/std", "parking"]
portable-atomic = ["portable-atomic-util", "portable_atomic_crate"]
loom = ["concurrent-queue/loom", "parking?/loom", "dep:loom"]
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(loom)'] }
[dependencies]
concurrent-queue = { version = "2.4.0", default-features = false }
pin-project-lite = "0.2.12"

View File

@ -68,6 +68,7 @@
//! [`portable-atomic`]: https://crates.io/crates/portable-atomic
#![cfg_attr(not(feature = "std"), no_std)]
#![allow(clippy::multiple_bound_locations)] // This is a WONTFIX issue with pin-project-lite
#![warn(missing_docs, missing_debug_implementations, rust_2018_idioms)]
#![doc(
html_favicon_url = "https://raw.githubusercontent.com/smol-rs/smol/master/assets/images/logo_fullsize_transparent.png"
@ -131,7 +132,7 @@ struct Inner<T> {
impl<T> Inner<T> {
fn new() -> Self {
Self {
notified: AtomicUsize::new(core::usize::MAX),
notified: AtomicUsize::new(usize::MAX),
list: sys::List::new(),
}
}
@ -438,7 +439,7 @@ impl<T> Event<T> {
if let Some(inner) = self.try_inner() {
let limit = if notify.is_additional(Internal::new()) {
core::usize::MAX
usize::MAX
} else {
notify.count(Internal::new())
};

View File

@ -307,7 +307,7 @@ impl<T> Drop for ListGuard<'_, T> {
let notified = if list.notified < list.len {
list.notified
} else {
core::usize::MAX
usize::MAX
};
self.inner.notified.store(notified, Ordering::Release);

View File

@ -306,7 +306,7 @@ impl<T> Drop for ListLock<'_, '_, T> {
let notified = if list.notified < list.len {
list.notified
} else {
core::usize::MAX
usize::MAX
};
self.inner.notified.store(notified, Ordering::Release);

View File

@ -3,7 +3,6 @@ use std::future::Future;
use std::pin::Pin;
use std::sync::{Arc, Mutex};
use std::task::Context;
use std::usize;
use event_listener::{Event, EventListener};
use waker_fn::waker_fn;

View File

@ -2,7 +2,6 @@ use std::future::Future;
use std::pin::Pin;
use std::sync::{Arc, Mutex};
use std::task::Context;
use std::usize;
use event_listener::{Event, EventListener};
use waker_fn::waker_fn;