Closed
Description
#![feature(inline_const)]
fn main() {
let false = const {
true
} else {
return;
};
}
I believe the intention in let-else is that this code should be considered syntactically invalid, but it compiles successfully today.
If you replace const
with unsafe
, it correctly fails to parse.
error: right curly brace `}` before `else` in a `let...else` statement not allowed
--> src/main.rs:6:5
|
6 | } else {
| ^
|
help: wrap the expression in parentheses
|
4 ~ let false = (unsafe {
5 | true
6 ~ }) else {
|
Metadata
Metadata
Assignees
Labels
Area: The lexing & parsing of Rust source code to an ASTCategory: This is a bug.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Inline constants (aka: const blocks, const expressions, anonymous constants)Issues related to let-else statements (RFC 3137)Relevant to the compiler team, which will review and decide on the PR/issue.This issue requires a nightly compiler in some way.