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

Document our policy on target architecture soundness #383

Closed
joshlf opened this issue Sep 15, 2023 · 3 comments
Closed

Document our policy on target architecture soundness #383

joshlf opened this issue Sep 15, 2023 · 3 comments

Comments

@joshlf
Copy link
Member

joshlf commented Sep 15, 2023

As described in #61, we pin the soundness of zerocopy and of the code generated by zerocopy-derive only on the Rust reference and standard library documentation. Unfortunately, it turns out that the Rust reference and stdlib docs make guarantees which are not actually upheld on some target architectures. We originally considered attempting to only compile on targets which we could either validate matched the reference or at least which had a promise from Rust that they matched the reference. It turns out that both of those are non-starters.

Instead, this issue tracks:

  • Update our docs to describe that our soundness is based on guarantees provided by the Rust reference and stdlib docs.
  • Warn that some target architectures may not actually uphold these guarantees, and note that zerocopy may not be sound on such targets.
  • Provide a link to this UCG WG issue for context.
@joshlf joshlf added help wanted Extra attention is needed experience-easy This issue is easy, and shouldn't require much experience labels Sep 15, 2023
@jswrenn
Copy link
Collaborator

jswrenn commented Sep 15, 2023

Given zerocopy's ethos of always, definitely being sound, we should perhaps take the even more conservative route of producing a compile_error on all architectures except the ones we know are sound. That way, we won't have a repeat of this issue if rustc later adds support for another unsupportable architecture.

@joshlf
Copy link
Member Author

joshlf commented Sep 15, 2023

Hmm very good point. Want to edit the text/title of this issue to track that broader task? I'm thinking we could change the error message to something that conveys:

  • Zerocopy hasn't been proven sound on this target architecture
  • That isn't cause for alarm - it just means we haven't gotten around to doing it
  • Comment on this issue if you need support a not-yet-supported target

It'd also be good to track potential support by target so we have a place to write the note about SPIR-V so we don't forget and spuriously re-enable support.

Looks like compile_error supports multi-line string literals, but the output is a bit weird - only the first line is colored red, and the rest are black.

@joshlf joshlf changed the title Zerocopy unsound on SPIR-V target? Zerocopy is sound on any target architecture Sep 19, 2023
joshlf added a commit that referenced this issue Sep 19, 2023
TODO: Figure out how to make sure we block the next minor version
release on adding back all of the targets that people actually rely on.

Makes progress on #383
@joshlf joshlf changed the title Zerocopy is sound on any target architecture Document our policy on target architecture soundness Sep 27, 2023
@joshlf joshlf removed help wanted Extra attention is needed experience-easy This issue is easy, and shouldn't require much experience labels Sep 29, 2023
joshlf added a commit that referenced this issue Oct 10, 2023
Document our policies on soundness and MSRV.

Closes #383
joshlf added a commit that referenced this issue Oct 10, 2023
Document our policies on soundness and MSRV.

Closes #383
joshlf added a commit that referenced this issue Oct 10, 2023
Document our policies on soundness and MSRV.

Closes #383
joshlf added a commit that referenced this issue Oct 10, 2023
Document our policies on soundness and MSRV.

Closes #383
github-merge-queue bot pushed a commit that referenced this issue Oct 10, 2023
Document our policies on soundness and MSRV.

Closes #383
samuelselleck pushed a commit to samuelselleck/zerocopy that referenced this issue Oct 13, 2023
Document our policies on soundness and MSRV.

Closes google#383
@joshlf
Copy link
Member Author

joshlf commented Nov 30, 2023

Closed in #485

@joshlf joshlf closed this as completed Nov 30, 2023
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

No branches or pull requests

2 participants