I tried this code:
#![feature(try_blocks)]
fn bug_repro() {
None = try {
return; // The semicolon is important!
};
}
#![feature(try_blocks)]
fn bug_repro() {
None = try {
None?;
return;
};
}
I expected to see this happen: The code compiles. This pattern is irrefutable
Instead, this happened: The pattern is marked as refutable and this code doesn't compile
Meta
rustc --version --verbose:
rustc 1.99.0-nightly (12c36e253 2026-08-10)
binary: rustc
commit-hash: 12c36e2539c54397c51d6ea4401defd8768a4f5b
commit-date: 2026-08-10
host: aarch64-apple-darwin
release: 1.99.0-nightly
LLVM version: 23.1.0
I tried this code:
I expected to see this happen: The code compiles. This pattern is irrefutable
Instead, this happened: The pattern is marked as refutable and this code doesn't compile
Meta
rustc --version --verbose: