prefer T::IS_ZST over manual check - #155840
Conversation
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
prefer `T::IS_ZST` over manual check
This comment has been minimized.
This comment has been minimized.
0174ef9 to
cefd2f3
Compare
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (b37c1ea): comparison URL. Overall result: no relevant changes - no action neededBenchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up. @rustbot label: -S-waiting-on-perf -perf-regression Instruction countThis perf run didn't have relevant results for this metric. Max RSS (memory usage)Results (primary 1.9%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 3.8%, secondary 2.5%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis perf run didn't have relevant results for this metric. Bootstrap: 488.641s -> 495.724s (1.45%) |
|
There are also some instances of this check in the compiler itself, and some ZST checks that are spelt differently. There's still these instances in the library:
And the compiler:
There's also a bunch in |
|
Portable SIMD is developed in its own repository. If possible, consider making this change to rust-lang/portable-simd instead. cc @calebzulawski, @programmerjake
cc @tgross35 |
|
rustbot has assigned @ShoyuVanilla. Use Why was this reviewer chosen?The reviewer was selected based on:
|
Oh, great that this pings the world :], I assume I just remove the relevant changes here and make separate PRs to those repos? |
|
This changes seems fine for anything already using the feature ( At a minimum please drop the subtree changes, it's better to minimize unstable features where possible so syncs are less painful if things change. |
3a4dff8 to
6eefc1b
Compare
I cut everything except the changes in alloc and core. |
|
This should be fine now that it's limited to the standard library. @bors r+ rollup |
…uwer Rollup of 3 pull requests Successful merges: - rust-lang/rust#156146 (test new solver on CI until stabilization) - rust-lang/rust#155840 (prefer `T::IS_ZST` over manual check) - rust-lang/rust#156723 (Update books)
…rfonthey Stabilize `mem::conjure_zst` Tracking issue: rust-lang#95383 --- Stabilized API: ```rust pub const unsafe fn conjure_zst<T>() -> T; ``` The notable thing about this implementation is that if this function is called at run time (as opposed to in consteval), then the function will panic at run time (as opposed to at compile time) if `T` is not a ZST. If the function panics in consteval, the panic message is a fixed literal string. If the function panics at run time, the panic message includes the `type_name` of `T`. Note that [`type_name`](https://doc.rust-lang.org/nightly/std/any/fn.type_name.html) is currently [unstable in const](rust-lang#63084). --- Implementation history: * rust-lang#95385 (attempted to add the API without an ACP, and then the PR was closed) * rust-lang/libs-team#292 (The ACP. It has a lot of additional context and discussion, including the explanation of why this is needed) * rust-lang#146479 (the actual implementation) * rust-lang#153073 (changes the panic message) * rust-lang#155840 (internal implementation change)
Rollup merge of #161710 - theemathas:stab-conjure-zst, r=clarfonthey Stabilize `mem::conjure_zst` Tracking issue: #95383 --- Stabilized API: ```rust pub const unsafe fn conjure_zst<T>() -> T; ``` The notable thing about this implementation is that if this function is called at run time (as opposed to in consteval), then the function will panic at run time (as opposed to at compile time) if `T` is not a ZST. If the function panics in consteval, the panic message is a fixed literal string. If the function panics at run time, the panic message includes the `type_name` of `T`. Note that [`type_name`](https://doc.rust-lang.org/nightly/std/any/fn.type_name.html) is currently [unstable in const](#63084). --- Implementation history: * #95385 (attempted to add the API without an ACP, and then the PR was closed) * rust-lang/libs-team#292 (The ACP. It has a lot of additional context and discussion, including the explanation of why this is needed) * #146479 (the actual implementation) * #153073 (changes the panic message) * #155840 (internal implementation change)
makes the intent clearer and possible small perf improvement