Skip to content

Conversation

@steveklabnik
Copy link
Collaborator

Add pointer type system support:

  • PtrConstTypeId and PtrMutTypeId structs for typed pointers
  • TypeKind::PtrConst and TypeKind::PtrMut variants
  • Type parsing for 'ptr const T' and 'ptr mut T' syntax
  • Type interning with deduplication for pointer types
  • Helper methods: is_ptr(), is_ptr_const(), is_ptr_mut()

Add pointer intrinsic analysis:

  • @ptr_read(ptr) -> T - read value through pointer
  • @ptr_write(ptr, val) - write value through pointer
  • @ptr_offset(ptr, n) -> ptr - pointer arithmetic
  • @ptr_to_int(ptr) -> u64 - convert pointer to integer
  • @int_to_ptr(addr) -> ptr mut T - convert integer to pointer
  • @addr_of(lvalue) -> ptr const T - take address
  • @addr_of_mut(lvalue) -> ptr mut T - take mutable address

All intrinsics require the unchecked_code preview feature.

Update exhaustive pattern matches in all affected files to handle the new pointer type variants.

Update spec tests to verify pointer types are now recognized (Phase 2 was incomplete - pointer types were parsed but not supported in the type system).

🤖 Generated with Claude Code

Add pointer type system support:
- PtrConstTypeId and PtrMutTypeId structs for typed pointers
- TypeKind::PtrConst and TypeKind::PtrMut variants
- Type parsing for 'ptr const T' and 'ptr mut T' syntax
- Type interning with deduplication for pointer types
- Helper methods: is_ptr(), is_ptr_const(), is_ptr_mut()

Add pointer intrinsic analysis:
- @ptr_read(ptr) -> T - read value through pointer
- @ptr_write(ptr, val) - write value through pointer
- @ptr_offset(ptr, n) -> ptr - pointer arithmetic
- @ptr_to_int(ptr) -> u64 - convert pointer to integer
- @int_to_ptr(addr) -> ptr mut T - convert integer to pointer
- @addr_of(lvalue) -> ptr const T - take address
- @addr_of_mut(lvalue) -> ptr mut T - take mutable address

All intrinsics require the unchecked_code preview feature.

Update exhaustive pattern matches in all affected files to handle
the new pointer type variants.

Update spec tests to verify pointer types are now recognized (Phase 2
was incomplete - pointer types were parsed but not supported in the
type system).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@steveklabnik steveklabnik enabled auto-merge January 4, 2026 18:29
@steveklabnik steveklabnik added this pull request to the merge queue Jan 4, 2026
Merged via the queue into rue-language:trunk with commit 437ce60 Jan 4, 2026
4 checks passed
@steveklabnik steveklabnik deleted the steveklabnik/push-tqwszqvsxnyo branch January 4, 2026 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant