Skip to content

Commit 007eb57

Browse files
committed
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) ```
2 parents b8d5a3a + 6a4da97 commit 007eb57

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

core/src/macros/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1427,7 +1427,7 @@ pub(crate) mod builtin {
14271427
#[rustc_builtin_macro]
14281428
#[macro_export]
14291429
#[rustc_diagnostic_item = "assert_macro"]
1430-
#[allow_internal_unstable(core_panic, edition_panic)]
1430+
#[allow_internal_unstable(core_panic, edition_panic, generic_assert_internals)]
14311431
macro_rules! assert {
14321432
($cond:expr $(,)?) => {{ /* compiler built-in */ }};
14331433
($cond:expr, $($arg:tt)+) => {{ /* compiler built-in */ }};

0 commit comments

Comments
 (0)