about summary refs log tree commit diff
path: root/src/libstd/sys/unix/stack_overflow.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-11-23 01:13:41 +0000
committerbors <bors@rust-lang.org>2019-11-23 01:13:41 +0000
commit6d523ee501a1ae30428d22ce4fc3c1f720e896e6 (patch)
tree94b996d5eab8f40f1b541501df4ddfddd97000ce /src/libstd/sys/unix/stack_overflow.rs
parenta449535bbc7912c4adc1bbf2ab2738d0442f212c (diff)
parentb09bb1569b23eaadcf22d7420f1ba9872c1088f7 (diff)
downloadrust-6d523ee501a1ae30428d22ce4fc3c1f720e896e6.tar.gz
rust-6d523ee501a1ae30428d22ce4fc3c1f720e896e6.zip
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
Diffstat (limited to 'src/libstd/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions