-
Notifications
You must be signed in to change notification settings - Fork 139
[atomic] Initial commit of Atomic<T>
#2956
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
base: main
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @joshlf, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request lays the groundwork for a generic Highlights
π§ New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with π and π on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
fdb9070 to
250475e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a new Atomic<T> type. While this is a good start, the implementation is highly incomplete and not ready for merging. There are numerous TODO placeholders for documentation, safety justifications, and even core logic, which will cause panics at runtime. The unsafe traits and implementations lack the required safety comments, which is critical for a library focused on safety and a violation of the repository's contribution guidelines. Additionally, there's a large block of commented-out code that should be removed. The provided tests do not compile because the necessary trait implementations are missing. I recommend completing the implementation, adding all necessary documentation and safety justifications, and ensuring the tests pass before this can be considered for merging.
I am having trouble creating individual review comments. Click here to see my feedback.
src/atomic.rs (16-21)
The public unsafe trait HasAtomic is missing documentation. It is critical to provide a detailed explanation of the trait's purpose and, most importantly, its safety contract in a /// # Safety section. This contract should clearly define the invariants that both implementors and callers must uphold to ensure memory safety.
References
- The repository style guide requires that every
unsafetrait has/// # Safetydocumentation explaining its safety contract. (link)
src/atomic.rs (54-83)
The unsafe impl blocks within the impl_atomic_selector! macro are missing their SAFETY comments (lines 56 and 77). Per the repository's guidelines, every unsafe implementation must be justified with a comment explaining why it is sound. Please add detailed // SAFETY: comments for the impl AtomicOps and impl AtomicSelector blocks.
References
- The repository style guide requires that every
unsafeblock has a// SAFETY:comment justifying its soundness. (link)
src/atomic.rs (92-111)
The impl_atomic! macro is #[macro_export]-ed, but its implementation is incomplete, using todo!() for from_atomic and into_atomic. This will cause runtime panics. This functionality must be fully implemented. Additionally, the unsafe impl HasAtomic block is missing its required // SAFETY: comment explaining the soundness of the implementation.
References
- The repository style guide requires that every
unsafeblock has a// SAFETY:comment justifying its soundness. (link)
src/atomic.rs (142-143)
This unsafe block is missing its required // SAFETY: comment. Please add a justification explaining why the call to T::from_atomic(v) is safe in this context. The comment should detail the invariants that make this operation sound.
References
- The repository style guide requires that every
unsafeblock has a// SAFETY:comment justifying its soundness. (link)
src/atomic.rs (34-52)
The doc(hidden) but public unsafe traits AtomicSelector and AtomicOps are missing their safety documentation. Even for hidden items, unsafe APIs must have a clearly documented safety contract.
References
- The repository style guide requires that every
unsafetrait has/// # Safetydocumentation explaining its safety contract. (link)
src/atomic.rs (9)
The module is missing documentation. Please add a module-level doc comment explaining the purpose and usage of the atomic module. Several other public items like Atomic<T> and its methods also have TODO placeholders instead of proper documentation.
src/atomic.rs (154-604)
This large block of commented-out code should be removed. Dead code reduces maintainability and can be confusing for future contributors. If this code is being kept for reference, consider moving it to a separate document or tracking it in an issue.
gherrit-pr-id: Gc89c7a052aa2609ae71d4db8531f55dab2fd4306
250475e to
92107ed
Compare
Atomic<T>Β #2956Latest Update: v4 β Compare vs v3
π Full Patch History
Links show the diff between the row version and the column version.
Stacked PRs enabled by GHerrit.