Skip to content

Lock stable_crate_ids once in create_crate_num#155273

Open
zetanumbers wants to merge 1 commit intorust-lang:mainfrom
zetanumbers:create_crate_num_lock
Open

Lock stable_crate_ids once in create_crate_num#155273
zetanumbers wants to merge 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.

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

Labels

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants