Skip to content

Change "error finalizing incremental compilation" text and emit it as a note, not a warning#154110

Merged
rust-bors[bot] merged 4 commits intorust-lang:mainfrom
lambdageek:fix/incr-compile-note
Mar 28, 2026
Merged

Change "error finalizing incremental compilation" text and emit it as a note, not a warning#154110
rust-bors[bot] merged 4 commits intorust-lang:mainfrom
lambdageek:fix/incr-compile-note

Conversation

@lambdageek
Copy link
Copy Markdown
Contributor

As mentioned in #151181 (comment) and #151181 (comment) the current message could be improved:

  1. Right now it displays as "warning: error ..." which is confusing (is it an error or a warning)
  2. It doesn't give the user a clear indication of what the consequences are
  3. The current build is successful. The next build might be slower

The new message is now

note: did not finalize incremental compilation session directory ...
  |
  = help: the next build will not be able to reuse work from this compilation

I started a zulip thread #t-compiler/incremental > Ergonomics of "error finalizing incremental session"

The warning has no error code, so in a `-D warnings` environment, it's
impossible to ignore if it consistently breaks your build.  Change it
to a note so it is still visible, but doesn't break the build
Remove the confusing word "error".  The diagnostic is already prefixed
with a level when it is displayed, so this is redundant and possibly
confusing ("warning: error ...").

Add some help text summarizing the impact of what happened: the next
build won't be able to reuse work from the current run.
@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 19, 2026
@lambdageek lambdageek marked this pull request as ready for review March 19, 2026 19:52
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 19, 2026
@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Mar 19, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Mar 19, 2026

r? @wesleywiser

rustbot has assigned @wesleywiser.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler, incremental
  • compiler, incremental expanded to 69 candidates
  • Random selection from 15 candidates

@Kivooeo
Copy link
Copy Markdown
Member

Kivooeo commented Mar 19, 2026

I like new wording, but I'm wondering if that's possible to add a test for this?

@lambdageek
Copy link
Copy Markdown
Contributor Author

I like new wording, but I'm wondering if that's possible to add a test for this?

Came up with a convoluted way to test this. Make a proc macro that poisons the incremental -working directory in a way that would make the rename operation in finalize_session_directory fail. The proc macro runs when the incremental session directory already exists but before the session is finalized, so it can mess with it.

  • On Unix, change permissions on the parent directory of the -working directory to read-only
  • On Windows, write a file into the -working directory and leak the handle

I'm not sure this a great idea

I'll push it to the PR, though

@rustbot rustbot added the A-run-make Area: port run-make Makefiles to rmake.rs label Mar 20, 2026
…e fail

Use a proc macro to observe the incremental session directory and do
something platform specific so that renaming the '-working' session
directory during finalize_session_directory will fail.  On Unix,
change the permissions on the parent directory to be read-only.  On
Windows, open and leak a file inside the `-working` directory.
@lambdageek lambdageek force-pushed the fix/incr-compile-note branch from 525cb88 to 0cc4946 Compare March 20, 2026 02:37
#[derive(Diagnostic)]
#[diag("error finalizing incremental compilation session directory `{$path}`: {$err}")]
#[diag("did not finalize incremental compilation session directory `{$path}`: {$err}")]
#[help("the next build will not be able to reuse work from this compilation")]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that this focuses the issue directly on the impact the user might care about 👍

@wesleywiser
Copy link
Copy Markdown
Member

@bors r+ rollup

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Mar 26, 2026

📌 Commit 0cc4946 has been approved by wesleywiser

It is now in the queue for this repository.

@rust-bors rust-bors bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 26, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 26, 2026
…r=wesleywiser

Change "error finalizing incremental compilation" text and emit it as a note, not a warning

As mentioned in rust-lang#151181 (comment) and rust-lang#151181 (comment) the current message could be improved:

1. Right now it displays as "warning: error ..." which is confusing (is it an error or a warning)
2. It doesn't give the user a clear indication of what the consequences are
3. The _current_ build is successful. The _next_ build might be slower

The new message is now

```text
note: did not finalize incremental compilation session directory ...
  |
  = help: the next build will not be able to reuse work from this compilation
```

I started a zulip thread [#t-compiler/incremental > Ergonomics of "error finalizing incremental session"](https://rust-lang.zulipchat.com/#narrow/channel/241847-t-compiler.2Fincremental/topic/Ergonomics.20of.20.22error.20finalizing.20incremental.20session.22/with/580191447)
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 26, 2026
…r=wesleywiser

Change "error finalizing incremental compilation" text and emit it as a note, not a warning

As mentioned in rust-lang#151181 (comment) and rust-lang#151181 (comment) the current message could be improved:

1. Right now it displays as "warning: error ..." which is confusing (is it an error or a warning)
2. It doesn't give the user a clear indication of what the consequences are
3. The _current_ build is successful. The _next_ build might be slower

The new message is now

```text
note: did not finalize incremental compilation session directory ...
  |
  = help: the next build will not be able to reuse work from this compilation
```

I started a zulip thread [#t-compiler/incremental > Ergonomics of "error finalizing incremental session"](https://rust-lang.zulipchat.com/#narrow/channel/241847-t-compiler.2Fincremental/topic/Ergonomics.20of.20.22error.20finalizing.20incremental.20session.22/with/580191447)
rust-bors bot pushed a commit that referenced this pull request Mar 27, 2026
Rollup of 7 pull requests

Successful merges:

 - #152457 (Pass -pg to linker when using -Zinstrument-mcount)
 - #154031 (Remove divergence check from check_expr_array)
 - #154418 (move many tests out of `ui/unsafe`)
 - #153662 (Suggest fully qualified path on method name collision)
 - #153675 (simd_add/sub/mul/neg: document overflow behavior)
 - #154110 (Change "error finalizing incremental compilation" text and emit it as a note, not a warning)
 - #154430 (Create GPU target notification group)
@Zalathar
Copy link
Copy Markdown
Member

@bors r-

@rust-bors rust-bors bot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Mar 27, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Mar 27, 2026

This pull request was unapproved.

This PR was contained in a rollup (#154440), which was unapproved.

@lambdageek
Copy link
Copy Markdown
Contributor Author

ok, #154440 (comment) makes sense: we need the proc macro compiled for the host platform, not the target.

  • need to figure out how to do that (or skip the test everywhere except normal unix & windows)
  • need to run some tests for interesting platforms here in the PR before it goes into the queue

The test needs proc-macros to function
@lambdageek
Copy link
Copy Markdown
Contributor Author

@bors try jobs=test-various

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Mar 27, 2026

@lambdageek: 🔑 Insufficient privileges: not in try users

@lambdageek
Copy link
Copy Markdown
Contributor Author

@wesleywiser PTAL (and re-run "test-various"?)

@Kivooeo
Copy link
Copy Markdown
Member

Kivooeo commented Mar 27, 2026

@bors try jobs=test-various

rust-bors bot pushed a commit that referenced this pull request Mar 27, 2026
Change "error finalizing incremental compilation" text and emit it as a note, not a warning


try-job: test-various
@rust-bors

This comment has been minimized.

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Mar 27, 2026

☀️ Try build successful (CI)
Build commit: 2f749ba (2f749bad253f070dba5f0b67caf5911659c402b9, parent: fda6d37bb88ee12fd50fa54d15859f1f91b74f55)

@wesleywiser
Copy link
Copy Markdown
Member

@bors r+

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Mar 27, 2026

📌 Commit 0c05f6c has been approved by wesleywiser

It is now in the queue for this repository.

@rust-bors rust-bors bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 27, 2026
rust-bors bot pushed a commit that referenced this pull request Mar 28, 2026
Rollup of 9 pull requests

Successful merges:

 - #154357 (uefi: extend comment for TcpStream Send impl)
 - #154410 (Clean up the API for opening/checking incremental-compilation files )
 - #154081 (format safety doc of Rc/Arc::from_raw/from_raw_in)
 - #154110 (Change "error finalizing incremental compilation" text and emit it as a note, not a warning)
 - #154196 (Make `Ipv6Addr::multicast_scope()` exhaustive)
 - #154221 (`vec::as_mut_slice()`: use lowercase "isize" in safety comment)
 - #154234 (Use common Timestamp impl in Hermit (attempt 2))
 - #154396 (chore(deps): update rust crate tar to v0.4.45)
 - #154488 (Revert "Unstable book options parser")
rust-bors bot pushed a commit that referenced this pull request Mar 28, 2026
Rollup of 9 pull requests

Successful merges:

 - #154357 (uefi: extend comment for TcpStream Send impl)
 - #154410 (Clean up the API for opening/checking incremental-compilation files )
 - #154081 (format safety doc of Rc/Arc::from_raw/from_raw_in)
 - #154110 (Change "error finalizing incremental compilation" text and emit it as a note, not a warning)
 - #154196 (Make `Ipv6Addr::multicast_scope()` exhaustive)
 - #154221 (`vec::as_mut_slice()`: use lowercase "isize" in safety comment)
 - #154234 (Use common Timestamp impl in Hermit (attempt 2))
 - #154396 (chore(deps): update rust crate tar to v0.4.45)
 - #154488 (Revert "Unstable book options parser")
@rust-bors rust-bors bot merged commit ee64422 into rust-lang:main Mar 28, 2026
12 checks passed
@rustbot rustbot added this to the 1.96.0 milestone Mar 28, 2026
rust-timer added a commit that referenced this pull request Mar 28, 2026
Rollup merge of #154110 - lambdageek:fix/incr-compile-note, r=wesleywiser

Change "error finalizing incremental compilation" text and emit it as a note, not a warning

As mentioned in #151181 (comment) and #151181 (comment) the current message could be improved:

1. Right now it displays as "warning: error ..." which is confusing (is it an error or a warning)
2. It doesn't give the user a clear indication of what the consequences are
3. The _current_ build is successful. The _next_ build might be slower

The new message is now

```text
note: did not finalize incremental compilation session directory ...
  |
  = help: the next build will not be able to reuse work from this compilation
```

I started a zulip thread [#t-compiler/incremental > Ergonomics of "error finalizing incremental session"](https://rust-lang.zulipchat.com/#narrow/channel/241847-t-compiler.2Fincremental/topic/Ergonomics.20of.20.22error.20finalizing.20incremental.20session.22/with/580191447)
@lambdageek lambdageek deleted the fix/incr-compile-note branch March 28, 2026 11:51
@Zalathar
Copy link
Copy Markdown
Member

The newly-added run-make test works very hard to trigger a real rename failure, via a custom proc-macro and some platform-specific code.

But for the sake of testing diagnostics I wonder if it might have been more appropriate to instead add a perma-unstable compiler flag that simply fakes an error in the appropriate place.

@Kivooeo
Copy link
Copy Markdown
Member

Kivooeo commented Mar 29, 2026

By the way, I originally asked for the test to be added just to see this diagnostic in action. However, looking at the test, I can't see any output, such as .stderr. How is this test testing this diagnostic?

@Zalathar
Copy link
Copy Markdown
Member

Looks like there are some hardcoded non-blessable assertions in rmake.rs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-run-make Area: port run-make Makefiles to rmake.rs S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants