Closed MartinKavik closed 3 years ago
Thanks for the PR! I'm looking into the errors you ran into right now. Could you try making this change with std
's locks instead of simple-mutex? That crate looks really cool but it looks like it's only used by one other crate right now and I don't feel qualified to assess the lock myself.
How is your Rust toolchain installed? The repository is set up assuming you're using rustup which may not be correct.
Re your question (2) I opened https://github.com/anp/moxie/issues/221. There used to be a bunch more nightly deps and I think that might be the only one left!
Re (1), can you paste the output of rustc --version
? That doesn't look like an issue I'd expect from the toolchain version but I'm not sure how to repro otherwise (I'm also on Windows).
Could you try making this change with std's locks instead of simple-mutex? That crate looks really cool but it looks like it's only used by one other crate right now and I don't feel qualified to assess the lock myself.
My first attempt was with std
's Mutex
but the problem was a different API - e.g. lock
method:
fn lock(&self) -> LockResult<MutexGuard<'_, T>> // std
fn lock(&self) -> MutexGuard<T> // simple-mutex
fn lock(&self) -> MutexGuard<'_, R, T> // parking_lot
As the result, I had to write a lot of .unwrap()
s or change the API to handle possible errors because of LockResult
. Also I was fighting a lot with the compiler where the lock
has been called inside macro definitions (if I remember it correctly.)
So I decided to use simple_mutex
- replacement is much easier, should be faster than std
and the author is pretty experienced.
However I can try to use std
's Mutex
again if you want, but I'll need to know if I should use unwrap
or expect
or change API.
How is your Rust toolchain installed?
I've installed Rust from the official *.exe
installer. And I use classic rustup update
. So it should be the most standard way.
Re (1), can you paste the output of rustc --version?
I've just tried the current one (rustc 1.50.0-nightly (1c389ffef 2020-11-24)
) and the one set explicitly in Moxie's rust-toolchain
(rustc 1.47.0-nightly (6c8927b0c 2020-07-26
) and the error persists.
I'm not sure how to repro otherwise
I've done some more investigation and the reason why you can't reproduce it is Cargo.lock
. I'm starting to hate dependency version resolving in Cargo.toml
and I plan to remove Cargo.lock
from my .gitignore
's (it doesn't help with cargo install
but that's another story.) I've also found the bug with parking_lot
when I've deleted Cargo.lock
and it broke the app for my client.
Ok, back to the problem. There is probably a bug or changed API in the latest paste crate 1.0.3
. I can "fix" it by changing paste = "1.0.0"
to paste = "=1.0.0"
(or =1.0.2
) in dom
's Cargo.toml
.
Let's look at the code in dom
:
https://github.com/anp/moxie/blob/74fb3e750e506649d1aca5ffd90d70c3021a89af/dom/src/lib.rs#L76-L88
I've tried to replace ($app:ty)
with ($app:ident)
and then some combinations like js_name = "[<boot $app>]")
or js_name = "boot" $app
but everything failed as a compilation error or even Rust compiler panic. What do you think? Should I create an issue in paste
's repo? I guess it has been broken by this PR: https://github.com/dtolnay/paste/pull/57
Thank you again for this! I think for now it'll be easier to take the approach proposed in #225 so I'll give this a close.
What do you think? Should I create an issue in paste's repo? I guess it has been broken by this PR: dtolnay/paste#57
I'm not sure I follow where this error is coming from, if you're still hitting it can you open a separate issue? Would be happy to help figure it out.
Resolves #218
This PR replaces the dependency parking_lot with simple_mutex to resolve runtime bugs caused by
parking_lot
'sMutex::lock
in Wasm. See the linked issue for more info.The fix has been manually tested through a Seed app that uses
topo
as an indirect dependency.The PR has been marked as
Draft
because of two reasons:I can't compile it because of the error below. The error was already present in the
main
branch without my changes:How should I resolve it?
It looks like the only thing that prevents to compile the project (at least
topo
) on the stable Rust is this line inCargo.toml
:Is there a simple way to remove this limitation?
Thank you!