transpile: Factor out common function for address-of and array-decay #1446
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.
volatile int*Triggers Invalid Pointer Cast in Transpiled Rust #1240.(void*)arrayCast Still Emits Invalid*mut _Despite Fix for Scalar-to-void* Casts (Related to #1077) #1238.This combines handling of the address-of and array-decay cast into a common function.
In the current code, this check for whether the created pointer type has a different pointee than the actual desired pointee type is only applied to array-to-pointer decays but not address-of. I left it that way, but perhaps it's also good to have it for address-of?
c2rust/c2rust-transpile/src/translator/mod.rs
Lines 4837 to 4843 in bbeb6de