Skip to content

Commit 91ddf78

Browse files
committed
Fix rustc coverage tests.
1 parent 6616a8c commit 91ddf78

15 files changed

+233
-51
lines changed

rustc-coverage-tests/run-coverage-tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def write_summary(results, stability):
135135

136136
def run_tests(config, target, include_negative, check_stability, update_snapshots):
137137
results = []
138-
all_targets = ["coq", "fstar", "fstar-lax", "lean", "lean-tc" "json"]
138+
all_targets = ["coq", "fstar", "fstar-lax", "lean", "lean-tc", "json"]
139139

140140
applicable_targets = [target] if target != "all" else all_targets
141141

rustc-coverage-tests/snapshots/fstar/Coverage.Color.fst

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,17 @@ open Core
44
open FStar.Mul
55

66
let main (_: Prims.unit) : (Prims.unit & Prims.unit) =
7-
Rust_primitives.Hax.failure "something is not implemented yet.This is discussed in issue https://github.com/hacspec/hax/issues/405.\nPlease upvote or comment this issue if you see this error message.\nLoop without mutation\n\nThis is discussed in issue https://github.com/hacspec/hax/issues/405.\nPlease upvote or comment this issue if you see this error message.\nNote: the error was labeled with context `FunctionalizeLoops`.\n"
8-
"{\n for _i in (core::iter::traits::collect::f_into_iter(core::ops::range::Range {\n f_start: 0,\n f_end: 0,\n })) {\n Tuple0\n }\n }"
9-
,
7+
Rust_primitives.Hax.Folds.fold_range (mk_i32 0)
8+
(mk_i32 0)
9+
(fun temp_0_ temp_1_ ->
10+
let _:Prims.unit = temp_0_ in
11+
let _:i32 = temp_1_ in
12+
true)
13+
()
14+
(fun temp_0_ e_i ->
15+
let _:Prims.unit = temp_0_ in
16+
let e_i:i32 = e_i in
17+
()),
1018
()
1119
<:
1220
(Prims.unit & Prims.unit)

rustc-coverage-tests/snapshots/fstar/Coverage.If_not.fst

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,29 @@ let if_not (cond: bool) : Prims.unit =
5858

5959
let main (_: Prims.unit) : (Prims.unit & Prims.unit) =
6060
let _:Prims.unit =
61-
Rust_primitives.Hax.failure "something is not implemented yet.This is discussed in issue https://github.com/hacspec/hax/issues/405.\nPlease upvote or comment this issue if you see this error message.\nLoop without mutation\n\nThis is discussed in issue https://github.com/hacspec/hax/issues/405.\nPlease upvote or comment this issue if you see this error message.\nNote: the error was labeled with context `FunctionalizeLoops`.\n"
62-
"{\n for _ in (core::iter::traits::collect::f_into_iter(core::ops::range::Range {\n f_start: 0,\n f_end: 8,\n })) {\n coverage::if_not::if_not(core::hint::black_box::<bool>(true))\n }\n }"
63-
61+
Rust_primitives.Hax.Folds.fold_range (mk_i32 0)
62+
(mk_i32 8)
63+
(fun temp_0_ temp_1_ ->
64+
let _:Prims.unit = temp_0_ in
65+
let _:i32 = temp_1_ in
66+
true)
67+
()
68+
(fun temp_0_ temp_1_ ->
69+
let _:Prims.unit = temp_0_ in
70+
let _:i32 = temp_1_ in
71+
if_not (Core.Hint.black_box #bool true <: bool) <: Prims.unit)
6472
in
65-
Rust_primitives.Hax.failure "something is not implemented yet.This is discussed in issue https://github.com/hacspec/hax/issues/405.\nPlease upvote or comment this issue if you see this error message.\nLoop without mutation\n\nThis is discussed in issue https://github.com/hacspec/hax/issues/405.\nPlease upvote or comment this issue if you see this error message.\nNote: the error was labeled with context `FunctionalizeLoops`.\n"
66-
"{\n for _ in (core::iter::traits::collect::f_into_iter(core::ops::range::Range {\n f_start: 0,\n f_end: 4,\n })) {\n coverage::if_not::if_not(core::hint::black_box::<bool>(false))\n }\n }"
67-
,
73+
Rust_primitives.Hax.Folds.fold_range (mk_i32 0)
74+
(mk_i32 4)
75+
(fun temp_0_ temp_1_ ->
76+
let _:Prims.unit = temp_0_ in
77+
let _:i32 = temp_1_ in
78+
true)
79+
()
80+
(fun temp_0_ temp_1_ ->
81+
let _:Prims.unit = temp_0_ in
82+
let _:i32 = temp_1_ in
83+
if_not (Core.Hint.black_box #bool false <: bool) <: Prims.unit),
6884
()
6985
<:
7086
(Prims.unit & Prims.unit)

rustc-coverage-tests/snapshots/fstar/Coverage.Inline.fst

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,31 @@ let display
2424
(xs: t_Slice v_T)
2525
: Prims.unit =
2626
let _:Prims.unit =
27-
Rust_primitives.Hax.failure "something is not implemented yet.This is discussed in issue https://github.com/hacspec/hax/issues/405.\nPlease upvote or comment this issue if you see this error message.\nLoop without mutation\n\nThis is discussed in issue https://github.com/hacspec/hax/issues/405.\nPlease upvote or comment this issue if you see this error message.\nNote: the error was labeled with context `FunctionalizeLoops`.\n"
28-
"{\n for x in (core::iter::traits::collect::f_into_iter(xs)) {\n {\n let args: [core::fmt::rt::t_Argument; 1] = {\n [core::fmt::rt::impl__new_display::<T>(x)]\n };\n {\n let _: tuple0 = {\n std::io::stdio::e_p..."
29-
27+
Core.Iter.Traits.Iterator.f_fold (Core.Iter.Traits.Collect.f_into_iter #(t_Slice v_T)
28+
#FStar.Tactics.Typeclasses.solve
29+
xs
30+
<:
31+
Core.Slice.Iter.t_Iter v_T)
32+
()
33+
(fun temp_0_ x ->
34+
let _:Prims.unit = temp_0_ in
35+
let x:v_T = x in
36+
let args:t_Array Core.Fmt.Rt.t_Argument (mk_usize 1) =
37+
let list = [Core.Fmt.Rt.impl__new_display #v_T x] in
38+
FStar.Pervasives.assert_norm (Prims.eq2 (List.Tot.length list) 1);
39+
Rust_primitives.Hax.array_of_list 1 list
40+
in
41+
let _:Prims.unit =
42+
Std.Io.Stdio.e_print (Core.Fmt.Rt.impl_1__new_v1 (mk_usize 1)
43+
(mk_usize 1)
44+
(let list = [""] in
45+
FStar.Pervasives.assert_norm (Prims.eq2 (List.Tot.length list) 1);
46+
Rust_primitives.Hax.array_of_list 1 list)
47+
args
48+
<:
49+
Core.Fmt.t_Arguments)
50+
in
51+
())
3052
in
3153
let _:Prims.unit =
3254
Std.Io.Stdio.e_print (Core.Fmt.Rt.impl_1__new_const (mk_usize 1)

rustc-coverage-tests/snapshots/fstar/Coverage.Let_else_loop.fst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ let loopy (cond: bool) : Prims.unit =
77
match cond <: bool with
88
| true -> ()
99
| _ ->
10-
Rust_primitives.Hax.failure "something is not implemented yet.This is discussed in issue https://github.com/hacspec/hax/issues/405.\nPlease upvote or comment this issue if you see this error message.\nLoop without mutation\n\nThis is discussed in issue https://github.com/hacspec/hax/issues/405.\nPlease upvote or comment this issue if you see this error message.\nNote: the error was labeled with context `FunctionalizeLoops`.\n"
10+
Rust_primitives.Hax.failure "something is not implemented yet.\nUnhandled loop kind\n\nThis is discussed in issue https://github.com/hacspec/hax/issues/933.\nPlease upvote or comment this issue if you see this error message.\nNote: the error was labeled with context `FunctionalizeLoops`.\n"
1111
"{\n loop {\n Tuple0\n }\n }",
1212
()
1313
<:
@@ -16,15 +16,15 @@ let loopy (cond: bool) : Prims.unit =
1616
let e_loop_either_way (cond: bool) : Prims.unit =
1717
match cond <: bool with
1818
| true ->
19-
Rust_primitives.Hax.never_to_any ((Rust_primitives.Hax.failure "something is not implemented yet.This is discussed in issue https://github.com/hacspec/hax/issues/405.\nPlease upvote or comment this issue if you see this error message.\nLoop without mutation\n\nThis is discussed in issue https://github.com/hacspec/hax/issues/405.\nPlease upvote or comment this issue if you see this error message.\nNote: the error was labeled with context `FunctionalizeLoops`.\n"
19+
Rust_primitives.Hax.never_to_any ((Rust_primitives.Hax.failure "something is not implemented yet.\nUnhandled loop kind\n\nThis is discussed in issue https://github.com/hacspec/hax/issues/933.\nPlease upvote or comment this issue if you see this error message.\nNote: the error was labeled with context `FunctionalizeLoops`.\n"
2020
"{\n loop {\n Tuple0\n }\n }"
2121
<:
2222
Prims.unit),
2323
()
2424
<:
2525
(Prims.unit & Prims.unit))
2626
| _ ->
27-
Rust_primitives.Hax.failure "something is not implemented yet.This is discussed in issue https://github.com/hacspec/hax/issues/405.\nPlease upvote or comment this issue if you see this error message.\nLoop without mutation\n\nThis is discussed in issue https://github.com/hacspec/hax/issues/405.\nPlease upvote or comment this issue if you see this error message.\nNote: the error was labeled with context `FunctionalizeLoops`.\n"
27+
Rust_primitives.Hax.failure "something is not implemented yet.\nUnhandled loop kind\n\nThis is discussed in issue https://github.com/hacspec/hax/issues/933.\nPlease upvote or comment this issue if you see this error message.\nNote: the error was labeled with context `FunctionalizeLoops`.\n"
2828
"{\n loop {\n Tuple0\n }\n }",
2929
()
3030
<:
@@ -33,15 +33,15 @@ let e_loop_either_way (cond: bool) : Prims.unit =
3333
let e_if (cond: bool) : Prims.unit =
3434
if cond
3535
then
36-
Rust_primitives.Hax.never_to_any ((Rust_primitives.Hax.failure "something is not implemented yet.This is discussed in issue https://github.com/hacspec/hax/issues/405.\nPlease upvote or comment this issue if you see this error message.\nLoop without mutation\n\nThis is discussed in issue https://github.com/hacspec/hax/issues/405.\nPlease upvote or comment this issue if you see this error message.\nNote: the error was labeled with context `FunctionalizeLoops`.\n"
36+
Rust_primitives.Hax.never_to_any ((Rust_primitives.Hax.failure "something is not implemented yet.\nUnhandled loop kind\n\nThis is discussed in issue https://github.com/hacspec/hax/issues/933.\nPlease upvote or comment this issue if you see this error message.\nNote: the error was labeled with context `FunctionalizeLoops`.\n"
3737
"{\n loop {\n Tuple0\n }\n }"
3838
<:
3939
Prims.unit),
4040
()
4141
<:
4242
(Prims.unit & Prims.unit))
4343
else
44-
Rust_primitives.Hax.never_to_any ((Rust_primitives.Hax.failure "something is not implemented yet.This is discussed in issue https://github.com/hacspec/hax/issues/405.\nPlease upvote or comment this issue if you see this error message.\nLoop without mutation\n\nThis is discussed in issue https://github.com/hacspec/hax/issues/405.\nPlease upvote or comment this issue if you see this error message.\nNote: the error was labeled with context `FunctionalizeLoops`.\n"
44+
Rust_primitives.Hax.never_to_any ((Rust_primitives.Hax.failure "something is not implemented yet.\nUnhandled loop kind\n\nThis is discussed in issue https://github.com/hacspec/hax/issues/933.\nPlease upvote or comment this issue if you see this error message.\nNote: the error was labeled with context `FunctionalizeLoops`.\n"
4545
"{\n loop {\n Tuple0\n }\n }"
4646
<:
4747
Prims.unit),

rustc-coverage-tests/snapshots/fstar/Coverage.Loop_break.fst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ open Core
44
open FStar.Mul
55

66
let main (_: Prims.unit) : (Prims.unit & Prims.unit) =
7-
Rust_primitives.Hax.failure "something is not implemented yet.This is discussed in issue https://github.com/hacspec/hax/issues/405.\nPlease upvote or comment this issue if you see this error message.\nLoop without mutation\n\nThis is discussed in issue https://github.com/hacspec/hax/issues/405.\nPlease upvote or comment this issue if you see this error message.\nNote: the error was labeled with context `FunctionalizeLoops`.\n"
7+
Rust_primitives.Hax.failure "something is not implemented yet.\nUnhandled loop kind\n\nThis is discussed in issue https://github.com/hacspec/hax/issues/933.\nPlease upvote or comment this issue if you see this error message.\nNote: the error was labeled with context `FunctionalizeLoops`.\n"
88
"{\n loop {\n (if core::hint::black_box::<bool>(true) {\n core::ops::control_flow::ControlFlow_Break(Tuple2(Tuple0, Tuple0()))\n } else {\n core::ops::control_flow::ControlFlow_Continue(Tuple0)\n })\n }\n }"
99
,
1010
()

rustc-coverage-tests/snapshots/fstar/Coverage.Loop_break_value.fst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ open FStar.Mul
55

66
let main (_: Prims.unit) : Prims.unit =
77
let result:i32 =
8-
Rust_primitives.Hax.failure "something is not implemented yet.This is discussed in issue https://github.com/hacspec/hax/issues/405.\nPlease upvote or comment this issue if you see this error message.\nLoop without mutation\n\nThis is discussed in issue https://github.com/hacspec/hax/issues/405.\nPlease upvote or comment this issue if you see this error message.\nNote: the error was labeled with context `FunctionalizeLoops`.\n"
8+
Rust_primitives.Hax.failure "something is not implemented yet.\nUnhandled loop kind\n\nThis is discussed in issue https://github.com/hacspec/hax/issues/933.\nPlease upvote or comment this issue if you see this error message.\nNote: the error was labeled with context `FunctionalizeLoops`.\n"
99
"{\n loop {\n core::ops::control_flow::ControlFlow_Break(Tuple2(10, Tuple0()))\n }\n }",
1010
()
1111
<:

0 commit comments

Comments
 (0)