diff options
| author | bors <bors@rust-lang.org> | 2023-05-27 07:02:48 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-05-27 07:02:48 +0000 |
| commit | a525c7ddba5997b132efa46515e0ce90c173f480 (patch) | |
| tree | 17ca62c1eb7822c77ba93af082ea1b00af290f20 /compiler/rustc_mir_transform/src | |
| parent | dbfc95f969802788f6082772c50f7f3d20d5bf88 (diff) | |
| parent | 462a96c9e902e8ec7b2fddfbe9429f27eb0030d0 (diff) | |
| download | rust-a525c7ddba5997b132efa46515e0ce90c173f480.tar.gz rust-a525c7ddba5997b132efa46515e0ce90c173f480.zip | |
Auto merge of #111928 - c410-f3r:dqewdas, r=eholk
[RFC-2011] Expand more expressions
cc #44838
Expands `if`, `let`, `match` and also makes `generic_assert_internals` an allowed feature when using `assert!`. `#![feature(generic_assert)]` is still needed to activate everything.
```rust
#![feature(generic_assert)]
fn fun(a: Option<i32>, b: Option<i32>, c: Option<i32>) {
assert!(
if a.is_some() { 1 } else { 2 } == 3
&& if let Some(elem) = b { elem == 4 } else { false }
&& match c { Some(_) => true, None => false }
);
}
fn main() {
fun(Some(1), None, Some(2));
}
// Assertion failed: assert!(
// if a.is_some() { 1 } else { 2 } == 3
// && if let Some(elem) = b { elem == 4 } else { false }
// && match c { Some(_) => true, None => false }
// );
//
// With captures:
// a = Some(1)
// b = None
// c = Some(2)
```
Diffstat (limited to 'compiler/rustc_mir_transform/src')
0 files changed, 0 insertions, 0 deletions
