Commit c977b87
committed
Auto merge of rust-lang#72437 - ecstatic-morse:stabilize-const-if-match, r=oli-obk
Stabilize `#![feature(const_if_match)]`
Quoting from the [stabilization report](rust-lang#49146 (comment)):
> `if` and `match` expressions as well as the short-circuiting logic operators `&&` and `||` will become legal in all [const contexts](https://doc.rust-lang.org/reference/const_eval.html#const-context). A const context is any of the following:
>
> - The initializer of a `const`, `static`, `static mut` or enum discriminant.
> - The body of a `const fn`.
> - The value of a const generic (nightly only).
> - The length of an array type (`[u8; 3]`) or an array repeat expression (`[0u8; 3]`).
>
> Furthermore, the short-circuiting logic operators will no longer be lowered to their bitwise equivalents (`&` and `|` respectively) in `const` and `static` initializers (see rust-lang#57175). As a result, `let` bindings can be used alongside short-circuiting logic in those initializers.
Resolves rust-lang#49146.
Ideally, we would resolve 🐳 rust-lang#66753 before this lands on stable, so it might be worth pushing this back a release. Also, this means we should get the process started for rust-lang#52000, otherwise people will have no recourse except recursion for iterative `const fn`.
r? @oli-obkFile tree
129 files changed
+348
-1757
lines changed- src
- doc/unstable-book/src/language-features
- liballoc
- libcore
- num
- librustc_ast
- librustc_feature
- librustc_hir
- librustc_index
- librustc_infer
- librustc_middle
- mir
- librustc_mir_build
- build
- hair/cx
- librustc_mir
- transform
- check_consts
- librustc_passes
- librustc_query_system
- librustc_span
- librustc_target
- test
- compile-fail
- ui
- array-slice-vec
- async-await
- borrowck
- closures
- consts
- const-eval
- const_in_pattern
- const_limit
- control-flow
- min_const_fn
- miri_unleashed
- enum-discriminant
- internal
- issues
- or-patterns
- return
- rfc-2497-if-let-chains
- rfc-2632-const-trait-impl
- tools/clippy/tests/ui
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
129 files changed
+348
-1757
lines changedLines changed: 0 additions & 14 deletions
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
| 90 | + | |
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
77 | | - | |
| 76 | + | |
| 77 | + | |
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1578 | 1578 | | |
1579 | 1579 | | |
1580 | 1580 | | |
1581 | | - | |
| 1581 | + | |
1582 | 1582 | | |
1583 | 1583 | | |
1584 | 1584 | | |
| |||
1867 | 1867 | | |
1868 | 1868 | | |
1869 | 1869 | | |
1870 | | - | |
| 1870 | + | |
1871 | 1871 | | |
1872 | 1872 | | |
1873 | 1873 | | |
| |||
2160 | 2160 | | |
2161 | 2161 | | |
2162 | 2162 | | |
2163 | | - | |
| 2163 | + | |
2164 | 2164 | | |
2165 | 2165 | | |
2166 | 2166 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
261 | 261 | | |
262 | 262 | | |
263 | 263 | | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
264 | 268 | | |
265 | 269 | | |
266 | 270 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
518 | 518 | | |
519 | 519 | | |
520 | 520 | | |
521 | | - | |
522 | | - | |
523 | | - | |
524 | 521 | | |
525 | 522 | | |
526 | 523 | | |
| |||
530 | 527 | | |
531 | 528 | | |
532 | 529 | | |
533 | | - | |
534 | | - | |
535 | | - | |
536 | 530 | | |
537 | 531 | | |
538 | 532 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
0 commit comments