rust/compiler/rustc_session/src
Matthias Krüger 0eec5e3d0c
Rollup merge of #115869 - ferrocene:pa-fix-tests-cargo-remap, r=compiler-errors
Avoid blessing cargo deps's source code in ui tests

Before this PR, the source code of dependencies was included in UI test error messages whenever possible. Unfortunately, "whenever possible" means in some cases the source code wouldn't be injected, resulting in a test failure.

One such case is when `$CARGO_HOME` is remapped to something that is not present on disk [^1]. As the remapped path doesn't exist on disk, the source code wouldn't be showed in `tests/ui/issues/issue-21763.rs`:

```diff
    = note: required for `hashbrown::raw::RawTable<(Rc<()>, Rc<()>)>` to implement `Send`
 note: required because it appears within the type `HashMap<Rc<()>, Rc<()>, RandomState>`
   --> $HASHBROWN_SRC_LOCATION
-   |
-LL | pub struct HashMap<K, V, S = DefaultHashBuilder, A: Allocator + Clone = Global> {
-   |            ^^^^^^^
 note: required because it appears within the type `HashMap<Rc<()>, Rc<()>>`
   --> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL
 note: required by a bound in `foo`
```

This PR fixes the problem by always hiding dependencies source code in the error messages generated during UI tests. This is implemented with a new internal flag, `-Z ignore-directory-in-diagnostics-source-blocks=$path`, which compiletest passes during UI tests. Once this is merged, remapping the Cargo home will be supported.

This PR is best reviewed commit-by-commit.

[^1]: After being puzzled for a bit, I discovered why this never impacted `rust-lang/rust`: we don't remap `$CARGO_HOME` 😅. Instead, we set `$CARGO_HOME` to `/cargo` in CI, which sort-of-but-not-really achieves the same effect.
2023-09-19 01:29:41 +02:00
..
config Change process spawning to inherit the parent's signal mask by default 2022-10-20 14:53:38 -07:00
cgu_reuse_tracker.rs Remove useless borrows and derefs 2022-12-01 17:34:43 +00:00
code_stats.rs fix couple of clippy findings: 2023-07-23 10:50:14 +02:00
config.rs Auto merge of #114750 - Enselic:metadata-dep-info, r=compiler-errors 2023-09-17 11:45:53 +00:00
cstore.rs Use FreezeLock for CStore 2023-09-09 16:02:11 +02:00
errors.rs unknown unstable lint command line 2023-08-22 18:58:39 +08:00
filesearch.rs bump windows crate 0.46 -> 0.48 in workspace 2023-05-09 18:20:13 +03:00
lib.rs Bump cfg(bootstrap) 2023-08-23 20:05:14 -04:00
options.rs implement -Z ignore-directory-in-diagnostics-source-blocks 2023-09-15 16:22:50 +02:00
output.rs Make .rmeta file in dep-info have correct name (lib prefix) 2023-09-03 07:14:12 +02:00
parse.rs unknown unstable lint command line 2023-08-22 18:58:39 +08:00
search_paths.rs Provide more context for rustc +nightly -Zunstable-options on stable 2023-06-27 23:23:33 +08:00
session.rs implement -Z ignore-directory-in-diagnostics-source-blocks 2023-09-15 16:22:50 +02:00
utils.rs Move extra_compiler_flags() to rustc_session 2023-08-24 06:31:11 +02:00