rust/library/core/tests
bors 908fc5b26d Auto merge of #99174 - scottmcm:reoptimize-layout-array, r=joshtriplett
Reoptimize layout array

This way it's one check instead of two, so hopefully (cc #99117) it'll be simpler for rustc perf too 🤞

Quick demonstration:
```rust
pub fn demo(n: usize) -> Option<Layout> {
    Layout::array::<i32>(n).ok()
}
```

Nightly: <https://play.rust-lang.org/?version=nightly&mode=release&edition=2021&gist=e97bf33508aa03f38968101cdeb5322d>
```nasm
	mov	rax, rdi
	mov	ecx, 4
	mul	rcx
	seto	cl
	movabs	rdx, 9223372036854775805
	xor	esi, esi
	cmp	rax, rdx
	setb	sil
	shl	rsi, 2
	xor	edx, edx
	test	cl, cl
	cmove	rdx, rsi
	ret
```

This PR (note no `mul`, in addition to being much shorter):
```nasm
	xor	edx, edx
	lea	rax, [4*rcx]
	shr	rcx, 61
	sete	dl
	shl	rdx, 2
	ret
```

This is built atop `@CAD97` 's #99136; the new changes are cb8aba66ef6a0e17f08a0574e4820653e31b45a0.

I added a bunch more tests for `Layout::from_size_align` and `Layout::array` too.
2022-08-10 23:50:18 +00:00
..
fmt Use implicit capture syntax in format_args 2022-03-10 10:23:40 -05:00
hash libcore tests: avoid int2ptr casts 2022-06-27 13:30:44 -04:00
iter Add note to test about Unfuse 2022-07-18 21:53:35 +02:00
num Rename integer log* methods to ilog* 2022-08-09 10:20:49 -07:00
ops Expand the docs for ops::ControlFlow a bit 2021-02-06 22:36:05 -08:00
alloc.rs Re-optimize Layout::array 2022-07-13 17:07:41 -07:00
any.rs core::any: replace some unstable generic types with impl Trait 2022-07-05 15:06:31 +01:00
array.rs Stabilize core::array::from_fn 2022-05-20 11:04:13 -03:00
ascii.rs Add #[must_use] to expensive computations 2021-10-12 23:27:17 -04:00
asserting.rs [RFC 2011] Library code 2022-05-22 07:18:32 -03:00
atomic.rs Rename AtomicPtr::fetch_{add,sub}{,_bytes} 2022-07-01 06:21:19 -07:00
bool.rs Constify bool::then{,_some} 2021-12-15 00:11:23 +08:00
cell.rs Fix Display for cell::{Ref,RefMut} 2022-05-20 11:16:30 -07:00
char.rs Debug print char 0 as '\0' rather than '\u{0}' 2022-03-27 04:49:10 -07:00
clone.rs Use Box::new() instead of box syntax in core tests 2022-05-29 01:44:11 +02:00
cmp.rs Add test for StructuralEq for std::cmp::Ordering. 2022-03-16 14:01:48 -05:00
const_ptr.rs Revert "Revert tests added by PR 81167." 2021-06-27 12:05:17 +02:00
convert.rs Revert "Auto merge of #89450 - usbalbin:const_try_revert, r=oli-obk" 2021-12-12 12:34:59 +08:00
future.rs add tests 2022-02-02 23:07:02 +09:00
intrinsics.rs Switch bootstrap cfgs 2022-02-25 08:00:52 -05:00
lazy.rs Move/rename lazy::{OnceCell, Lazy} to cell::{OnceCell, LazyCell} 2022-06-16 19:53:59 +04:00
lib.rs Stabilize future_poll_fn 2022-07-16 10:04:14 +09:00
macros.rs Allow leading pipe in matches!() patterns. 2021-07-15 22:05:45 +03:00
manually_drop.rs Test ManuallyDrop::clone_from. 2021-07-05 11:55:45 +00:00
mem.rs Add size assert in transmute_copy 2022-07-03 10:46:20 +01:00
nonzero.rs Make From impls of NonZero integer const. 2021-10-20 12:04:58 +09:00
ops.rs Test not never 2021-11-21 19:10:39 -08:00
option.rs Use Box::new() instead of box syntax in core tests 2022-05-29 01:44:11 +02:00
pattern.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
pin_macro.rs Write {ui,} tests for pin_macro and pin! 2022-02-14 16:56:37 +01:00
pin.rs Make some methods of Pin<&mut T> unstable const 2020-09-18 19:23:50 +02:00
ptr.rs Auto merge of #98866 - nagisa:nagisa/align-offset-wroom, r=Mark-Simulacrum 2022-07-16 23:28:28 +00:00
result.rs Use Box::new() instead of box syntax in core tests 2022-05-29 01:44:11 +02:00
simd.rs Introduce core::simd trait imports in tests 2022-07-20 18:08:20 -07:00
slice.rs Add back Send and Sync impls on ChunksMut iterators 2022-08-01 10:32:45 -04:00
str_lossy.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
str.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
task.rs Move const tests for Poll to library\core 2020-09-04 01:04:34 +02:00
time.rs Make Duration's Debug format pad to width 2021-09-16 03:09:31 +02:00
tuple.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
unicode.rs revert changes to unicode stability 2022-07-08 21:18:15 +00:00
waker.rs libcore tests: avoid int2ptr casts 2022-06-27 13:30:44 -04:00