-
Notifications
You must be signed in to change notification settings - Fork 822
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
Add UnsupportedTarget error to compiler #1881
Conversation
lib/compiler/src/error.rs
Outdated
/// The compiler cannot be used the current environment. | ||
/// This can refer to the OS, the chipset or any other aspect of the environment the compiler runs in. | ||
#[cfg_attr(feature = "std", error("Environment {0} is not yet supported (see https://docs.wasmer.io/ecosystem/wasmer/wasmer-features)"))] | ||
UnsupportedEnvironment(String), |
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.
Maybe UnsupportedTarget
should be the way to think about this?
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.
Yeah, I think UnsupportedTarget
reflects much better the propose of the error!
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.
Also, it would be great to have the Target
and Compiler
name as part of the error!
UnsupportedEnvironment(String), | |
/// The compiler cannot be used the provided target. | |
/// This can refer to the OS, the chipset or any other aspect of the environment the compiler runs in. | |
#[cfg_attr(feature = "std", error("The target {0} is not yet supported in the compiler {1} (see https://docs.wasmer.io/ecosystem/wasmer/wasmer-features)"))] | |
UnsupportedTarget(Target, Compiler), |
Note: we will need the Compiler
trait to derive from Display
(not just Send
) and implement the Display
trait for each of the compilers (CraneliftCompiler
, LLVMCompiler
and SinglepassCompiler
).
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.
Updated to UnsupportedTarget
and added tests. There is also an error for 32 bit now.
I'm not convinced about the proposed arguments:
- Using
Target
shows a lot of information to the user but does not provide information, which aspect of the target the problem is. - Adding
Compiler
seems redundant to me. It puts some of the context information in the error message. But this context should be available by knowledge of the compiler or stack traces. Adding it to one error case only feels very inconsistent.
372348d
to
624f0ec
Compare
bors r+ |
Closes #1878
Description
We can error early on for system combinations that are known to not work. This gives users a much better idea why things error and allows adapting the strategy without investing lots of time in debugging.
The different behaviour is tested here:
(CI job "Contract Development / Windows (pull_request)" in Upgrade to Wasmer Reborn (part 1) CosmWasm/cosmwasm#504)
(CI job "Contract Development / Windows (pull_request)" in Test Windows error CosmWasm/cosmwasm#648)
Something that is not yet clear to me is if
target
is the proper OS source information and if theCompiler
supports cross compilation where compile evironment is different from runtime environment.Review