Skip to content

Commit

Permalink
add miri test via const fn
Browse files Browse the repository at this point in the history
  • Loading branch information
dingxiangfei2009 committed Sep 18, 2022
1 parent d510ba3 commit eb36f5e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/test/mir-opt/issue-101867.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(let_else)]
#![cfg_attr(bootstrap, feature(let_else))]

// EMIT_MIR issue_101867.main.mir_map.0.mir
fn main() {
Expand Down
19 changes: 19 additions & 0 deletions src/test/ui/let-else/const-fn.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// run-pass
// issue #101932

#![cfg_attr(bootstrap, feature(let_else))]

const fn foo(a: Option<i32>) -> i32 {
let Some(a) = a else {
return 42
};

a + 1
}

fn main() {
const A: i32 = foo(None);
const B: i32 = foo(Some(1));

println!("{} {}", A, B);
}

0 comments on commit eb36f5e

Please sign in to comment.