rust/library
bors 7abab1efb2 Auto merge of #91838 - scottmcm:array-slice-eq-via-arrays-not-slices, r=dtolnay
Do array-slice equality via array equality, rather than always via slices

~~Draft because it needs a rebase after #91766 eventually gets through bors.~~

This enables the optimizations from #85828 to be used for array-to-slice comparisons too, not just array-to-array.

For example, <https://play.rust-lang.org/?version=nightly&mode=release&edition=2021&gist=5f9ba69b3d5825a782f897c830d3a6aa>
```rust
pub fn demo(x: &[u8], y: [u8; 4]) -> bool {
    *x == y
}
```
Currently writes the array to stack for no reason:
```nasm
	sub	rsp, 4
	mov	dword ptr [rsp], edx
	cmp	rsi, 4
	jne	.LBB0_1
	mov	eax, dword ptr [rdi]
	cmp	eax, dword ptr [rsp]
	sete	al
	add	rsp, 4
	ret

.LBB0_1:
	xor	eax, eax
	add	rsp, 4
	ret
```
Whereas with the change in this PR it just compares it directly:
```nasm
	cmp	rsi, 4
	jne	.LBB1_1
	cmp	dword ptr [rdi], edx
	sete	al
	ret

.LBB1_1:
	xor	eax, eax
	ret
```
2021-12-17 19:17:29 +00:00
..
alloc Auto merge of #91527 - the8472:retain-opt, r=dtolnay 2021-12-16 07:58:36 +00:00
backtrace@b02ed04a7e
core Auto merge of #91838 - scottmcm:array-slice-eq-via-arrays-not-slices, r=dtolnay 2021-12-17 19:17:29 +00:00
panic_abort Stabilize asm! and global_asm! 2021-12-12 11:20:03 +00:00
panic_unwind Fix a bunch of typos 2021-12-14 16:40:43 +01:00
portable-simd
proc_macro made compiler happy 2021-12-14 16:42:16 +05:30
profiler_builtins
rtstartup
rustc-std-workspace-alloc
rustc-std-workspace-core
rustc-std-workspace-std
std Rollup merge of #91947 - ibraheemdev:io-error-other, r=joshtriplett 2021-12-16 17:23:10 +01:00
stdarch@0716b22e90 update stdarch 2021-12-15 10:22:03 +08:00
test
unwind