Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions tests/build-std/main.rs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind briefly explaining (or copy) the regression a bit in the PR description as well?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would also be helpful to have a code comment around the test, as the test has a bit of distance from Cargo itself.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for providing the context!

Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,37 @@ fn basic() {
assert_eq!(p.glob(deps_dir.join("*.dylib")).count(), 0);
}

#[cargo_test(build_std_real)]
fn lto() {
// Checks that `-Zbuild-std` can work with `lto = "thin"`.
// This regression is from https://github.com/rust-lang/rust/issues/146109.
let p = project()
.file(
"Cargo.toml",
r#"
[package]
name = "foo"
version = "0.1.0"
edition = "2021"

[profile.dev]
lto = "thin"
"#,
)
.file(
"src/main.rs",
r#"
fn main() {}
"#,
)
.build();

p.cargo("build")
.build_std_arg("std")
.env("RUSTFLAGS", "-C linker-features=-lld")
.run();
}

#[cargo_test(build_std_real)]
fn host_proc_macro() {
let p = project()
Expand Down