rust/src/test
bors 6d523ee501 Auto merge of #66507 - ecstatic-morse:const-if-match, r=oli-obk
Enable `if` and `match` in constants behind a feature flag

This PR is an initial implementation of #49146. It introduces a `const_if_match` feature flag and does the following if it is enabled:
- Allows `Downcast` projections, `SwitchInt` terminators and `FakeRead`s for matched places through the MIR const-checker.
- Allows `if` and `match` expressions through the HIR const-checker.
- Stops converting `&&` to `&` and `||` to `|` in `const` and `static` items.

As a result, the following operations are now allowed in a const context behind the feature flag:
- `if` and `match`
- short circuiting logic operators (`&&` and `||`)
- the `assert` and `debug_assert` macros (if the `const_panic` feature flag is also enabled)

However, the following operations remain forbidden:
- `while`, `loop` and `for` (see #52000)
- the `?` operator (calls `From::from` on its error variant)
- the `assert_eq` and `assert_ne` macros, along with their `debug` variants (calls `fmt::Debug`)

This PR is possible now that we use dataflow for const qualification (see #64470 and #66385).

r? @oli-obk
cc @rust-lang/wg-const-eval @eddyb
2019-11-23 01:13:41 +00:00
..
assembly
auxiliary
codegen Introduce MIR optimizations for simplifying x? on Results. 2019-11-21 20:05:16 +01:00
codegen-units Update test output. 2019-10-25 14:52:39 +02:00
compile-fail A Downcast is now reached when const-checking a for loop 2019-11-15 10:33:52 -08:00
debuginfo
incremental Fix broken incremental test 2019-11-21 14:08:33 -08:00
mir-opt Rollup merge of #66587 - matthewjasper:handle-static-as-const, r=oli-obk 2019-11-22 19:57:49 +01:00
pretty Fix a previously forgotten pretty-printing test after a change to the pretty-printing mechanism. 2019-10-28 18:43:59 +01:00
run-fail [const-prop] Handle MIR Rvalue::Aggregates 2019-10-18 06:29:57 -04:00
run-make Upgrade Emscripten targets to use upstream LLVM backend 2019-10-16 17:06:48 -07:00
run-make-fulldeps Rollup merge of #66575 - Mark-Simulacrum:no-uii, r=petrochenkov 2019-11-22 19:57:48 +01:00
run-pass-valgrind
rustdoc Auto merge of #66238 - ehuss:stabilize-rustdoc-edition, r=GuillaumeGomez 2019-11-18 03:06:42 +00:00
rustdoc-js
rustdoc-js-std
rustdoc-ui Surround types with backticks in type errors 2019-11-18 11:03:04 -08:00
rustfix
ui Auto merge of #66507 - ecstatic-morse:const-if-match, r=oli-obk 2019-11-23 01:13:41 +00:00
ui-fulldeps Delete ProcessCfgMod 2019-11-20 14:07:57 -05:00
COMPILER_TESTS.md