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

add cargo config alternative to set unstable rustflags #3905

Merged
merged 3 commits into from
Apr 1, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion guide/src/web-sys/unstable-apis.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,19 @@ APIs. Specifically, these APIs do not follow semver and may break whenever the
WebIDL changes.

Crates can opt-in to unstable APIs at compile-time by passing the `cfg` flag
`web_sys_unstable_apis`. Typically the `RUSTFLAGS` environment variable is used
`web_sys_unstable_apis`.

Typically the `RUSTFLAGS` environment variable is used
to do this. For example:

```bash
RUSTFLAGS=--cfg=web_sys_unstable_apis cargo run
```

Alternatively, you can create a [cargo config file](https://doc.rust-lang.org/cargo/reference/config.html)
to set its [rustflags](https://doc.rust-lang.org/cargo/reference/config.html#buildrustflags):

Within `./.cargo/config.toml`:
```bash
Vrixyz marked this conversation as resolved.
Show resolved Hide resolved
RUSTFLAGS=--cfg=web_sys_unstable_apis cargo run
Vrixyz marked this conversation as resolved.
Show resolved Hide resolved
```