Skip to content

Commit 03747ff

Browse files
committed
test(integration): add thunk frontier red baselines and shows
1 parent 682df6b commit 03747ff

7 files changed

Lines changed: 161 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: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
┌─ 1 (root, init)
3+
│ #execTerminator ( terminator ( ... kind: terminatorKindCall ( ... func: operandC
4+
│ span: 0
5+
6+
│ (126 steps)
7+
├─ 3 (terminal)
8+
│ #EndProgram ~> .K
9+
10+
┊ constraint: true
11+
┊ subst: ...
12+
└─ 2 (leaf, target, terminal)
13+
#EndProgram ~> .K
14+
15+
16+
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
2+
┌─ 1 (root, init)
3+
│ #execTerminator ( terminator ( ... kind: terminatorKindCall ( ... func: operandC
4+
│ span: 0
5+
6+
│ (337 steps)
7+
├─ 3 (split)
8+
│ #selectBlock ( switchTargets ( ... branches: branch ( 0 , basicBlockIdx ( 9 ) )
9+
10+
┃ (branch)
11+
┣━━┓ subst: .Subst
12+
┃ ┃ constraint:
13+
┃ ┃ notBool 1 <=Int ARG_UINT1:Int
14+
┃ │
15+
┃ ├─ 4
16+
┃ │ #selectBlock ( switchTargets ( ... branches: branch ( 0 , basicBlockIdx ( 9 ) )
17+
┃ │
18+
┃ │ (17 steps)
19+
┃ ├─ 6 (terminal)
20+
┃ │ #EndProgram ~> .K
21+
┃ │
22+
┃ ┊ constraint: true
23+
┃ ┊ subst: ...
24+
┃ └─ 2 (leaf, target, terminal)
25+
┃ #EndProgram ~> .K
26+
27+
┗━━┓ subst: .Subst
28+
┃ constraint:
29+
┃ 1 <=Int ARG_UINT1:Int
30+
31+
├─ 5
32+
│ #selectBlock ( switchTargets ( ... branches: branch ( 0 , basicBlockIdx ( 9 ) )
33+
34+
│ (27 steps)
35+
├─ 7 (split)
36+
│ #selectBlock ( switchTargets ( ... branches: branch ( 0 , basicBlockIdx ( 9 ) )
37+
38+
┃ (branch)
39+
┣━━┓ subst: .Subst
40+
┃ ┃ constraint:
41+
┃ ┃ notBool ARG_UINT1:Int <=Int 11
42+
┃ │
43+
┃ ├─ 8
44+
┃ │ #selectBlock ( switchTargets ( ... branches: branch ( 0 , basicBlockIdx ( 9 ) )
45+
┃ │
46+
┃ │ (17 steps)
47+
┃ ├─ 10 (terminal)
48+
┃ │ #EndProgram ~> .K
49+
┃ │
50+
┃ ┊ constraint: true
51+
┃ ┊ subst: ...
52+
┃ └─ 2 (leaf, target, terminal)
53+
┃ #EndProgram ~> .K
54+
55+
┗━━┓ subst: .Subst
56+
┃ constraint:
57+
┃ ARG_UINT1:Int <=Int 11
58+
59+
├─ 9
60+
│ #selectBlock ( switchTargets ( ... branches: branch ( 0 , basicBlockIdx ( 9 ) )
61+
62+
│ (706 steps)
63+
├─ 11 (terminal)
64+
│ #EndProgram ~> .K
65+
66+
┊ constraint: true
67+
┊ subst: ...
68+
└─ 2 (leaf, target, terminal)
69+
#EndProgram ~> .K
70+
71+
72+
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+
│ (867 steps)
7+
└─ 3 (stuck, leaf)
8+
ListItem ( thunk ( #decodeConstant ( constantKindZeroSized , ty ( 88 ) , typeInf
9+
span: 273
10+
11+
12+
┌─ 2 (root, leaf, target, terminal)
13+
│ #EndProgram ~> .K
14+
15+

kmir/src/tests/integration/test_integration.py

Lines changed: 6 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,9 @@
6568
'ref-ptr-cast-elem-offset-fail',
6669
'and_then_closure-fail',
6770
'closure_access_struct-fail',
71+
'closure-fnonce-single-arg',
72+
'iter-copied-take-next-thunk-regression',
73+
'iter-map-eq-copied-take-thunk-frontier-fail',
6874
]
6975

7076

0 commit comments

Comments
 (0)