Stream: cranelift

Topic: Move `clif-util` to `anyhow` and `structopt`?


view this post on Zulip fitzgen (he/him) (Sep 14 2020 at 20:35):

Hacking on clif-util is a bit annoying:

  1. It uses String for error types, which requires annoying conversions and formatting to provide context.
  2. The raw clap usage to build up CLI arguments and subcommands is a bit tedious.

We can address (1) with anyhow, which is used extensively throughout the rest of the project and provides easy error conversions, backtraces, and addition of context.

We can address (2) with structopt, which is also used in wasmtime and is a derive for creating CLI arguments from structs and enums. It is more concise and moves us towards better idioms (eg functions taking an options struct rather than fifteen parameters).

I don't expect any controversy around these proposed changes, but I did want to make sure that there wasn't any hidden issues with this stuff due to the firefox+cranelift integration.

cc @Dan Gohman @Benjamin Bouvier @Chris Fallin @Julian Seward

view this post on Zulip Chris Fallin (Sep 14 2020 at 20:36):

+1 from me at least; it sounds like this won't affect the codegen or wasm crates at all (that's all we use in SpiderMonkey)?

view this post on Zulip Dan Gohman (Sep 14 2020 at 20:40):

+1 from me. String was once common as an error type in Cranelift, but anyhow is better in every way

view this post on Zulip fitzgen (he/him) (Sep 14 2020 at 21:46):

Great, I'll get started on this then. Thanks!


Last updated: Dec 23 2024 at 12:05 UTC