diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-04-09 09:32:30 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-09 09:32:30 +0000 |
commit | 85bd4cef64e1be492d1c62eb05d77a6cea1a8d21 (patch) | |
tree | 8bb52fa13b51bfbbd960f3d5ba5836204eb8cb2f /gcc/rust/backend | |
parent | 4937562f7ca354dc80369cc2e049c391838537f1 (diff) | |
parent | 90d5337d97e6193a8728413e2b34fc6e0e998dd8 (diff) | |
download | gcc-85bd4cef64e1be492d1c62eb05d77a6cea1a8d21.zip gcc-85bd4cef64e1be492d1c62eb05d77a6cea1a8d21.tar.gz gcc-85bd4cef64e1be492d1c62eb05d77a6cea1a8d21.tar.bz2 |
Merge #288
288: Fix crash with zero length array r=philberty a=YizhePKU
This PR fixes the crash that results from zero-length arrays, such as `let arr = []`(issue #260). `ArrayExpr` now uses `ArrayElemsValues` to represent an empty array like that, instead of `nullptr`.
However, currently such code still doesn't compile. Four tests were added, two of which report an error:
```Rust
// compilable/array_empty_list.rs
fn main() {
let arr = [];
}
// rust1: error: unable to determine type: please give this a type: 24
```
```Rust
// compilable/array_zero_length_fold.rs
fn main() {
let arr = ["Hello"; 123 - 123];
}
// array_zero_length_fold.rs:2:25: fatal error: failed to fold capacity constant
```
I think these are best treated as separate bugs. We can merge first and fix later, or we can delay this PR. Either is OK.
Co-authored-by: Yizhe <yizhe@pku.edu.cn>
Co-authored-by: YizhePKU <yizhe@pku.edu.cn>
Co-authored-by: YizhePKU <42838469+YizhePKU@users.noreply.github.com>
Diffstat (limited to 'gcc/rust/backend')
0 files changed, 0 insertions, 0 deletions