Skip to content

Fix the handling of constant parameters in function bodies #710

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 3 additions & 13 deletions CoqOfRust/alloc/boxed/convert.v
Original file line number Diff line number Diff line change
Expand Up @@ -931,13 +931,7 @@ Module boxed.
|)
|)
|);
M.borrow (|
Pointer.Kind.Ref,
get_constant (|
"alloc::boxed::convert::boxed_slice_as_array_unchecked::N",
Ty.path "usize"
|)
|)
M.borrow (| Pointer.Kind.Ref, M.alloc (| N |) |)
]
|),
[
Expand Down Expand Up @@ -1161,9 +1155,7 @@ Module boxed.
|)
]
|),
M.read (|
get_constant (| "alloc::boxed::convert::N", Ty.path "usize" |)
|)
N
|)
|)) in
let _ := M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
Expand Down Expand Up @@ -1286,9 +1278,7 @@ Module boxed.
|),
[ M.borrow (| Pointer.Kind.Ref, vec |) ]
|),
M.read (|
get_constant (| "alloc::boxed::convert::N", Ty.path "usize" |)
|)
N
|)
|)) in
let _ := M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
Expand Down
10 changes: 1 addition & 9 deletions CoqOfRust/alloc/collections/btree/map.v
Original file line number Diff line number Diff line change
Expand Up @@ -22642,15 +22642,7 @@ Module collections.
(let γ :=
M.use
(M.alloc (|
BinOp.eq (|
M.read (|
get_constant (|
"alloc::collections::btree::map::N",
Ty.path "usize"
|)
|),
Value.Integer IntegerKind.Usize 0
|)
BinOp.eq (| N, Value.Integer IntegerKind.Usize 0 |)
|)) in
let _ :=
M.is_constant_or_break_match (|
Expand Down
10 changes: 1 addition & 9 deletions CoqOfRust/alloc/collections/btree/set.v
Original file line number Diff line number Diff line change
Expand Up @@ -7451,15 +7451,7 @@ Module collections.
(let γ :=
M.use
(M.alloc (|
BinOp.eq (|
M.read (|
get_constant (|
"alloc::collections::btree::set::N",
Ty.path "usize"
|)
|),
Value.Integer IntegerKind.Usize 0
|)
BinOp.eq (| N, Value.Integer IntegerKind.Usize 0 |)
|)) in
let _ :=
M.is_constant_or_break_match (|
Expand Down
58 changes: 7 additions & 51 deletions CoqOfRust/alloc/collections/vec_deque/into_iter.v
Original file line number Diff line number Diff line change
Expand Up @@ -1373,12 +1373,7 @@ Module collections.
|)
]
|),
M.read (|
get_constant (|
"alloc::collections::vec_deque::into_iter::next_chunk::N",
Ty.path "usize"
|)
|)
N
|)
|)) in
let _ :=
Expand Down Expand Up @@ -1415,12 +1410,7 @@ Module collections.
]
|);
M.read (| raw_arr_ptr |);
M.read (|
get_constant (|
"alloc::collections::vec_deque::into_iter::next_chunk::N",
Ty.path "usize"
|)
|)
N
]
|)
|) in
Expand Down Expand Up @@ -1457,12 +1447,7 @@ Module collections.
"inner"
|)
|);
M.read (|
get_constant (|
"alloc::collections::vec_deque::into_iter::next_chunk::N",
Ty.path "usize"
|)
|)
N
]
|)
|)
Expand All @@ -1481,15 +1466,7 @@ Module collections.
|) in
M.write (|
β,
BinOp.Wrap.sub (|
M.read (| β |),
M.read (|
get_constant (|
"alloc::collections::vec_deque::into_iter::next_chunk::N",
Ty.path "usize"
|)
|)
|)
BinOp.Wrap.sub (| M.read (| β |), N |)
|)
|) in
M.return_ (|
Expand Down Expand Up @@ -1590,12 +1567,7 @@ Module collections.
let~ remaining : Ty.path "usize" :=
M.alloc (|
BinOp.Wrap.sub (|
M.read (|
get_constant (|
"alloc::collections::vec_deque::into_iter::next_chunk::N",
Ty.path "usize"
|)
|),
N,
M.call_closure (|
Ty.path "usize",
M.get_associated_function (|
Expand Down Expand Up @@ -1741,12 +1713,7 @@ Module collections.
"inner"
|)
|);
M.read (|
get_constant (|
"alloc::collections::vec_deque::into_iter::next_chunk::N",
Ty.path "usize"
|)
|)
N
]
|)
|)
Expand All @@ -1763,18 +1730,7 @@ Module collections.
"alloc::collections::vec_deque::VecDeque",
"len"
|) in
M.write (|
β,
BinOp.Wrap.sub (|
M.read (| β |),
M.read (|
get_constant (|
"alloc::collections::vec_deque::into_iter::next_chunk::N",
Ty.path "usize"
|)
|)
|)
|)
M.write (| β, BinOp.Wrap.sub (| M.read (| β |), N |) |)
|) in
M.alloc (|
Value.StructTuple
Expand Down
17 changes: 3 additions & 14 deletions CoqOfRust/alloc/collections/vec_deque/mod.v
Original file line number Diff line number Diff line change
Expand Up @@ -19513,11 +19513,7 @@ Module collections.
[],
[]
|),
[
M.read (|
get_constant (| "alloc::collections::vec_deque::N", Ty.path "usize" |)
|)
]
[ N ]
|)
|) in
let~ arr :
Expand Down Expand Up @@ -19622,12 +19618,7 @@ Module collections.
|),
[ M.borrow (| Pointer.Kind.Ref, deq |) ]
|);
M.read (|
get_constant (|
"alloc::collections::vec_deque::N",
Ty.path "usize"
|)
|)
N
]
|)
|) in
Expand All @@ -19654,9 +19645,7 @@ Module collections.
"alloc::collections::vec_deque::VecDeque",
"len"
|),
M.read (|
get_constant (| "alloc::collections::vec_deque::N", Ty.path "usize" |)
|)
N
|)
|) in
deq
Expand Down
2 changes: 1 addition & 1 deletion CoqOfRust/alloc/rc.v
Original file line number Diff line number Diff line change
Expand Up @@ -12714,7 +12714,7 @@ Module rc.
|)
]
|),
M.read (| get_constant (| "alloc::rc::N", Ty.path "usize" |) |)
N
|)
|)) in
let _ := M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
Expand Down
2 changes: 1 addition & 1 deletion CoqOfRust/alloc/sync.v
Original file line number Diff line number Diff line change
Expand Up @@ -17655,7 +17655,7 @@ Module sync.
|)
]
|),
M.read (| get_constant (| "alloc::sync::N", Ty.path "usize" |) |)
N
|)
|)) in
let _ := M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
Expand Down
45 changes: 5 additions & 40 deletions CoqOfRust/alloc/vec/into_iter.v
Original file line number Diff line number Diff line change
Expand Up @@ -1928,15 +1928,7 @@ Module vec.
(let γ :=
M.use
(M.alloc (|
BinOp.lt (|
M.read (| len |),
M.read (|
get_constant (|
"alloc::vec::into_iter::next_chunk::N",
Ty.path "usize"
|)
|)
|)
BinOp.lt (| M.read (| len |), N |)
|)) in
let _ :=
M.is_constant_or_break_match (|
Expand Down Expand Up @@ -2032,12 +2024,7 @@ Module vec.
"end"
|)
|);
M.read (|
get_constant (|
"alloc::vec::into_iter::next_chunk::N",
Ty.path "usize"
|)
|)
N
]
|)
|)
Expand Down Expand Up @@ -2097,19 +2084,7 @@ Module vec.
[
fun γ =>
ltac:(M.monadic
(let γ :=
M.use
(M.alloc (|
BinOp.lt (|
M.read (| len |),
M.read (|
get_constant (|
"alloc::vec::into_iter::next_chunk::N",
Ty.path "usize"
|)
|)
|)
|)) in
(let γ := M.use (M.alloc (| BinOp.lt (| M.read (| len |), N |) |)) in
let _ :=
M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
M.alloc (|
Expand Down Expand Up @@ -2288,12 +2263,7 @@ Module vec.
|),
[ M.borrow (| Pointer.Kind.MutRef, raw_ary |) ]
|));
M.read (|
get_constant (|
"alloc::vec::into_iter::next_chunk::N",
Ty.path "usize"
|)
|)
N
]
|)
|) in
Expand Down Expand Up @@ -2321,12 +2291,7 @@ Module vec.
"ptr"
|)
|);
M.read (|
get_constant (|
"alloc::vec::into_iter::next_chunk::N",
Ty.path "usize"
|)
|)
N
]
|)
|)
Expand Down
5 changes: 1 addition & 4 deletions CoqOfRust/alloc/vec/is_zero.v
Original file line number Diff line number Diff line change
Expand Up @@ -1173,10 +1173,7 @@ Module vec.
ltac:(M.monadic
(let self := M.alloc (| self |) in
LogicalOp.and (|
BinOp.le (|
M.read (| get_constant (| "alloc::vec::is_zero::N", Ty.path "usize" |) |),
Value.Integer IntegerKind.Usize 16
|),
BinOp.le (| N, Value.Integer IntegerKind.Usize 16 |),
ltac:(M.monadic
(M.call_closure (|
Ty.path "bool",
Expand Down
23 changes: 4 additions & 19 deletions CoqOfRust/alloc/vec/mod.v
Original file line number Diff line number Diff line change
Expand Up @@ -7812,12 +7812,7 @@ Module vec.
[],
[]
|),
[
M.read (| len |);
M.read (|
get_constant (| "alloc::vec::N", Ty.path "usize" |)
|)
]
[ M.read (| len |); N ]
|);
M.borrow (|
Pointer.Kind.Ref,
Expand Down Expand Up @@ -7847,12 +7842,7 @@ Module vec.
[],
[]
|),
[
M.read (| len |);
M.read (|
get_constant (| "alloc::vec::N", Ty.path "usize" |)
|)
]
[ M.read (| len |); N ]
|);
M.call_closure (|
Ty.path "usize",
Expand All @@ -7862,12 +7852,7 @@ Module vec.
[],
[]
|),
[
M.read (| cap |);
M.read (|
get_constant (| "alloc::vec::N", Ty.path "usize" |)
|)
]
[ M.read (| cap |); N ]
|)
]
|)))
Expand Down Expand Up @@ -11157,7 +11142,7 @@ Module vec.
|),
[ M.borrow (| Pointer.Kind.Ref, vec |) ]
|),
M.read (| get_constant (| "alloc::vec::N", Ty.path "usize" |) |)
N
|)
|)) in
let _ :=
Expand Down
Loading
Loading