Repository navigation
Conversation
|
|
|
Some changes occurred in src/tools/compiletest cc @jieyouxu |
|
Looks like jieyou is busy r? compiler |
|
This feels very sus. How does this handle stable vs beta vs nightly vs in-tree std sources? I feel like there's a reason why ui tests don't get to access std sources, which is to prevent different diagnostics depending on availability of std sources, and which std sources? |
Is it possible to normalize the content of the source code and just let us know that the source code is displayed in stderr? I'm curious what kind of impact different versions (stable/nightly/beta/in-tree) would have, I don't know enough about CI. Any examples of this? |
show-std-sourcefef27bc to
1eb0f64
Compare
|
For further explanation, I moved the comments here. When fixing the problems listed in #142403, we found that the bug could not be reproduced in ui test. After investigation, I found that span suggestion and span note are not realized in the same way, so I submitted this pr to make std visible in ui tests. In daily use, the source of std should be visible, and execution will fall to the else branch, so these will not be displayed. This new test is a bug recorded in #142403, only for verifying this code change, I will fix it in later pr. |
|
r? @estebank |
This comment has been minimized.
This comment has been minimized.
5b01eb6 to
5b0b080
Compare
There was a problem hiding this comment.
I set it as a new zflag, enabled only during UI tests: if the source code isn't available, then print "span".
The results were as expected; the blessed UI test exposed some existing diagnostic bugs in the compiler, printing the contents of external macros(in std library). However, I think this might need to be fixed in a future PR.
@rustbot ready
| show_suggestions_with_unavailable_source: bool = (false, parse_bool, [UNTRACKED], | ||
| "show span-only suggestions when the source code is unavailable"), |
There was a problem hiding this comment.
I added a option show_suggestions_with_unavailable_source.
| help: check for equality instead of pattern matching | ||
| --> $SRC_DIR/alloc/src/macros.rs:LL:COL |
There was a problem hiding this comment.
I'm assuming we end up with a span into the vec![] expansion instead of its callsite.
This comment has been minimized.
This comment has been minimized.
|
Apologies for the delay on reviewing this. r=me after rebase. The code changes look good, every single suggestion being shown has a wrong span (because of macros, as usual). We should fix those suggestions in separate PRs, eventually. |
5b0b080 to
d4d1fbc
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
d4d1fbc to
3940850
Compare
|
@bors r+ |
Suggest only Span without source changes when source code is unavailable UI tests hide std library sources so diagnostics match what users may see when std sources are unavailable. In those cases, suggestions whose spans point into std macros cannot be rendered as source patches. Before this change, if all substitutions for a suggestion were filtered out because the source could not be loaded, the suggestion was dropped entirely. This meant useful help messages could disappear in UI test output, while it will appear in user's terminal. This adds a `-Zshow-suggestions-with-unavailable-source` flag and enables it for UI tests. When the annotate-snippet emitter cannot render a suggestion as a patch, but the original suggestion points to unavailable source, it now emits a span-only help instead: ```text help: consider using `drop` function --> $SRC_DIR/core/src/macros/mod.rs:LL:COL ``` cc rust-lang#139316 (comment)
|
💔 I suspect this PR failed tests as part of a rollup After fixing the problem, consider running a try job for the failed job before re-approving. Link to failure: #164048 (comment) |
|
This pull request was unapproved. This PR was contained in a rollup (#164048), which was unapproved. |
3940850 to
57d9695
Compare
| compiler.arg("-Zwrite-long-types-to-disk=no"); | ||
| // FIXME: use this for other modes too, for perf? | ||
| compiler.arg("-Cstrip=debuginfo"); | ||
| if self.config.suite != TestSuite::UiFullDeps { |
There was a problem hiding this comment.
I walked around the code, find in stage1 and ui-fulldeps it changes test_compiler to stage0
if suite == "ui-fulldeps" && test_compiler.stage == 1
I did a temp fix, supressing the flag in uifulldeps...but this is a bit strange—do you have any good ideas?@jieyouxu
View all comments
UI tests hide std library sources so diagnostics match what users may see when std sources are unavailable.
In those cases, suggestions whose spans point into std macros cannot be rendered as source patches.
Before this change, if all substitutions for a suggestion were filtered out because the source could not be loaded, the suggestion was dropped entirely. This meant useful help messages could disappear in UI test output, while it will appear in user's terminal.
This adds a
-Zshow-suggestions-with-unavailable-sourceflag and enables it for UI tests. When the annotate-snippet emitter cannot render a suggestion as a patch, but the original suggestion points to unavailable source, it now emits a span-only help instead:cc #139316 (comment)