Skip to content

handle unsized by-ref values#1644

Open
0xmuon wants to merge 2 commits intorust-lang:mainfrom
0xmuon:fix3
Open

handle unsized by-ref values#1644
0xmuon wants to merge 2 commits intorust-lang:mainfrom
0xmuon:fix3

Conversation

@0xmuon
Copy link
Copy Markdown

@0xmuon 0xmuon commented Apr 14, 2026

added handling for unsized by-ref values (CValueInner::ByRef(_, Some(meta))) in CValue::value_field and removes the remaining todo!() crash paths in src/value_and_place.rs. For write_cvalue from an unsized by-ref into a sized destination, it falls back to copying the sized prefix (destination’s fixed size) to avoid hard failures.

Comment thread src/value_and_place.rs Outdated
@0xmuon
Copy link
Copy Markdown
Author

0xmuon commented Apr 14, 2026

Is “copy sized prefix when writing from ByRef(_, Some(meta)) into a sized place” fallback acceptable or would you prefer we span_bug! there instead to enforce that such writes never happen?

Comment thread src/value_and_place.rs
Copy link
Copy Markdown
Member

@bjorn3 bjorn3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update the PR title and description to match the contents of the PR. Other than that LGTM.

View changes since this review

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.

2 participants