From a58c4f7825010fe4c0e7332c8318176530c28e36 Mon Sep 17 00:00:00 2001 From: Jan Hohenheim Date: Tue, 2 Jul 2024 15:29:10 +0200 Subject: [PATCH] Fix footgun for Windows users in `fast_config.toml` (#14103) # Objective - https://github.com/bevyengine/bevy/pull/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` - https://github.com/bevyengine/bevy/issues/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 https://github.com/bevyengine/bevy/issues/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 --- .cargo/config_fast_builds.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.cargo/config_fast_builds.toml b/.cargo/config_fast_builds.toml index 878f9084b3..30824fd13d 100644 --- a/.cargo/config_fast_builds.toml +++ b/.cargo/config_fast_builds.toml @@ -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", ]