Change:
name, virtual_rust_source_base_dir, sess.opts.real_rust_source_base_dir, ); <del> if let Some(virtual_dir) = virtual_rust_source_base_dir { </del> <ins> for virtual_dir in &virtual_rust_source_base_dir { </ins> if let Some(real_dir) = &sess.opts.real_rust_source_base_dir { if let rustc_span::FileName::Real(old_name) = name { if let rustc_span::RealFileName::Remapped { local_path: _, virtual_name } =

Discussion:
alternative title: is not working as expected with Hello! We are running the compiler test with a compiler configured with and after a recent PR merge we observed that the test suite is no longer passing. After looking into the issue I think a (test only?) compiler flag may not be working as intended. Details below and apologies for not using one of the issue templates! worked fine before PR with set in stopped working after was merged. more concretely, the UI test in PR fails. the error message looks like the one that was reported by CI in the original PR . see disabling makes test and the test suite pass: is not working as intended with . AIUI, the goal of is to make it as if there was no component installed but it's not working when the compiler is built with . This can be observed in the above test failure: the location of is reported. It can also be observed on nightly (shown below): only removing the component makes that note disappear. is not being exercised with in CI PR rebased PR but . with that change the test is run in the builder which is configured with the default of . (see ) I couldn't figure where in the source code is set for CI builders but for example is configured with (see ) but that builder does not run the tests. OTOH, is configured with (see ) and does run the tests. However, it will not run (see ) because the test has a directive. This builder is the one that failed in the original PR (again, see ); that original PR did not have the directive. is not working as intended with . of (1), is a hazard because it will fail if the configuration of the CI builders is tweaked in the future I would suggest: / disable the UI test -open issue and label it with . note that the actual issue is already fixed an issue about fixing (or re-purporse this issue for that) -add / re-enable test once (3) is sorted out cc (author of PR )
Thanks for reporting! Totally agree with your suggestions, I'm going to open a PR to disable that UI test later.
Opened , and retitled this issue as the issue is not limited to UI test, I think.
Found the cause of the mismatch between and !

When is passed to the compiler, when loading the standard library's / file paths are remapped on the fly, reproducing the same behavior of . This is correct. The problem is, below in the same file, another piece of code tries to determine the local path of a remapped path if available: That code is not correct, as it only looks at the prefix set by bootstrap when , not at the simulated prefix with the flag. This is the cause of the mismatch in behavior, and that code should be updated to also check for the simulated prefix (as the purpose of that flag is to fully simulate ). This also explains the difference identified depending on whether the component was installed: when it's not installed the second piece of code is skipped, as there is no local path to determine, causing the consistent behavior.
Opened to fix the test, and to fix the behavior of to be consistent.