Skip to content

Commit c977b87

Browse files
committedJun 28, 2020
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-obk
2 parents 2f517ce + 8509b69 commit c977b87

File tree

129 files changed

+348
-1757
lines changed

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 changed
 

‎src/doc/unstable-book/src/language-features/const-if-match.md

Lines changed: 0 additions & 14 deletions
This file was deleted.

‎src/liballoc/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
#![feature(const_generic_impls_guard)]
8888
#![feature(const_generics)]
8989
#![feature(const_in_array_repeat_expressions)]
90-
#![feature(const_if_match)]
90+
#![cfg_attr(bootstrap, feature(const_if_match))]
9191
#![feature(cow_is_borrowed)]
9292
#![feature(dispatch_from_dyn)]
9393
#![feature(core_intrinsics)]

0 commit comments

Comments
 (0)
Please sign in to comment.