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

Move mutex_integer to restriction and improve mutex_{integer,atomic} docs #14110

Merged
merged 1 commit into from
Feb 4, 2025

Conversation

taiki-e
Copy link
Member

@taiki-e taiki-e commented Jan 30, 2025

Similar to #10115 (for mutex_atomic), but for mutex_integer.

This also improve docs of mutex_integer/mutex_atomic (extend known problems section to mention condvar issue (#1516) and portability issue).

changelog: Moved [mutex_integer] to restriction

@rustbot
Copy link
Collaborator

rustbot commented Jan 30, 2025

r? @Jarcho

rustbot has assigned @Jarcho.
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 the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Jan 30, 2025
@@ -108,7 +120,7 @@ fn get_atomic_name(ty: Ty<'_>) -> Option<&'static str> {
UintTy::U32 => Some("AtomicU32"),
UintTy::U64 => Some("AtomicU64"),
UintTy::Usize => Some("AtomicUsize"),
// There's no `AtomicU128`.
// `AtomicU128` is unstable and only available on a few platforms: https://github.com/rust-lang/rust/issues/99069
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe this lint could be configurable:

  • You may want to specify a maximum size of integer that would trigger the lint (for example 32 bits) if you want your code to be portable across various architectures you use, with a reasonable default (32 or 64).
  • You may want to check if the projected target type exist on the current target at least, by looking up the corresponding diagnostic item. Note that AtomicI128 and AtomicU128 are also diagnostic items, but you may also want to check for the "integer_atomics" feature before you are going to suggest them.

Copy link
Contributor

@Jarcho Jarcho left a comment

Choose a reason for hiding this comment

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

Thank you.

@Jarcho Jarcho added this pull request to the merge queue Feb 4, 2025
Merged via the queue into rust-lang:master with commit 75e3a2e Feb 4, 2025
11 checks passed
@taiki-e taiki-e deleted the mutex_integer branch February 4, 2025 11:07
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants