-
Notifications
You must be signed in to change notification settings - Fork 106
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
Consider compiler-erroring instead of panicking in DST APIs #1149
Comments
jswrenn
added a commit
that referenced
this issue
May 1, 2024
Presently, we deny ZSTy DSTs in our APIs via panicking at runtime. However, the ZSTiness of a DST is statically detectable and can be denied instead at compile time. This PR replaces our ZSTy DST panics with compile-time assertions. Doing gives us the freedom later provide meaningful runtime semantics in such cases. Partially addresses #325 Closes #1149
jswrenn
added a commit
that referenced
this issue
May 1, 2024
Presently, we deny ZSTy DSTs in our APIs via panicking at runtime. However, the ZSTiness of a DST is statically detectable and can be denied instead at compile time. This PR replaces our ZSTy DST panics with compile-time assertions. Doing gives us the freedom later provide meaningful runtime semantics in such cases. Partially addresses #325 Closes #1149
jswrenn
added a commit
that referenced
this issue
May 1, 2024
Presently, we deny ZSTy DSTs in our APIs via panicking at runtime. However, the ZSTiness of a DST is statically detectable and can be denied instead at compile time. This PR replaces our ZSTy DST panics with compile-time assertions. Doing gives us the freedom later provide meaningful runtime semantics in such cases. Partially addresses #325 Closes #1149
joshlf
pushed a commit
that referenced
this issue
May 1, 2024
Presently, we deny ZSTy DSTs in our APIs via panicking at runtime. However, the ZSTiness of a DST is statically detectable and can be denied instead at compile time. This PR replaces our ZSTy DST panics with compile-time assertions. Doing gives us the freedom later provide meaningful runtime semantics in such cases. Partially addresses #325 Closes #1149
github-merge-queue bot
pushed a commit
that referenced
this issue
May 1, 2024
Presently, we deny ZSTy DSTs in our APIs via panicking at runtime. However, the ZSTiness of a DST is statically detectable and can be denied instead at compile time. This PR replaces our ZSTy DST panics with compile-time assertions. Doing gives us the freedom later provide meaningful runtime semantics in such cases. Partially addresses #325 Closes #1149
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This issue goes partway towards addressing #325.
For example,
Ref::from_prefix_with_trailing_elements
documents a panic ifSelf
is a ZST. However, the ZST-iness (pronounced "zestiness") of a type relevant here is always a static property and can be reported via postmonomorphization error.The advantages of this are several-fold:
TryFromBytes
validators)Postmonomorphization errors currently have a bit of a 'weirdness' factor (and an unwieldy name), but I suspect that will change. The recent stabilization notes for inline const exprs cite ZST-checking as a motivating case of what the feature will make possible.
The text was updated successfully, but these errors were encountered: