Skip to content

Lock stable_crate_ids once in create_crate_num#155273

Merged
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
zetanumbers:create_crate_num_lock
Apr 28, 2026
Merged

Lock stable_crate_ids once in create_crate_num#155273
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
zetanumbers:create_crate_num_lock

Conversation

@zetanumbers
Copy link
Copy Markdown
Contributor

This is a small refactor PR removing redundant locks of stable_crate_ids from create_crate_num.

@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 Apr 14, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 14, 2026

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

Why was this reviewer chosen?

The reviewer was selected based on:

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

@bjorn3
Copy link
Copy Markdown
Member

bjorn3 commented Apr 14, 2026

This would take a write lock even when the crate already exists. The old code is racy though.

@zetanumbers
Copy link
Copy Markdown
Contributor Author

This would take a write lock even when the crate already exists. The old code is racy though.

I thought using upgradable lock is too much to optimize the error path.

@jieyouxu
Copy link
Copy Markdown
Member

@rustbot reroll

@rustbot rustbot assigned jdonszelmann and unassigned jieyouxu Apr 14, 2026
@bjorn3
Copy link
Copy Markdown
Member

bjorn3 commented Apr 14, 2026

Doing a check with a read lock first and then taking a write lock and checking again is an option. If that is worth it, is another question.

@zetanumbers
Copy link
Copy Markdown
Contributor Author

Not worth it I think.

@jdonszelmann
Copy link
Copy Markdown
Contributor

nno, I think this is fine like this. @bors r+ rollup

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 28, 2026

📌 Commit 438d886 has been approved by jdonszelmann

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 Apr 28, 2026
jhpratt added a commit to jhpratt/rust that referenced this pull request Apr 28, 2026
… r=jdonszelmann

Lock stable_crate_ids once in create_crate_num

This is a small refactor PR removing redundant locks of `stable_crate_ids` from  `create_crate_num`.
rust-bors Bot pushed a commit that referenced this pull request Apr 28, 2026
Rollup of 5 pull requests

Successful merges:

 - #154325 (Tweak irrefutable let else warning output)
 - #155273 (Lock stable_crate_ids once in create_crate_num)
 - #155692 (disable naked-dead-code-elimination test if no RET mnemonic is available)
 - #155747 (Update documentation for `wasm32-wali-linux-musl` after integrating n…)
 - #155907 (Handle hkl const closures)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Apr 28, 2026
… r=jdonszelmann

Lock stable_crate_ids once in create_crate_num

This is a small refactor PR removing redundant locks of `stable_crate_ids` from  `create_crate_num`.
rust-bors Bot pushed a commit that referenced this pull request Apr 28, 2026
…uwer

Rollup of 12 pull requests

Successful merges:

 - #151994 (switch to v0 mangling by default on stable)
 - #154325 (Tweak irrefutable let else warning output)
 - #155899 (`dlltool`: Set the working directory to workaround `--temp-prefix` bug)
 - #155273 (Lock stable_crate_ids once in create_crate_num)
 - #155361 (Document that CFI diverges from Rust wrt. ABI-compatibility rules)
 - #155692 (disable naked-dead-code-elimination test if no RET mnemonic is available)
 - #155747 (Update documentation for `wasm32-wali-linux-musl` after integrating n…)
 - #155768 (compiletest: Overhaul the code for running an incremental test revision)
 - #155907 (Handle hkl const closures)
 - #155910 (misc stuff from reading borrowck again :))
 - #155913 (Delete the 12 year old fixme)
 - #155920 (remove review queue triagebot mentions)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Apr 28, 2026
… r=jdonszelmann

Lock stable_crate_ids once in create_crate_num

This is a small refactor PR removing redundant locks of `stable_crate_ids` from  `create_crate_num`.
rust-bors Bot pushed a commit that referenced this pull request Apr 28, 2026
…uwer

Rollup of 14 pull requests

Successful merges:

 - #155850 (Only exclude the #155473 change for 1-byte bool-likes)
 - #155923 (Subtree sync for rustc_codegen_cranelift)
 - #151994 (switch to v0 mangling by default on stable)
 - #154325 (Tweak irrefutable let else warning output)
 - #155899 (`dlltool`: Set the working directory to workaround `--temp-prefix` bug)
 - #155273 (Lock stable_crate_ids once in create_crate_num)
 - #155361 (Document that CFI diverges from Rust wrt. ABI-compatibility rules)
 - #155692 (disable naked-dead-code-elimination test if no RET mnemonic is available)
 - #155747 (Update documentation for `wasm32-wali-linux-musl` after integrating n…)
 - #155768 (compiletest: Overhaul the code for running an incremental test revision)
 - #155907 (Handle hkl const closures)
 - #155910 (misc stuff from reading borrowck again :))
 - #155913 (Delete the 12 year old fixme)
 - #155920 (remove review queue triagebot mentions)
rust-bors Bot pushed a commit that referenced this pull request Apr 28, 2026
…uwer

Rollup of 14 pull requests

Successful merges:

 - #155850 (Only exclude the #155473 change for 1-byte bool-likes)
 - #155923 (Subtree sync for rustc_codegen_cranelift)
 - #151994 (switch to v0 mangling by default on stable)
 - #154325 (Tweak irrefutable let else warning output)
 - #155899 (`dlltool`: Set the working directory to workaround `--temp-prefix` bug)
 - #155273 (Lock stable_crate_ids once in create_crate_num)
 - #155361 (Document that CFI diverges from Rust wrt. ABI-compatibility rules)
 - #155692 (disable naked-dead-code-elimination test if no RET mnemonic is available)
 - #155747 (Update documentation for `wasm32-wali-linux-musl` after integrating n…)
 - #155768 (compiletest: Overhaul the code for running an incremental test revision)
 - #155907 (Handle hkl const closures)
 - #155910 (misc stuff from reading borrowck again :))
 - #155913 (Delete the 12 year old fixme)
 - #155920 (remove review queue triagebot mentions)
rust-bors Bot pushed a commit that referenced this pull request Apr 28, 2026
…uwer

Rollup of 15 pull requests

Successful merges:

 - #155923 (Subtree sync for rustc_codegen_cranelift)
 - #155930 (Sync from portable simd 2026 04 28)
 - #155850 (Only exclude the #155473 change for 1-byte bool-likes)
 - #151994 (switch to v0 mangling by default on stable)
 - #154325 (Tweak irrefutable let else warning output)
 - #155273 (Lock stable_crate_ids once in create_crate_num)
 - #155361 (Document that CFI diverges from Rust wrt. ABI-compatibility rules)
 - #155692 (disable naked-dead-code-elimination test if no RET mnemonic is available)
 - #155747 (Update documentation for `wasm32-wali-linux-musl` after integrating n…)
 - #155768 (compiletest: Overhaul the code for running an incremental test revision)
 - #155907 (Handle hkl const closures)
 - #155910 (misc stuff from reading borrowck again :))
 - #155913 (Delete the 12 year old fixme)
 - #155920 (remove review queue triagebot mentions)
 - #155936 (Rename `SharedContext::emit_dyn_lint*` into `emit_lint*`)
rust-bors Bot pushed a commit that referenced this pull request Apr 28, 2026
…uwer

Rollup of 15 pull requests

Successful merges:

 - #155923 (Subtree sync for rustc_codegen_cranelift)
 - #155930 (Sync from portable simd 2026 04 28)
 - #155850 (Only exclude the #155473 change for 1-byte bool-likes)
 - #151994 (switch to v0 mangling by default on stable)
 - #154325 (Tweak irrefutable let else warning output)
 - #155273 (Lock stable_crate_ids once in create_crate_num)
 - #155361 (Document that CFI diverges from Rust wrt. ABI-compatibility rules)
 - #155692 (disable naked-dead-code-elimination test if no RET mnemonic is available)
 - #155747 (Update documentation for `wasm32-wali-linux-musl` after integrating n…)
 - #155768 (compiletest: Overhaul the code for running an incremental test revision)
 - #155907 (Handle hkl const closures)
 - #155910 (misc stuff from reading borrowck again :))
 - #155913 (Delete the 12 year old fixme)
 - #155920 (remove review queue triagebot mentions)
 - #155936 (Rename `SharedContext::emit_dyn_lint*` into `emit_lint*`)
@rust-bors rust-bors Bot merged commit 22967df into rust-lang:main Apr 28, 2026
11 checks passed
@rustbot rustbot added this to the 1.97.0 milestone Apr 28, 2026
rust-timer added a commit that referenced this pull request Apr 28, 2026
Rollup merge of #155273 - zetanumbers:create_crate_num_lock, r=jdonszelmann

Lock stable_crate_ids once in create_crate_num

This is a small refactor PR removing redundant locks of `stable_crate_ids` from  `create_crate_num`.
github-actions Bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Apr 30, 2026
…uwer

Rollup of 15 pull requests

Successful merges:

 - rust-lang/rust#155923 (Subtree sync for rustc_codegen_cranelift)
 - rust-lang/rust#155930 (Sync from portable simd 2026 04 28)
 - rust-lang/rust#155850 (Only exclude the rust-lang/rust#155473 change for 1-byte bool-likes)
 - rust-lang/rust#151994 (switch to v0 mangling by default on stable)
 - rust-lang/rust#154325 (Tweak irrefutable let else warning output)
 - rust-lang/rust#155273 (Lock stable_crate_ids once in create_crate_num)
 - rust-lang/rust#155361 (Document that CFI diverges from Rust wrt. ABI-compatibility rules)
 - rust-lang/rust#155692 (disable naked-dead-code-elimination test if no RET mnemonic is available)
 - rust-lang/rust#155747 (Update documentation for `wasm32-wali-linux-musl` after integrating n…)
 - rust-lang/rust#155768 (compiletest: Overhaul the code for running an incremental test revision)
 - rust-lang/rust#155907 (Handle hkl const closures)
 - rust-lang/rust#155910 (misc stuff from reading borrowck again :))
 - rust-lang/rust#155913 (Delete the 12 year old fixme)
 - rust-lang/rust#155920 (remove review queue triagebot mentions)
 - rust-lang/rust#155936 (Rename `SharedContext::emit_dyn_lint*` into `emit_lint*`)
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.

5 participants