Skip to content

Commit 8ac86d9

Browse files
committed
Build with LTO
Fixes #982
1 parent cb16ec9 commit 8ac86d9

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

Cargo.toml

+4
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,7 @@ test = false # no unit tests
7777
name = "rustup-init"
7878
path = "src/rustup-cli/main.rs"
7979
test = false # no unit tests
80+
81+
[profile.release]
82+
lto = true
83+
codegen-units = 1

src/rustup-cli/main.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@
1414
1515
#![recursion_limit = "1024"]
1616

17-
use std::alloc::System;
18-
19-
#[global_allocator]
20-
static A: System = System;
21-
2217
#[macro_use]
2318
extern crate error_chain;
2419
extern crate rustup_dist;
@@ -60,12 +55,17 @@ mod term2;
6055
mod errors;
6156
mod help;
6257

58+
use std::alloc::System;
6359
use std::env;
6460
use std::path::PathBuf;
6561
use errors::*;
6662
use rustup_dist::dist::TargetTriple;
6763
use rustup::env_var::RUST_RECURSION_COUNT_MAX;
6864

65+
// Always use the system allocator, to reduce binary size.
66+
#[global_allocator]
67+
static _ALLOCATOR: System = System;
68+
6969
fn main() {
7070
if let Err(ref e) = run_rustup() {
7171
common::report_error(e);

0 commit comments

Comments
 (0)