Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix initialization in immutable structs in Dart #415

Merged
merged 1 commit into from
Jan 31, 2024

Conversation

Manishearth
Copy link
Contributor

@Manishearth Manishearth commented Jan 30, 2024

This was an oversight from #408: previously when we lazy-loaded structs, converting a struct back to FFI could be a no-op if the struct wasn't mutable.

However in the new eager-converted structs, structs always need to be converted back.

Part of #439

This was an oversight from rust-diplomat#408: previously when we lazy-loaded structs, converting a struct back to FFI could be a no-op if the struct wasn't mutable.

However in the new eager-converted structs, structs always need to be converted back.
Comment on lines +800 to +802
// Note: {dart_name} == null ? 0 : {dart_name}.underlying
// will not work for struct fields since Dart can't guarantee the
// null check will be unchanged between the two accesses.
Copy link
Collaborator

Choose a reason for hiding this comment

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

been in Rust so long that it took me a minute to realise what you mean here :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it is kinda cool that Dart has refinement types here, I like refinement types

but it's annoying when you hit their limitations

@Manishearth Manishearth merged commit 5dfd2c0 into rust-diplomat:main Jan 31, 2024
6 checks passed
@Manishearth Manishearth deleted the dart-immutable-init branch January 31, 2024 16:37
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