-
-
Notifications
You must be signed in to change notification settings - Fork 400
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
Mark JsNativeError
's constructors const
#4020
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4020 +/- ##
==========================================
+ Coverage 47.24% 52.85% +5.61%
==========================================
Files 476 482 +6
Lines 46892 46723 -169
==========================================
+ Hits 22154 24696 +2542
+ Misses 24738 22027 -2711 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice improvement!
// SAFETY: miri safe and works in stable | ||
unsafe { std::mem::transmute("") } | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this guaranteed though? IIRC, Box<T>
has the same layout as &T
only for T: Sized
, but for unsized types they could always change the pointer metadata layout.
If we don't want to rely on this, we can just use Option<Box<str>>
, which should be const-compatible.
Use constant to reduce binary size.
https://godbolt.org/z/YEq4hW49n