Skip to content

Commit a9f0670

Browse files
authored
add cargo config alternative to set unstable rustflags (#3905)
1 parent 88efe46 commit a9f0670

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

guide/src/web-sys/unstable-apis.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,20 @@ APIs. Specifically, these APIs do not follow semver and may break whenever the
2323
WebIDL changes.
2424

2525
Crates can opt-in to unstable APIs at compile-time by passing the `cfg` flag
26-
`web_sys_unstable_apis`. Typically the `RUSTFLAGS` environment variable is used
26+
`web_sys_unstable_apis`.
27+
28+
Typically the `RUSTFLAGS` environment variable is used
2729
to do this. For example:
2830

2931
```bash
3032
RUSTFLAGS=--cfg=web_sys_unstable_apis cargo run
3133
```
34+
35+
Alternatively, you can create a [cargo config file](https://doc.rust-lang.org/cargo/reference/config.html)
36+
to set its [rustflags](https://doc.rust-lang.org/cargo/reference/config.html#buildrustflags):
37+
38+
Within `./.cargo/config.toml`:
39+
```toml
40+
[build]
41+
rustflags = ["--cfg=web_sys_unstable_apis"]
42+
```

0 commit comments

Comments
 (0)