Skip to content

Commit a32e55d

Browse files
committed
test(build-std): Add test for LTO
1 parent 5c03433 commit a32e55d

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

tests/build-std/main.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,35 @@ fn basic() {
187187
assert_eq!(p.glob(deps_dir.join("*.dylib")).count(), 0);
188188
}
189189

190+
#[cargo_test(build_std_real)]
191+
fn lto() {
192+
let p = project()
193+
.file(
194+
"Cargo.toml",
195+
r#"
196+
[package]
197+
name = "foo"
198+
version = "0.1.0"
199+
edition = "2021"
200+
201+
[profile.dev]
202+
lto = "thin"
203+
"#,
204+
)
205+
.file(
206+
"src/main.rs",
207+
r#"
208+
fn main() {}
209+
"#,
210+
)
211+
.build();
212+
213+
p.cargo("build")
214+
.build_std_arg("std")
215+
.env("RUSTFLAGS", "-C linker-features=-lld")
216+
.run();
217+
}
218+
190219
#[cargo_test(build_std_real)]
191220
fn host_proc_macro() {
192221
let p = project()

0 commit comments

Comments
 (0)