Skip to content

Commit 3c4a430

Browse files
authored
Rollup merge of rust-lang#105142 - nbdd0121:inline_const, r=petrochenkov
Make inline const block `ExprWithBlock` Fix rust-lang#104087 (comment) `@rustbot` label: +T-lang +F-inline_const
2 parents 7fe9597 + 171b7d6 commit 3c4a430

File tree

4 files changed

+26
-0
lines changed

4 files changed

+26
-0
lines changed

compiler/rustc_ast/src/util/classify.rs

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ pub fn expr_requires_semi_to_be_stmt(e: &ast::Expr) -> bool {
2121
| ast::ExprKind::Loop(..)
2222
| ast::ExprKind::ForLoop(..)
2323
| ast::ExprKind::TryBlock(..)
24+
| ast::ExprKind::ConstBlock(..)
2425
)
2526
}
2627

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#![feature(inline_const)]
2+
3+
fn main() {
4+
const { 2 } - const { 1 };
5+
//~^ ERROR mismatched types
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0308]: mismatched types
2+
--> $DIR/expr-with-block-err.rs:4:13
3+
|
4+
LL | const { 2 } - const { 1 };
5+
| ^ expected `()`, found integer
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0308`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// check-pass
2+
#![feature(inline_const)]
3+
fn main() {
4+
match true {
5+
true => const {}
6+
false => ()
7+
}
8+
const {}
9+
()
10+
}

0 commit comments

Comments
 (0)