-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
slicing with comptime start and end indexes results in pointer-to-array #4752
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
Merged
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
This prevents lazy values from being unnecessarily evaluated.
because it uncovered a result location bug, and I need to get this branch merged before going into a result location rabbit hole. also fix the result type of slicing when the indexes are runtime known and the result should be sentinel terminated.
behavior tests are passing now
std lib tests are passing now
now results in a sentinel-terminated slice.
This was referenced Mar 19, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
breaking
Implementing this issue could cause existing code to no longer compile or have different behavior.
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.
This implements #863. Big checklist before this can be merged.
Unify slices and single-item-pointer-to-array
@ptrCast
addadd .ptr property to single-pointer-to-array which decays it into [*] #4765.ptr
property to single-pointer-to-array which decays it into[*]
peer type resolution for slice and single-pointer-to-array (example:peer type resolution for slice and single-pointer-to-array #4766[]u8
and*const [2:0]u8
should be[]const u8
)peer type resolution for optional slice and single-pointer-to-array (example:peer type resolution for optional slice and single-pointer-to-array #4767lib/std/net.zig:819:60: error: incompatible types: '*[512]u8' and '?[]u8'
)Add Behavioral Tests
@ptrCast
slice to pointerFollow-up Items
var hack: usize = 0; // TODO remove this hack