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

Mark JsNativeError's constructors const #4020

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

CrazyboyQCD
Copy link
Contributor

@CrazyboyQCD CrazyboyQCD commented Oct 17, 2024

Use constant to reduce binary size.
https://godbolt.org/z/YEq4hW49n

Copy link

codecov bot commented Oct 17, 2024

Codecov Report

Attention: Patch coverage is 61.90476% with 8 lines in your changes missing coverage. Please review.

Project coverage is 52.85%. Comparing base (6ddc2b4) to head (332770f).
Report is 273 commits behind head on main.

Files with missing lines Patch % Lines
core/engine/src/error.rs 61.90% 8 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

Copy link
Member

@jedel1043 jedel1043 left a comment

Choose a reason for hiding this comment

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

Nice improvement!

Comment on lines +714 to +716
// SAFETY: miri safe and works in stable
unsafe { std::mem::transmute("") }
}
Copy link
Member

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.

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