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

remap-path-prefix will not re-compile properly in dev build #66955

Closed
daxpedda opened this issue Dec 2, 2019 · 6 comments · Fixed by #84233
Closed

remap-path-prefix will not re-compile properly in dev build #66955

daxpedda opened this issue Dec 2, 2019 · 6 comments · Fixed by #84233
Labels
A-incr-comp Area: Incremental compilation A-reproducibility Area: Reproducible / Deterministic builds C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@daxpedda
Copy link
Contributor

daxpedda commented Dec 2, 2019

Old post

Using remap-path-prefix in development builds has no effect.
I'm not sure if this is intended or not, but it's not documented.
Would write a documentation PR if this is intended.

Changing remap-path-prefix in dev mode will not properly cause re-compilation and the debug info will not change.
In release mode changing the flag will always cause proper re-compilation and update the debug info accordingly.

Meta

rustc 1.41.0-nightly (412f43ac5 2019-11-24)
binary: rustc
commit-hash: 412f43ac5b4ae8c3599e71c6972112e9be4758fa
commit-date: 2019-11-24
host: x86_64-pc-windows-msvc
release: 1.41.0-nightly
LLVM version: 9.0
@jonas-schievink jonas-schievink added A-reproducibility Area: Reproducible / Deterministic builds C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 2, 2019
@jonas-schievink
Copy link
Contributor

Can you provide an example of this? Is this due to debuginfo included in the binary?

@daxpedda
Copy link
Contributor Author

daxpedda commented Dec 2, 2019

😞, I was just trying to reproduce it again, but couldn't.
Apparently the issue was that changing the flag wouldn't cause proper re-compilation, so cargo clean solved the problem.

Sorry!

So this is now a re-compilation issue!
For some reason in release it would always re-compile properly when changing this flag, but in development it wouldn't.

Is this due to debuginfo included in the binary?

I'm not sure how it behaves on other operating systems, but in windows both dev and release builds produce the debug info as a seperate file.
Obviously in release mode we have to define debug = true, otherwise there won't be any debuginfo to begin with.

Cargo.toml:

[profile.release]
debug = true

main.rs:

fn main() {
    panic!("test");
}

Both commands run with:
RUSTFLAGS = "--remap-path-prefix WORKING_DIRECTORY="
RUST_BACKTRACE = "full"

cargo run:

thread 'main' panicked at 'test', src\main.rs:2:5
stack backtrace:
   0:     0x7ff74bf77bb9 - backtrace::backtrace::trace_unsynchronized
                               at C:\Users\VssAdministrator\.cargo\registry\src\github.com-1ecc6299db9ec823\backtrace-0.3.40\src\backtrace\mod.rs:66
   1:     0x7ff74bf77bb9 - std::sys_common::backtrace::_print_fmt
                               at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\sys_common\backtrace.rs:84
   2:     0x7ff74bf77bb9 - std::sys_common::backtrace::_print::{{impl}}::fmt
                               at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\sys_common\backtrace.rs:61
   3:     0x7ff74bf86e8b - core::fmt::write
                               at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libcore\fmt\mod.rs:1030
   4:     0x7ff74bf75b94 - std::io::Write::write_fmt<std::sys::windows::stdio::Stderr>
                               at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\io\mod.rs:1412
   5:     0x7ff74bf7a269 - std::sys_common::backtrace::_print
                               at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\sys_common\backtrace.rs:65
   6:     0x7ff74bf7a269 - std::sys_common::backtrace::print
                               at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\sys_common\backtrace.rs:50
   7:     0x7ff74bf7a269 - std::panicking::default_hook::{{closure}}
                               at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\panicking.rs:188
   8:     0x7ff74bf79ebc - std::panicking::default_hook
                               at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\panicking.rs:205
   9:     0x7ff74bf7a99c - std::panicking::rust_panic_with_hook
                               at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\panicking.rs:464
  10:     0x7ff74bf71ef1 - std::panicking::begin_panic<str*>
                               at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\src\libstd\panicking.rs:400
  11:     0x7ff74bf71e4c - test-remap::main
                               at C:\Users\User\Documents\rust\test-remap\src\main.rs:2
  12:     0x7ff74bf716d0 - std::rt::lang_start::{{closure}}<()>
                               at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\src\libstd\rt.rs:61
  13:     0x7ff74bf7a3e7 - std::rt::lang_start_internal::{{closure}}
                               at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\rt.rs:48
  14:     0x7ff74bf7a3e7 - std::panicking::try::do_call<closure-0,i32>
                               at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\panicking.rs:287
  15:     0x7ff74bf7cd72 - panic_unwind::__rust_maybe_catch_panic
                               at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libpanic_unwind\lib.rs:81
  16:     0x7ff74bf7abc2 - std::panicking::try
                               at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\panicking.rs:265
  17:     0x7ff74bf7abc2 - std::panic::catch_unwind
                               at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\panic.rs:395
  18:     0x7ff74bf7abc2 - std::rt::lang_start_internal
                               at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\rt.rs:47
  19:     0x7ff74bf716ab - std::rt::lang_start<()>
                               at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\src\libstd\rt.rs:61
  20:     0x7ff74bf71e70 - main
  21:     0x7ff74bf89790 - invoke_main
                               at d:\agent\_work\3\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78
  22:     0x7ff74bf89790 - __scrt_common_main_seh
                               at d:\agent\_work\3\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
  23:     0x7ff99d497974 - BaseThreadInitThunk
  24:     0x7ff99f98a271 - RtlUserThreadStart

cargo run --release:

thread 'main' panicked at 'test', src\main.rs:2:5
stack backtrace:
   0:     0x7ff797ab6959 - backtrace::backtrace::trace_unsynchronized
                               at C:\Users\VssAdministrator\.cargo\registry\src\github.com-1ecc6299db9ec823\backtrace-0.3.40\src\backtrace\mod.rs:66
   1:     0x7ff797ab6959 - std::sys_common::backtrace::_print_fmt
                               at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\sys_common\backtrace.rs:84
   2:     0x7ff797ab6959 - std::sys_common::backtrace::_print::{{impl}}::fmt
                               at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\sys_common\backtrace.rs:61
   3:     0x7ff797ac5afb - core::fmt::write
                               at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libcore\fmt\mod.rs:1030
   4:     0x7ff797ab4934 - std::io::Write::write_fmt<std::sys::windows::stdio::Stderr>
                               at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\io\mod.rs:1412
   5:     0x7ff797ab9009 - std::sys_common::backtrace::_print
                               at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\sys_common\backtrace.rs:65
   6:     0x7ff797ab9009 - std::sys_common::backtrace::print
                               at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\sys_common\backtrace.rs:50
   7:     0x7ff797ab9009 - std::panicking::default_hook::{{closure}}
                               at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\panicking.rs:188
   8:     0x7ff797ab8c5c - std::panicking::default_hook
                               at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\panicking.rs:205
   9:     0x7ff797ab973c - std::panicking::rust_panic_with_hook
                               at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\panicking.rs:464
  10:     0x7ff797ab1025 - std::panicking::begin_panic<str*>
                               at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\src\libstd\panicking.rs:400
  11:     0x7ff797ab111c - test-remap::main
                               at \src\main.rs:2
  12:     0x7ff797ab10d6 - std::rt::lang_start::{{closure}}<()>
                               at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\src\libstd\rt.rs:61
  13:     0x7ff797ab9187 - std::rt::lang_start_internal::{{closure}}
                               at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\rt.rs:48
  14:     0x7ff797ab9187 - std::panicking::try::do_call<closure-0,i32>
                               at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\panicking.rs:287
  15:     0x7ff797abbb12 - panic_unwind::__rust_maybe_catch_panic
                               at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libpanic_unwind\lib.rs:81
  16:     0x7ff797ab9962 - std::panicking::try
                               at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\panicking.rs:265
  17:     0x7ff797ab9962 - std::panic::catch_unwind
                               at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\panic.rs:395
  18:     0x7ff797ab9962 - std::rt::lang_start_internal
                               at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\rt.rs:47
  19:     0x7ff797ab1147 - main
  20:     0x7ff797ac8400 - invoke_main
                               at d:\agent\_work\3\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78
  21:     0x7ff797ac8400 - __scrt_common_main_seh
                               at d:\agent\_work\3\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
  22:     0x7ff99d497974 - BaseThreadInitThunk
  23:     0x7ff99f98a271 - RtlUserThreadStart

@daxpedda daxpedda changed the title remap-path-prefix only effective in release builds remap-path-prefix will not re-compile properly in dev build Dec 2, 2019
@jonas-schievink jonas-schievink added the A-incr-comp Area: Incremental compilation label Dec 2, 2019
@jonas-schievink
Copy link
Contributor

Perhaps the option needs to be TRACKED instead of UNTRACKED here?

remap_path_prefix: Vec<(PathBuf, PathBuf)> [UNTRACKED],

@daxpedda
Copy link
Contributor Author

daxpedda commented Dec 2, 2019

I wanted to try it out, but I'm kinda having trouble building rustc it seems. So feel free to check it out.

@jgalenson
Copy link

I haven't tested it out, but I believe changing remap_path_prefix to TRACKED will cause other problems, as it means the argument's value will be hashed. Then two builds in different directories that try to use that flag to get the same output will differ as they have different values for that argument.

@jyn514
Copy link
Member

jyn514 commented Apr 15, 2021

Then two builds in different directories that try to use that flag to get the same output will differ as they have different values for that argument.

Well yes, that's the whole point. Their inputs are different so the outputs need to be recomputed. Otherwise it will end up caching the wrong values.

Note that TRACKED can never break builds, or change the output compared to a non-incremental build, it can only make them slower.

Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Apr 29, 2021
…woerister

Add TRACKED_NO_CRATE_HASH and use it for `--remap-path-prefix`

I verified locally that this fixes rust-lang#66955.

r? `@Aaron1011` (feel free to reassign)
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Apr 29, 2021
…woerister

Add TRACKED_NO_CRATE_HASH and use it for `--remap-path-prefix`

I verified locally that this fixes rust-lang#66955.

r? ``@Aaron1011`` (feel free to reassign)
@bors bors closed this as completed in 814a560 Apr 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-incr-comp Area: Incremental compilation A-reproducibility Area: Reproducible / Deterministic builds C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants