Skip to content

Commit 148dc0e

Browse files
Rollup merge of rust-lang#157429 - Berektassuly:forbid-unreachable-try-test, r=Kivooeo
Add regression test for unreachable_code with try operator Fixes rust-lang#76053 Adds a regression test for `#![forbid(unreachable_code)]` with the `?` operator.
2 parents d1ef71c + 45d00a1 commit 148dc0e

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//@ check-pass
2+
3+
#![forbid(unreachable_code)]
4+
5+
fn result() -> Result<(), ()> {
6+
Ok(())?;
7+
Err(())
8+
}
9+
10+
fn option() -> Option<()> {
11+
Some(())?;
12+
None
13+
}
14+
15+
fn main() {
16+
let _ = result();
17+
let _ = option();
18+
}

0 commit comments

Comments
 (0)