rust/library/core
Yuki Okushi b2f6c2aa9b
Rollup merge of #81412 - hyd-dev:array-assume-init-wrong-assertion, r=m-ou-se
Fix assertion in `MaybeUninit::array_assume_init()` for zero-length arrays

That assertion has a false positive ([playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=63922b8c897b04112adcdf346deb1d0e)):
```rust
#![feature(maybe_uninit_array_assume_init)]

use std::mem::MaybeUninit;

enum Uninhabited {}

fn main() {
    unsafe {
        // thread 'main' panicked at 'attempted to instantiate uninhabited type `Uninhabited`'
        MaybeUninit::<Uninhabited>::array_assume_init([]);
    }
}
```
*Previously reported in https://github.com/rust-lang/rust/pull/80600#discussion_r564496692.*

This PR makes it ignore zero-length arrays.

cc #80908
2021-01-27 04:43:37 +09:00
..
benches Add more benchmarks 2021-01-08 09:50:35 +00:00
src Rollup merge of #81412 - hyd-dev:array-assume-init-wrong-assertion, r=m-ou-se 2021-01-27 04:43:37 +09:00
tests Rollup merge of #81412 - hyd-dev:array-assume-init-wrong-assertion, r=m-ou-se 2021-01-27 04:43:37 +09:00
Cargo.toml