dtolnay / dtolnay/watt

Forwarding cargo features into the wasm

Open
#35 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
1.5k
Forks
31
PR merge metrics
No merged PRs in 30d

Description

I have a macro I want to run through watt (in fact, I need to in order to break a self-dependency bootstrap cycle). However, I additionally want to have the macro emit slightly more or less depending on enabled features of my facade crate.

(Specifically, because I'm writing a proc macro that targets working with syn, I want to support disabling the bits covered by syn features. In the future, I can maybe emit [`#[cfg(accessible(::my_runtime::syn::path)]`](https://github.com/rust-lang/rust/issues/64797), but for now, this is covered by my runtime having equivalent feature flags.)

I have it... theoretically working, but the hack to call one of 24 different symbols is... not pretty at best.

![image](https://user-images.githubusercontent.com/5992217/76247453-f3107a00-6215-11ea-88e0-e7203948f4f3.png)

![image](https://user-images.githubusercontent.com/5992217/76247487-03c0f000-6216-11ea-87d6-3a2ac2d63476.png)

It'd be really nice if watt would support passing through a second FFI-safe argument so we can inform the proc macro about some more state. The author would be responsible for making sure that cargo still understands all of the inputs to the proc macro for when it needs to be rerun.

Contributor guide

No contributing guide indexed for this repository

Research direction

No source files, tests, or entry points are named. Start by reviewing watt's proc-macro FFI boundary and how Cargo feature state reaches the facade crate. Done means feature state can be passed through safely and feature changes still cause the proc macro to rerun.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, wasm
Domain
build-system, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.