Track panic mode in fingerprint
authorAlex Crichton <alex@alexcrichton.com>
Wed, 2 May 2018 14:32:10 +0000 (07:32 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Wed, 2 May 2018 14:34:19 +0000 (07:34 -0700)
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

src/cargo/core/compiler/fingerprint.rs
tests/testsuite/freshness.rs

index 73bd44bf3eb27e034904a0a9a70443b50a877367..c91d35093236559486ebbd576b90e4b72445cb9d 100644 (file)
@@ -457,6 +457,7 @@ fn calculate<'a, 'cfg>(
         unit.mode,
         cx.extra_args_for(unit),
         cx.incremental_args(unit)?,
+        cx.used_in_plugin.contains(unit), // used when passing panic=abort
     ));
     let fingerprint = Arc::new(Fingerprint {
         rustc: util::hash_u64(&cx.build_config.rustc.verbose_version),
index 9ff31d66afea41f40bb85aab1069ddce7622189a..09f324d8ea7efed5a7c657301e074f77606034fd 100644 (file)
@@ -1119,3 +1119,48 @@ fn path_dev_dep_registry_updates() {
         execs().with_status(0).with_stderr("[FINISHED] [..]"),
     );
 }
+
+#[test]
+fn change_panic_mode() {
+    let p = project("p")
+        .file(
+            "Cargo.toml",
+            r#"
+                [workspace]
+                members = ['foo', 'bar']
+                [profile.dev]
+                panic = 'abort'
+            "#,
+        )
+        .file("src/lib.rs", "")
+        .file(
+            "foo/Cargo.toml",
+            r#"
+                [package]
+                name = "foo"
+                version = "0.1.1"
+                authors = []
+            "#,
+        )
+        .file("foo/src/lib.rs", "")
+        .file(
+            "bar/Cargo.toml",
+            r#"
+                [package]
+                name = "bar"
+                version = "0.1.1"
+                authors = []
+
+                [lib]
+                proc-macro = true
+
+                [dependencies]
+                foo = { path = '../foo' }
+            "#,
+        )
+        .file("bar/src/lib.rs", "extern crate foo;")
+        .build();
+
+    assert_that(p.cargo("build -p foo"), execs().with_status(0));
+    assert_that(p.cargo("build -p bar"), execs().with_status(0));
+}