Conversation
There was a problem hiding this comment.
Pull request overview
Adds first-class CHC array support and uses it to model Vec<T> as (Array<int, T>, int), enabling specifications for common Vec operations and extending annotation parsing to support select/store.
Changes:
- Introduce
Arraysort/type across CHC + refined types, including formatting/unboxing/subtyping support. - Model
Vec<T>as a tuple(Array<int, T>, int)and addextern_spec_fnspecs for severalVecmethods. - Extend annotation parsing to accept postfix
.select(i)/.store(i, v)terms; add UI tests forVec.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
std.rs |
Adds extern_spec_fn contracts for Vec::{new,push,len,index,index_mut,clear,pop,is_empty,truncate} using store/select. |
src/rty.rs |
Adds ArrayType and Type::Array, including sort mapping and substitutions/unification. |
src/rty/subtyping.rs |
Adds subtyping relation for array refined types. |
src/refine/template.rs |
Lowers Rust Vec<T> to (Array<int, T>, int) in type building. |
src/chc.rs |
Adds Sort::Array, array pretty-printing, store/select functions, and Term::{select,store} helpers. |
src/chc/unbox.rs |
Unboxing support for array sorts. |
src/chc/format_context.rs |
Adjusts sort symbol formatting and adds SMT-LIB formatting for (Array ...). |
src/chc/hoice.rs |
Updates to renamed SortSymbol helper for datatype reference collection. |
src/annot.rs |
Extends postfix parsing to support .select(..) / .store(..) and adds UnknownMethod error. |
src/analyze/local_def.rs |
Resolves extern_spec_fn inner def_id via Instance::resolve. |
src/analyze/basic_block.rs |
Improves const handling for uints; resolves const_fn_def instances with args. |
tests/ui/pass/vec_1.rs |
Pass test for Vec::new/push/len/index. |
tests/ui/pass/vec_2.rs |
Pass test for IndexMut + pop. |
tests/ui/pass/vec_3.rs |
Pass test for truncate/clear. |
tests/ui/fail/vec_1.rs |
Fail test for incorrect len after push. |
tests/ui/fail/vec_2.rs |
Fail test for incorrect second pop result. |
tests/ui/fail/vec_3.rs |
Fail test for incorrect len/index after truncate/clear. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
extern_spec_fns