Skip to content

Get underling values of Fields#49

Merged
HKalbasi merged 11 commits intoHKalbasi:mainfrom
nickpdemarco:nickpdemarco/fields
Aug 19, 2025
Merged

Get underling values of Fields#49
HKalbasi merged 11 commits intoHKalbasi:mainfrom
nickpdemarco:nickpdemarco/fields

Conversation

@nickpdemarco
Copy link
Copy Markdown
Contributor

@nickpdemarco nickpdemarco commented Aug 14, 2025

Currently, it does not seem possible to read the underling value of zngur fields in C++. This PR adds support for converting a Field<T> to a T, and adds corresponding docs and tests.

@nickpdemarco
Copy link
Copy Markdown
Contributor Author

@HKalbasi it seems Rust 1.91 has started printing thread IDs on panics, which is breaking our diff-based example testing. Any suggestions on how to proceed? I don't see an obvious way to turn off that panic behavior.

@nickpdemarco
Copy link
Copy Markdown
Contributor Author

Seems we may need #50 before merging this.

Comment thread zngur-generator/src/cpp.rs Outdated
Comment thread book/src/call_rust_from_cpp/special_types.md Outdated
@HKalbasi
Copy link
Copy Markdown
Owner

@HKalbasi it seems Rust 1.91 has started printing thread IDs on panics, which is breaking our diff-based example testing. Any suggestions on how to proceed? I don't see an obvious way to turn off that panic behavior.

Ah, this is rust-lang/rust#115746 . Let's use the stable compiler instead of nightly for now, and hope that they will make an option to disable this behavior before this hits stable. I like to avoid regex if possible, since it will break the ability of auto-fixing the tests.

Comment thread examples/regression_test1/main.cpp Outdated
@nickpdemarco
Copy link
Copy Markdown
Contributor Author

@HKalbasi I'm trying to figure out why clang++ is not finding ld despite binutils being installed by default on our GH runner. Let me know if you've seen this before or have suggestions.

@HKalbasi
Copy link
Copy Markdown
Owner

IIRC examples enable lto with clang and use lld. Might be related.

@nickpdemarco
Copy link
Copy Markdown
Contributor Author

Well, I'm not sure why this PR broke it, but setting CC explicitly and installing lld seemed to do the trick.

Comment thread book/src/call_rust_from_cpp/fields.md Outdated
These wrappers now act as their underlying type `T` in many contexts:

- `Ref<T>` construction from any `Field*<T, OFFSET>`
- Implicit read via `operator T()` and `.read()` for value-like access
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This .read() is leftover.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah, good catch! Thanks.

@HKalbasi HKalbasi requested a review from Copilot August 19, 2025 07:39

This comment was marked as spam.

@HKalbasi HKalbasi merged commit 5d7a87c into HKalbasi:main Aug 19, 2025
3 checks passed
@nickpdemarco nickpdemarco deleted the nickpdemarco/fields branch August 19, 2025 19:51
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.

3 participants