Skip to content

Drive-by refactor: use OnceCell for the reverse region SCC graph #141823

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

Merged
merged 1 commit into from
Jun 1, 2025

Conversation

amandasystems
Copy link
Contributor

During region inference, the reverse SCC region graph is sometimes computed lazily. This changes the implementation for that from using an Option to a OnceCell which clearly communicates the intention and simplifies the code somewhat.

There shouldn't be any performance impact, except that this pulls the computation of the reverse SCC graph slightly later than before, and so may avoid computing it in some instances.

Note that this changes a mutable reference into an immutable (interior mutable) one.

@rustbot
Copy link
Collaborator

rustbot commented May 31, 2025

r? @jieyouxu

rustbot has assigned @jieyouxu.
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

@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 May 31, 2025
Copy link
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

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

Thanks, r=me once PR CI is green.

@amandasystems
Copy link
Contributor Author

@bors r=jieyouxu

@bors
Copy link
Collaborator

bors commented Jun 1, 2025

@amandasystems: 🔑 Insufficient privileges: Not in reviewers

@jieyouxu
Copy link
Member

jieyouxu commented Jun 1, 2025

D'oh
@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Jun 1, 2025

📌 Commit 95115b9 has been approved by jieyouxu

It is now in the queue for this repository.

@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 Jun 1, 2025
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Jun 1, 2025
…ce_cell, r=jieyouxu

Drive-by refactor: use `OnceCell` for the reverse region SCC graph

During region inference, the reverse SCC region graph is sometimes computed lazily. This changes the implementation for that from using an `Option` to a `OnceCell` which clearly communicates the intention and simplifies the code somewhat.

There shouldn't be any performance impact, except that this pulls the computation of the reverse SCC graph slightly later than before, and so may avoid computing it in some instances.

Note that this changes a mutable reference into an immutable (interior mutable) one.
bors added a commit that referenced this pull request Jun 1, 2025
Rollup of 9 pull requests

Successful merges:

 - #140370 (Improve diagnostics for usage of qualified paths within tuple struct exprs/pats)
 - #141224 (terminology: allocated object → allocation)
 - #141622 (implement `va_arg` for `powerpc`)
 - #141666 (source_span_for_markdown_range: fix utf8 violation)
 - #141789 (Exclude `CARGO_HOME` from `generate-copyright` in-tree determination)
 - #141823 (Drive-by refactor: use `OnceCell` for the reverse region SCC graph)
 - #141834 (Add unimplemented `current_dll_path()` for WASI)
 - #141846 (Fix TLS model on bootstrap for cygwin)
 - #141852 (resolve if-let-chain FIXME on bootstrap)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit b0b98a0 into rust-lang:master Jun 1, 2025
9 checks passed
@rustbot rustbot added this to the 1.89.0 milestone Jun 1, 2025
rust-timer added a commit that referenced this pull request Jun 1, 2025
Rollup merge of #141823 - amandasystems:reverse_scc_graph_once_cell, r=jieyouxu

Drive-by refactor: use `OnceCell` for the reverse region SCC graph

During region inference, the reverse SCC region graph is sometimes computed lazily. This changes the implementation for that from using an `Option` to a `OnceCell` which clearly communicates the intention and simplifies the code somewhat.

There shouldn't be any performance impact, except that this pulls the computation of the reverse SCC graph slightly later than before, and so may avoid computing it in some instances.

Note that this changes a mutable reference into an immutable (interior mutable) one.
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Jun 3, 2025
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#140370 (Improve diagnostics for usage of qualified paths within tuple struct exprs/pats)
 - rust-lang/rust#141224 (terminology: allocated object → allocation)
 - rust-lang/rust#141622 (implement `va_arg` for `powerpc`)
 - rust-lang/rust#141666 (source_span_for_markdown_range: fix utf8 violation)
 - rust-lang/rust#141789 (Exclude `CARGO_HOME` from `generate-copyright` in-tree determination)
 - rust-lang/rust#141823 (Drive-by refactor: use `OnceCell` for the reverse region SCC graph)
 - rust-lang/rust#141834 (Add unimplemented `current_dll_path()` for WASI)
 - rust-lang/rust#141846 (Fix TLS model on bootstrap for cygwin)
 - rust-lang/rust#141852 (resolve if-let-chain FIXME on bootstrap)

r? `@ghost`
`@rustbot` modify labels: rollup
github-actions bot pushed a commit to model-checking/verify-rust-std that referenced this pull request Jun 3, 2025
…llaumeGomez

Rollup of 9 pull requests

Successful merges:

 - rust-lang#140370 (Improve diagnostics for usage of qualified paths within tuple struct exprs/pats)
 - rust-lang#141224 (terminology: allocated object → allocation)
 - rust-lang#141622 (implement `va_arg` for `powerpc`)
 - rust-lang#141666 (source_span_for_markdown_range: fix utf8 violation)
 - rust-lang#141789 (Exclude `CARGO_HOME` from `generate-copyright` in-tree determination)
 - rust-lang#141823 (Drive-by refactor: use `OnceCell` for the reverse region SCC graph)
 - rust-lang#141834 (Add unimplemented `current_dll_path()` for WASI)
 - rust-lang#141846 (Fix TLS model on bootstrap for cygwin)
 - rust-lang#141852 (resolve if-let-chain FIXME on bootstrap)

r? `@ghost`
`@rustbot` modify labels: rollup
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.

4 participants