-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
std.builtin.Type: renames #22496
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
Closed
Closed
std.builtin.Type: renames #22496
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c4a5a98
to
f9de2ce
Compare
The commit 2 after this will explain this diff.
Implementing the changes from the prior commit, to prepare for the following commit. Signed-off-by: mlugg <[email protected]>
For representing struct field default values and array/pointer type sentinel values, we use `*const anyopaque`, since there is no way for `std.builtin.Type.StructField` etc to refer back to its `type` field. However, when introspecting a type, this is quite awkward due to the pointer casts necessary. As such, this commit renames the `sentinel` fields to `sentinel_ptr`, and the `default_value` field to `default_value_ptr`, and introduces helper methods `sentinel()` and `defaultValue()` to load the values. These methods are marked as `inline` because their return value, which is always comptime-known, is very often required at comptime by use sites, so this avoids having to annotate such calls with `comptime`. This is a breaking change, although note that 0.14.0 is already a breaking release for all users of `std.builtin.Type` due to the union fields being renamed.
This matches established naming conventions. Now is an opportune time to make this change, since we're already performing breaking changes to `std.builtin.Type`.
This was done by regex substitution with `sed`. I then manually went over the entire diff and fixed any incorrect changes. This diff also changes a lot of `callconv(.C)` to `callconv(.c)`, since my regex happened to also trigger here. I opted to leave these changes in, since they *are* a correct migration, even if they're not the one I was trying to do!
f9de2ce
to
dfdf03e
Compare
I missed a few things before.
Removing labels to avoid confusion; this is superceded by #22505. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See commit messages. In brief:
std.builtin.Type.Pointer.sentinel
tosentinel_ptr
std.builtin.Type.Array.sentinel
tosentinel_ptr
std.builtin.Type.StructField.default_value
todefault_value_ptr
std.builtin.Type.Pointer.sentinel
std.builtin.Type.Array.sentinel
std.builtin.Type.StructField.defaultValue
std.builtin.Type.Pointer.Size
This is a breaking change. Note that the 0.14.0 release cycle has already had a major breaking change which affects all uses of
std.builtin.Type
: #21225.