disallow slicing many-item pointer with different sentinel (rev. 2) #22372
+53
−3
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 is a rebasing/reopening of the previously closed PR #18033 due to the accepted issue #22345 which addresses the same concerns as #18019 which the original PR was meant to resolve.
The 3 removed lines in the behaviour tests are needed due to the interaction of #22345 with #22344 which pointed out that they should likely not have ever been legal, however behaviour tests run against #22344 would not catch these lines because the way #22344 fixed the issue with incorrect sentinels in the first slicing operation did so by lowering this pattern to a
slice_sentinel
/slice_end
ZIR node pair instead of adding explicit sentinel checks for by-length slices; see #22371. Since these lines in the behaviour test were slicing a many-item pointer, theslice_sentinel
was then allowed by the bug/problem that a solution to #22345 will prevent.Resolves #22345.
Resolves #18019.