Code
if let Some(v) = Some(1) {
const { v }
}
Current output
error[E0435]: attempt to use a non-constant value in a constant
--> src/main.rs:3:13
|
3 | const { v }
| ^ non-constant value
|
help: consider using `const` instead of `let`
|
2 - if let Some(v) = Some(1) {
2 + if const v: /* Type */) = Some(1) {
|
For more information about this error, try `rustc --explain E0435`.
Desired output
error[E0435]: attempt to use a non-constant value in a constant
--> src/main.rs:3:13
|
3 | const { v }
| ^ non-constant value
|
For more information about this error, try `rustc --explain E0435`.
Rationale and extra context
No response
Other cases
Rust Version
rustc 1.95.0-nightly (873b4beb0 2026-02-15)
binary: rustc
commit-hash: 873b4beb0cc726493b94c8ef21f68795c04fbbc1
commit-date: 2026-02-15
host: x86_64-unknown-linux-gnu
release: 1.95.0-nightly
LLVM version: 22.1.0
Anything else?
No response
Code
Current output
Desired output
Rationale and extra context
No response
Other cases
Rust Version
Anything else?
No response