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

Apply simulate-remapped-rust-src-base even if remap-debuginfo is set in config.toml #110699

Merged
merged 2 commits into from
May 13, 2023

Commits on Apr 22, 2023

  1. Configuration menu
    Copy the full SHA
    919b391 View commit details
    Browse the repository at this point in the history
  2. Apply simulate-remapped-rust-src-base even remap-debuginfo is set…

    … in config.toml
    
    This is really a mess. Here is the situation before this change:
    
    - UI tests depend on not having `rust-src` available. In particular, <https://github.com/rust-lang/rust/blob/3f374128ee3924514aacadf96479e17fee8f9903/tests/ui/tuple/wrong_argument_ice.stderr#L7-L8> is depending on the `note` being a single line and not showing the source code.
    - When `download-rustc` is disabled, we pass `-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX` `-Ztranslate-remapped-path-to-local-path=no`, which changes the diagnostic to something like `  --> /rustc/FAKE_PREFIX/library/alloc/src/collections/vec_deque/mod.rs:1657:12`
    - When `download-rustc` is enabled, we still pass those flags, but they no longer have an effect. Instead rustc emits diagnostic paths like this: `  --> /rustc/39c6804b92aa202369e402525cee329556bc1db0/library/alloc/src/collections/vec_deque/mod.rs:1657:12`. Notice how there's a real commit and not `FAKE_PREFIX`. This happens because we set `CFG_VIRTUAL_RUST_SOURCE_BASE_DIR` during bootstrapping for CI artifacts, and rustc previously didn't allow for `simulate-remapped` to affect paths that had already been remapped.
    - Pietro noticed this and decided the right thing was to normalize `/rustc/<commit>` to `$SRC_DIR` in compiletest: rust-lang@470423c
    - After my change to `x test core`, which rebuilds stage 2 std from source so `build/stage2-std` and `build/stage2` use the same `.rlib` metadata, the compiler suddenly notices it has sources for `std` available and prints those in the diagnostic, causing the test to fail.
    
    This changes `simulate-remapped-rust-src-base` to support remapping paths that have already been remapped, unblocking download-rustc.
    
    Unfortunately, although this fixes the specific problem for
    download-rustc, it doesn't seem to affect all the compiler's
    diagnostics. In particular, various `mir-opt` tests are failing to
    respect `simulate-remapped-path-prefix` (I looked into fixing this but
    it seems non-trivial). As a result, we can't remove the normalization in
    compiletest that maps `/rustc/<commit>` to `$SRC_DIR`, so this change is
    currently untested anywhere except locally.
    jyn514 committed Apr 22, 2023
    Configuration menu
    Copy the full SHA
    8785615 View commit details
    Browse the repository at this point in the history