-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #983 from hacspec/dummy-lib
feat(hax-lib): intro. `hax` feature
- Loading branch information
Showing
41 changed files
with
665 additions
and
340 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[build] | ||
rustflags = ["--cfg", "hax"] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Removes a field from an object at any depth | ||
def remove_field(field): | ||
walk(if type == "object" and has(field) then del(.[field]) else . end); | ||
|
||
# Remove `table_id` indirections whenever a value is found | ||
def thir_drop_table_id_nodes: | ||
walk(if type == "object" and has("cache_id") and has("value") and .value then .value else . end); | ||
|
||
# Prints a THIR def_id as a string, useful for searching | ||
def thir_str_of_def_id_contents: | ||
( | ||
[.krate] | ||
+ [ | ||
.path.[] | ||
| try (.disambiguator as $d | .data | . as $data | keys | .[0] | $data[.] + (if $d > 0 then "#" + $d else "" end)) | ||
| select(type == "string")] | ||
) | join("::"); | ||
|
||
# Prints all THIR def_ids | ||
def thir_str_of_def_ids: | ||
thir_drop_table_id_nodes | walk( | ||
# if type == "object" and has("contents") and (.contents | type) == "object" and .contents | has("krate") and .contents | has("path") then | ||
if try(. as $o | ($o.contents.krate | type == "string") and ($o.contents.path | type == "array")) catch false then | ||
.contents | thir_str_of_def_id_contents | ||
else | ||
. | ||
end); |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,4 @@ edition = "2021" | |
path = "src/sha256.rs" | ||
|
||
[dependencies] | ||
hax-lib-macros.workspace = true | ||
hax-lib.workspace = true |
This file contains 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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.