-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Avoid blessing cargo deps's source code in ui tests #115869
Conversation
(rustbot has picked a reviewer for you, use r? to override) |
6428001
to
c230637
Compare
These commits modify the If this was unintentional then you should revert the changes before this PR is merged. |
@bors r+ |
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#115869 (Avoid blessing cargo deps's source code in ui tests) - rust-lang#115873 (Make `TyKind::Adt`'s `Debug` impl be more pretty) - rust-lang#115879 (Migrate diagnostics in `hir_typeck/src/cast.rs`) - rust-lang#115930 (coverage: Fix an unstable-sort inconsistency in coverage spans) - rust-lang#115931 (Move mobile topbar title creation entirely into JS) - rust-lang#115941 (Add myself to .mailmap) - rust-lang#115943 (compiletest: Don't swallow some error messages.) - rust-lang#115949 (Update browser-ui-test version) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#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` :sweat_smile:. Instead, we set `$CARGO_HOME` to `/cargo` in CI, which sort-of-but-not-really achieves the same effect.
Hmm, I'm still seeing this test failure with 1.74.0. I guess it's because I'm using |
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 intests/ui/issues/issue-21763.rs
: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.
Footnotes
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. ↩