You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
alternative title: -Z simulate-remapped-rust-src-base is not working as expected with remap-debuginfo = true
Hello! We are running the compiler test with a compiler configured with remap-debuginfo = true and after a recent PR merge we observed that the src/test/ui test suite is no longer passing. After looking into the issue I think a (test only?) -Z compiler flag may not be working as intended. Details below and apologies for not using one of the issue templates!
Observations
./x.py test src/test/ui worked fine before PR #97504 with remap-debuginfo = true set in config.toml
$ git clone https://github.com/rust-lang/rust
$ cd rust
$ git checkout 946a88a # before PR 97504
$ git submodule update
$ cp config.toml.example config.toml
$ # enable remap-debuginfo
$ sed -i '/remap-debuginfo/c\remap-debuginfo = true' config.toml
$ ./x.py test src/test/ui &&echo OK(..)OK
./x.py test src/test/ui stopped working after #97504 was merged.
$ git checkout e810f75 # after PR 97504
$ git submodule update
$ cp config.toml.example config.toml
$ # enable remap-debuginfo
$ sed -i '/remap-debuginfo/c\remap-debuginfo = true' config.toml
$ ./x.py test src/test/ui(..)---- [ui] src/test/ui/span/issue-71363.rs stdout ----diff of stderr:1 error[E0277]: `MyError` doesn't implement `std::fmt::Display`- --> $DIR/issue-71363.rs:6:6- |- 6 | impl std::error::Error for MyError {}- | ^^^^^^^^^^^^^^^^^ `MyError` cannot be formatted with the default formatter- |- = help: the trait `std::fmt::Display` is not implemented for `MyError`- = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead+ --> $DIR/issue-71363.rs:6:6+ |+ 6 | impl std::error::Error for MyError {}+ | ^^^^^^^^^^^^^^^^^ `MyError` cannot be formatted with the default formatter+ |+ = help: the trait `std::fmt::Display` is not implemented for `MyError`+ = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead9 note: required by a bound in `std::error::Error`+ --> $SRC_DIR/std/src/error.rs:LL:COL+ |+ 193 | pub trait Error: Debug + Display {+ | ^^^^^^^ required by this bound in `std::error::Error`1011 error[E0277]: `MyError` doesn't implement `Debug`- --> $DIR/issue-71363.rs:6:6- |- 6 | impl std::error::Error for MyError {}- | ^^^^^^^^^^^^^^^^^ `MyError` cannot be formatted using `{:?}`- |- = help: the trait `Debug` is not implemented for `MyError`- = note: add `#[derive(Debug)]` to `MyError` or manually `impl Debug for MyError`+ --> $DIR/issue-71363.rs:6:6+ |+ 6 | impl std::error::Error for MyError {}+ | ^^^^^^^^^^^^^^^^^ `MyError` cannot be formatted using `{:?}`+ |+ = help: the trait `Debug` is not implemented for `MyError`+ = note: add `#[derive(Debug)]` to `MyError` or manually `impl Debug for MyError`19 note: required by a bound in `std::error::Error`+ --> $SRC_DIR/std/src/error.rs:LL:COL+ |+ 193 | pub trait Error: Debug + Display {+ | ^^^^^ required by this bound in `std::error::Error`20 help: consider annotating `MyError` with `#[derive(Debug)]`- |- 5 | #[derive(Debug)]- |+ |+ 5 | #[derive(Debug)]+ |2425 error: aborting due to 2 previous errors26(..)
more concretely, the UI test issue-71363 added in PR #97504 fails. the error message looks like the one that was reported by CI in the original PR #89268. see rust-log-analyzer
disabling remap-debuginfo makes test issue-71363 and the test suite pass:
$ # disable remap-debuginfo
$ sed -i '/remap-debuginfo/c\remap-debuginfo = false' config.toml
$ ./x.py test src/test/ui &&echo OK(..)OK
Hypotheses
-Z simulate-remapped-rust-src-base is not working as intended with remap-debuginfo = true.
AIUI, the goal of -Z simulate-remapped-rust-src-base=/rustc/xyz is to make it as if there was no rust-src component installed but it's not working when the compiler is built with remap-debuginfo = true. This can be observed in the above test failure: the location of trait Error is reported. It can also be observed on nightly (shown below):
$ rustup default nightly-2022-06-02
$ rustup component add rust-src
$ cd src/test/ui/span # within rust-lang/rust repo
$ rustc -Z ui-testing=no -Z simulate-remapped-rust-src-base=/rustc/xyz issue-71363.rs(..)
note: required by a bound in `std::error::Error`
--> $RUST_SRC/library/std/src/error.rs:193:18
|
193 | pub trait Error:Debug + Display{
only removing the rust-src component makes that pub trait note disappear.
$ rustup component remove rust-src
$ rustc -Z ui-testing=no -Z simulate-remapped-rust-src-base=/rustc/xyz issue-71363.rs2>&1 | rg 'pubtrait' || echo not found
not found
$ rustc issue-71363.rs2>&1 | rg 'pubtrait' || echo not found
not found
issue-71363 is not being exercised with remap-debuginfo = true in CI
PR #97504 rebased PR #89268 but added // only-x86_64-unknown-linux-gnu. with that change the issue-71363 test is run in the auto (x86_64-gnu, ubuntu-20.04-xl) builder which is configured with the default of remap-debuginfo = false. (see temporary logs)
I couldn't figure where in the source code remap-debuginfo is set for CI builders but for example auto (dist-x86_64-linux, ubuntu-20.04-xl) is configured with remap-debuginfo = true (see temporary logs) but that builder does not run the src/test/ui tests.
OTOH, auto (dist-i586-gnu-i586-i686-musl, ubuntu-20.04-xl) is configured with remap-debuginfo = true (see temporary logs) and does run the src/test/ui tests. However, it will not run issue-71363 (see temp logs) because the test has a // only-x86_64-unknown-linux-gnu directive. This dist-i586 builder is the one that failed in the original PR #89268 (again, see rust-log-analyzer); that original PR did not have the // only- directive.
Conclusions
-Z simulate-remapped-rust-src-base is not working as intended with remap-debuginfo = true.
because of (1), issue-71363 is a hazard because it will fail if the remap-debuginfo configuration of the CI builders is tweaked in the future
alternative title:
-Z simulate-remapped-rust-src-baseis not working as expected withremap-debuginfo = trueHello! We are running the compiler test with a compiler configured with
remap-debuginfo = trueand after a recent PR merge we observed that thesrc/test/uitest suite is no longer passing. After looking into the issue I think a (test only?)-Zcompiler flag may not be working as intended. Details below and apologies for not using one of the issue templates!Observations
./x.py test src/test/uiworked fine before PR #97504 withremap-debuginfo = trueset inconfig.toml./x.py test src/test/uistopped working after #97504 was merged.more concretely, the UI test
issue-71363added in PR #97504 fails. the error message looks like the one that was reported by CI in the original PR #89268. see rust-log-analyzerdisabling
remap-debuginfomakes testissue-71363and the test suite pass:Hypotheses
-Z simulate-remapped-rust-src-baseis not working as intended withremap-debuginfo = true.AIUI, the goal of
-Z simulate-remapped-rust-src-base=/rustc/xyzis to make it as if there was norust-srccomponent installed but it's not working when the compiler is built withremap-debuginfo = true. This can be observed in the above test failure: the location oftrait Erroris reported. It can also be observed on nightly (shown below):only removing the
rust-srccomponent makes thatpub traitnote disappear.issue-71363is not being exercised withremap-debuginfo = truein CIPR #97504 rebased PR #89268 but added
// only-x86_64-unknown-linux-gnu. with that change theissue-71363test is run in theauto (x86_64-gnu, ubuntu-20.04-xl)builder which is configured with the default ofremap-debuginfo = false. (see temporary logs)I couldn't figure where in the source code
remap-debuginfois set for CI builders but for exampleauto (dist-x86_64-linux, ubuntu-20.04-xl)is configured withremap-debuginfo = true(see temporary logs) but that builder does not run thesrc/test/uitests.OTOH,
auto (dist-i586-gnu-i586-i686-musl, ubuntu-20.04-xl)is configured withremap-debuginfo = true(see temporary logs) and does run thesrc/test/uitests. However, it will not runissue-71363(see temp logs) because the test has a// only-x86_64-unknown-linux-gnudirective. Thisdist-i586builder is the one that failed in the original PR #89268 (again, see rust-log-analyzer); that original PR did not have the// only-directive.Conclusions
-Z simulate-remapped-rust-src-baseis not working as intended withremap-debuginfo = true.issue-71363is a hazard because it will fail if theremap-debuginfoconfiguration of the CI builders is tweaked in the futureSuggestions
I would suggest:
issue-71363needs-test. note that the actual issue is already fixed-Z simulate-remapped-rust-src-base(or re-purporse this issue for that)issue-71363once (3) is sorted outcc @JohnTitor (author of PR #97504)