rust/src/test
bors eb8f2586eb Auto merge of #44060 - taleks:issue-43205, r=arielb1
Fixes issue #43205: ICE in Rvalue::Len evaluation.

- fixes evaluation of array length for zero-sized type referenced by rvalue operand.
- adds test to verify fix.

*Cause of the issue*.

Zero-sized aggregates are handled as operands, not lvalues. Therefore while visiting `Assign` statement by `LocalAnalyser`, `mark_as_lvalue()` is not called for related `Local`. This behaviour is controlled by `rvalue_creates_operand()` method.

As result it causes error later, when rvalue operand is evaluated in `trans_rvalue_operand()` while handling `Rvalue::Len` case. Array length evaluation invokes `trans_lvalue()` which expects referenced `Local` to be value, not operand.

*How it is fixed*.

In certain cases result of `Rvalue::Len` can be evaluated without calling
`trans_lvalue()`. Method `evaluate_array_len()` is introduced to handle length
evaluation for zero-sized types referenced by Locals.

*Some concerns*.

- `trans_lvalue()` has two other entry points in `rvalue.rs`: it is invoked while handling `Rvalue::Ref` and `Rvalue::Discriminant`. There is a chance those may produce the same issue, but I've failed to write a specific test that leads to this.
- `evaluate_array_len()` performs the same check (matches lvalue and `Local`), which is performed again in `trans_lvalue()`. Without changing `trans_lvalue()` signature to make it aware that caller deals with rvalue, it seems there is no cheap solution to avoid this check.
2017-08-27 12:53:48 +00:00
..
codegen Auto merge of #43488 - Florob:repeat-opt, r=arielb1 2017-08-06 08:09:59 +00:00
codegen-units Adapt cgu-partitioning tests to pre-trans symbol internalization. 2017-07-13 13:29:25 +02:00
compile-fail Address review comments, second turn 2017-08-27 19:02:24 +09:00
compile-fail-fulldeps Move unused-extern-crate to late pass 2017-08-27 19:02:24 +09:00
debuginfo Pretty-printers tests: gdbr -> gdb 2017-06-09 18:51:28 +03:00
incremental Detect implicitly defined late bound lifetime parameters as well 2017-07-18 00:12:48 +03:00
mir-opt Regression test. 2017-08-25 16:35:42 +02:00
parse-fail syntax: Relax path grammar 2017-08-11 02:06:27 +03:00
pretty
run-fail Add tests for issues with the E-needstest label 2017-07-25 12:23:16 +09:00
run-fail-fulldeps Implement a file-path remapping feature in support of debuginfo and reproducible builds. 2017-04-26 15:44:02 +02:00
run-make *: remove crate_{name,type} attributes 2017-08-25 16:18:21 -04:00
run-pass Auto merge of #44060 - taleks:issue-43205, r=arielb1 2017-08-27 12:53:48 +00:00
run-pass-fulldeps Update ignored tests for dynamic musl 2017-08-22 16:24:29 -05:00
run-pass-valgrind Move unsized_tuple_coercion behind a feature gate. 2017-06-29 21:25:35 +09:00
rustdoc Add duplicate test 2017-08-24 11:38:58 +02:00
ui Auto merge of #44098 - frewsxcv:rollup, r=frewsxcv 2017-08-26 15:17:32 +00:00
ui-fulldeps rustc: Rearchitect lints to be emitted more eagerly 2017-08-09 09:13:51 -07:00
COMPILER_TESTS.md Merge ui/README.md into COMPILER_TESTS.md and describe how custom UI normalization works. 2017-07-11 16:57:53 +08:00