Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build scripts and panic=abort #2730

Merged
merged 1 commit into from
May 23, 2016
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions src/cargo/ops/cargo_rustc/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -632,10 +632,10 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
}
}

pub fn build_script_profile(&self, _pkg: &PackageId) -> &'a Profile {
// TODO: should build scripts always be built with a dev
pub fn build_script_profile(&self, pkg: &PackageId) -> &'a Profile {
// TODO: should build scripts always be built with the same library
// profile? How is this controlled at the CLI layer?
&self.profiles.dev
self.lib_profile(pkg)
}

pub fn rustflags_args(&self, unit: &Unit) -> CargoResult<Vec<String>> {
Expand Down
42 changes: 42 additions & 0 deletions tests/test_cargo_compile_custom_build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1930,3 +1930,45 @@ test!(custom_target_dir {
assert_that(p.cargo_process("build").arg("-v"),
execs().with_status(0));
});

test!(panic_abort_with_build_scripts {
if !::is_nightly() {
return
}
let p = project("foo")
.file("Cargo.toml", r#"
[project]
name = "foo"
version = "0.5.0"
authors = []

[profile.release]
panic = 'abort'

[dependencies]
a = { path = "a" }
"#)
.file("src/lib.rs", "extern crate a;")
.file("a/Cargo.toml", r#"
[project]
name = "a"
version = "0.5.0"
authors = []
build = "build.rs"

[build-dependencies]
b = { path = "../b" }
"#)
.file("a/src/lib.rs", "")
.file("a/build.rs", "extern crate b; fn main() {}")
.file("b/Cargo.toml", r#"
[project]
name = "b"
version = "0.5.0"
authors = []
"#)
.file("b/src/lib.rs", "");

assert_that(p.cargo_process("build").arg("-v").arg("--release"),
execs().with_status(0));
});