-
Notifications
You must be signed in to change notification settings - Fork 21
feat(ci): run clippy on wasm target #2184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Eldolfin
wants to merge
7
commits into
main
Choose a base branch
from
oscarld/ci-clippy-wasm
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
0e1bf5d
feat(ci): run clippy on wasm target
Eldolfin 906038b
fix: --target wasm and limit to wasm compatible crates
Eldolfin a0cdedf
fix(ci): install wasm32 target for the toolchain under test in clippy…
Eldolfin b4bf49b
fix: add crates that compile with --no-default-features
Eldolfin 7747b8d
fix: add crates that compile with --no-default-features
Eldolfin b5e56fc
fix lints
Eldolfin a82209f
fix: lints
Eldolfin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,15 +24,25 @@ use crate::worker::Worker; | |
| use libdd_capabilities::MaybeSend; | ||
| use libdd_common::MutexExt; | ||
| use pausable_worker::{PausableWorker, PausableWorkerError}; | ||
| use std::sync::{Arc, Mutex}; | ||
| use std::sync::Mutex; | ||
| use std::{fmt, io}; | ||
|
|
||
| // Shared, reference-counted registry of live workers. On native targets it must be `Arc` because | ||
| // runtimes and their `WorkerHandle`s are shared across threads. On wasm the runtime is | ||
| // single-threaded and its workers are `!Send`, so `Rc` is both correct and avoids the | ||
| // `arc_with_non_send_sync` lint. | ||
| #[cfg(not(target_arch = "wasm32"))] | ||
| pub(crate) type WorkerRegistry = std::sync::Arc<Mutex<Vec<WorkerEntry>>>; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will this pattern recur? Should this be a generic type? |
||
| #[cfg(target_arch = "wasm32")] | ||
| pub(crate) type WorkerRegistry = std::rc::Rc<Mutex<Vec<WorkerEntry>>>; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need the mutex if single-threaded? |
||
|
|
||
| /// A worker registered on a [`SharedRuntime`]. | ||
| pub(crate) type BoxedWorker = Box<dyn Worker + Sync>; | ||
|
|
||
| #[derive(Debug)] | ||
| pub(crate) struct WorkerEntry { | ||
| pub(crate) id: u64, | ||
| #[cfg(not(target_arch = "wasm32"))] | ||
| pub(crate) restart_on_fork: bool, | ||
| pub(crate) worker: PausableWorker<BoxedWorker>, | ||
| } | ||
|
|
@@ -97,7 +107,7 @@ pub trait BlockingRuntime: SharedRuntime { | |
| #[derive(Clone, Debug)] | ||
| pub struct WorkerHandle { | ||
| pub(crate) worker_id: u64, | ||
| pub(crate) workers: Arc<Mutex<Vec<WorkerEntry>>>, | ||
| pub(crate) workers: WorkerRegistry, | ||
| } | ||
|
|
||
| #[derive(Debug)] | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How will we keep this in sync?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure honestly, the other idea I had instead of a fixed list would be to add a metadata field to each relevant crate's
Cargo.tomlto indicate if it should be compiling on wasm but that would add more complexity and I'm not even sure it solve the syncing problem, it just moves it to a per-crate toggle.I'm open to suggestion if you have a better alternative in mind