Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upReduce scope of generic code in script #26790
Conversation
highfive
commented
Jun 4, 2020
|
Heads up! This PR modifies the following files:
|
highfive
commented
Jun 4, 2020
|
r? @SimonSapin |
|
Nice! What does the impact on |
| /// Creates a new TrustedReference from a pointer to a value that impements DOMObject. | ||
| /// This is not enforced by the type system to reduce duplicated generic code, | ||
| /// which is acceptable since this method is internal to this module. | ||
| unsafe fn new(ptr: *const libc::c_void) -> TrustedReference { | ||
| TrustedReference(ptr as *const libc::c_void) |
This comment has been minimized.
This comment has been minimized.
| #[cfg(debug_assertions)] | ||
| pub(crate) fn assert_in_script() { | ||
| debug_assert!(thread_state::get().is_script()); | ||
| } | ||
|
|
||
| #[cfg(debug_assertions)] | ||
| pub(crate) fn assert_in_layout() { | ||
| debug_assert!(thread_state::get().is_layout()); | ||
| } | ||
|
|
||
| #[cfg(not(debug_assertions))] | ||
| pub(crate) fn assert_in_layout() {} | ||
|
|
||
| #[cfg(not(debug_assertions))] | ||
| fn assert_in_script() {} |
This comment has been minimized.
This comment has been minimized.
SimonSapin
Jun 4, 2020
Member
Those #[cfg] attributes and separate function definitions look redundant. The expansion of debug_assert! (instead of assert!) is if false { … } when debug_assertions is not enabled, which is easy for the optimizer to eliminate.
|
llvm-lines output diff:
|
|
@bors-servo r+ |
|
|
Reduce scope of generic code in script Combined, these changes account for almost 100k lines of generated code in a debug build for the script crate. --- - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] There are tests for these changes
|
|
Bumps [unicode-normalization](https://github.com/unicode-rs/unicode-normalization) from 0.1.5 to 0.1.12. - [Release notes](https://github.com/unicode-rs/unicode-normalization/releases) - [Commits](unicode-rs/unicode-normalization@v0.1.5...v0.1.12) Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
…ode duplication.
|
@bors-servo r=SimonSapin |
|
|
|
|
jdm commentedJun 4, 2020
Combined, these changes account for almost 100k lines of generated code in a debug build for the script crate.
./mach build -ddoes not report any errors./mach test-tidydoes not report any errors