Skip to content

Clean up the API for opening/checking incremental-compilation files #154410

Merged
rust-bors[bot] merged 2 commits intorust-lang:mainfrom
Zalathar:open-incremental-file
Mar 28, 2026
Merged

Clean up the API for opening/checking incremental-compilation files #154410
rust-bors[bot] merged 2 commits intorust-lang:mainfrom
Zalathar:open-incremental-file

Conversation

@Zalathar
Copy link
Copy Markdown
Member

Returning dedicated structs and enums makes the meaning of each return value more obvious, and provides a more natural home for documentation.

This part of the codebase is fairly crufty, and I doubt anyone feels fully confident about reviewing changes to it, but hopefully these particular cleanups should be fairly straightforward.

I have more changes planned in this area (e.g. cleaning up LoadResult), but I stopped here to make review a bit easier.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 26, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Mar 26, 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 12 candidates

Returning dedicated structs and enums makes the meaning of each return value
more obvious, and provides a more natural home for documentation.

The intermediate `load_data` function was unhelpful, and has been inlined into
the main function.
The standard library has helper methods for converting integers to/from
little-endian bytes, for checked conversion from `usize` to `u8`, and for
treating `&mut T` as `&mut [T; 1]`.
@Zalathar Zalathar force-pushed the open-incremental-file branch from 3a70458 to 505dabc Compare March 27, 2026 02:46
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Mar 27, 2026

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.

Err(err) if err.kind() == io::ErrorKind::NotFound => return Ok(None),
Err(err) => return Err(err),
};
) -> Result<OpenFile, OpenFileError> {
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.

This is a nice cleanup! I appreciate the clear doc comments on OpenFile and OpenFileError.

@wesleywiser
Copy link
Copy Markdown
Member

@bors r+

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Mar 27, 2026

📌 Commit 505dabc 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 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 7b5fe9e into rust-lang:main Mar 28, 2026
11 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 #154410 - Zalathar:open-incremental-file, r=wesleywiser

Clean up the API for opening/checking incremental-compilation files

Returning dedicated structs and enums makes the meaning of each return value more obvious, and provides a more natural home for documentation.

This part of the codebase is fairly crufty, and I doubt anyone feels fully confident about reviewing changes to it, but hopefully these particular cleanups should be fairly straightforward.

I have more changes planned in this area (e.g. cleaning up `LoadResult`), but I stopped here to make review a bit easier.
@Zalathar Zalathar deleted the open-incremental-file branch March 28, 2026 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

3 participants