Skip to content

Commit 7f44648

Browse files
committed
Track panic mode in fingerprint
Ensure that if we've previously compiled a crate with panic=abort and we later need it for panic=unwind we correctly recompile it. Closes #5445
1 parent acea5e2 commit 7f44648

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

src/cargo/core/compiler/fingerprint.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,7 @@ fn calculate<'a, 'cfg>(
457457
unit.mode,
458458
cx.extra_args_for(unit),
459459
cx.incremental_args(unit)?,
460+
cx.used_in_plugin.contains(unit), // used when passing panic=abort
460461
));
461462
let fingerprint = Arc::new(Fingerprint {
462463
rustc: util::hash_u64(&cx.build_config.rustc.verbose_version),

tests/testsuite/freshness.rs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,3 +1119,48 @@ fn path_dev_dep_registry_updates() {
11191119
execs().with_status(0).with_stderr("[FINISHED] [..]"),
11201120
);
11211121
}
1122+
1123+
#[test]
1124+
fn change_panic_mode() {
1125+
let p = project("p")
1126+
.file(
1127+
"Cargo.toml",
1128+
r#"
1129+
[workspace]
1130+
members = ['foo', 'bar']
1131+
[profile.dev]
1132+
panic = 'abort'
1133+
"#,
1134+
)
1135+
.file("src/lib.rs", "")
1136+
.file(
1137+
"foo/Cargo.toml",
1138+
r#"
1139+
[package]
1140+
name = "foo"
1141+
version = "0.1.1"
1142+
authors = []
1143+
"#,
1144+
)
1145+
.file("foo/src/lib.rs", "")
1146+
.file(
1147+
"bar/Cargo.toml",
1148+
r#"
1149+
[package]
1150+
name = "bar"
1151+
version = "0.1.1"
1152+
authors = []
1153+
1154+
[lib]
1155+
proc-macro = true
1156+
1157+
[dependencies]
1158+
foo = { path = '../foo' }
1159+
"#,
1160+
)
1161+
.file("bar/src/lib.rs", "extern crate foo;")
1162+
.build();
1163+
1164+
assert_that(p.cargo("build -p foo"), execs().with_status(0));
1165+
assert_that(p.cargo("build -p bar"), execs().with_status(0));
1166+
}

0 commit comments

Comments
 (0)