Skip to content

transpile: Refactor and improve address-of handling - #1982

Draft
Rua wants to merge 12 commits into
immunant:masterfrom
Rua:array-decay-refactor
Draft

transpile: Refactor and improve address-of handling#1982
Rua wants to merge 12 commits into
immunant:masterfrom
Rua:array-decay-refactor

Conversation

@Rua

@Rua Rua commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

This PR does a few things that more or less depend on each other:

  • Using ptr::from_ref, which is now available in the currently used nightly. It's still unstable there, but it's stable in Rust 2024 so it shouldn't be much of an issue to use it?
  • When mutable borrows are done in a const context, only do an immutable borrow first if the edition isn't 2024. The feature that allowed mutable borrows in const context was stabilised before the 2024 edition.
  • Changing how convert_address_of_common handles casting after the borrow operation. It now deep-compares the pointee types and casts only if actually needed.
  • Some refactoring and cleanup, including removal of decay_ref. It was a bit of a deadweight anyway since address-of was changed to use raw borrows. Using from_ref makes it completely unnecessary.

@Rua
Rua force-pushed the array-decay-refactor branch 2 times, most recently from 0f13150 to 70bcccb Compare August 24, 2026 08:24
@Rua Rua changed the title transpile: Shortcut derefs and subscripts for array decays too transpile: Refactor address-of handling Aug 24, 2026
@Rua
Rua force-pushed the array-decay-refactor branch 5 times, most recently from 39bc23c to 938ab27 Compare August 25, 2026 14:38
@Rua Rua changed the title transpile: Refactor address-of handling transpile: Refactor and improve address-of handling Aug 25, 2026
@Rua
Rua force-pushed the array-decay-refactor branch 6 times, most recently from 2f12e6b to e850d52 Compare August 26, 2026 10:02
@Rua
Rua force-pushed the array-decay-refactor branch from e850d52 to 01a469e Compare September 2, 2026 07:49
@Rua
Rua marked this pull request as ready for review September 2, 2026 07:49
@Rua
Rua force-pushed the array-decay-refactor branch 3 times, most recently from 0f48954 to 666a7b5 Compare September 2, 2026 16:11
@Rua
Rua force-pushed the array-decay-refactor branch from 666a7b5 to 9fe69bc Compare September 3, 2026 18:21
@Rua
Rua force-pushed the array-decay-refactor branch from 9fe69bc to 69e9791 Compare September 3, 2026 18:28
@Rua
Rua marked this pull request as draft September 3, 2026 18:30
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