Skip to content
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

Document all public items in rustc_incremental #90407

Merged
merged 1 commit into from
Dec 11, 2021

Conversation

pierwill
Copy link
Member

Also:

  • Review and edit current docs
  • Enforce documentation for the module.

@rust-highfive
Copy link
Collaborator

r? @cjgillot

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 29, 2021
compiler/rustc_incremental/src/persist/load.rs Outdated Show resolved Hide resolved
compiler/rustc_incremental/src/persist/load.rs Outdated Show resolved Hide resolved
compiler/rustc_incremental/src/persist/load.rs Outdated Show resolved Hide resolved
compiler/rustc_incremental/src/persist/save.rs Outdated Show resolved Hide resolved
compiler/rustc_incremental/src/persist/save.rs Outdated Show resolved Hide resolved
compiler/rustc_incremental/src/persist/fs.rs Outdated Show resolved Hide resolved
compiler/rustc_incremental/src/persist/fs.rs Outdated Show resolved Hide resolved
compiler/rustc_incremental/src/persist/fs.rs Outdated Show resolved Hide resolved
compiler/rustc_incremental/src/persist/fs.rs Outdated Show resolved Hide resolved
compiler/rustc_incremental/src/persist/fs.rs Outdated Show resolved Hide resolved
@pierwill
Copy link
Member Author

pierwill commented Oct 29, 2021

Thank you, @r00ster91! I forgot the recommend style.

pub fn staging_dep_graph_path(sess: &Session) -> PathBuf {
in_incr_comp_dir_sess(sess, STAGING_DEP_GRAPH_FILENAME)
}
/// Returns the path to the dependency graph directory.
pub fn dep_graph_path_from(incr_comp_session_dir: &Path) -> PathBuf {
in_incr_comp_dir(incr_comp_session_dir, DEP_GRAPH_FILENAME)
}
Copy link
Member

Choose a reason for hiding this comment

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

What is the difference between the return values of these functions? Can you expand on this in the doc comments?

Copy link
Member Author

@pierwill pierwill Oct 29, 2021

Choose a reason for hiding this comment

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

I removed references to "the current session". The signature tells the story, here, it seems.

How do these function docs look to you, @cjgillot?

https://github.com/rust-lang/rust/blob/cac82a28bd7a780b86a581648685f439a76153ee/compiler/rustc_incremental/src/persist/fs.rs#L136-L155

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you expand a bit on what those path represent? I mean:

  • what are stored in all these files?
  • the difference between dep-graph and staging dep-graph?
  • what are work products?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure how to describe the query cache here.

@@ -664,6 +676,7 @@ fn is_old_enough_to_be_collected(timestamp: SystemTime) -> bool {
timestamp < SystemTime::now() - Duration::from_secs(10)
}

/// Runs garbage collection for the current session.
Copy link
Member

Choose a reason for hiding this comment

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

It garbage collects all incremental session directories except the current session, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good question. I'll double check.

Copy link
Member Author

@pierwill pierwill Oct 29, 2021

Choose a reason for hiding this comment

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

The garbage collection logic is complex enough here that I wouldn't feel comfortable discussing its behavior in the public doc comment without input from someone familiar with this code. (Although I suspect you are right!)

@bjorn3 bjorn3 removed their request for review November 1, 2021 14:18
@pierwill pierwill requested a review from bjorn3 November 1, 2021 18:50
pub fn staging_dep_graph_path(sess: &Session) -> PathBuf {
in_incr_comp_dir_sess(sess, STAGING_DEP_GRAPH_FILENAME)
}
/// Returns the path to the dependency graph directory.
pub fn dep_graph_path_from(incr_comp_session_dir: &Path) -> PathBuf {
in_incr_comp_dir(incr_comp_session_dir, DEP_GRAPH_FILENAME)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you expand a bit on what those path represent? I mean:

  • what are stored in all these files?
  • the difference between dep-graph and staging dep-graph?
  • what are work products?

pub fn staging_dep_graph_path(sess: &Session) -> PathBuf {
in_incr_comp_dir_sess(sess, STAGING_DEP_GRAPH_FILENAME)
}
/// Returns the path to the dependency graph for a given session directory.
pub fn dep_graph_path_from(incr_comp_session_dir: &Path) -> PathBuf {
Copy link
Contributor

Choose a reason for hiding this comment

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

This function is only used once, with the current session's directory. Is there a reason to keep it, or should it be replaced by dep_graph_path?

Copy link
Member Author

Choose a reason for hiding this comment

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

If it's inlined, DEP_GRAPH_FILENAME has to be made public. I think it makes sense to have all these in one place, even if the function is only used once.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't mean inlining it. I mean using dep_graph_path instead.

compiler/rustc_incremental/src/persist/load.rs Outdated Show resolved Hide resolved
compiler/rustc_incremental/src/persist/save.rs Outdated Show resolved Hide resolved
@@ -40,6 +43,7 @@ pub fn copy_cgu_workproduct_to_incr_comp_cache_dir(
Some((work_product_id, work_product))
}

/// Removes files for a given work product.
pub fn delete_workproduct_files(sess: &Session, work_product: &WorkProduct) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This function is never used outside the crate.

compiler/rustc_incremental/src/persist/work_product.rs Outdated Show resolved Hide resolved
@apiraino apiraino added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Nov 11, 2021
@bors
Copy link
Contributor

bors commented Nov 12, 2021

☔ The latest upstream changes (presumably #90731) made this pull request unmergeable. Please resolve the merge conflicts.

@bors
Copy link
Contributor

bors commented Nov 18, 2021

☔ The latest upstream changes (presumably #91019) made this pull request unmergeable. Please resolve the merge conflicts.

@cjgillot
Copy link
Contributor

r=me after rebase. Thanks @pierwill !

@cjgillot cjgillot 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-review Status: Awaiting review from the assignee but also interested parties. labels Nov 27, 2021
@pierwill pierwill force-pushed the edit-rustc-incremental-docs branch 2 times, most recently from 3602c51 to fa054cf Compare December 6, 2021 15:47
@pierwill
Copy link
Member Author

pierwill commented Dec 6, 2021

r=me after rebase. Thanks @pierwill !

ping @cjgillot :)

@cjgillot
Copy link
Contributor

cjgillot commented Dec 6, 2021

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Dec 6, 2021

📌 Commit fa054cf has been approved by cjgillot

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 7, 2021
…s, r=cjgillot

Document all public items in `rustc_incremental`

Also:

- Review and edit current docs
- Enforce documentation for the module.
@matthiaskrgr
Copy link
Member

@bors r-
failed in rollup
#91621 (comment)

@bors bors 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 Dec 7, 2021
@pierwill
Copy link
Member Author

pierwill commented Dec 7, 2021

@bors r- failed in rollup #91621 (comment)

Looking at this now.

Also:

- Review and edit current docs
- Enforce documentation for crate

Co-authored-by: r00ster <r00ster91@protonmail.com>
Co-authored-by: Camille Gillot <gillot.camille@gmail.com>
@pierwill
Copy link
Member Author

pierwill commented Dec 7, 2021

This should be ready now. @matthiaskrgr

@pierwill
Copy link
Member Author

pierwill commented Dec 7, 2021

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 7, 2021
@cjgillot
Copy link
Contributor

cjgillot commented Dec 9, 2021

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Dec 9, 2021

📌 Commit 41f7692 has been approved by cjgillot

@bors bors 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 Dec 9, 2021
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 9, 2021
…s, r=cjgillot

Document all public items in `rustc_incremental`

Also:

- Review and edit current docs
- Enforce documentation for the module.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 10, 2021
…s, r=cjgillot

Document all public items in `rustc_incremental`

Also:

- Review and edit current docs
- Enforce documentation for the module.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 10, 2021
…s, r=cjgillot

Document all public items in `rustc_incremental`

Also:

- Review and edit current docs
- Enforce documentation for the module.
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 10, 2021
…askrgr

Rollup of 10 pull requests

Successful merges:

 - rust-lang#90407 (Document all public items in `rustc_incremental`)
 - rust-lang#90897 (Fix incorrect stability attributes)
 - rust-lang#91105 (Fix method name reference in stream documentation)
 - rust-lang#91325 (adjust const_eval_select documentation)
 - rust-lang#91470 (code-cov: generate dead functions with private/default linkage)
 - rust-lang#91482 (Update documentation to use `from()` to initialize `HashMap`s and `BTreeMap`s)
 - rust-lang#91524 (Fix Vec::extend_from_slice docs)
 - rust-lang#91575 (Fix ICE on format string of macro with secondary-label)
 - rust-lang#91625 (Remove redundant [..]s)
 - rust-lang#91646 (Fix documentation for `core::ready::Ready`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 71c1d56 into rust-lang:master Dec 11, 2021
@rustbot rustbot added this to the 1.59.0 milestone Dec 11, 2021
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.

9 participants