File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -72,9 +72,6 @@ opt-level = "z" # Optimize for size.
72
72
> It is recommended to experiment with different levels to find the right balance for your project.
73
73
> There may be surprising results, such as ... the ` "s" ` and ` "z" ` levels not being necessarily
74
74
> smaller.
75
- >
76
- > When using ` "z" ` , you can also try the ` -Zshare-generics=false ` rustc flag with the nightly toolchain
77
- > (via RUSTFLAGS).
78
75
79
76
# Enable Link Time Optimization (LTO)
80
77
@@ -125,6 +122,22 @@ Enable this in `Cargo.toml`:
125
122
panic = " abort"
126
123
```
127
124
125
+ # (Un)Share Generics
126
+
127
+ ![ Minimum Rust: Nightly] ( https://img.shields.io/badge/Minimum%20Rust%20Version-nightly-orange.svg )
128
+
129
+ Currently Rust enables ` -Zshare-generics ` implicitly for opt-level ` "s" ` and ` "z" ` .
130
+ Just like ` "s" ` vs ` "z" ` , this can sometimes be helpful and sometimes cause larger binaries.
131
+
132
+ To avoid sharing generics, use the unstable
133
+ ` rustc ` ` -Zshare-generics ` flag:
134
+ flag:
135
+
136
+ ``` bash
137
+ $ RUSTFLAGS=" -Zshare-generics=false" cargo +nightly build --release
138
+ ```
139
+
140
+
128
141
# Remove Location Details
129
142
130
143
![ Minimum Rust: Nightly] ( https://img.shields.io/badge/Minimum%20Rust%20Version-nightly-orange.svg )
You can’t perform that action at this time.
0 commit comments