Skip to content

Regression that causes app to not be recompiled #7969

@nazar-pc

Description

@nazar-pc

Problem
When checking src/main.rs cargo (rustc?) expects file to have newer timestamp than before to detect changes and this causes app to not be recompiled in some cases.

Steps

  1. cargo init
#!/bin/bash
set -e

binary=$(basename $(pwd))
rm -rf target
rm -rf src
mkdir src
echo "WTF ^, cargo?" > src/main-backup.rs
echo "fn main() {println!(\"bad\");}" > src/main.rs
cargo +nightly build --release
target/release/$binary
mv src/main-backup.rs src/main.rs
cargo +nightly build --release
target/release/$binary
touch src/main.rs
cargo +nightly build --release
target/release/$binary

Possible Solution(s)

  1. Ideally it should at least check for inequality instead, maybe file inode, etc., current implementation is just broken.
  2. Fix cargo build --dependencies-only #2644, I faced this issue with echo "fn main() {}" > src/main.rs workaround to make dependencies compile and cache separately from the app itself

Notes
Last working version was installed with this (Jenkins output):

[2020-03-04T09:15:20.431Z] info: downloading installer
[2020-03-04T09:15:20.431Z] info: profile set to 'default'
[2020-03-04T09:15:20.431Z] info: default host triple is x86_64-unknown-linux-gnu
[2020-03-04T09:15:20.431Z] info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
[2020-03-04T09:15:20.824Z] info: latest update on 2020-03-04, rust version 1.43.0-nightly (4ad624882 2020-03-03)
[2020-03-04T09:15:20.824Z] info: downloading component 'cargo'
[2020-03-04T09:15:20.824Z] info: downloading component 'clippy'
[2020-03-04T09:15:20.824Z] info: downloading component 'rust-docs'
[2020-03-04T09:15:21.647Z] info: downloading component 'rust-std'
[2020-03-04T09:15:22.487Z] info: downloading component 'rustc'
[2020-03-04T09:15:25.011Z] info: downloading component 'rustfmt'
[2020-03-04T09:15:25.011Z] info: installing component 'cargo'
[2020-03-04T09:15:25.827Z] info: installing component 'clippy'
[2020-03-04T09:15:26.211Z] info: installing component 'rust-docs'
[2020-03-04T09:15:27.523Z] info: installing component 'rust-std'
[2020-03-04T09:15:28.831Z] info: installing component 'rustc'
[2020-03-04T09:15:34.019Z] info: installing component 'rustfmt'
[2020-03-04T09:15:34.411Z] info: default toolchain set to 'nightly'
[2020-03-04T09:15:34.411Z] 
[2020-03-04T09:15:34.411Z]   nightly installed - rustc 1.43.0-nightly (4ad624882 2020-03-03)

First non-working was installed with this:

[2020-03-04T19:57:07.393Z] info: downloading installer
[2020-03-04T19:57:07.393Z] info: profile set to 'default'
[2020-03-04T19:57:07.393Z] info: default host triple is x86_64-unknown-linux-gnu
[2020-03-04T19:57:07.393Z] info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
[2020-03-04T19:57:07.394Z] info: latest update on 2020-03-04, rust version 1.43.0-nightly (4ad624882 2020-03-03)
[2020-03-04T19:57:07.394Z] info: downloading component 'cargo'
[2020-03-04T19:57:07.778Z] info: downloading component 'clippy'
[2020-03-04T19:57:07.778Z] info: downloading component 'rust-docs'
[2020-03-04T19:57:07.778Z] info: downloading component 'rust-std'
[2020-03-04T19:57:08.594Z] info: downloading component 'rustc'
[2020-03-04T19:57:09.901Z] info: downloading component 'rustfmt'
[2020-03-04T19:57:09.901Z] info: installing component 'cargo'
[2020-03-04T19:57:10.285Z] info: installing component 'clippy'
[2020-03-04T19:57:10.669Z] info: installing component 'rust-docs'
[2020-03-04T19:57:12.541Z] info: installing component 'rust-std'
[2020-03-04T19:57:13.849Z] info: installing component 'rustc'
[2020-03-04T19:57:20.233Z] info: installing component 'rustfmt'
[2020-03-04T19:57:20.233Z] 
[2020-03-04T19:57:20.233Z] info: default toolchain set to 'nightly'
[2020-03-04T19:57:20.233Z]   nightly installed - rustc 1.43.0-nightly (4ad624882 2020-03-03)

Output of cargo version:

cargo 1.43.0-nightly (bda50510d 2020-03-02)

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions