File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -122,6 +122,22 @@ Enable this in `Cargo.toml`:
122122panic = " abort"
123123```
124124
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+
125141# Remove Location Details
126142
127143![ Minimum Rust: Nightly] ( https://img.shields.io/badge/Minimum%20Rust%20Version-nightly-orange.svg )
@@ -438,4 +454,4 @@ use std::alloc::System;
438454
439455#[global_allocator]
440456static A : System = System ;
441- ```
457+ ```
You can’t perform that action at this time.
0 commit comments