Skip to content
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

Symbols always resolve to an empty str on wasm32-unknown-unknown #33

Closed
QuinnWilton opened this issue Jan 5, 2023 · 3 comments · Fixed by #34 or #35
Closed

Symbols always resolve to an empty str on wasm32-unknown-unknown #33

QuinnWilton opened this issue Jan 5, 2023 · 3 comments · Fixed by #34 or #35

Comments

@QuinnWilton
Copy link

Hi again!

I spoke a little too soon in my last issue, and even with an updated parking_lot, I haven't quite been able to get things to work on wasm32-unknown-unknown, and symbols always end up resolving to an empty &str.

I've created a minimal reproduction here. The code should be fairly straightforward, but it just exports a reproduce function to Javascript, which when called, logs Ustr::from("test").as_str() to the browser's console. You'll note that an empty string is logged.

I imagine this has something to do with the pointer tagging scheme you employ, but I haven't investigated enough to be sure.

In the meantime, I've swapped out for a simpler string interning crate in my code, so this isn't a blocking issue for me or anything, but I at least wanted to raise it in case you had any ideas, or anyone else gets stuck on the same thing :)

Thanks again for the crate! If this ever gets resolved, I'd love to switch back to Ustr, because it really is an impressively fast piece of code.

@anderslanglands
Copy link
Owner

Thanks for the repro case! I was a bit confused by your last issue as the parking lot bump was already published in 0.8!

I'm afraid I have zero experience with WASM or web tech in general so it's unlikely I'll be able to do too much about this myself in the near term at least.

@QuinnWilton
Copy link
Author

Thanks for the repro case! I was a bit confused by your last issue as the parking lot bump was already published in 0.8!

Was it? Unless I'm misunderstanding the crates.io UI (which is very possible, I'm new to Rust!), 0.9 and 0.8 both depend on parking_lot ^0.11, whereas it's 0.12 that ends up being necessary to build things successfully: https://crates.io/crates/ustr/0.9.0/dependencies

I'm afraid I have zero experience with WASM or web tech in general so it's unlikely I'll be able to do too much about this myself in the near term at least.

No worries at all!

QuinnWilton added a commit to RhizomeDB/rs-rhizome that referenced this issue Jan 6, 2023
This swaps the Ustr crate for string_interner, to resolve:
anderslanglands/ustr#33
QuinnWilton added a commit to RhizomeDB/rs-rhizome that referenced this issue Jan 6, 2023
This swaps the Ustr crate for string_interner, to resolve:
anderslanglands/ustr#33
QuinnWilton added a commit to RhizomeDB/rs-rhizome that referenced this issue Jan 6, 2023
This swaps the Ustr crate for string_interner, to resolve:
anderslanglands/ustr#33
bouk added a commit to bouk/ustr that referenced this issue Feb 9, 2023
This is to resolve 0 length on architectures where size_of<usize> !=
size_of<u64>, which causes padding to be added so the struct is aligned.

Fixes anderslanglands#33
@bouk
Copy link
Contributor

bouk commented Feb 9, 2023

Got a fix here: #34 (the problem is that wasm32 is 32-bit)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants