[layout] Support sized->unsized, sized->sized casts#2950
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 significantly enhances the pointer casting capabilities within the 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
|
There was a problem hiding this comment.
Code Review
This pull request is a significant and well-executed refactoring that adds support for sized-to-sized and sized-to-unsized casts, complementing the existing support for unsized-to-unsized casts. The changes primarily involve src/layout.rs, where the casting logic is generalized using a new CastParamsInner enum and associated functions. A new to_elem_count method has been added to the PointerMetadata trait in src/lib.rs to support this generalization. The implementation appears correct, robust, and handles the increased complexity effectively. The code is of high quality, and I have no specific comments for improvement.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2950 +/- ##
==========================================
- Coverage 92.29% 91.84% -0.46%
==========================================
Files 19 19
Lines 5868 5908 +40
==========================================
+ Hits 5416 5426 +10
- Misses 452 482 +30 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
c3f1d21 to
8f56cbe
Compare
Merge commits are not allowed on this repository
Makes progress on #2721 gherrit-pr-id: G374c587ce49c18d4dd1d7de970df8556ed7834e3
8f56cbe to
9504690
Compare
jswrenn
left a comment
There was a problem hiding this comment.
Let's also try to eventually support unsized to sized casts where the unsized thing has a trailing element size of 0.
Filed #2954 |
Makes progress on #2721
try_transmute_{ref,mut}!#2944transmute_{ref,mut}!#2943Latest Update: v9 — Compare vs v8
📚 Full Patch History
Links show the diff between the row version and the column version.
Stacked PRs enabled by GHerrit.