Skip to content
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

disallow slicing many-item pointer with different sentinel (rev. 2) #22372

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dweiller
Copy link
Contributor

@dweiller dweiller commented Dec 31, 2024

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, the slice_sentinel was then allowed by the bug/problem that a solution to #22345 will prevent.

Resolves #22345.
Resolves #18019.

This change prevents adding or changing the sentinel in the type of a
many-item pointer via the slicing syntax `ptr[a.. :S]`.
@dweiller dweiller changed the title sema: disallow slicing many-item pointer with different sentinel disallow slicing many-item pointer with different sentinel (rev. 2) Dec 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant