Skip to content

Commit

Permalink
Fix footgun for Windows users in fast_config.toml (#14103)
Browse files Browse the repository at this point in the history
# Objective

- #13136 changed the default
value of `-Zshare-generics=n` to `-Zshare-generics=y` on Windows
- New users are encouraged to use dynamic builds and LLD when setting up
Bevy
- New users are also encouraged to check out `fast_config.toml`
- #1126 means that running
dynamic builds, using LLD and sharing generics on Windows results in a
cryptic error message

As a result, a new Windows user following all recommendations for better
compiles is actually not able to compile Bevy at all.

## Solution

- Set `-Zshare-generics=n` on Windows with a comment saying this is for
dynamic linking

## Testing

I verified that #1126 is still
in place on the current nightly (1.80)

## Additional Info

Maybe the website should mention this as well? The relevant snippet
there looks like this:
```toml
# /path/to/project/.cargo/config.toml
[target.x86_64-unknown-linux-gnu]
rustflags = [
  # (Nightly) Make the current crate share its generic instantiations
  "-Zshare-generics=y",
]
```
so it kinda implies it's only for Linux? Which is not quite true, this
setting works on macOS as well AFAIK
  • Loading branch information
janhohenheim authored Jul 2, 2024
1 parent ce5254e commit a58c4f7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion .cargo/config_fast_builds.toml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ rustflags = [
linker = "rust-lld.exe"
rustflags = [
# Nightly
# "-Zshare-generics=y",
# "-Zshare-generics=n", # This needs to be off if you use dynamic linking on Windows.
# "-Zthreads=0",
]

Expand Down

0 comments on commit a58c4f7

Please sign in to comment.