Skip to content

Commit 778e41d

Browse files
committed
test(integration): add thunk frontier red baseline
1 parent 682df6b commit 778e41d

5 files changed

Lines changed: 71 additions & 0 deletions
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
fn apply<F: FnOnce(u8) -> u8>(f: F, v: u8) -> u8 {
2+
f(v)
3+
}
4+
5+
fn main() {
6+
let _ = repro();
7+
}
8+
9+
fn repro() -> u8 {
10+
let f = |x: u8| x + 1;
11+
apply(f, 41u8)
12+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#[derive(Copy, Clone)]
2+
struct Pubkey([u8; 32]);
3+
4+
fn main() {
5+
let _keep: fn(usize) -> u8 = repro;
6+
}
7+
8+
#[no_mangle]
9+
pub fn repro(n: usize) -> u8 {
10+
let keys = [Pubkey([1; 32]); 11];
11+
let mut it = keys.iter().take(n).copied();
12+
13+
if 1 <= n && n <= 11 {
14+
let first = it.next().unwrap();
15+
first.0[0]
16+
} else {
17+
0
18+
}
19+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
const TAKE_N: usize = 3;
2+
3+
fn main() {
4+
let _keep: fn(&[AccountInfo<'_>; 5], [Pubkey; 11]) -> bool = repro;
5+
}
6+
7+
#[no_mangle]
8+
pub fn repro(accounts: &[AccountInfo<'_>; 5], signers: [Pubkey; 11]) -> bool {
9+
accounts[2..]
10+
.iter()
11+
.map(|signer| *signer.key)
12+
.eq(signers.iter().take(TAKE_N).copied())
13+
}
14+
15+
#[derive(Clone)]
16+
struct AccountInfo<'a> {
17+
key: &'a Pubkey,
18+
}
19+
20+
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
21+
struct Pubkey([u8; 32]);
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
┌─ 1 (root, init)
3+
│ #execTerminator ( terminator ( ... kind: terminatorKindCall ( ... func: operandC
4+
│ span: 0
5+
6+
│ (1691 steps)
7+
└─ 3 (stuck, leaf)
8+
#traverseProjection ( toLocal ( 1 ) , thunk ( rvalueRef ( region ( ... kind: reg
9+
span: 227
10+
11+
12+
┌─ 2 (root, leaf, target, terminal)
13+
│ #EndProgram ~> .K
14+
15+

kmir/src/tests/integration/test_integration.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838
'assume-cheatcode-conflict-fail': ['check_assume_conflict'],
3939
'transmute-bytes': ['bytes_to_u64', 'u64_to_bytes'],
4040
'test_offset_from-fail': ['testing'],
41+
'closure-fnonce-single-arg': ['repro'],
42+
'iter-copied-take-next-thunk-regression': ['repro'],
43+
'iter-map-eq-copied-take-thunk-frontier-fail': ['repro'],
4144
}
4245
PROVE_RS_SHOW_SPECS = [
4346
'local-raw-fail',
@@ -65,6 +68,7 @@
6568
'ref-ptr-cast-elem-offset-fail',
6669
'and_then_closure-fail',
6770
'closure_access_struct-fail',
71+
'iter-map-eq-copied-take-thunk-frontier-fail',
6872
]
6973

7074

0 commit comments

Comments
 (0)