-
-
Notifications
You must be signed in to change notification settings - Fork 20
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
return errors on unsupported targets (e.g., wasm) #42
Comments
Sorry, but I can't reproduce. The error message honestly just doesn't make any sense to me. Please provide more details. Is there something else about your environment that is unique? Have you tried using Rust stable? This library shouldn't have any differences between nightly and stable Rust. |
Yeah it's weird to me too, I'm on windows just trying to update |
Doesn't cc @alexcrichton You're the only one that comes to mind to ping on this... The relevant code is here: Lines 78 to 86 in c499d02
which unstandable fails on WASM. What is the normal approach for things like this? |
I don't think it's being compiled for wasm, just the cli tool |
@ForsakenHarmony do you perhaps have a |
Oh wow, I didn't think about that, that's probably it Why does it read that with cargo install though? |
@ForsakenHarmony ah that's the subject of rust-lang/cargo#5874 |
I'm getting this error when using the syntect crate as a dependency, and building to wasm32-unknown-unknown. Sounds like an incompatibility with the target |
@David-OConnor I don't know what the desired fix is supposed to be unfortunately. |
I don't think this should be re-opened. At least, I'm not convinced this is a problem in this crate. I don't even know what "same file" means in a wasm context. |
Er sorry I never actually answered this original question, only the side effect! FWIW we generally try to get crates "working on wasm" which means they at least compile. The standard library just returns errors everywhere (files aren't a thing) but for crates.io-based crates you could either do that or just the crate (like winapi does on Unix for example). |
@alexcrichton Ah thanks for responding! Interesting! Making the crate just be empty would be easy I guess, but I imagine that would just push compilation errors up the chain. That is, you'd get this same problem, but just manifest in a different way. e.g., syntect is using same-file via walkdir, so syntect would need to avoid walking directories? Seems a little iffy, but I guess that's probably desired? Returning errors seems OK too. Honestly, I'm not sure which way to go. I don't really have a strong opinion on what to do either way since I don't have much experience with how this sort of stuff is eventually handled at the application level. |
I'm personally partial to the "just return errors" route. While it feels wrong it's often the easiest to actually code against. A "correctly written" wasm app which is also portable to other platforms tends to be easiest to write (or at least so I find) when you can just have constant conditionals earlier in control flow to avoid these functions, but otherwise they look like they're still compiled in. I'm 100% certain others feel differently though :) |
Sounds good to me. Happy to defer to your judgment on this one! |
I am seeing a similar error with the relatively new Steps to reproduce:
|
I'm personally unlikely to look into this any time soon. PRs for fixing this on other targets are welcome. |
imp
in newest nightly
I ran into this issue this morning and it's a showstopper for some work that I'm doing. This crate is in the dependency chain of quite a few things. If I try and compile my project for the
It looks to me like the conditional attributes above the imports all fail under this target, so the |
@autodidaddict Yes, as shown above, the issue is known. This has been fixed in b121320 and put on to crates.io in |
version
The text was updated successfully, but these errors were encountered: