Make inline const block ExprWithBlock

This commit is contained in:
Gary Guo 2022-12-01 17:54:50 +00:00
parent 9c0bc3028a
commit 171b7d62ad
4 changed files with 26 additions and 0 deletions

View file

@ -21,6 +21,7 @@ pub fn expr_requires_semi_to_be_stmt(e: &ast::Expr) -> bool {
| ast::ExprKind::Loop(..)
| ast::ExprKind::ForLoop(..)
| ast::ExprKind::TryBlock(..)
| ast::ExprKind::ConstBlock(..)
)
}

View file

@ -0,0 +1,6 @@
#![feature(inline_const)]
fn main() {
const { 2 } - const { 1 };
//~^ ERROR mismatched types
}

View file

@ -0,0 +1,9 @@
error[E0308]: mismatched types
--> $DIR/expr-with-block-err.rs:4:13
|
LL | const { 2 } - const { 1 };
| ^ expected `()`, found integer
error: aborting due to previous error
For more information about this error, try `rustc --explain E0308`.

View file

@ -0,0 +1,10 @@
// check-pass
#![feature(inline_const)]
fn main() {
match true {
true => const {}
false => ()
}
const {}
()
}