Skip to content

Commit

Permalink
add cargo config alternative to set unstable rustflags (#3905)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vrixyz committed Apr 1, 2024
1 parent 88efe46 commit a9f0670
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 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,20 @@ 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`:
```toml
[build]
rustflags = ["--cfg=web_sys_unstable_apis"]
```

0 comments on commit a9f0670

Please sign in to comment.