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

fingerprint error causing rebuild on feature flag changes #3923

Closed
SergioBenitez opened this issue Apr 14, 2017 · 6 comments
Closed

fingerprint error causing rebuild on feature flag changes #3923

SergioBenitez opened this issue Apr 14, 2017 · 6 comments

Comments

@SergioBenitez
Copy link
Contributor

Switching between building rocket with and without feature flags causes the cookie dependency to be rebuilt each item. The following logs show this:

$ cargo build
   Compiling rocket v0.2.4
    Finished dev [unoptimized + debuginfo] target(s) in 21.1 secs
$ cargo build --all-features
   Compiling cookie v0.7.4
   Compiling rocket v0.2.4
    Finished dev [unoptimized + debuginfo] target(s) in 24.31 secs
$ cargo build
   Compiling cookie v0.7.4
   Compiling rocket v0.2.4
    Finished dev [unoptimized + debuginfo] target(s) in 23.16 secs

Running with RUST_LOG=cargo::ops::cargo_rustc::fingerprint=info shows that this is caused by a fingerprint error due to cookie in turn due to ring.

 $ RUST_LOG=cargo::ops::cargo_rustc::fingerprint=info cargo build --all-features
INFO:cargo::ops::cargo_rustc::fingerprint: fingerprint error for cookie v0.7.4: new (ring v0.7.5) != old (ring v0.7.5)
   Compiling cookie v0.7.4
   Compiling rocket v0.2.4
    Finished dev [unoptimized + debuginfo] target(s) in 24.29 secs

cc @briansmith

@alexcrichton
Copy link
Member

Sounds bad!

Could you try enabling fingerprint=debug to get a few more logs? I'm hopeful that may have some extra information but I'm also not holding my breath

@SergioBenitez
Copy link
Contributor Author

Here's the full log:

$ RUST_LOG=cargo::ops::cargo_rustc::fingerprint=debug cargo build
DEBUG:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /Users/sbenitez/Rocket/target/debug/.fingerprint/rocket-345600c44cd7c0e1/lib-rocket-345600c44cd7c0e1
DEBUG:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /Users/sbenitez/Rocket/target/debug/.fingerprint/num_cpus-9d46f9850838cbe9/lib-num_cpus-9d46f9850838cbe9
DEBUG:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /Users/sbenitez/Rocket/target/debug/.fingerprint/libc-133c2936106da144/lib-libc-133c2936106da144
DEBUG:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /Users/sbenitez/Rocket/target/debug/.fingerprint/smallvec-0a0a78ad45ad7466/lib-smallvec-0a0a78ad45ad7466
DEBUG:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /Users/sbenitez/Rocket/target/debug/.fingerprint/hyper-1a84cd390831c3ae/lib-hyper-1a84cd390831c3ae
DEBUG:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /Users/sbenitez/Rocket/target/debug/.fingerprint/typeable-65ff39e1a79225ed/lib-typeable-65ff39e1a79225ed
DEBUG:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /Users/sbenitez/Rocket/target/debug/.fingerprint/mime-bccdaf777dcff437/lib-mime-bccdaf777dcff437
DEBUG:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /Users/sbenitez/Rocket/target/debug/.fingerprint/log-72a4331fc2f8629e/lib-log-72a4331fc2f8629e
DEBUG:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /Users/sbenitez/Rocket/target/debug/.fingerprint/traitobject-bc224b6576d03647/lib-traitobject-bc224b6576d03647
DEBUG:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /Users/sbenitez/Rocket/target/debug/.fingerprint/unicase-3bb06bfe1c6860a7/lib-unicase-3bb06bfe1c6860a7
DEBUG:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /Users/sbenitez/Rocket/target/debug/.fingerprint/unicase-da156157c559b4b5/build
DEBUG:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /Users/sbenitez/Rocket/target/debug/.fingerprint/unicase-95d90fcebb64eeac/build-script-build_script_build-95d90fcebb64eeac
DEBUG:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /Users/sbenitez/Rocket/target/debug/.fingerprint/rustc_version-76e71e47667641c7/lib-rustc_version-76e71e47667641c7
DEBUG:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /Users/sbenitez/Rocket/target/debug/.fingerprint/semver-21371f1df4b09baa/lib-semver-21371f1df4b09baa
DEBUG:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /Users/sbenitez/Rocket/target/debug/.fingerprint/rustc-serialize-29daaebfc16e55cb/lib-rustc_serialize-29daaebfc16e55cb
DEBUG:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /Users/sbenitez/Rocket/target/debug/.fingerprint/url-6d842f47cc20a326/lib-url-6d842f47cc20a326
DEBUG:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /Users/sbenitez/Rocket/target/debug/.fingerprint/matches-dc52e482a85f2c5e/lib-matches-dc52e482a85f2c5e
DEBUG:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /Users/sbenitez/Rocket/target/debug/.fingerprint/idna-3db054cccbce4cb4/lib-idna-3db054cccbce4cb4
DEBUG:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /Users/sbenitez/Rocket/target/debug/.fingerprint/unicode-normalization-0380c037f91e7541/lib-unicode_normalization-0380c037f91e7541
DEBUG:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /Users/sbenitez/Rocket/target/debug/.fingerprint/unicode-bidi-384fe7d92389c1e3/lib-unicode_bidi-384fe7d92389c1e3
DEBUG:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /Users/sbenitez/Rocket/target/debug/.fingerprint/httparse-b31dfcd369f0dc79/lib-httparse-b31dfcd369f0dc79
DEBUG:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /Users/sbenitez/Rocket/target/debug/.fingerprint/language-tags-ca27e3e6961d878e/lib-language_tags-ca27e3e6961d878e
DEBUG:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /Users/sbenitez/Rocket/target/debug/.fingerprint/time-0bbc884d1946f0b1/lib-time-0bbc884d1946f0b1
DEBUG:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /Users/sbenitez/Rocket/target/debug/.fingerprint/hyper-2991d3239613cfd5/build
DEBUG:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /Users/sbenitez/Rocket/target/debug/.fingerprint/hyper-92ca72aa2b55879b/build-script-build_script_build-92ca72aa2b55879b
DEBUG:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /Users/sbenitez/Rocket/target/debug/.fingerprint/term-painter-91afc7f285355627/lib-term_painter-91afc7f285355627
DEBUG:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /Users/sbenitez/Rocket/target/debug/.fingerprint/term-e1d1158d86029c51/lib-term-e1d1158d86029c51
DEBUG:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /Users/sbenitez/Rocket/target/debug/.fingerprint/toml-1d42d8ba6745fe04/lib-toml-1d42d8ba6745fe04
DEBUG:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /Users/sbenitez/Rocket/target/debug/.fingerprint/cookie-136e11922312d484/lib-cookie-136e11922312d484
INFO:cargo::ops::cargo_rustc::fingerprint: fingerprint error for cookie v0.7.4: new (ring v0.7.5) != old (ring v0.7.5)
DEBUG:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /Users/sbenitez/Rocket/target/debug/.fingerprint/base64-84e78143d7e2ea7a/lib-base64-84e78143d7e2ea7a
DEBUG:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /Users/sbenitez/Rocket/target/debug/.fingerprint/byteorder-361be4c405c73a78/lib-byteorder-361be4c405c73a78
DEBUG:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /Users/sbenitez/Rocket/target/debug/.fingerprint/ring-71257f4c48d769d2/lib-ring-71257f4c48d769d2
DEBUG:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /Users/sbenitez/Rocket/target/debug/.fingerprint/untrusted-96f63d538a9429f2/lib-untrusted-96f63d538a9429f2
DEBUG:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /Users/sbenitez/Rocket/target/debug/.fingerprint/ring-bc00b1b93ac2f828/build
DEBUG:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /Users/sbenitez/Rocket/target/debug/.fingerprint/ring-a00ba5c693ebcc7d/build-script-build_script_build-a00ba5c693ebcc7d
DEBUG:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /Users/sbenitez/Rocket/target/debug/.fingerprint/gcc-1604195341ed8041/lib-gcc-1604195341ed8041
DEBUG:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /Users/sbenitez/Rocket/target/debug/.fingerprint/rayon-6ecacfcf784b6a76/lib-rayon-6ecacfcf784b6a76
DEBUG:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /Users/sbenitez/Rocket/target/debug/.fingerprint/rayon-core-3cefb5850366c4a9/lib-rayon_core-3cefb5850366c4a9
DEBUG:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /Users/sbenitez/Rocket/target/debug/.fingerprint/rand-181c3a1f3e956745/lib-rand-181c3a1f3e956745
DEBUG:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /Users/sbenitez/Rocket/target/debug/.fingerprint/lazy_static-15bf74d66408cb83/lib-lazy_static-15bf74d66408cb83
DEBUG:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /Users/sbenitez/Rocket/target/debug/.fingerprint/deque-42de4d9eab150772/lib-deque-42de4d9eab150772
DEBUG:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /Users/sbenitez/Rocket/target/debug/.fingerprint/rayon-core-c3a164c795f8c9fa/build
DEBUG:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /Users/sbenitez/Rocket/target/debug/.fingerprint/rayon-core-56379ddd89a27abc/build-script-build_script_build-56379ddd89a27abc
DEBUG:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /Users/sbenitez/Rocket/target/debug/.fingerprint/pear_codegen-cc62c9c92af30dd1/lib-pear_codegen-cc62c9c92af30dd1
DEBUG:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /Users/sbenitez/Rocket/target/debug/.fingerprint/state-43fca0fef156b855/lib-state-43fca0fef156b855
DEBUG:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /Users/sbenitez/Rocket/target/debug/.fingerprint/pear-6e760722afd2bc17/lib-pear-6e760722afd2bc17
DEBUG:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /Users/sbenitez/Rocket/target/debug/.fingerprint/memchr-f30fddda4c33551d/lib-memchr-f30fddda4c33551d
DEBUG:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /Users/sbenitez/Rocket/target/debug/.fingerprint/rocket-155c4b197dfde48a/build
DEBUG:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /Users/sbenitez/Rocket/target/debug/.fingerprint/rocket-151022718a5939c8/build-script-build_script_build-151022718a5939c8
DEBUG:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /Users/sbenitez/Rocket/target/debug/.fingerprint/version_check-6f5d0758724fd92a/lib-version_check-6f5d0758724fd92a
DEBUG:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /Users/sbenitez/Rocket/target/debug/.fingerprint/ansi_term-f51fe439a0e7ebce/lib-ansi_term-f51fe439a0e7ebce
   Compiling cookie v0.7.4
DEBUG:cargo::ops::cargo_rustc::fingerprint: appending /Users/sbenitez/Rocket/target/debug/.fingerprint/cookie-136e11922312d484/dep-lib-cookie-136e11922312d484 <- /Users/sbenitez/Rocket/lib
DEBUG:cargo::ops::cargo_rustc::fingerprint: write fingerprint: /Users/sbenitez/Rocket/target/debug/.fingerprint/cookie-136e11922312d484/lib-cookie-136e11922312d484
   Compiling rocket v0.2.6 (file:///Users/sbenitez/Rocket/lib)
DEBUG:cargo::ops::cargo_rustc::fingerprint: appending /Users/sbenitez/Rocket/target/debug/.fingerprint/rocket-345600c44cd7c0e1/dep-lib-rocket-345600c44cd7c0e1 <- /Users/sbenitez/Rocket/lib
DEBUG:cargo::ops::cargo_rustc::fingerprint: write fingerprint: /Users/sbenitez/Rocket/target/debug/.fingerprint/rocket-345600c44cd7c0e1/lib-rocket-345600c44cd7c0e1
    Finished dev [unoptimized + debuginfo] target(s) in 10.97 secs

@alexcrichton
Copy link
Member

So much for being more illuminating, alas!

@alexcrichton
Copy link
Member

alexcrichton commented Apr 19, 2017

Oh wait sorry I think I misunderstood the issue, I believe I see the problem now.

So cargo recently started caching crates based on features as well as debug/release, meaning that cargo build and cargo build --feature foo should have two separate caches and shouldn't thrash if you go back in forth. Cargo is indeed successfully doing that here but the problem is that Cargo's not taking dependencies into account.

So for one compilation graph here no features are enabled. Next a feature in Rocket and transitively, ring, a feature is enabled. Now cookie depends on ring so when it's recompiled it means cookie is recompiled, and later Rocket is recompiled. This basically means that the Rocket with no features uses a different version of the cookie crate than the version of Rocket with features. Both versions of the cookie crate have no features enabled, but the dependencies are different.

I believe the solution here, and one we forgot to do earlier, is to simply hash dependencies when hashing a crate. I believe the relevant function already has all the information necessary to do this, we basically just need to call target_deps on the unit provided recursively and throw a bunch of hashes into what we're working with. Note that to be efficient we're going to want some memoization here as well.

froydnj added a commit to froydnj/servo that referenced this issue Sep 13, 2017
Gecko would like to turn on the stylo layout tests (tests/unit/stylo) in
Gecko CI.  The plan for doing this is to add the tests as a
dev-dependency of Gecko's main Rust library, from which `cargo test` can
be run in the usual fashion.

Doing this creates problems for normal development, because the stylo
tests need the `selectors` crate to be compiled with `gecko_like_types`,
whereas the `geckolib` crate does not.  So if we compile `geckolib` in a
non-test build configuration, the `selectors` crate is compiled without
`gecko_like_types`...but then if we compile `geckolib` in a test build
configuration, cargo will evict the previous rlib for the `selectors`
crate and replace it with a `selectors` compiled with gecko_like_types.
And then compiling `geckolib` in a non-test configuration repeats the
process, and so forth.

Needless to say, this is highly annoying behavior.  It is due to a bug
in cargo:

rust-lang/cargo#3923

but it's not known when that bug will get fixed.  In the meantime, we
can just make sure that geckolib's `selectors` is compiled with the same
features as the `selectors` crate in the stylo tests.
froydnj added a commit to froydnj/servo that referenced this issue Sep 13, 2017
Gecko would like to turn on the stylo layout tests (tests/unit/stylo) in
Gecko CI.  The plan for doing this is to add the tests as a
dev-dependency of Gecko's main Rust library, from which `cargo test` can
be run in the usual fashion.

Doing this creates problems for normal development, because the stylo
tests need the `selectors` crate to be compiled with `gecko_like_types`,
whereas the `geckolib` crate does not.  So if we compile `geckolib` in a
non-test build configuration, the `selectors` crate is compiled without
`gecko_like_types`...but then if we compile `geckolib` in a test build
configuration, cargo will evict the previous rlib for the `selectors`
crate and replace it with a `selectors` compiled with gecko_like_types.
And then compiling `geckolib` in a non-test configuration repeats the
process, and so forth.

Needless to say, this is highly annoying behavior.  It is due to a bug
in cargo:

rust-lang/cargo#3923

but it's not known when that bug will get fixed.  In the meantime, we
can just make sure that geckolib's `selectors` is compiled with the same
features as the `selectors` crate in the stylo tests.
bors-servo pushed a commit to servo/servo that referenced this issue Sep 13, 2017
align selectors's features in geckolib and stylo_tests

Gecko would like to turn on the stylo layout tests (tests/unit/stylo) in
Gecko CI.  The plan for doing this is to add the tests as a
dev-dependency of Gecko's main Rust library, from which `cargo test` can
be run in the usual fashion.

Doing this creates problems for normal development, because the stylo
tests need the `selectors` crate to be compiled with `gecko_like_types`,
whereas the `geckolib` crate does not.  So if we compile `geckolib` in a
non-test build configuration, the `selectors` crate is compiled without
`gecko_like_types`...but then if we compile `geckolib` in a test build
configuration, cargo will evict the previous rlib for the `selectors`
crate and replace it with a `selectors` compiled with gecko_like_types.
And then compiling `geckolib` in a non-test configuration repeats the
process, and so forth.

Needless to say, this is highly annoying behavior.  It is due to a bug
in cargo:

rust-lang/cargo#3923

but it's not known when that bug will get fixed.  In the meantime, we
can just make sure that geckolib's `selectors` is compiled with the same
features as the `selectors` crate in the stylo tests.

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18489)
<!-- Reviewable:end -->
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Sep 14, 2017
…o_tests (from froydnj:geckolib-feature-alignment); r=froydnj

Gecko would like to turn on the stylo layout tests (tests/unit/stylo) in
Gecko CI.  The plan for doing this is to add the tests as a
dev-dependency of Gecko's main Rust library, from which `cargo test` can
be run in the usual fashion.

Doing this creates problems for normal development, because the stylo
tests need the `selectors` crate to be compiled with `gecko_like_types`,
whereas the `geckolib` crate does not.  So if we compile `geckolib` in a
non-test build configuration, the `selectors` crate is compiled without
`gecko_like_types`...but then if we compile `geckolib` in a test build
configuration, cargo will evict the previous rlib for the `selectors`
crate and replace it with a `selectors` compiled with gecko_like_types.
And then compiling `geckolib` in a non-test configuration repeats the
process, and so forth.

Needless to say, this is highly annoying behavior.  It is due to a bug
in cargo:

rust-lang/cargo#3923

but it's not known when that bug will get fixed.  In the meantime, we
can just make sure that geckolib's `selectors` is compiled with the same
features as the `selectors` crate in the stylo tests.

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors

Source-Repo: https://github.com/servo/servo
Source-Revision: 1aa8be392b0ab8e7a8426f525361b40b69d70b4f

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : f496fa2a771c7765dae4da1edbf160e298a426f3
aethanyc pushed a commit to aethanyc/gecko-dev that referenced this issue Sep 14, 2017
…o_tests (from froydnj:geckolib-feature-alignment); r=froydnj

Gecko would like to turn on the stylo layout tests (tests/unit/stylo) in
Gecko CI.  The plan for doing this is to add the tests as a
dev-dependency of Gecko's main Rust library, from which `cargo test` can
be run in the usual fashion.

Doing this creates problems for normal development, because the stylo
tests need the `selectors` crate to be compiled with `gecko_like_types`,
whereas the `geckolib` crate does not.  So if we compile `geckolib` in a
non-test build configuration, the `selectors` crate is compiled without
`gecko_like_types`...but then if we compile `geckolib` in a test build
configuration, cargo will evict the previous rlib for the `selectors`
crate and replace it with a `selectors` compiled with gecko_like_types.
And then compiling `geckolib` in a non-test configuration repeats the
process, and so forth.

Needless to say, this is highly annoying behavior.  It is due to a bug
in cargo:

rust-lang/cargo#3923

but it's not known when that bug will get fixed.  In the meantime, we
can just make sure that geckolib's `selectors` is compiled with the same
features as the `selectors` crate in the stylo tests.

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors

Source-Repo: https://github.com/servo/servo
Source-Revision: 1aa8be392b0ab8e7a8426f525361b40b69d70b4f
JerryShih pushed a commit to JerryShih/gecko-dev that referenced this issue Sep 14, 2017
…o_tests (from froydnj:geckolib-feature-alignment); r=froydnj

Gecko would like to turn on the stylo layout tests (tests/unit/stylo) in
Gecko CI.  The plan for doing this is to add the tests as a
dev-dependency of Gecko's main Rust library, from which `cargo test` can
be run in the usual fashion.

Doing this creates problems for normal development, because the stylo
tests need the `selectors` crate to be compiled with `gecko_like_types`,
whereas the `geckolib` crate does not.  So if we compile `geckolib` in a
non-test build configuration, the `selectors` crate is compiled without
`gecko_like_types`...but then if we compile `geckolib` in a test build
configuration, cargo will evict the previous rlib for the `selectors`
crate and replace it with a `selectors` compiled with gecko_like_types.
And then compiling `geckolib` in a non-test configuration repeats the
process, and so forth.

Needless to say, this is highly annoying behavior.  It is due to a bug
in cargo:

rust-lang/cargo#3923

but it's not known when that bug will get fixed.  In the meantime, we
can just make sure that geckolib's `selectors` is compiled with the same
features as the `selectors` crate in the stylo tests.

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors

Source-Repo: https://github.com/servo/servo
Source-Revision: 1aa8be392b0ab8e7a8426f525361b40b69d70b4f
luke-chang pushed a commit to luke-chang/gecko that referenced this issue Sep 14, 2017
…o_tests (from froydnj:geckolib-feature-alignment); r=froydnj

Gecko would like to turn on the stylo layout tests (tests/unit/stylo) in
Gecko CI.  The plan for doing this is to add the tests as a
dev-dependency of Gecko's main Rust library, from which `cargo test` can
be run in the usual fashion.

Doing this creates problems for normal development, because the stylo
tests need the `selectors` crate to be compiled with `gecko_like_types`,
whereas the `geckolib` crate does not.  So if we compile `geckolib` in a
non-test build configuration, the `selectors` crate is compiled without
`gecko_like_types`...but then if we compile `geckolib` in a test build
configuration, cargo will evict the previous rlib for the `selectors`
crate and replace it with a `selectors` compiled with gecko_like_types.
And then compiling `geckolib` in a non-test configuration repeats the
process, and so forth.

Needless to say, this is highly annoying behavior.  It is due to a bug
in cargo:

rust-lang/cargo#3923

but it's not known when that bug will get fixed.  In the meantime, we
can just make sure that geckolib's `selectors` is compiled with the same
features as the `selectors` crate in the stylo tests.

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors

Source-Repo: https://github.com/servo/servo
Source-Revision: 1aa8be392b0ab8e7a8426f525361b40b69d70b4f
@udoprog
Copy link

udoprog commented Sep 26, 2017

I've been troubleshooting this in nikomatsakis/lalrpop#266, and I've put together a small project to easily reproduce it.

I can reproduce this on stable cargo (0.21.1), but not on on cargo compile from master. So this might have been fixed.

@alexcrichton
Copy link
Member

Ah yes, this was indeed fixed on master!

#4469

moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Oct 2, 2017
The easy part of this patch is the addition of the RustTest itself.

The more difficult to understand part of the patch is the changes to all
of our Rust build configuration.  We do this due to a bug in cargo:

rust-lang/cargo#3923

where features on dependent crates are not correctly taken into account
when determining whether cached artifacts on disk are valid and whether
they should be evicted from the disk cache.  The practical upshot of
this behavior is that, say, running gtests during normal development
when files in libxul are modified will:

* rebuild some Rust dependencies for libxul;
* link libxul;
* rebuild those same Rust dependencies *again* for libxul-gtest, since
  we have different features active and therefore the old artifacts look
  to be out of date;
* link libxul-gtest.

Needless to say, this is highly annoying and counterproductive behavior.

The "fix" is to ensure that the gkrust-shared crate explicitly depends
on crates and assigns features to them such that the feature sets do not
change between normal builds and testing builds.  This is admittedly
fragile, but it is not the first time this has come up, and is probably
not the last.
xeonchen pushed a commit to xeonchen/gecko-cinnabar that referenced this issue Oct 2, 2017
The easy part of this patch is the addition of the RustTest itself.

The more difficult to understand part of the patch is the changes to all
of our Rust build configuration.  We do this due to a bug in cargo:

rust-lang/cargo#3923

where features on dependent crates are not correctly taken into account
when determining whether cached artifacts on disk are valid and whether
they should be evicted from the disk cache.  The practical upshot of
this behavior is that, say, running gtests during normal development
when files in libxul are modified will:

* rebuild some Rust dependencies for libxul;
* link libxul;
* rebuild those same Rust dependencies *again* for libxul-gtest, since
  we have different features active and therefore the old artifacts look
  to be out of date;
* link libxul-gtest.

Needless to say, this is highly annoying and counterproductive behavior.

The "fix" is to ensure that the gkrust-shared crate explicitly depends
on crates and assigns features to them such that the feature sets do not
change between normal builds and testing builds.  This is admittedly
fragile, but it is not the first time this has come up, and is probably
not the last.
aethanyc pushed a commit to aethanyc/gecko-dev that referenced this issue Oct 3, 2017
The easy part of this patch is the addition of the RustTest itself.

The more difficult to understand part of the patch is the changes to all
of our Rust build configuration.  We do this due to a bug in cargo:

rust-lang/cargo#3923

where features on dependent crates are not correctly taken into account
when determining whether cached artifacts on disk are valid and whether
they should be evicted from the disk cache.  The practical upshot of
this behavior is that, say, running gtests during normal development
when files in libxul are modified will:

* rebuild some Rust dependencies for libxul;
* link libxul;
* rebuild those same Rust dependencies *again* for libxul-gtest, since
  we have different features active and therefore the old artifacts look
  to be out of date;
* link libxul-gtest.

Needless to say, this is highly annoying and counterproductive behavior.

The "fix" is to ensure that the gkrust-shared crate explicitly depends
on crates and assigns features to them such that the feature sets do not
change between normal builds and testing builds.  This is admittedly
fragile, but it is not the first time this has come up, and is probably
not the last.
JerryShih pushed a commit to JerryShih/gecko-dev that referenced this issue Oct 3, 2017
The easy part of this patch is the addition of the RustTest itself.

The more difficult to understand part of the patch is the changes to all
of our Rust build configuration.  We do this due to a bug in cargo:

rust-lang/cargo#3923

where features on dependent crates are not correctly taken into account
when determining whether cached artifacts on disk are valid and whether
they should be evicted from the disk cache.  The practical upshot of
this behavior is that, say, running gtests during normal development
when files in libxul are modified will:

* rebuild some Rust dependencies for libxul;
* link libxul;
* rebuild those same Rust dependencies *again* for libxul-gtest, since
  we have different features active and therefore the old artifacts look
  to be out of date;
* link libxul-gtest.

Needless to say, this is highly annoying and counterproductive behavior.

The "fix" is to ensure that the gkrust-shared crate explicitly depends
on crates and assigns features to them such that the feature sets do not
change between normal builds and testing builds.  This is admittedly
fragile, but it is not the first time this has come up, and is probably
not the last.
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Apr 6, 2018
Remove the syn dependency from gkrust-shared, which was added in bug 1373878
as a workaround for this Cargo bug:

rust-lang/cargo#3923

MozReview-Commit-ID: L34J0davEYd

--HG--
extra : rebase_source : 79e5684cba143f6215e7dcf9367f82227bca48c5
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this issue Oct 1, 2019
…o_tests (from froydnj:geckolib-feature-alignment); r=froydnj

Gecko would like to turn on the stylo layout tests (tests/unit/stylo) in
Gecko CI.  The plan for doing this is to add the tests as a
dev-dependency of Gecko's main Rust library, from which `cargo test` can
be run in the usual fashion.

Doing this creates problems for normal development, because the stylo
tests need the `selectors` crate to be compiled with `gecko_like_types`,
whereas the `geckolib` crate does not.  So if we compile `geckolib` in a
non-test build configuration, the `selectors` crate is compiled without
`gecko_like_types`...but then if we compile `geckolib` in a test build
configuration, cargo will evict the previous rlib for the `selectors`
crate and replace it with a `selectors` compiled with gecko_like_types.
And then compiling `geckolib` in a non-test configuration repeats the
process, and so forth.

Needless to say, this is highly annoying behavior.  It is due to a bug
in cargo:

rust-lang/cargo#3923

but it's not known when that bug will get fixed.  In the meantime, we
can just make sure that geckolib's `selectors` is compiled with the same
features as the `selectors` crate in the stylo tests.

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors

Source-Repo: https://github.com/servo/servo
Source-Revision: 1aa8be392b0ab8e7a8426f525361b40b69d70b4f

UltraBlame original commit: 962216b7844402a956a9b410fed0567506f96261
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this issue Oct 2, 2019
…o_tests (from froydnj:geckolib-feature-alignment); r=froydnj

Gecko would like to turn on the stylo layout tests (tests/unit/stylo) in
Gecko CI.  The plan for doing this is to add the tests as a
dev-dependency of Gecko's main Rust library, from which `cargo test` can
be run in the usual fashion.

Doing this creates problems for normal development, because the stylo
tests need the `selectors` crate to be compiled with `gecko_like_types`,
whereas the `geckolib` crate does not.  So if we compile `geckolib` in a
non-test build configuration, the `selectors` crate is compiled without
`gecko_like_types`...but then if we compile `geckolib` in a test build
configuration, cargo will evict the previous rlib for the `selectors`
crate and replace it with a `selectors` compiled with gecko_like_types.
And then compiling `geckolib` in a non-test configuration repeats the
process, and so forth.

Needless to say, this is highly annoying behavior.  It is due to a bug
in cargo:

rust-lang/cargo#3923

but it's not known when that bug will get fixed.  In the meantime, we
can just make sure that geckolib's `selectors` is compiled with the same
features as the `selectors` crate in the stylo tests.

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors

Source-Repo: https://github.com/servo/servo
Source-Revision: 1aa8be392b0ab8e7a8426f525361b40b69d70b4f

UltraBlame original commit: 962216b7844402a956a9b410fed0567506f96261
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this issue Oct 2, 2019
…o_tests (from froydnj:geckolib-feature-alignment); r=froydnj

Gecko would like to turn on the stylo layout tests (tests/unit/stylo) in
Gecko CI.  The plan for doing this is to add the tests as a
dev-dependency of Gecko's main Rust library, from which `cargo test` can
be run in the usual fashion.

Doing this creates problems for normal development, because the stylo
tests need the `selectors` crate to be compiled with `gecko_like_types`,
whereas the `geckolib` crate does not.  So if we compile `geckolib` in a
non-test build configuration, the `selectors` crate is compiled without
`gecko_like_types`...but then if we compile `geckolib` in a test build
configuration, cargo will evict the previous rlib for the `selectors`
crate and replace it with a `selectors` compiled with gecko_like_types.
And then compiling `geckolib` in a non-test configuration repeats the
process, and so forth.

Needless to say, this is highly annoying behavior.  It is due to a bug
in cargo:

rust-lang/cargo#3923

but it's not known when that bug will get fixed.  In the meantime, we
can just make sure that geckolib's `selectors` is compiled with the same
features as the `selectors` crate in the stylo tests.

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors

Source-Repo: https://github.com/servo/servo
Source-Revision: 1aa8be392b0ab8e7a8426f525361b40b69d70b4f

UltraBlame original commit: 962216b7844402a956a9b410fed0567506f96261
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this issue Oct 2, 2019
The easy part of this patch is the addition of the RustTest itself.

The more difficult to understand part of the patch is the changes to all
of our Rust build configuration.  We do this due to a bug in cargo:

rust-lang/cargo#3923

where features on dependent crates are not correctly taken into account
when determining whether cached artifacts on disk are valid and whether
they should be evicted from the disk cache.  The practical upshot of
this behavior is that, say, running gtests during normal development
when files in libxul are modified will:

* rebuild some Rust dependencies for libxul;
* link libxul;
* rebuild those same Rust dependencies *again* for libxul-gtest, since
  we have different features active and therefore the old artifacts look
  to be out of date;
* link libxul-gtest.

Needless to say, this is highly annoying and counterproductive behavior.

The "fix" is to ensure that the gkrust-shared crate explicitly depends
on crates and assigns features to them such that the feature sets do not
change between normal builds and testing builds.  This is admittedly
fragile, but it is not the first time this has come up, and is probably
not the last.

UltraBlame original commit: 7d0cf5897a623819500a45b042cce3732c8ad86d
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this issue Oct 2, 2019
The easy part of this patch is the addition of the RustTest itself.

The more difficult to understand part of the patch is the changes to all
of our Rust build configuration.  We do this due to a bug in cargo:

rust-lang/cargo#3923

where features on dependent crates are not correctly taken into account
when determining whether cached artifacts on disk are valid and whether
they should be evicted from the disk cache.  The practical upshot of
this behavior is that, say, running gtests during normal development
when files in libxul are modified will:

* rebuild some Rust dependencies for libxul;
* link libxul;
* rebuild those same Rust dependencies *again* for libxul-gtest, since
  we have different features active and therefore the old artifacts look
  to be out of date;
* link libxul-gtest.

Needless to say, this is highly annoying and counterproductive behavior.

The "fix" is to ensure that the gkrust-shared crate explicitly depends
on crates and assigns features to them such that the feature sets do not
change between normal builds and testing builds.  This is admittedly
fragile, but it is not the first time this has come up, and is probably
not the last.

UltraBlame original commit: 7d0cf5897a623819500a45b042cce3732c8ad86d
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this issue Oct 2, 2019
The easy part of this patch is the addition of the RustTest itself.

The more difficult to understand part of the patch is the changes to all
of our Rust build configuration.  We do this due to a bug in cargo:

rust-lang/cargo#3923

where features on dependent crates are not correctly taken into account
when determining whether cached artifacts on disk are valid and whether
they should be evicted from the disk cache.  The practical upshot of
this behavior is that, say, running gtests during normal development
when files in libxul are modified will:

* rebuild some Rust dependencies for libxul;
* link libxul;
* rebuild those same Rust dependencies *again* for libxul-gtest, since
  we have different features active and therefore the old artifacts look
  to be out of date;
* link libxul-gtest.

Needless to say, this is highly annoying and counterproductive behavior.

The "fix" is to ensure that the gkrust-shared crate explicitly depends
on crates and assigns features to them such that the feature sets do not
change between normal builds and testing builds.  This is admittedly
fragile, but it is not the first time this has come up, and is probably
not the last.

UltraBlame original commit: 7d0cf5897a623819500a45b042cce3732c8ad86d
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this issue Oct 2, 2019
Remove the syn dependency from gkrust-shared, which was added in bug 1373878
as a workaround for this Cargo bug:

rust-lang/cargo#3923

MozReview-Commit-ID: L34J0davEYd

UltraBlame original commit: 580a27dbc127ef6ea45de4122395361bc22190d9
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this issue Oct 2, 2019
Remove the syn dependency from gkrust-shared, which was added in bug 1373878
as a workaround for this Cargo bug:

rust-lang/cargo#3923

MozReview-Commit-ID: L34J0davEYd

UltraBlame original commit: 580a27dbc127ef6ea45de4122395361bc22190d9
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this issue Oct 2, 2019
Remove the syn dependency from gkrust-shared, which was added in bug 1373878
as a workaround for this Cargo bug:

rust-lang/cargo#3923

MozReview-Commit-ID: L34J0davEYd

UltraBlame original commit: 580a27dbc127ef6ea45de4122395361bc22190d9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants