Make inline const block ExprWithBlock
This commit is contained in:
parent
9c0bc3028a
commit
171b7d62ad
@ -21,6 +21,7 @@ pub fn expr_requires_semi_to_be_stmt(e: &ast::Expr) -> bool {
|
|||||||
| ast::ExprKind::Loop(..)
|
| ast::ExprKind::Loop(..)
|
||||||
| ast::ExprKind::ForLoop(..)
|
| ast::ExprKind::ForLoop(..)
|
||||||
| ast::ExprKind::TryBlock(..)
|
| ast::ExprKind::TryBlock(..)
|
||||||
|
| ast::ExprKind::ConstBlock(..)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
6
src/test/ui/inline-const/expr-with-block-err.rs
Normal file
6
src/test/ui/inline-const/expr-with-block-err.rs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#![feature(inline_const)]
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
const { 2 } - const { 1 };
|
||||||
|
//~^ ERROR mismatched types
|
||||||
|
}
|
9
src/test/ui/inline-const/expr-with-block-err.stderr
Normal file
9
src/test/ui/inline-const/expr-with-block-err.stderr
Normal 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`.
|
10
src/test/ui/inline-const/expr-with-block.rs
Normal file
10
src/test/ui/inline-const/expr-with-block.rs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
// check-pass
|
||||||
|
#![feature(inline_const)]
|
||||||
|
fn main() {
|
||||||
|
match true {
|
||||||
|
true => const {}
|
||||||
|
false => ()
|
||||||
|
}
|
||||||
|
const {}
|
||||||
|
()
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user