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

Ensure is_sized in global layout lemma #1115

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ouuan
Copy link
Contributor

@ouuan ouuan commented May 15, 2024

This could be useful for satisfying the precondition of PointsToRaw::into_typed, saving a layout_for_type_is_valid/size_of.

Now users can write things like global size_of int == 1 to make ghost/unsized types is_sized, but that's another topic. We may need to constraint the types that can use global size_of, but it's not a problem to ensure is_sized here. Anyhow, assert(size_of::<int>() == 1) is already a mistake.

@tjhance tjhance requested a review from utaal May 15, 2024 15:14
This could be useful for satisfying the precondition of
`PointsToRaw::into_typed`, saving a `layout_for_type_is_valid`/`size_of`.

Now users can write things like `global size_of int == 1` to make
ghost/unsized types `is_sized`, but that's another topic. We may need to
constraint the types that can use `global size_of`, but it's not a
problem to ensure `is_sized` here. Anyhow, `assert(size_of::<int>() == 1)`
is already a mistake.
@ouuan
Copy link
Contributor Author

ouuan commented May 20, 2024

Now users can write things like global size_of int == 1 to make ghost/unsized types is_sized, but that's another topic. We may need to constrain the types that can use global size_of, but it's not a problem to ensure is_sized here. Anyhow, assert(size_of::<int>() == 1) is already a mistake.

I just realized that incorrect global size_of will cause errors at compilation instead of verification. This leaves only the problem that global size_of int == 0 works and we can have is_sized::<int>(). Not a big problem IMO 🤔️

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.

None yet

1 participant