Merge remote-tracking branch 'origin/main' into glue-getters-rtfeldman

This commit is contained in:
Folkert 2023-03-08 19:46:00 +01:00
commit fe15a2e79c
No known key found for this signature in database
GPG Key ID: 1F17F6FFD112B97C
124 changed files with 2445 additions and 9925 deletions

9
.gitignore vendored
View File

@ -72,4 +72,11 @@ roc_linux_x86_64.tar.gz
result
# tutorial
www/src/roc-tutorial
www/src/roc-tutorial
# Only keep Cargo.lock dependencies for the main compiler.
# Examples and test only crates should be fine to be unlocked.
# This remove unneccessary lock file versioning.
# It also ensures the compiler can always pull in 1 version of things and doesn't get restricted by sub lockfiles.
/**/Cargo.lock
!/Cargo.lock

1440
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,44 +1,40 @@
[workspace]
members = [
"crates/compiler/*",
"crates/vendor/*",
"crates/glue",
"crates/editor",
"crates/ast",
"crates/cli",
"crates/code_markup",
"crates/highlight",
"crates/error_macros",
"crates/reporting",
"crates/packaging",
"crates/repl_cli",
"crates/repl_eval",
"crates/repl_test",
"crates/repl_wasm",
"crates/repl_expect",
"crates/test_utils",
"crates/valgrind",
"crates/tracing",
"crates/utils",
"crates/docs",
"crates/docs_cli",
"crates/linker",
"crates/wasi-libc-sys",
"crates/wasm_module",
"crates/wasm_interp",
"crates/compiler/*",
"crates/vendor/*",
"crates/glue",
"crates/editor",
"crates/ast",
"crates/cli",
"crates/cli_utils",
"crates/code_markup",
"crates/highlight",
"crates/error_macros",
"crates/reporting",
"crates/packaging",
"crates/repl_cli",
"crates/repl_eval",
"crates/repl_test",
"crates/repl_wasm",
"crates/repl_expect",
"crates/roc_std",
"crates/test_utils",
"crates/valgrind",
"crates/tracing",
"crates/utils",
"crates/docs",
"crates/docs_cli",
"crates/linker",
"crates/wasi-libc-sys",
"crates/wasm_module",
"crates/wasm_interp",
]
exclude = [
"ci/benchmarks/bench-runner",
# Examples sometimes have Rust hosts in their platforms. The compiler should ignore those.
"crates/cli_testing_examples",
"examples",
# Ignore building these normally. They are only imported by tests.
# The tests will still correctly build them.
"crates/cli_utils",
"crates/compiler/test_mono_macros",
"crates/compiler/str",
# `cargo build` would cause roc_std to be built with default features which errors on windows
"crates/roc_std",
"ci/benchmarks/bench-runner",
# Examples sometimes have Rust hosts in their platforms. The compiler should ignore those.
"crates/cli_testing_examples",
"examples",
]
# Needed to be able to run `cargo run -p roc_cli --no-default-features` -
# see www/build.sh for more.
@ -47,6 +43,13 @@ exclude = [
# workspace, and without `resolver = "2"` here, you can't use `-p` like this.
resolver = "2"
[workspace.package]
authors = ["The Roc Contributors"]
edition = "2021"
license = "UPL-1.0"
repository = "https://github.com/roc-lang/roc"
version = "0.0.1"
[workspace.dependencies]
# NOTE: roc-lang/inkwell is a fork of TheDan64/inkwell which does not change anything.
#
@ -65,72 +68,117 @@ resolver = "2"
# commit of TheDan64/inkwell, push a new tag which points to the latest commit,
# change the tag value in this Cargo.toml to point to that tag, and `cargo update`.
# This way, GitHub Actions works and nobody's builds get broken.
inkwell = { git = "https://github.com/roc-lang/inkwell", branch = "inkwell-llvm-15", features = [ "llvm13-0" ] }
inkwell = { git = "https://github.com/roc-lang/inkwell", branch = "inkwell-llvm-15", features = ["llvm13-0"] }
arrayvec = "0.7.2"
base64-url = "1.4.13"
bincode = "1.3.3"
bitflags = "1.3.2"
bitvec = "1.0.1"
bumpalo = { version = "3.11.1", features = ["collections"] }
capstone = "0.11.0"
clap = { version = "3.2.20", default-features = false, features = ["std", "color", "suggestions"] }
const_format = { version = "0.2.23", features = ["const_generics"] }
criterion = { git = "https://github.com/Anton-4/criterion.rs", features = ["html_reports"]}
blake3 = "1.3.3"
brotli = "3.3.4" # used for decompressing tarballs over HTTPS, if the server supports brotli
bumpalo = { version = "3.12.0", features = ["collections"] }
bytemuck = { version = "1.13.1", features = ["derive"] }
capstone = { version = "0.11.0", default-features = false }
cgmath = "0.18.0"
clap = { version = "3.2.23", default-features = false, features = ["std", "color", "suggestions"] }
colored = "2.0.0"
confy = { git = 'https://github.com/rust-cli/confy', features = ["yaml_conf"], default-features = false }
console_error_panic_hook = "0.1.7"
const_format = { version = "0.2.30", features = ["const_generics"] }
copypasta = "0.8.2"
criterion = { git = "https://github.com/Anton-4/criterion.rs", features = ["html_reports"] }
criterion-perf-events = { git = "https://github.com/Anton-4/criterion-perf-events" }
crossbeam = "0.8.2"
dircpy = "0.3.14"
distance = "0.4.0"
encode_unicode = "1.0.0"
errno = "0.2.8"
errno = "0.3.0"
flate2 = "1.0.25"
fnv = "1.0.7"
fs_extra = "1.2.0"
hashbrown = { version = "0.12.3", features = [ "bumpalo" ] }
iced-x86 = { version = "1.15.0", default-features = false, features = ["std", "decoder", "op_code_info", "instr_info"] }
im = "15.0.0"
im-rc = "15.0.0"
indoc = "1.0.7"
insta = "1.20.0"
fs_extra = "1.3.0"
futures = "0.3.26"
glyph_brush = "0.7.7"
hashbrown = { version = "0.13.2", features = ["bumpalo"] }
iced-x86 = { version = "1.18.0", default-features = false, features = ["std", "decoder", "op_code_info", "instr_info"] }
im = "15.1.0"
im-rc = "15.1.0"
indexmap = "1.9.2"
indoc = "1.0.9"
insta = "1.28.0"
js-sys = "0.3.61"
lazy_static = "1.4.0"
libc = "0.2.135"
libloading = "0.7.1"
libc = "0.2.139"
libfuzzer-sys = "0.4"
libloading = "0.7.4"
log = "0.4.17"
mach_object = "0.1"
maplit = "1.0.2"
memmap2 = "0.5.7"
mimalloc = { version = "0.1.26", default-features = false }
packed_struct = "0.10.0"
page_size = "0.4.2"
memmap2 = "0.5.10"
mimalloc = { version = "0.1.34", default-features = false }
nonempty = "0.8.1"
object = { version = "0.30.3", features = ["read", "write"] }
packed_struct = "0.10.1"
page_size = "0.5.0"
palette = "0.6.1"
parking_lot = "0.12"
peg = "0.8.1"
perfcnt = "0.8.0"
pest = "2.5.6"
pest_derive = "2.5.6"
pretty_assertions = "1.3.0"
proc-macro2 = "1.0.51"
proptest = "1.1.0"
pulldown-cmark = { version = "0.9.2", default-features = false }
quickcheck = "1.0.3"
quickcheck_macros = "1.0.0"
regex = "1.5.5"
rustyline = {git = "https://github.com/roc-lang/rustyline", rev = "e74333c"}
rustyline-derive = {git = "https://github.com/roc-lang/rustyline", rev = "e74333c"}
serde = { version = "1.0.144", features = ["derive"] }
signal-hook = "0.3.14"
snafu = { version = "0.7.1", features = ["backtraces"] }
quote = "1.0.23"
rand = "0.8.5"
regex = "1.7.1"
remove_dir_all = "0.8.1"
reqwest = { version = "0.11.14", default-features = false, features = ["blocking", "rustls-tls"] } # default-features=false removes libopenssl as a dependency on Linux, which might not be available!
rlimit = "0.9.1"
rustyline = { git = "https://github.com/roc-lang/rustyline", rev = "e74333c" }
rustyline-derive = { git = "https://github.com/roc-lang/rustyline", rev = "e74333c" }
serde = { version = "1.0.153", features = ["derive"] }
serde-xml-rs = "0.6.0"
serde_json = "1.0.94"
serial_test = "1.0.0"
signal-hook = "0.3.15"
snafu = { version = "0.7.4", features = ["backtraces"] }
static_assertions = "1.1.0"
strip-ansi-escapes = "0.1.1"
strum = { version = "0.24.1", features = ["derive"] }
target-lexicon = "0.12.3"
tempfile = "3.2.0"
unicode-segmentation = "1.10.0"
strum_macros = "0.24.3"
syn = { version = "1.0.109", features = ["full", "extra-traits"] }
tar = "0.4.38"
target-lexicon = "0.12.6"
tempfile = "=3.2.0"
threadpool = "1.8.1"
tracing = { version = "0.1.37", features = ["release_max_level_off"] }
tracing-appender = "0.2.2"
tracing-subscriber = { version = "0.3.16", features = ["env-filter"] }
unicode-segmentation = "1.10.1"
uuid = { version = "1.3.0", features = ["v4"] }
walkdir = "2.3.2"
wasm-bindgen = "0.2.84"
wasm-bindgen-futures = "0.4.34"
wgpu = "0.12.0"
wgpu_glyph = "0.16.0"
winapi = { version = "0.3.9", features = ["memoryapi"] }
winit = "0.26.1"
wyhash = "0.5.0"
# TODO: Deal with the update of object to 0.27.
# It looks like it breaks linking the generated objects.
# Probably just need to specify an extra field that used to be implicit or something.
object = { version = "0.29.0", features = ["read", "write"] }
# Optimizations based on https://deterministic.space/high-performance-rust.html
[profile.release]
lto = "thin"
codegen-units = 1
lto = "thin"
# debug = true # enable when profiling
[profile.bench]
lto = "thin"
codegen-units = 1
lto = "thin"
[profile.release-with-debug]
inherits = "release"
debug = true
inherits = "release"

View File

@ -12,12 +12,24 @@ If you'd like to get involved in contributing to the language, the Zulip chat is
## Sponsors
We are very grateful to our sponsors [NoRedInk](https://www.noredink.com/), [rwx](https://www.rwx.com), and [Tweede golf](https://tweedegolf.nl/en).
We are very grateful for our corporate sponsors [Vendr](https://www.vendr.com/), [rwx](https://www.rwx.com), and [Tweede golf](https://tweedegolf.nl/en).
[<img src="https://www.noredink.com/assets/logo-red-black-f6989d7567cf90b349409137595e99c52d036d755b4403d25528e0fd83a3b084.svg" height="60" alt="NoRedInk logo"/>](https://www.noredink.com/)
[<img src="https://user-images.githubusercontent.com/1094080/223597445-81755626-a080-4299-a38c-3c92e7548489.png" height="60" alt="Vendr logo"/>](https://www.vendr.com)
&nbsp;&nbsp;&nbsp;&nbsp;
[<img src="https://www.rwx.com/rwx_banner.svg" height="60" alt="rwx logo"/>](https://www.rwx.com)
&nbsp;&nbsp;&nbsp;&nbsp;
[<img src="https://user-images.githubusercontent.com/1094080/183123052-856815b1-8cc9-410a-83b0-589f03613188.svg" height="60" alt="tweede golf logo"/>](https://tweedegolf.nl/en)
If you or your employer would like to sponsor Roc's development, please [DM Richard Feldman on Zulip](https://roc.zulipchat.com/#narrow/pm-with/281383-user281383)!
If you would like your company to become a corporate sponsor of Roc's development, please [DM Richard Feldman on Zulip](https://roc.zulipchat.com/#narrow/pm-with/281383-user281383)!
We'd also like to express our gratitude to each and every one of our fantastic [GitHub sponsors](https://github.com/sponsors/roc-lang/)! A special thanks to those sponsoring $25/month or more:
* [Christopher Dolan](https://github.com/cdolan)
* [Nick Gravgaard](https://github.com/nickgravgaard)
* [Aaron White](https://github.com/aaronwhite)
* [Zeljko Nesic](https://github.com/popara)
* [Shritesh Bhattarai](https://github.com/shritesh)
* [Richard Feldman](https://github.com/rtfeldman)
* [Ayaz Hafiz](https://github.com/ayazhafiz)
Thank you all so much for helping Roc progress!

View File

@ -1,422 +0,0 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "aho-corasick"
version = "0.7.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f"
dependencies = [
"memchr",
]
[[package]]
name = "atty"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
dependencies = [
"hermit-abi",
"libc",
"winapi",
]
[[package]]
name = "autocfg"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
[[package]]
name = "bench-runner"
version = "0.0.1"
dependencies = [
"clap",
"data-encoding",
"is_executable",
"regex",
"ring",
]
[[package]]
name = "bitflags"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
[[package]]
name = "bumpalo"
version = "3.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535"
[[package]]
name = "cc"
version = "1.0.69"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e70cc2f62c6ce1868963827bd677764c62d07c3d9a3e1fb1177ee1a9ab199eb2"
[[package]]
name = "cfg-if"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "clap"
version = "3.1.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85a35a599b11c089a7f49105658d089b8f2cf0882993c17daf6de15285c2c35d"
dependencies = [
"atty",
"bitflags",
"clap_derive",
"clap_lex",
"indexmap",
"lazy_static",
"strsim",
"termcolor",
"textwrap",
]
[[package]]
name = "clap_derive"
version = "3.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3aab4734e083b809aaf5794e14e756d1c798d2c69c7f7de7a09a2f5214993c1"
dependencies = [
"heck",
"proc-macro-error",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "clap_lex"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a37c35f1112dad5e6e0b1adaff798507497a18fceeb30cceb3bae7d1427b9213"
dependencies = [
"os_str_bytes",
]
[[package]]
name = "data-encoding"
version = "2.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ee2393c4a91429dffb4bedf19f4d6abf27d8a732c8ce4980305d782e5426d57"
[[package]]
name = "hashbrown"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
[[package]]
name = "heck"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9"
[[package]]
name = "hermit-abi"
version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
dependencies = [
"libc",
]
[[package]]
name = "indexmap"
version = "1.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5"
dependencies = [
"autocfg",
"hashbrown",
]
[[package]]
name = "is_executable"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa9acdc6d67b75e626ad644734e8bc6df893d9cd2a834129065d3dd6158ea9c8"
dependencies = [
"winapi",
]
[[package]]
name = "js-sys"
version = "0.3.51"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "83bdfbace3a0e81a4253f73b49e960b053e396a11012cbd49b9b74d6a2b67062"
dependencies = [
"wasm-bindgen",
]
[[package]]
name = "lazy_static"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
version = "0.2.98"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "320cfe77175da3a483efed4bc0adc1968ca050b098ce4f2f1c13a56626128790"
[[package]]
name = "log"
version = "0.4.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710"
dependencies = [
"cfg-if",
]
[[package]]
name = "memchr"
version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc"
[[package]]
name = "once_cell"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56"
[[package]]
name = "os_str_bytes"
version = "6.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64"
[[package]]
name = "proc-macro-error"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
dependencies = [
"proc-macro-error-attr",
"proc-macro2",
"quote",
"syn",
"version_check",
]
[[package]]
name = "proc-macro-error-attr"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
dependencies = [
"proc-macro2",
"quote",
"version_check",
]
[[package]]
name = "proc-macro2"
version = "1.0.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c7ed8b8c7b886ea3ed7dde405212185f423ab44682667c8c6dd14aa1d9f6612"
dependencies = [
"unicode-xid",
]
[[package]]
name = "quote"
version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7"
dependencies = [
"proc-macro2",
]
[[package]]
name = "regex"
version = "1.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
]
[[package]]
name = "regex-syntax"
version = "0.6.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
[[package]]
name = "ring"
version = "0.16.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc"
dependencies = [
"cc",
"libc",
"once_cell",
"spin",
"untrusted",
"web-sys",
"winapi",
]
[[package]]
name = "spin"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
[[package]]
name = "strsim"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]]
name = "syn"
version = "1.0.74"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1873d832550d4588c3dbc20f01361ab00bfe741048f71e3fecf145a7cc18b29c"
dependencies = [
"proc-macro2",
"quote",
"unicode-xid",
]
[[package]]
name = "termcolor"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4"
dependencies = [
"winapi-util",
]
[[package]]
name = "textwrap"
version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb"
[[package]]
name = "unicode-xid"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
[[package]]
name = "untrusted"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a"
[[package]]
name = "version_check"
version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]]
name = "wasm-bindgen"
version = "0.2.74"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d54ee1d4ed486f78874278e63e4069fc1ab9f6a18ca492076ffb90c5eb2997fd"
dependencies = [
"cfg-if",
"wasm-bindgen-macro",
]
[[package]]
name = "wasm-bindgen-backend"
version = "0.2.74"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b33f6a0694ccfea53d94db8b2ed1c3a8a4c86dd936b13b9f0a15ec4a451b900"
dependencies = [
"bumpalo",
"lazy_static",
"log",
"proc-macro2",
"quote",
"syn",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.74"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "088169ca61430fe1e58b8096c24975251700e7b1f6fd91cc9d59b04fb9b18bd4"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
]
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.74"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be2241542ff3d9f241f5e2cb6dd09b37efe786df8851c54957683a49f0987a97"
dependencies = [
"proc-macro2",
"quote",
"syn",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.74"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d7cff876b8f18eed75a66cf49b65e7f967cb354a7aa16003fb55dbfd25b44b4f"
[[package]]
name = "web-sys"
version = "0.3.51"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e828417b379f3df7111d3a2a9e5753706cae29c41f7c4029ee9fd77f3e09e582"
dependencies = [
"js-sys",
"wasm-bindgen",
]
[[package]]
name = "winapi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
dependencies = [
"winapi-i686-pc-windows-gnu",
"winapi-x86_64-pc-windows-gnu",
]
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-util"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
dependencies = [
"winapi",
]
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"

View File

@ -7,7 +7,7 @@ edition = "2021"
[dependencies]
clap = { version = "3.1.15", features = ["derive"] }
regex = "1.5.5"
data-encoding = "2.3.2"
is_executable = "1.0.1"
regex = "1.5.5"
ring = "0.16.20"
data-encoding = "2.3.2"

View File

@ -1,39 +1,39 @@
[package]
name = "roc_ast"
version = "0.0.1"
authors = ["The Roc Contributors"]
license = "UPL-1.0"
edition = "2021"
description = "AST as used by the editor and (soon) docs. In contrast to the compiler, these types do not keep track of a location in a file."
authors.workspace = true
edition.workspace = true
license.workspace = true
version.workspace = true
[dependencies]
roc_builtins = { path = "../compiler/builtins"}
roc_builtins = { path = "../compiler/builtins" }
roc_can = { path = "../compiler/can" }
roc_collections = { path = "../compiler/collections" }
roc_region = { path = "../compiler/region" }
roc_error_macros = { path = "../error_macros" }
roc_load = { path = "../compiler/load" }
roc_module = { path = "../compiler/module" }
roc_packaging = { path = "../packaging" }
roc_parse = { path = "../compiler/parse" }
roc_problem = { path = "../compiler/problem" }
roc_types = { path = "../compiler/types" }
roc_unify = { path = "../compiler/unify"}
roc_solve = { path = "../compiler/solve"}
roc_load = { path = "../compiler/load" }
roc_target = { path = "../compiler/roc_target" }
roc_error_macros = { path = "../error_macros" }
roc_packaging = { path = "../packaging" }
roc_region = { path = "../compiler/region" }
roc_reporting = { path = "../reporting" }
roc_solve = { path = "../compiler/solve" }
roc_target = { path = "../compiler/roc_target" }
roc_types = { path = "../compiler/types" }
roc_unify = { path = "../compiler/unify" }
ven_graph = { path = "../vendor/pathfinding" }
arrayvec.workspace = true
bumpalo.workspace = true
libc.workspace = true
page_size.workspace = true
snafu.workspace = true
libc.workspace = true
[dev-dependencies]
indoc.workspace = true
[target.'cfg(windows)'.dependencies]
winapi = { version = "0.3.9", features = ["memoryapi"]}
winapi.workspace = true

View File

@ -1,87 +1,81 @@
[package]
name = "roc_cli"
version = "0.0.1"
authors = ["The Roc Contributors"]
license = "UPL-1.0"
repository = "https://github.com/roc-lang/roc"
edition = "2021"
description = "The Roc binary that brings together all functionality in the Roc toolset."
default-run = "roc"
authors.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true
version.workspace = true
[[bin]]
bench = false
name = "roc"
path = "src/main.rs"
test = false
bench = false
[features]
default = ["target-aarch64", "target-x86_64", "target-wasm32", "editor"]
wasm32-cli-run = ["target-wasm32", "run-wasm32"]
i386-cli-run = ["target-x86"]
wasm32-cli-run = ["target-wasm32", "run-wasm32"]
editor = ["roc_editor"]
run-wasm32 = ["roc_wasm_interp"]
# Compiling for a different target than the current machine can cause linker errors.
target-arm = ["roc_build/target-arm", "roc_repl_cli/target-arm"]
target-aarch64 = ["roc_build/target-aarch64", "roc_repl_cli/target-aarch64"]
target-arm = ["roc_build/target-arm", "roc_repl_cli/target-arm"]
target-wasm32 = ["roc_build/target-wasm32", "roc_repl_cli/target-wasm32"]
target-x86 = ["roc_build/target-x86", "roc_repl_cli/target-x86"]
target-x86_64 = ["roc_build/target-x86_64", "roc_repl_cli/target-x86_64"]
target-wasm32 = ["roc_build/target-wasm32", "roc_repl_cli/target-wasm32"]
target-all = [
"target-aarch64",
"target-arm",
"target-x86",
"target-x86_64",
"target-wasm32"
]
target-all = ["target-aarch64", "target-arm", "target-x86", "target-x86_64", "target-wasm32"]
sanitizers = ["roc_build/sanitizers"]
[dependencies]
roc_collections = { path = "../compiler/collections" }
roc_build = { path = "../compiler/build" }
roc_builtins = { path = "../compiler/builtins" }
roc_can = { path = "../compiler/can" }
roc_collections = { path = "../compiler/collections" }
roc_docs = { path = "../docs" }
roc_editor = { path = "../editor", optional = true }
roc_error_macros = { path = "../error_macros" }
roc_fmt = { path = "../compiler/fmt" }
roc_gen_llvm = { path = "../compiler/gen_llvm" }
roc_glue = { path = "../glue" }
roc_linker = { path = "../linker" }
roc_load = { path = "../compiler/load" }
roc_module = { path = "../compiler/module" }
roc_mono = { path = "../compiler/mono" }
roc_packaging = { path = "../packaging" }
roc_parse = { path = "../compiler/parse" }
roc_region = { path = "../compiler/region" }
roc_module = { path = "../compiler/module" }
roc_builtins = { path = "../compiler/builtins" }
roc_mono = { path = "../compiler/mono" }
roc_load = { path = "../compiler/load" }
roc_build = { path = "../compiler/build" }
roc_fmt = { path = "../compiler/fmt" }
roc_target = { path = "../compiler/roc_target" }
roc_packaging = { path = "../packaging" }
roc_reporting = { path = "../reporting" }
roc_error_macros = { path = "../error_macros" }
roc_editor = { path = "../editor", optional = true }
roc_linker = { path = "../linker" }
roc_repl_cli = { path = "../repl_cli", optional = true }
roc_reporting = { path = "../reporting" }
roc_target = { path = "../compiler/roc_target" }
roc_tracing = { path = "../tracing" }
roc_gen_llvm = {path = "../compiler/gen_llvm"}
roc_wasm_interp = { path = "../wasm_interp", optional = true }
ven_pretty = { path = "../vendor/pretty" }
indoc.workspace = true
bumpalo.workspace = true
clap.workspace = true
const_format.workspace = true
mimalloc.workspace = true
bumpalo.workspace = true
libc.workspace = true
errno.workspace = true
indoc.workspace = true
inkwell.workspace = true
libc.workspace = true
libloading.workspace = true
mimalloc.workspace = true
signal-hook.workspace = true
strum.workspace = true
target-lexicon.workspace = true
tempfile.workspace = true
strum.workspace = true
libloading.workspace = true
signal-hook.workspace = true
inkwell.workspace = true
# for now, uses unix/libc functions that windows does not support
[target.'cfg(not(windows))'.dependencies]
@ -89,14 +83,15 @@ roc_repl_expect = { path = "../repl_expect" }
[dev-dependencies]
pretty_assertions = "1.3.0"
cli_utils = { path = "../cli_utils" }
roc_test_utils = { path = "../test_utils" }
roc_utils = { path = "../utils" }
indoc = "1.0.7"
serial_test = "0.9.0"
criterion = { git = "https://github.com/Anton-4/criterion.rs"}
cli_utils = { path = "../cli_utils" }
parking_lot = "0.12"
criterion.workspace = true
indoc.workspace = true
parking_lot.workspace = true
pretty_assertions.workspace = true
serial_test.workspace = true
[[bench]]
name = "time_bench"

View File

@ -1,27 +1,25 @@
[package]
name = "cli_utils"
version = "0.0.1"
authors = ["The Roc Contributors"]
license = "UPL-1.0"
repository = "https://github.com/roc-lang/roc"
edition = "2021"
description = "Provides shared code for cli tests and benchmarks."
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
authors.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true
version.workspace = true
[dependencies]
roc_collections = { path = "../compiler/collections" }
roc_reporting = { path = "../reporting" }
roc_load = { path = "../compiler/load" }
roc_module = { path = "../compiler/module" }
roc_reporting = { path = "../reporting" }
roc_utils = { path = "../utils" }
bumpalo = { version = "3.8.0", features = ["collections"] }
criterion = { git = "https://github.com/Anton-4/criterion.rs"}
serde = { version = "1.0.130", features = ["derive"] }
serde-xml-rs = "0.5.1"
strip-ansi-escapes = "0.1.1"
tempfile = "3.2.0"
bumpalo.workspace = true
criterion.workspace = true
serde-xml-rs.workspace = true
serde.workspace = true
tempfile.workspace = true
[target.'cfg(unix)'.dependencies]
rlimit = "0.6.2"
rlimit.workspace = true

View File

@ -387,7 +387,7 @@ pub fn cli_testing_dir(dir_name: &str) -> PathBuf {
// Descend into examples/{dir_name}
path.push("crates");
path.push("cli_testing_examples");
path.extend(dir_name.split("/")); // Make slashes cross-target
path.extend(dir_name.split('/')); // Make slashes cross-target
path
}
@ -396,7 +396,7 @@ pub fn cli_testing_dir(dir_name: &str) -> PathBuf {
pub fn dir_path_from_root(dir_name: &str) -> PathBuf {
let mut path = root_dir();
path.extend(dir_name.split("/")); // Make slashes cross-target
path.extend(dir_name.split('/')); // Make slashes cross-target
path
}
@ -419,7 +419,7 @@ pub fn fixtures_dir(dir_name: &str) -> PathBuf {
path.push("cli");
path.push("tests");
path.push("fixtures");
path.extend(dir_name.split("/")); // Make slashes cross-target
path.extend(dir_name.split('/')); // Make slashes cross-target
path
}

View File

@ -1,16 +1,19 @@
[package]
name = "roc_code_markup"
version = "0.0.1"
authors = ["The Roc Contributors"]
license = "UPL-1.0"
edition = "2021"
description = "Our own markup language for Roc code. Used by the editor and the docs."
authors.workspace = true
edition.workspace = true
license.workspace = true
version.workspace = true
[dependencies]
roc_ast = { path = "../ast" }
roc_module = { path = "../compiler/module" }
roc_utils = { path = "../utils" }
serde = { version = "1.0.144", features = ["derive"] }
palette = "0.6.1"
snafu = { version = "0.7.1", features = ["backtraces"] }
bumpalo = { version = "3.11.1", features = ["collections"] }
palette.workspace = true
bumpalo.workspace = true
serde.workspace = true
snafu.workspace = true

View File

@ -1,15 +1,17 @@
[package]
authors = ["The Roc Contributors"]
edition = "2021"
license = "UPL-1.0"
name = "roc_alias_analysis"
version = "0.0.1"
authors.workspace = true
edition.workspace = true
license.workspace = true
version.workspace = true
[dependencies]
morphic_lib = {path = "../../vendor/morphic_lib"}
roc_collections = {path = "../collections"}
roc_error_macros = {path = "../../error_macros"}
roc_module = {path = "../module"}
roc_mono = {path = "../mono"}
roc_debug_flags = {path = "../debug_flags"}
morphic_lib = { path = "../../vendor/morphic_lib" }
roc_collections = { path = "../collections" }
roc_debug_flags = { path = "../debug_flags" }
roc_error_macros = { path = "../../error_macros" }
roc_module = { path = "../module" }
roc_mono = { path = "../mono" }
bumpalo.workspace = true

View File

@ -1,11 +1,12 @@
[package]
name = "arena-pool"
version = "0.0.1"
authors = ["The Roc Contributors"]
license = "UPL-1.0"
repository = "https://github.com/roc-lang/roc"
edition = "2021"
description = "An implementation of an arena allocator designed for the compiler's workloads."
authors.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true
version.workspace = true
[dependencies]
roc_error_macros = { path = "../../error_macros" }

View File

@ -1,55 +1,55 @@
[package]
name = "roc_build"
version = "0.0.1"
authors = ["The Roc Contributors"]
license = "UPL-1.0"
edition = "2021"
description = "Responsible for coordinating building and linking of a Roc app with its host."
authors.workspace = true
edition.workspace = true
license.workspace = true
version.workspace = true
[dependencies]
roc_collections = { path = "../collections" }
roc_can = { path = "../can" }
roc_parse = { path = "../parse" }
roc_region = { path = "../region" }
roc_module = { path = "../module" }
roc_problem = { path = "../problem" }
roc_types = { path = "../types" }
roc_builtins = { path = "../builtins" }
roc_can = { path = "../can" }
roc_collections = { path = "../collections" }
roc_constrain = { path = "../constrain" }
roc_unify = { path = "../unify" }
roc_solve_problem = { path = "../solve_problem" }
roc_mono = { path = "../mono" }
roc_load = { path = "../load" }
roc_target = { path = "../roc_target" }
roc_error_macros = { path = "../../error_macros" }
roc_gen_dev = { path = "../gen_dev", default-features = false }
roc_gen_llvm = { path = "../gen_llvm" }
roc_gen_wasm = { path = "../gen_wasm" }
roc_gen_dev = { path = "../gen_dev", default-features = false }
roc_reporting = { path = "../../reporting" }
roc_error_macros = { path = "../../error_macros" }
roc_std = { path = "../../roc_std" }
roc_utils = { path = "../../utils" }
roc_packaging = { path = "../../packaging" }
roc_linker = { path = "../../linker" }
roc_load = { path = "../load" }
roc_module = { path = "../module" }
roc_mono = { path = "../mono" }
roc_packaging = { path = "../../packaging" }
roc_parse = { path = "../parse" }
roc_problem = { path = "../problem" }
roc_region = { path = "../region" }
roc_reporting = { path = "../../reporting" }
roc_solve_problem = { path = "../solve_problem" }
roc_std = { path = "../../roc_std" }
roc_target = { path = "../roc_target" }
roc_types = { path = "../types" }
roc_unify = { path = "../unify" }
roc_utils = { path = "../../utils" }
wasi_libc_sys = { path = "../../wasi-libc-sys" }
const_format.workspace = true
bumpalo.workspace = true
libloading.workspace = true
tempfile.workspace = true
target-lexicon.workspace = true
inkwell.workspace = true
indoc.workspace = true
inkwell.workspace = true
libloading.workspace = true
target-lexicon.workspace = true
tempfile.workspace = true
[target.'cfg(target_os = "macos")'.dependencies]
serde_json = "1.0.85"
serde_json.workspace = true
[features]
target-arm = []
target-aarch64 = ["roc_gen_dev/target-aarch64"]
target-arm = []
target-wasm32 = []
target-x86 = []
target-x86_64 = ["roc_gen_dev/target-x86_64"]
target-wasm32 = []
# This is used to enable fuzzing and sanitizers.
# Example use is describe here: https://github.com/bhansconnect/roc-fuzz

View File

@ -1,23 +1,26 @@
[package]
name = "roc_builtins"
version = "0.0.1"
authors = ["The Roc Contributors"]
license = "UPL-1.0"
edition = "2021"
description = "Provides the Roc functions and modules that are implicitly imported into every module."
authors.workspace = true
edition.workspace = true
license.workspace = true
version.workspace = true
[dependencies]
roc_collections = { path = "../collections" }
roc_region = { path = "../region" }
roc_module = { path = "../module" }
roc_region = { path = "../region" }
roc_target = { path = "../roc_target" }
roc_utils = { path = "../../utils" }
tempfile.workspace = true
[build-dependencies]
roc_utils = { path = "../../utils" }
# dunce can be removed once ziglang/zig#5109 is fixed
dunce = "1.0.3"
roc_utils = { path = "../../utils" }
[target.'cfg(target_os = "macos")'.build-dependencies]
tempfile.workspace = true

View File

@ -1082,7 +1082,7 @@ split = \elements, userSplitIndex ->
## Returns the elements before the first occurrence of a delimiter, as well as the
## remaining elements after that occurrence. If the delimiter is not found, returns `Err`.
##
## List.splitFirst [Foo, Z, Bar, Z, Baz] Z == Ok { before: [Foo], after: [Bar, Baz] }
## List.splitFirst [Foo, Z, Bar, Z, Baz] Z == Ok { before: [Foo], after: [Bar, Z, Baz] }
splitFirst : List elem, elem -> Result { before : List elem, after : List elem } [NotFound] | elem has Eq
splitFirst = \list, delimiter ->
when List.findFirstIndex list (\elem -> elem == delimiter) is
@ -1097,7 +1097,7 @@ splitFirst = \list, delimiter ->
## Returns the elements before the last occurrence of a delimiter, as well as the
## remaining elements after that occurrence. If the delimiter is not found, returns `Err`.
##
## List.splitLast [Foo, Z, Bar, Z, Baz] Z == Ok { before: [Foo, Bar], after: [Baz] }
## List.splitLast [Foo, Z, Bar, Z, Baz] Z == Ok { before: [Foo, Z, Bar], after: [Baz] }
splitLast : List elem, elem -> Result { before : List elem, after : List elem } [NotFound] | elem has Eq
splitLast = \list, delimiter ->
when List.findLastIndex list (\elem -> elem == delimiter) is

View File

@ -1,28 +1,29 @@
[package]
name = "roc_can"
version = "0.0.1"
authors = ["The Roc Contributors"]
license = "UPL-1.0"
edition = "2021"
description = "Canonicalize a roc abstract syntax tree, resolving symbols, re-ordering definitions, and preparing a module for type inference."
authors.workspace = true
edition.workspace = true
license.workspace = true
version.workspace = true
[dependencies]
roc_collections = { path = "../collections" }
roc_error_macros = { path = "../../error_macros" }
roc_exhaustive = { path = "../exhaustive" }
roc_region = { path = "../region" }
roc_module = { path = "../module" }
roc_parse = { path = "../parse" }
roc_problem = { path = "../problem" }
roc_types = { path = "../types" }
roc_region = { path = "../region" }
roc_serialize = { path = "../serialize" }
bumpalo.workspace = true
static_assertions.workspace = true
bitvec.workspace = true
roc_types = { path = "../types" }
ven_pretty = { path = "../../vendor/pretty" }
bitvec.workspace = true
bumpalo.workspace = true
static_assertions.workspace = true
[dev-dependencies]
pretty_assertions.workspace = true
indoc.workspace = true
pretty_assertions.workspace = true

View File

@ -1,16 +1,17 @@
[package]
name = "roc_collections"
version = "0.0.1"
authors = ["The Roc Contributors"]
license = "UPL-1.0"
edition = "2021"
description = "Domain-specific collections created for the needs of the compiler."
authors.workspace = true
edition.workspace = true
license.workspace = true
version.workspace = true
[dependencies]
fnv.workspace = true
im.workspace = true
im-rc.workspace = true
wyhash.workspace = true
bumpalo.workspace = true
hashbrown.workspace = true
bitvec.workspace = true
bumpalo.workspace = true
fnv.workspace = true
hashbrown.workspace = true
im-rc.workspace = true
im.workspace = true
wyhash.workspace = true

View File

@ -1,18 +1,20 @@
[package]
name = "roc_constrain"
version = "0.0.1"
authors = ["The Roc Contributors"]
license = "UPL-1.0"
edition = "2021"
description = "Responsible for building the set of constraints that are used during type inference of a program, and for gathering context needed for pleasant error messages when a type error occurs."
authors.workspace = true
edition.workspace = true
license.workspace = true
version.workspace = true
[dependencies]
roc_can = { path = "../can" }
roc_collections = { path = "../collections" }
roc_error_macros = { path = "../../error_macros" }
roc_region = { path = "../region" }
roc_module = { path = "../module" }
roc_parse = { path = "../parse" }
roc_problem = { path = "../problem" }
roc_region = { path = "../region" }
roc_types = { path = "../types" }
roc_can = { path = "../can" }
arrayvec = "0.7.2"
arrayvec.workspace = true

View File

@ -1,9 +1,10 @@
[package]
name = "roc_debug_flags"
version = "0.0.1"
edition = "2021"
authors = ["The Roc Contributors"]
license = "UPL-1.0"
description = "Environment variables that can be toggled to aid debugging of the compiler itself."
authors.workspace = true
edition.workspace = true
license.workspace = true
version.workspace = true
[dependencies]

View File

@ -1,25 +1,27 @@
[package]
name = "roc_derive"
version = "0.0.1"
authors = ["The Roc Contributors"]
license = "UPL-1.0"
edition = "2021"
description = "Provides auto-derivers for builtin abilities like `Hash` and `Decode`."
authors.workspace = true
edition.workspace = true
license.workspace = true
version.workspace = true
[dependencies]
roc_collections = { path = "../collections" }
roc_error_macros = { path = "../../error_macros" }
roc_derive_key = { path = "../derive_key" }
roc_region = { path = "../region" }
roc_module = { path = "../module" }
roc_types = { path = "../types" }
roc_can = { path = "../can" }
roc_collections = { path = "../collections" }
roc_derive_key = { path = "../derive_key" }
roc_error_macros = { path = "../../error_macros" }
roc_module = { path = "../module" }
roc_region = { path = "../region" }
roc_types = { path = "../types" }
roc_unify = { path = "../unify" }
bumpalo.workspace = true
[features]
default = []
debug-derived-symbols = ["roc_module/debug-symbols"]
default = []
# Enables open extension variables for constructed records and tag unions.
# This is not necessary for code generation, but may be necessary if you are
# constraining and solving generated derived bodies.

View File

@ -1,14 +1,14 @@
[package]
name = "roc_derive_key"
version = "0.0.1"
authors = ["The Roc Contributors"]
license = "UPL-1.0"
edition = "2021"
authors.workspace = true
edition.workspace = true
license.workspace = true
version.workspace = true
[dependencies]
roc_collections = { path = "../collections" }
roc_error_macros = { path = "../../error_macros" }
roc_region = { path = "../region" }
roc_module = { path = "../module" }
roc_region = { path = "../region" }
roc_types = { path = "../types" }
roc_can = { path = "../can" }

View File

@ -1,14 +1,15 @@
[package]
name = "roc_exhaustive"
version = "0.0.1"
authors = ["The Roc Contributors"]
license = "UPL-1.0"
edition = "2021"
description = "Provides exhaustiveness checking for Roc."
authors.workspace = true
edition.workspace = true
license.workspace = true
version.workspace = true
[dependencies]
roc_collections = { path = "../collections" }
roc_region = { path = "../region" }
roc_module = { path = "../module" }
roc_error_macros = { path = "../../error_macros" }
roc_module = { path = "../module" }
roc_problem = { path = "../problem" }
roc_region = { path = "../region" }

View File

@ -1,14 +1,16 @@
[package]
name = "roc_fmt"
version = "0.0.1"
authors = ["The Roc Contributors"]
license = "UPL-1.0"
edition = "2021"
description = "The roc code formatter."
authors.workspace = true
edition.workspace = true
license.workspace = true
version.workspace = true
[dependencies]
roc_collections = { path = "../collections" }
roc_region = { path = "../region" }
roc_module = { path = "../module" }
roc_parse = { path = "../parse" }
bumpalo.workspace = true
roc_region = { path = "../region" }
bumpalo.workspace = true

View File

@ -1,28 +1,29 @@
[package]
name = "roc_gen_dev"
description = "The development backend for the Roc compiler"
version = "0.0.1"
authors = ["The Roc Contributors"]
license = "UPL-1.0"
edition = "2021"
authors.workspace = true
edition.workspace = true
license.workspace = true
version.workspace = true
[dependencies]
roc_collections = { path = "../collections" }
roc_region = { path = "../region" }
roc_module = { path = "../module" }
roc_problem = { path = "../problem" }
roc_types = { path = "../types" }
roc_builtins = { path = "../builtins" }
roc_unify = { path = "../unify" }
roc_solve = { path = "../solve" }
roc_mono = { path = "../mono" }
roc_target = { path = "../roc_target" }
roc_collections = { path = "../collections" }
roc_error_macros = { path = "../../error_macros" }
roc_module = { path = "../module" }
roc_mono = { path = "../mono" }
roc_problem = { path = "../problem" }
roc_region = { path = "../region" }
roc_solve = { path = "../solve" }
roc_target = { path = "../roc_target" }
roc_types = { path = "../types" }
roc_unify = { path = "../unify" }
bumpalo.workspace = true
target-lexicon.workspace = true
object.workspace = true
packed_struct.workspace = true
target-lexicon.workspace = true
[dev-dependencies]
roc_can = { path = "../can" }

View File

@ -843,12 +843,12 @@ impl Assembler<AArch64GeneralReg, AArch64FloatReg> for AArch64Assembler {
}
#[inline(always)]
fn sub_reg64_reg64_reg64(
_buf: &mut Vec<'_, u8>,
_dst: AArch64GeneralReg,
_src1: AArch64GeneralReg,
_src2: AArch64GeneralReg,
buf: &mut Vec<'_, u8>,
dst: AArch64GeneralReg,
src1: AArch64GeneralReg,
src2: AArch64GeneralReg,
) {
todo!("registers subtractions for AArch64");
sub_reg64_reg64_reg64(buf, dst, src1, src2);
}
#[inline(always)]
@ -1477,6 +1477,19 @@ fn sub_reg64_reg64_imm12(
buf.extend(inst.bytes());
}
/// `SUB Xd, Xm, Xn` -> Subtract Xm and Xn and place the result into Xd.
#[inline(always)]
fn sub_reg64_reg64_reg64(
buf: &mut Vec<'_, u8>,
dst: AArch64GeneralReg,
src1: AArch64GeneralReg,
src2: AArch64GeneralReg,
) {
let inst = ArithmeticShifted::new(true, false, ShiftType::LSL, 0, src2, src1, dst);
buf.extend(inst.bytes());
}
/// `RET Xn` -> Return to the address stored in Xn.
#[inline(always)]
fn ret_reg64(buf: &mut Vec<'_, u8>, xn: AArch64GeneralReg) {
@ -1697,6 +1710,34 @@ mod tests {
);
}
#[test]
fn test_sub_reg64_reg64_reg64() {
disassembler_test!(
sub_reg64_reg64_reg64,
|reg1: AArch64GeneralReg, reg2: AArch64GeneralReg, reg3: AArch64GeneralReg| {
if reg2 == AArch64GeneralReg::ZRSP {
// When the second register is ZR, it gets disassembled as neg,
// which is an alias for sub.
format!(
"neg {}, {}",
reg1.capstone_string(UsesZR),
reg3.capstone_string(UsesZR)
)
} else {
format!(
"sub {}, {}, {}",
reg1.capstone_string(UsesZR),
reg2.capstone_string(UsesZR),
reg3.capstone_string(UsesZR)
)
}
},
ALL_GENERAL_REGS,
ALL_GENERAL_REGS,
ALL_GENERAL_REGS
);
}
#[test]
fn test_ret_reg64() {
disassembler_test!(

View File

@ -1,24 +1,25 @@
[package]
name = "roc_gen_llvm"
description = "The LLVM backend for the Roc compiler"
version = "0.0.1"
authors = ["The Roc Contributors"]
license = "UPL-1.0"
edition = "2021"
authors.workspace = true
edition.workspace = true
license.workspace = true
version.workspace = true
[dependencies]
roc_alias_analysis = { path = "../alias_analysis" }
roc_collections = { path = "../collections" }
roc_module = { path = "../module" }
roc_builtins = { path = "../builtins" }
roc_error_macros = { path = "../../error_macros" }
roc_mono = { path = "../mono" }
roc_target = { path = "../roc_target" }
roc_std = { path = "../../roc_std" }
roc_debug_flags = { path = "../debug_flags" }
roc_region = { path = "../region" }
morphic_lib = { path = "../../vendor/morphic_lib" }
roc_alias_analysis = { path = "../alias_analysis" }
roc_builtins = { path = "../builtins" }
roc_collections = { path = "../collections" }
roc_debug_flags = { path = "../debug_flags" }
roc_error_macros = { path = "../../error_macros" }
roc_module = { path = "../module" }
roc_mono = { path = "../mono" }
roc_region = { path = "../region" }
roc_std = { path = "../../roc_std" }
roc_target = { path = "../roc_target" }
bumpalo.workspace = true
inkwell.workspace = true
target-lexicon.workspace = true
inkwell.workspace = true

View File

@ -1,19 +1,20 @@
[package]
name = "roc_gen_wasm"
version = "0.0.1"
edition = "2021"
authors = ["The Roc Contributors"]
license = "UPL-1.0"
description = "Provides the WASM backend to generate Roc binaries."
authors.workspace = true
edition.workspace = true
license.workspace = true
version.workspace = true
[dependencies]
roc_builtins = { path = "../builtins" }
roc_collections = { path = "../collections" }
roc_error_macros = { path = "../../error_macros" }
roc_module = { path = "../module" }
roc_mono = { path = "../mono" }
roc_target = { path = "../roc_target" }
roc_std = { path = "../../roc_std" }
roc_error_macros = { path = "../../error_macros" }
roc_target = { path = "../roc_target" }
roc_wasm_module = { path = "../../wasm_module" }
bitvec.workspace = true

View File

@ -1,7 +1,8 @@
[package]
name = "roc_ident"
version = "0.0.1"
authors = ["The Roc Contributors"]
license = "UPL-1.0"
edition = "2021"
description = "Implements data structures used for efficiently representing small strings, like identifiers."
authors.workspace = true
edition.workspace = true
license.workspace = true
version.workspace = true

View File

@ -1,19 +1,20 @@
[package]
name = "roc_late_solve"
version = "0.0.1"
authors = ["The Roc Contributors"]
license = "UPL-1.0"
edition = "2021"
description = "Provides type unification and solving primitives from the perspective of the compiler backend."
[dependencies]
roc_types = { path = "../types" }
roc_can = { path = "../can" }
roc_derive = { path = "../derive" }
roc_module = { path = "../module" }
roc_unify = { path = "../unify" }
roc_solve = { path = "../solve" }
roc_collections = { path = "../collections" }
roc_error_macros = { path = "../../error_macros" }
authors.workspace = true
edition.workspace = true
license.workspace = true
version.workspace = true
bumpalo.workspace = true
[dependencies]
roc_can = { path = "../can" }
roc_collections = { path = "../collections" }
roc_derive = { path = "../derive" }
roc_error_macros = { path = "../../error_macros" }
roc_module = { path = "../module" }
roc_solve = { path = "../solve" }
roc_types = { path = "../types" }
roc_unify = { path = "../unify" }
bumpalo.workspace = true

View File

@ -1,30 +1,31 @@
[package]
name = "roc_load"
version = "0.0.1"
authors = ["The Roc Contributors"]
license = "UPL-1.0"
edition = "2021"
description = "Used to load a .roc file and coordinate the compiler pipeline, including parsing, type checking, and code generation."
authors.workspace = true
edition.workspace = true
license.workspace = true
version.workspace = true
[dependencies]
roc_load_internal = { path = "../load_internal" }
roc_target = { path = "../roc_target" }
roc_can = { path = "../can" }
roc_types = { path = "../types" }
roc_module = { path = "../module" }
roc_collections = { path = "../collections" }
roc_load_internal = { path = "../load_internal" }
roc_module = { path = "../module" }
roc_packaging = { path = "../../packaging" }
roc_reporting = { path = "../../reporting" }
roc_target = { path = "../roc_target" }
roc_types = { path = "../types" }
bumpalo.workspace = true
[build-dependencies]
roc_builtins = { path = "../builtins" }
roc_can = { path = "../can" }
roc_module = { path = "../module" }
roc_packaging = { path = "../../packaging" }
roc_reporting = { path = "../../reporting" }
roc_target = { path = "../roc_target" }
roc_can = { path = "../can" }
bumpalo.workspace = true

View File

@ -1,45 +1,46 @@
[package]
name = "roc_load_internal"
version = "0.0.1"
authors = ["The Roc Contributors"]
license = "UPL-1.0"
edition = "2021"
description = "The internal implementation of roc_load, separate from roc_load to support caching."
authors.workspace = true
edition.workspace = true
license.workspace = true
version.workspace = true
[dependencies]
roc_collections = { path = "../collections" }
roc_error_macros = { path = "../../error_macros" }
roc_region = { path = "../region" }
roc_module = { path = "../module" }
roc_types = { path = "../types" }
roc_can = { path = "../can" }
roc_constrain = { path = "../constrain" }
roc_derive_key = { path = "../derive_key" }
roc_derive = { path = "../derive" }
roc_builtins = { path = "../builtins" }
roc_problem = { path = "../problem" }
roc_unify = { path = "../unify" }
roc_can = { path = "../can" }
roc_collections = { path = "../collections" }
roc_constrain = { path = "../constrain" }
roc_debug_flags = { path = "../debug_flags" }
roc_derive = { path = "../derive" }
roc_derive_key = { path = "../derive_key" }
roc_error_macros = { path = "../../error_macros" }
roc_late_solve = { path = "../late_solve" }
roc_module = { path = "../module" }
roc_mono = { path = "../mono" }
roc_packaging = { path = "../../packaging" }
roc_parse = { path = "../parse" }
roc_problem = { path = "../problem" }
roc_region = { path = "../region" }
roc_reporting = { path = "../../reporting" }
roc_solve = { path = "../solve" }
roc_solve_problem = { path = "../solve_problem" }
roc_late_solve = { path = "../late_solve" }
roc_mono = { path = "../mono" }
roc_target = { path = "../roc_target" }
roc_tracing = { path = "../../tracing" }
roc_packaging = { path = "../../packaging" }
roc_reporting = { path = "../../reporting" }
roc_debug_flags = { path = "../debug_flags" }
roc_types = { path = "../types" }
roc_unify = { path = "../unify" }
ven_pretty = { path = "../../vendor/pretty" }
bumpalo.workspace = true
parking_lot.workspace = true
crossbeam.workspace = true
parking_lot.workspace = true
tempfile.workspace = true
[dev-dependencies]
roc_test_utils = { path = "../../test_utils" }
pretty_assertions.workspace = true
indoc.workspace = true
maplit.workspace = true
pretty_assertions.workspace = true

View File

@ -1,20 +1,22 @@
[package]
name = "roc_module"
version = "0.0.1"
authors = ["The Roc Contributors"]
edition = "2021"
license = "UPL-1.0"
description = "Implements data structures used for efficiently representing unique modules and identifiers in Roc programs."
authors.workspace = true
edition.workspace = true
license.workspace = true
version.workspace = true
[dependencies]
roc_region = { path = "../region" }
roc_ident = { path = "../ident" }
roc_collections = { path = "../collections" }
roc_error_macros = {path = "../../error_macros"}
roc_error_macros = { path = "../../error_macros" }
roc_ident = { path = "../ident" }
roc_region = { path = "../region" }
bumpalo.workspace = true
static_assertions.workspace = true
snafu.workspace = true
static_assertions.workspace = true
[features]
default = []
debug-symbols = []
default = []

View File

@ -1,32 +1,33 @@
[package]
name = "roc_mono"
version = "0.0.1"
authors = ["The Roc Contributors"]
license = "UPL-1.0"
edition = "2021"
description = "Roc's main intermediate representation (IR), which is responsible for monomorphization, defunctionalization, inserting ref-count instructions, and transforming a Roc program into a form that is easy to consume by a backend."
authors.workspace = true
edition.workspace = true
license.workspace = true
version.workspace = true
[dependencies]
roc_collections = { path = "../collections" }
roc_exhaustive = { path = "../exhaustive" }
roc_region = { path = "../region" }
roc_module = { path = "../module" }
roc_types = { path = "../types" }
roc_can = { path = "../can" }
roc_derive_key = { path = "../derive_key" }
roc_derive = { path = "../derive" }
roc_late_solve = { path = "../late_solve" }
roc_std = { path = "../../roc_std" }
roc_problem = { path = "../problem" }
roc_builtins = { path = "../builtins" }
roc_can = { path = "../can" }
roc_collections = { path = "../collections" }
roc_debug_flags = { path = "../debug_flags" }
roc_derive = { path = "../derive" }
roc_derive_key = { path = "../derive_key" }
roc_error_macros = { path = "../../error_macros" }
roc_exhaustive = { path = "../exhaustive" }
roc_late_solve = { path = "../late_solve" }
roc_module = { path = "../module" }
roc_problem = { path = "../problem" }
roc_region = { path = "../region" }
roc_std = { path = "../../roc_std" }
roc_target = { path = "../roc_target" }
roc_error_macros = {path="../../error_macros"}
roc_debug_flags = {path="../debug_flags"}
roc_tracing = { path = "../../tracing" }
roc_types = { path = "../types" }
ven_pretty = { path = "../../vendor/pretty" }
bitvec.workspace = true
bumpalo.workspace = true
hashbrown.workspace = true
static_assertions.workspace = true
bitvec.workspace = true
parking_lot.workspace = true
static_assertions.workspace = true

View File

@ -2331,15 +2331,6 @@ impl<'a> Stmt<'a> {
String::from_utf8(w).unwrap()
}
pub fn is_terminal(&self) -> bool {
use Stmt::*;
matches!(
self,
Switch { .. } | Ret(_) | Jump(_, _) // TODO for Switch; is this the reason Lean only looks at the outermost `when`?
)
}
pub fn if_then_else(
arena: &'a Bump,
condition_symbol: Symbol,
@ -10834,7 +10825,20 @@ fn union_lambda_set_to_switch<'a>(
return empty_lambda_set_error(env);
}
let join_point_id = JoinPointId(env.unique_symbol());
let (opt_join, branch_assigned, branch_hole) = match hole {
Stmt::Ret(_) => {
// No need to jump to a joinpoint, inline the return in each statement as-is.
// This makes further analyses, like TCO, easier as well.
(None, assigned, hole)
}
_ => {
let join_point_id = JoinPointId(env.unique_symbol());
let assigned = env.unique_symbol();
let hole = Stmt::Jump(join_point_id, env.arena.alloc([assigned]));
(Some(join_point_id), assigned, &*env.arena.alloc(hole))
}
};
let mut branches = Vec::with_capacity_in(lambda_set.len(), env.arena);
@ -10850,12 +10854,13 @@ fn union_lambda_set_to_switch<'a>(
let stmt = union_lambda_set_branch(
env,
join_point_id,
lambda_name,
closure_info,
argument_symbols,
argument_layouts,
return_layout,
branch_assigned,
branch_hole,
);
branches.push((i as u64, BranchInfo::None, stmt));
}
@ -10874,34 +10879,36 @@ fn union_lambda_set_to_switch<'a>(
ret_layout: return_layout,
};
let param = Param {
symbol: assigned,
layout: return_layout,
ownership: Ownership::Owned,
};
match opt_join {
None => switch,
Some(join_point_id) => {
let param = Param {
symbol: assigned,
layout: return_layout,
ownership: Ownership::Owned,
};
Stmt::Join {
id: join_point_id,
parameters: &*env.arena.alloc([param]),
body: hole,
remainder: env.arena.alloc(switch),
Stmt::Join {
id: join_point_id,
parameters: &*env.arena.alloc([param]),
body: hole,
remainder: env.arena.alloc(switch),
}
}
}
}
#[allow(clippy::too_many_arguments)]
fn union_lambda_set_branch<'a>(
env: &mut Env<'a, '_>,
join_point_id: JoinPointId,
lambda_name: LambdaName<'a>,
closure_info: ClosureInfo<'a>,
argument_symbols_slice: &'a [Symbol],
argument_layouts_slice: &'a [InLayout<'a>],
return_layout: InLayout<'a>,
assigned: Symbol,
hole: &'a Stmt<'a>,
) -> Stmt<'a> {
let result_symbol = env.unique_symbol();
let hole = Stmt::Jump(join_point_id, env.arena.alloc([result_symbol]));
union_lambda_set_branch_help(
env,
lambda_name,
@ -10909,7 +10916,7 @@ fn union_lambda_set_branch<'a>(
argument_symbols_slice,
argument_layouts_slice,
return_layout,
result_symbol,
assigned,
env.arena.alloc(hole),
)
}
@ -10995,18 +11002,32 @@ fn enum_lambda_set_to_switch<'a>(
) -> Stmt<'a> {
debug_assert_ne!(lambda_set.len(), 0);
let join_point_id = JoinPointId(env.unique_symbol());
let (opt_join, branch_assigned, branch_hole) = match hole {
Stmt::Ret(_) => {
// No need to jump to a joinpoint, inline the return in each statement as-is.
// This makes further analyses, like TCO, easier as well.
(None, assigned, hole)
}
_ => {
let join_point_id = JoinPointId(env.unique_symbol());
let assigned = env.unique_symbol();
let hole = Stmt::Jump(join_point_id, env.arena.alloc([assigned]));
(Some(join_point_id), assigned, &*env.arena.alloc(hole))
}
};
let mut branches = Vec::with_capacity_in(lambda_set.len(), env.arena);
for (i, lambda_name) in lambda_set.into_iter().enumerate() {
let stmt = enum_lambda_set_branch(
env,
join_point_id,
lambda_name,
argument_symbols,
argument_layouts,
return_layout,
branch_assigned,
branch_hole,
);
branches.push((i as u64, BranchInfo::None, stmt));
}
@ -11025,17 +11046,22 @@ fn enum_lambda_set_to_switch<'a>(
ret_layout: return_layout,
};
let param = Param {
symbol: assigned,
layout: return_layout,
ownership: Ownership::Owned,
};
match opt_join {
None => switch,
Some(join_point_id) => {
let param = Param {
symbol: assigned,
layout: return_layout,
ownership: Ownership::Owned,
};
Stmt::Join {
id: join_point_id,
parameters: &*env.arena.alloc([param]),
body: hole,
remainder: env.arena.alloc(switch),
Stmt::Join {
id: join_point_id,
parameters: &*env.arena.alloc([param]),
body: hole,
remainder: env.arena.alloc(switch),
}
}
}
}
@ -11043,18 +11069,13 @@ fn enum_lambda_set_to_switch<'a>(
#[allow(clippy::too_many_arguments)]
fn enum_lambda_set_branch<'a>(
env: &mut Env<'a, '_>,
join_point_id: JoinPointId,
lambda_name: LambdaName<'a>,
argument_symbols: &'a [Symbol],
argument_layouts: &'a [InLayout<'a>],
return_layout: InLayout<'a>,
assigned: Symbol,
hole: &'a Stmt<'a>,
) -> Stmt<'a> {
let result_symbol = env.unique_symbol();
let hole = Stmt::Jump(join_point_id, env.arena.alloc([result_symbol]));
let assigned = result_symbol;
let call = self::Call {
call_type: CallType::ByName {
name: lambda_name,
@ -11064,7 +11085,7 @@ fn enum_lambda_set_branch<'a>(
},
arguments: argument_symbols,
};
build_call(env, call, assigned, return_layout, env.arena.alloc(hole))
build_call(env, call, assigned, return_layout, hole)
}
#[allow(clippy::too_many_arguments)]

View File

@ -1,32 +1,31 @@
[package]
name = "roc_parse"
version = "0.0.1"
authors = ["The Roc Contributors"]
license = "UPL-1.0"
edition = "2021"
description = "Implements the Roc parser, which transforms a textual representation of a Roc program to an AST."
authors.workspace = true
edition.workspace = true
license.workspace = true
version.workspace = true
[features]
"parse_debug_trace" = []
[dependencies]
roc_collections = { path = "../collections" }
roc_region = { path = "../region" }
roc_module = { path = "../module" }
roc_region = { path = "../region" }
bumpalo.workspace = true
encode_unicode.workspace = true
[dev-dependencies]
roc_test_utils = { path = "../../test_utils" }
proptest = "1.0.0"
criterion.workspace = true
pretty_assertions.workspace = true
indoc.workspace = true
pretty_assertions.workspace = true
proptest.workspace = true
quickcheck.workspace = true
quickcheck_macros.workspace = true
[[bench]]
name = "bench_parse"
harness = false
name = "bench_parse"

View File

@ -1,14 +1,15 @@
[package]
name = "roc_problem"
version = "0.0.1"
authors = ["The Roc Contributors"]
license = "UPL-1.0"
edition = "2021"
description = "Provides types to describe problems that can occur when compiling Roc code."
authors.workspace = true
edition.workspace = true
license.workspace = true
version.workspace = true
[dependencies]
roc_collections = { path = "../collections" }
roc_region = { path = "../region" }
roc_module = { path = "../module" }
roc_types = { path = "../types" }
roc_parse = { path = "../parse" }
roc_region = { path = "../region" }
roc_types = { path = "../types" }

View File

@ -1,10 +1,11 @@
[package]
name = "roc_region"
version = "0.0.1"
authors = ["The Roc Contributors"]
license = "UPL-1.0"
edition = "2021"
description = "Data structures for storing source-code-location information, used heavily for contextual error messages."
authors.workspace = true
edition.workspace = true
license.workspace = true
version.workspace = true
[dependencies]
static_assertions = "1.1.0"
static_assertions.workspace = true

View File

@ -1,12 +1,13 @@
[package]
name = "roc_target"
version = "0.0.1"
authors = ["The Roc Contributors"]
license = "UPL-1.0"
edition = "2021"
description = "Provides types and helpers for compiler targets such as default_x86_64."
authors.workspace = true
edition.workspace = true
license.workspace = true
version.workspace = true
[dependencies]
target-lexicon = "0.12.3"
strum = "0.24.0"
strum_macros = "0.24"
strum.workspace = true
strum_macros.workspace = true
target-lexicon.workspace = true

View File

@ -1,10 +1,11 @@
[package]
name = "roc_serialize"
version = "0.0.1"
authors = ["The Roc Contributors"]
license = "UPL-1.0"
edition = "2021"
description = "Provides helpers for serializing and deserializing to/from bytes."
authors.workspace = true
edition.workspace = true
license.workspace = true
version.workspace = true
[dependencies]
roc_collections = { path = "../collections" }

View File

@ -1,44 +1,45 @@
[package]
name = "roc_solve"
version = "0.0.1"
authors = ["The Roc Contributors"]
license = "UPL-1.0"
edition = "2021"
description = "The entry point of Roc's type inference system. Implements type inference and specialization of abilities."
authors.workspace = true
edition.workspace = true
license.workspace = true
version.workspace = true
[dependencies]
roc_can = { path = "../can" }
roc_collections = { path = "../collections" }
roc_debug_flags = { path = "../debug_flags" }
roc_derive = { path = "../derive" }
roc_derive_key = { path = "../derive_key" }
roc_error_macros = { path = "../../error_macros" }
roc_exhaustive = { path = "../exhaustive" }
roc_packaging = { path = "../../packaging" }
roc_region = { path = "../region" }
roc_module = { path = "../module" }
roc_types = { path = "../types" }
roc_can = { path = "../can" }
roc_derive_key = { path = "../derive_key" }
roc_derive = { path = "../derive" }
roc_packaging = { path = "../../packaging" }
roc_problem = { path = "../problem" }
roc_region = { path = "../region" }
roc_solve_problem = { path = "../solve_problem" }
roc_types = { path = "../types" }
roc_unify = { path = "../unify" }
roc_debug_flags = { path = "../debug_flags" }
arrayvec.workspace = true
bumpalo.workspace = true
[dev-dependencies]
roc_load = { path = "../load" }
roc_builtins = { path = "../builtins" }
roc_problem = { path = "../problem" }
roc_derive = { path = "../derive", features = ["debug-derived-symbols"] }
roc_load = { path = "../load" }
roc_parse = { path = "../parse" }
roc_problem = { path = "../problem" }
roc_reporting = { path = "../../reporting" }
roc_solve = { path = "../solve" }
roc_target = { path = "../roc_target" }
roc_reporting = { path = "../../reporting" }
roc_derive = { path = "../derive", features = ["debug-derived-symbols"] }
pretty_assertions.workspace = true
indoc.workspace = true
tempfile.workspace = true
bumpalo.workspace = true
regex.workspace = true
lazy_static.workspace = true
indoc.workspace = true
insta.workspace = true
lazy_static.workspace = true
pretty_assertions.workspace = true
regex.workspace = true
tempfile.workspace = true

View File

@ -1,16 +1,17 @@
[package]
name = "roc_solve_problem"
version = "0.0.1"
authors = ["The Roc Contributors"]
license = "UPL-1.0"
edition = "2021"
description = "Provides types to describe problems that can occur during solving."
authors.workspace = true
edition.workspace = true
license.workspace = true
version.workspace = true
[dependencies]
roc_collections = { path = "../collections" }
roc_region = { path = "../region" }
roc_module = { path = "../module" }
roc_types = { path = "../types" }
roc_can = { path = "../can" }
roc_problem = { path = "../problem" }
roc_collections = { path = "../collections" }
roc_exhaustive = { path = "../exhaustive" }
roc_module = { path = "../module" }
roc_problem = { path = "../problem" }
roc_region = { path = "../region" }
roc_types = { path = "../types" }

View File

@ -1,27 +0,0 @@
[package]
name = "roc_str"
version = "0.0.1"
authors = ["The Roc Contributors"]
license = "UPL-1.0"
edition = "2021"
description = "Provides a Roc Str with reference-counting so that it may be mutated in-place."
[dependencies]
roc_collections = { path = "../collections" }
roc_region = { path = "../region" }
roc_module = { path = "../module" }
roc_types = { path = "../types" }
roc_can = { path = "../can" }
roc_unify = { path = "../unify" }
roc_problem = { path = "../problem" }
bumpalo = { version = "3.6.1", features = ["collections"] }
[dev-dependencies]
roc_constrain = { path = "../constrain" }
roc_builtins = { path = "../builtins" }
roc_parse = { path = "../parse" }
roc_solve = { path = "../solve" }
pretty_assertions = "0.5.1"
indoc = "0.3.3"
quickcheck = "0.8"
quickcheck_macros = "0.8"

View File

@ -1,209 +0,0 @@
# `Str`
This is the in-memory representation for `Str`. To explain how `Str` is laid out in memory, it's helpful to start with how `List` is laid out.
## Empty list
An empty `List Str` is essentially this Rust type with all 0s in memory:
```rust
struct List {
pointer: *Str, // pointers are the same size as `usize`
length: usize
}
```
On a 64-bit system, this `struct` would take up 16B in memory. On a 32-bit system, it would take up 8B.
Here's what the fields mean:
- `pointer` is the memory address of the heap-allocated memory containing the `Bool` elements. For an empty list, the pointer is null (that is, 0).
- `length` is the number of `Bool` elements in the list. For an empty list, this is also 0.
## Nonempty list
Now let's say we define a `List Str` with two elements in it, like so: `["foo", "bar"]`.
First we'd have the `struct` above, with both `length` and `capacity` set to 2. Then, we'd have some memory allocated on the heap, and `pointer` would store that memory's address.
Here's how that heap memory would be laid out on a 64-bit system. It's a total of 48 bytes.
```text
|------16B------|------16B------|---8B---|---8B---|
string #1 string #2 refcount unused
```
Just like how `List` is a `struct` that takes up `2 * usize` bytes in memory, `Str` takes up the same amount of memory - namely, 16B on a 64-bit system. That's why each of the two strings take up 16B of this heap-allocated memory. (Those structs may also point to other heap memory, but they could also be empty strings! Either way we just store the structs in the list, which take up 16B.)
We'll get to what the refcount is for shortly, but first let's talk about the memory layout. The refcount is a `usize` integer, so 8B on our 64-bit system. Why is there 8B of unused memory after it?
This is because of memory alignment. Whenever a system loads some memory from a memory address, it's much more efficient if the address is a multiple of the number of bytes it wants to get. So if we want to load a 16B string struct, we want its address to be a multiple of 16.
When we're allocating memory on the heap, the way we specify what alignment we want is to say how big each element is, and how many of them we want. In this case, we say we want 16B elements, and we want 3 of them. Then we use the first 16B slot to store the 8B refcount, and the 8B after it are unused.
This is memory-inefficient, but it's the price we pay for having all the 16B strings stored in addresses that are multiples of 16. It'd be worse for performance if we tried to pack everything tightly, so we accept the memory inefficiency as a cost of achieving better overall execution speed.
> Note: if we happened to have 8B elements instead of 16B elements, the alignment would be 8 anyway and we'd have no unused memory.
## Reference counting
Let's go back to the refcount - short for "reference count."
The refcount is a `usize` integer which counts how many times this `List` has been shared. For example, if we named this list `myList` and then wrote `[myList, myList, myList]` then we'd increment that refcount 3 times because `myList` is now being shared three more times.
If we were to later call `List.pop` on that list, and the result was an in-place mutation that removed one of the `myList` entries, we'd decrement the refcount. If we did that again and again until the refcount got all the way down to 0, meaning nothing is using it anymore, then we'd deallocate these 48B of heap memory because nobody is using them anymore.
In some cases, the compiler can detect that no reference counting is necessary. In that scenario, it doesn't bother allocating extra space for the refcount; instead, it inserts an instruction to allocate the memory at the appropriate place, another to free it later, and that's it.
## Pointing to the first element
The fact that the reference count may or may not be present could creat a tricky situation for some `List` operations.
For example, should `List.get 0` return the first 16B of the heap-allocated bytes, or the second 16B? If there's a reference count in the first 16B, it should return the second 16B. If there's no refcount, it should return the first 16B.
To solve this, the pointer in the List struct *always* points to the first element in the list. That means to access the reference count, it does negative pointer arithmetic to get the address at 16B *preceding* the memory address it has stored in its pointer field.
## Growing lists
If uniqueness typing tells us that a list is Unique, we know two things about it:
1. It doesn't need a refcount, because nothing else ever references it.
2. It can be mutated in-place.
One of the in-place mutations that can happen to a list is that its length can increase. For example, if I call `List.append list1 list2`, and `list1` is unique, then we'll attempt to append `list2`'s contents in-place into `list1`.
Calling `List.append` on a Shared list results in allocating a new chunk of heap memory large enough to hold both lists (with a fresh refcount, since nothing is referencing the new memory yet), then copying the contents of both lists into the new memory, and finally decrementing the refcount of the old memory.
Calling `List.append` on a Unique list can potentially be done in-place instead.
First, `List.append` repurposes the `usize` slot normally used to store refcount, and stores a `capacity` counter in there instead of a refcount. (After all, unique lists don't need to be refcounted.) A list's capacity refers to how many elements the list *can* hold given the memory it has allocated to it, which is always guaranteed to be at least as many as its length.
When calling `List.append list1 list2` on a unique `list1`, first we'll check to see if `list1.capacity <= list1.length + list2.length`. If it is, then we can copy in the new values without needing to allocate more memory for `list1`.
If there is not enough capacity to fit both lists, then we can try to call [`realloc`](https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/realloc?view=vs-2019) to hopefully extend the size of our allocated memory. If `realloc` succeeds (meaning there happened to be enough free memory right after our current allocation), then we update `capacity` to reflect the new amount of space, and move on.
> **Note:** The reason we store capacity right after the last element in the list is because of how memory cache lines work. Whenever we need to access `capacity`, it's because we're about to increase the length of the list, which means that we will most certainly be writing to the memory location right after its last element. That in turn means that we'll need to have that memory location in cache, which in turn means that looking up the `capacity` there is guaranteed not to cause a cache miss. (It's possible that writing the new capacity value to a later address could cause a cache miss, but this strategy minimizes the chance of that happening.) An alternate design would be where we store the capacity right before the first element in the list. In that design we wouldn't have to re-write the capacity value at the end of the list every time we grew it, but we'd be much more likely to incur more cache misses that way - because we're working at the end of the list, not at the beginning. Cache misses are many times more expensive than an extra write to a memory address that's in cache already, not to mention the potential extra load instruction to add the length to the memory address of the first element (instead of subtracting 1 from that address), so we optimize for minimizing the highly expensive cache misses by always paying a tiny additional cost when increasing the length of the list, as well as a potential even tinier cost (zero, if the length already happens to be in a register) when looking up its capacity or refcount.
If `realloc` fails, then we have to fall back on the same "allocate new memory and copy everything" strategy that we do with shared lists.
When you have a way to anticipate that a list will want to grow incrementally to a certain size, you can avoid such extra allocations by using `List.reserve` to guarantee more capacity up front. (`List.reserve` works like Rust's [`Vec::reserve`](https://doc.rust-lang.org/std/vec/struct.Vec.html#method.reserve).)
> **Note:** Calling `List.reserve 0 myList` will have no effect on a Unique list, but on a Shared list it will clone `myList` and return a Unique one. If you want to do a bunch of in-place mutations on a list, but it's currently Shared, calling `List.reserve 0` on it to get a Unique clone could actually be an effective performance optimization!
## Capacity and alignment
Some lists may end up beginning with excess capacity due to memory alignment requirements. Since the refcount is `usize`, all lists need a minimum of that alignment. For example, on a 64-bit system, a `List Bool` has an alignment of 8B even though bools can fit in 1B.
This means the list `[True, True, False]` would have a memory layout like this):
```text
|--------------8B--------------|--1B--|--1B--|--1B--|-----5B-----|
either refcount or capacity bool1 bool2 bool3 unused
```
As such, if this list is Unique, it would start out with a length of 3 and a capacity of 8.
Since each bool value is a byte, it's okay for them to be packed side-by-side even though the overall alignment of the list elements is 8. This is fine because each of their individual memory addresses will end up being a multiple of their size in bytes.
Note that unlike in the `List Str` example before, there wouldn't be any unused memory between the refcount (or capacity, depending on whether the list was shared or unique) and the first element in the list. That will always be the case when the size of the refcount is no bigger than the alignment of the list's elements.
## Distinguishing between refcount and capacity in the host
If I'm a platform author, and I receive a `List` from the application, it's important that I be able to tell whether I'm dealing with a refcount or a capacity. (The uniqueness type information will have been erased by this time, because some applications will return a Unique list while others return a Shared list, so I need to be able to tell using runtime information only which is which.) This way, I can know to either increment the refcount, or to feel free to mutate it in-place using the capacity value.
We use a very simple system to distinguish the two: if the high bit in that `usize` value is 0, then it's capacity. If it's 1, then it's a refcount.
This has a couple of implications:
- `capacity` actually has a maximum of `isize::MAX`, not `usize::MAX` - because if its high bit flips to 1, then now suddenly it's considered a refcount by the host. As it happens, capacity's maximum value is naturally `isize::MAX` anyway, so there's no downside here.
- `refcount` actually begins at `isize::MIN` and increments towards 0, rather than beginning at 0 and incrementing towards a larger number. When a decrement instruction is executed and the refcount is `isize::MIN`, it gets freed instead. Since all refcounts do is count up and down, and they only ever compare the refcount to a fixed constant, there's no real performance cost to comparing to `isize::MIN` instead of to 0. So this has no significant downside either.
Using this representation, hosts can trivially distinguish any list they receive as being either refcounted or having a capacity value, without any runtime cost in either the refcounted case or the capacity case.
### Saturated reference count
What happens if the reference count overflows? As in, we try to reference the same list more than `isize` times?
In this situation, the reference count becomes unreliable. Suppose we try to increment it 3 more times after it's already been incremented `isize` times, and since we can't store any further numbers without flipping the high bit from 1 to 0 (meaning it will become a capacity value instead of a refcount), we leave it at -1. If we later decrement it `isize` times, we'll be down to `isize::MIN` and will free the memory, even though 3 things are still referencing that memory!
This would be a total disaster, so what we do instead is that we decide to leak the memory. Once the reference count hits -1, we neither increment nor decrement it ever again, which in turn means we will never free it. So -1 is a special reference count meaning "this memory has become unreclaimable, and must never be freed."
This has the downside of being potentially wasteful of the program's memory, but it's less detrimental to user experience than a crash, and it doesn't impact correctness at all.
## Summary of Lists
Lists are a `2 * usize` struct which contains a length and a pointer.
That pointer is a memory address (null in the case of an empty list) which points to the first element in a sequential array of memory.
If that pointer is shared in multiple places, then there will be a `usize` reference count stored right before the first element of the list. There may be unused memory after the refcount if `usize` is smaller than the alignment of one of the list's elements.
Refcounts get incremented each time a list gets shared somewhere, and decremented each time that shared value is no longer referenced by anything else (for example, by going out of scope). Once there are no more references, the list's heap memory can be safely freed. If a reference count gets all the way up to `usize`, then it will never be decremented again and the memory will never be freed.
Whenever a list grows, it will grow in-place if it's Unique and there is enough capacity. (Capacity is stored where a refcount would be in a Shared list.) If there isn't enough capacity - even after trying `realloc` - or if the list is Shared, then instead new heap memory will be allocated, all the necessary elements will get copied into it, and the original list's refcount will be decremented.
## Strings
Strings have several things in common with lists:
- They are a `2 * usize` struct, sometimes with a non-null pointer to some heap memory
- They have a length and a capacity, and they can grow in basically the same way
- They are reference counted in basically the same way
However, they also have two things going on that lists do not:
- The Small String Optimization
- Literals stored in read-only memory
## The Small String Optimization
In practice, a lot of strings are pretty small. For example, the string `"Richard Feldman"` can be stored in 15 UTF-8 bytes. If we stored that string the same way we store a list, then on a 64-bit system we'd need a 16B struct, which would include a pointer to 24B of heap memory (including the refcount/capacity and one unused byte for alignment).
That's a total of 48B to store 15B of data, when we could have fit the whole string into the original 16B we needed for the struct, with one byte left over.
The Small String Optimization is where we store strings directly in the struct, assuming they can fit in there. We reserve one of those bytes to indicate whether this is a Small String or a larger one that actually uses a pointer.
## String Memory Layout
How do we tell small strings apart from nonsmall strings?
We make use of the fact that lengths (for both strings *and* lists) are `usize` values which have a maximum value of `isize::MAX` rather than `usize::MAX`. This is because `List.get` compiles down to an array access operation, and LLVM uses `isize` indices for those because they do signed arithmetic on the pointer in case the caller wants to add a negative number to the address. (We don't want to, as it happens, but that's what the low-level API supports, so we are bound by its limitations.)
Since the string's length is a `usize` value with a maximum of `isize::MAX`, we can be sure that its most significant bit will always be 0, not 1. (If it were a 1, that would be a negative `isize`!) We can use this fact to use that spare bit as a flag indicating whether the string is small: if that bit is a 1, it's a small string; otherwise, it's a nonsmall string.
This makes calculating the length of the string a multi-step process:
1. Get the length field out of the struct.
2. Look at its highest bit. If that bit is 0, return the length as-is.
3. If the bit is 1, then this is a small string, and its length is packed into the highest byte of the `usize` length field we're currently examining. Take that byte and bit shift it by 1 (to drop the `1` flag we used to indicate this is a small string), cast the resulting byte to `usize`, and that's our length. (Actually we bit shift by 4, not 1, because we only need 4 bits to store a length of 0-16, and the leftover 3 bits can potentially be useful in the future.)
Using this strategy with a [conditional move instruction](https://stackoverflow.com/questions/14131096/why-is-a-conditional-move-not-vulnerable-for-branch-prediction-failure), we can always get the length of a `Str` in 2-3 cheap instructions on a single `usize` value, without any chance of a branch misprediction.
Thus, the layout of a small string on a 64-bit big-endian architecture would be:
```text
|-----------usize length field----------|-----------usize pointer field---------|
|-1B-|-1B-|-1B-|-1B-|-1B-|-1B-|-1B-|-1B-|-1B-|-1B-|-1B-|-1B-|-1B-|-1B-|-1B-|-1B-|
len 'R' 'i' 'c' 'h' 'a' 'r' 'd' ' ' 'F' 'e' 'l' 'd' 'm' 'a' 'n'
```
The `len` value here would be the number 15, plus a 1 (to flag that this is a small string) that would always get bit-shifted away. The capacity of a small Unique string is always equal to `2 * usize`, because that's how much you can fit without promoting to a nonsmall string.
## Endianness
The preceding memory layout example works on a big-endian architecture, but most CPUs are little-endian. That means the high bit where we want to store the flag (the 0 or 1
that would make an `isize` either negative or positive) will actually be the `usize`'s last byte rather than its first byte.
That means we'd have to move swap the order of the struct's length and pointer fields. Here's how the string `"Roc string"` would be stored on a little-endian system:
```text
|-----------usize pointer field---------|-----------usize length field----------|
|-1B-|-1B-|-1B-|-1B-|-1B-|-1B-|-1B-|-1B-|-1B-|-1B-|-1B-|-1B-|-1B-|-1B-|-1B-|-1B-|
'R' 'o' 'c' ' ' 's' 't' 'r' 'i' 'n' 'g' 0 0 0 0 0 len
```
Here, `len` would have the same format as before (including the extra 1 in the same position, which we'd bit shift away) except that it'd store a length of 10 instead of 15.
Notice that the leftover bytes are stored as zeroes. This is handy because it means we can convert small Roc strings into C strings (which are 0-terminated) for free as long as they have at least one unused byte. Also notice that `usize pointer field` and `usize length field` have been swapped compared to the preceding example!
## Storing string literals in read-only memory

View File

@ -1,71 +0,0 @@
//! Provides `Roc` styled collection [reference counting](https://en.wikipedia.org/wiki/Reference_counting).
//! This means the collection may or may not be safe to mutate in-place, may or
//! may not be reference counted, and may or may not need to be freed when no
//! longer in use. Whether each of these is true for a given collection can be
//! determined by inspecting that collection at runtime.
#![crate_type = "lib"]
#![no_std]
/// Str does Roc-style collection reference counting, which means the collection
/// may or may not be safe to mutate in-place, may or may not be reference counted,
/// and may or may not need to be freed when no longer in use. Whether each of
/// these is true for a given collection can be determined by inspecting
/// that collection at runtime.
///
/// Details:
///
/// 1. If the collection is empty, it does not allocate on the heap.
/// 2. If it is nonempty, its pointer points to the first element of a "backing array" on the heap.
/// 3. There is an extra `isize` right before that backing array (still on the heap) which stores the
/// "flexible reference count" ("flexcount" for short).
/// 4. The flexcount can refer to one of three things, depending on whether it is positive,
/// negative, or zero.
/// 5. If the flexcount is positive, then it's a capacity. The capacity refers to the number of
/// collection elements in the backing array. This collection can be mutated in-place, until it
/// runs out of capacity. At that point, it will need a new backing array. Once it goes out of
/// scope, the backing array should be freed by the system allocator - but free() must be passed
/// a pointer to the flexcount slot, not to element 0 (because the flexcount slot is where the
/// original allocation began). Capacity will always be at least 1, because otherwise we would
/// not have allocated on the heap in the first place.
/// 6. If the flexcount is 0, then this collection resides in readonly memory. That means it cannot
/// be mutated in-place (and attempting to do so will segfault), and it must not be attempted to
/// be freed. It exists in memory forever!
/// 7. If the flexcount is negative, then it is a reference count. Treat the collection as immutable, just like
/// if the flexcount were 0, except free it when there are no more references to it. Instead of the reference count
/// starting at 0 or 1 and incrementing when new references are added, this refcount starts with all bits being 1 (so, isize::MIN) and
/// increments towards 0 when new references are added. When a reference is removed, if all bits are 1, then it should be freed. If so many new references are added that it gets incremented all the way from isize::MAX to 0, then, as is best practice when running out of reference counts, it will leak. (Leaking memory is typically less bad than crashing, and this should essentially never happen.) This happens automatically because when the flexcount is 0, it's assumed that the collection is in readonly memory and should not be freed - which is nice because it means there is no extra conditional required to implement this edge case.
/// 8. If a collection has a refcount of isize::MIN (meaning nothing else references it), it may or may not be safe to convert it to a capacity,
/// depending on whether it contains other refcounted collections. For example, a Str
/// is a collection of all bytes, so if it has a refcount of all 1 bits, it can be safely
/// converted to a capacity (the initial capacity should be equal to the collection's length),
/// after which point it can be safely mutated in-place. However, a refcounted List of Lists with a refcount of isize::MIN will not be safe to convert to a capacity, unless the inner Lists also happen to have refcounts of isize::MIN. This is because mutate-in-place operations like removing an element from a list do not check for refcounts in the elements they remove, which means removing an element from the newly mutable-in-place list would cause memory leaks in its refcounted contents. (They'd have been removed, but their reference counts would not have been adjusted accordingly.)
///
/// Note that because of these runtime conditionals, modifying and freeing Roc collections are both
/// cheaper operations in generated Roc code than in host code. Since the Roc compiler knows
/// statically whether a collection is refcounted, unique, or readonly, it does not bother with
/// these checks at runtime. A host, however, cannot have that information statically (since it may be different
/// for different applications), and so must check at runtime instead.
struct Str {
bytes: [16, u8];
}
#[no_mangle]
pub fn empty_() -> Str {
Str {
bytes : [0; 16]
}
}
#[no_mangle]
pub fn len_(string: Str) -> usize {
let disc = discriminant(str);
if disc == 0 {
// It's a
}
}
#[inline(always)]
fn discriminant(string: &Str) -> u8 {
// cast the first 8 bytes to be u64, return its lsbyte
}

View File

@ -1,35 +1,34 @@
[package]
name = "test_derive"
version = "0.0.1"
authors = ["The Roc Contributors"]
license = "UPL-1.0"
edition = "2021"
description = "Tests Roc's auto-derivers."
authors.workspace = true
edition.workspace = true
license.workspace = true
version.workspace = true
[[test]]
name = "test_derive"
path = "src/tests.rs"
[dev-dependencies]
roc_collections = { path = "../collections" }
roc_module = { path = "../module" }
roc_builtins = { path = "../builtins" }
roc_load_internal = { path = "../load_internal" }
roc_can = { path = "../can" }
roc_derive_key = { path = "../derive_key" }
roc_collections = { path = "../collections" }
roc_constrain = { path = "../constrain" }
roc_debug_flags = { path = "../debug_flags" }
roc_derive = { path = "../derive", features = ["debug-derived-symbols", "open-extension-vars"] }
roc_derive_key = { path = "../derive_key" }
roc_load_internal = { path = "../load_internal" }
roc_module = { path = "../module" }
roc_packaging = { path = "../../packaging" }
roc_region = { path = "../region" }
roc_reporting = { path = "../../reporting" }
roc_solve = { path = "../solve" }
roc_target = { path = "../roc_target" }
roc_types = { path = "../types" }
roc_packaging = { path = "../../packaging" }
roc_reporting = { path = "../../reporting" }
roc_constrain = { path = "../constrain" }
roc_region = { path = "../region" }
roc_solve = { path = "../solve" }
roc_debug_flags = { path = "../debug_flags" }
ven_pretty = { path = "../../vendor/pretty" }
bumpalo.workspace = true
indoc.workspace = true
pretty_assertions.workspace = true
insta.workspace = true

View File

@ -1,11 +1,12 @@
[package]
name = "test_gen"
version = "0.0.1"
authors = ["The Roc Contributors"]
license = "UPL-1.0"
edition = "2021"
description = "Contains all of Roc's code generation tests."
authors.workspace = true
edition.workspace = true
license.workspace = true
version.workspace = true
[[test]]
name = "test_gen"
path = "src/tests.rs"
@ -14,54 +15,58 @@ path = "src/tests.rs"
roc_builtins = { path = "../builtins" }
roc_utils = { path = "../../utils" }
wasi_libc_sys = { path = "../../wasi-libc-sys" }
tempfile.workspace = true
[dev-dependencies]
roc_gen_llvm = { path = "../gen_llvm" }
roc_gen_dev = { path = "../gen_dev" }
roc_gen_wasm = { path = "../gen_wasm" }
roc_collections = { path = "../collections" }
roc_region = { path = "../region" }
roc_module = { path = "../module" }
roc_problem = { path = "../problem" }
roc_types = { path = "../types" }
roc_build = { path = "../build", features = ["target-aarch64", "target-x86_64", "target-wasm32"] }
roc_builtins = { path = "../builtins" }
roc_can = { path = "../can" }
roc_collections = { path = "../collections" }
roc_constrain = { path = "../constrain" }
roc_unify = { path = "../unify" }
roc_utils = { path = "../../utils" }
roc_solve = { path = "../solve" }
roc_debug_flags = { path = "../debug_flags" }
roc_error_macros = { path = "../../error_macros" }
roc_gen_dev = { path = "../gen_dev" }
roc_gen_llvm = { path = "../gen_llvm" }
roc_gen_wasm = { path = "../gen_wasm" }
roc_load = { path = "../load" }
roc_module = { path = "../module" }
roc_mono = { path = "../mono" }
roc_packaging = { path = "../../packaging" }
roc_reporting = { path = "../../reporting" }
roc_load = { path = "../load" }
roc_can = { path = "../can" }
roc_parse = { path = "../parse" }
roc_build = { path = "../build", features = ["target-aarch64", "target-x86_64", "target-wasm32"] }
roc_problem = { path = "../problem" }
roc_region = { path = "../region" }
roc_reporting = { path = "../../reporting" }
roc_solve = { path = "../solve" }
roc_std = { path = "../../roc_std" }
roc_target = { path = "../roc_target" }
roc_error_macros = { path = "../../error_macros" }
roc_std = { path = "../../roc_std" }
roc_debug_flags = {path="../debug_flags"}
roc_wasm_module = {path="../../wasm_module"}
roc_wasm_interp = {path="../../wasm_interp"}
roc_types = { path = "../types" }
roc_unify = { path = "../unify" }
roc_utils = { path = "../../utils" }
roc_wasm_interp = { path = "../../wasm_interp" }
roc_wasm_module = { path = "../../wasm_module" }
bumpalo.workspace = true
criterion.workspace = true
indoc.workspace = true
inkwell.workspace = true
lazy_static.workspace = true
libc.workspace = true
libloading.workspace = true
criterion.workspace = true
tempfile.workspace = true
indoc.workspace = true
lazy_static.workspace = true
inkwell.workspace = true
target-lexicon.workspace = true
tempfile.workspace = true
[features]
default = ["gen-llvm"]
gen-llvm = []
gen-dev = []
gen-wasm = []
gen-llvm = []
gen-llvm-wasm = ["gen-llvm"]
gen-wasm = []
[[bench]]
name = "list_map"
harness = false
[package.metadata.cargo-udeps.ignore]
development = ["roc_wasm_interp"]

View File

@ -1,25 +1,26 @@
[package]
name = "test_mono"
version = "0.0.1"
authors = ["The Roc Contributors"]
license = "UPL-1.0"
edition = "2021"
description = "Tests Roc's generation of the mono intermediate representation."
authors.workspace = true
edition.workspace = true
license.workspace = true
version.workspace = true
[[test]]
name = "test_mono"
path = "src/tests.rs"
[dev-dependencies]
roc_collections = { path = "../collections" }
roc_module = { path = "../module", features = ["debug-symbols"] }
roc_builtins = { path = "../builtins" }
roc_load = { path = "../load" }
roc_can = { path = "../can" }
roc_collections = { path = "../collections" }
roc_load = { path = "../load" }
roc_module = { path = "../module", features = ["debug-symbols"] }
roc_mono = { path = "../mono" }
roc_target = { path = "../roc_target" }
roc_packaging = { path = "../../packaging" }
roc_reporting = { path = "../../reporting" }
roc_target = { path = "../roc_target" }
roc_tracing = { path = "../../tracing" }
test_mono_macros = { path = "../test_mono_macros" }

View File

@ -23,19 +23,19 @@ procedure Test.4 (Test.5, Test.3):
jump Test.19 Test.20;
default:
let Test.21 : I64 = CallByName Test.7 Test.18;
jump Test.19 Test.21;
let Test.20 : I64 = CallByName Test.7 Test.18;
jump Test.19 Test.20;
procedure Test.6 (Test.22):
let Test.25 : Int1 = true;
let Test.24 : I64 = CallByName Test.2;
let Test.23 : I64 = CallByName Test.4 Test.25 Test.24;
ret Test.23;
procedure Test.6 (Test.21):
let Test.24 : Int1 = true;
let Test.23 : I64 = CallByName Test.2;
let Test.22 : I64 = CallByName Test.4 Test.24 Test.23;
ret Test.22;
procedure Test.7 (Test.26):
let Test.27 : I64 = 10i64;
ret Test.27;
procedure Test.7 (Test.25):
let Test.26 : I64 = 10i64;
ret Test.26;
procedure Test.0 ():
let Test.11 : Int1 = false;

View File

@ -0,0 +1,34 @@
procedure Bool.1 ():
let Bool.23 : Int1 = false;
ret Bool.23;
procedure Num.19 (#Attr.2, #Attr.3):
let Num.256 : I64 = lowlevel NumAdd #Attr.2 #Attr.3;
ret Num.256;
procedure Test.3 (Test.4):
ret Test.4;
procedure Test.0 (Test.14):
joinpoint Test.5 Test.1:
joinpoint Test.10 Test.2:
let Test.8 : I64 = 1i64;
let Test.7 : I64 = CallByName Num.19 Test.1 Test.8;
switch Test.2:
case 0:
jump Test.5 Test.7;
default:
let Test.6 : I64 = CallByName Test.3 Test.7;
ret Test.6;
in
let Test.12 : Int1 = CallByName Bool.1;
if Test.12 then
let Test.9 : Int1 = false;
jump Test.10 Test.9;
else
let Test.9 : Int1 = true;
jump Test.10 Test.9;
in
jump Test.5 Test.14;

View File

@ -0,0 +1,60 @@
procedure Num.19 (#Attr.2, #Attr.3):
let Num.258 : I64 = lowlevel NumAdd #Attr.2 #Attr.3;
ret Num.258;
procedure Test.2 (Test.3):
switch Test.3:
case 0:
let Test.16 : U8 = 0u8;
ret Test.16;
case 1:
let Test.17 : U8 = 1u8;
ret Test.17;
case 2:
let Test.19 : U8 = 2u8;
ret Test.19;
default:
let Test.22 : U8 = 3u8;
ret Test.22;
procedure Test.4 (Test.5):
ret Test.5;
procedure Test.6 (Test.7):
let Test.21 : I64 = 1i64;
let Test.20 : I64 = CallByName Num.19 Test.7 Test.21;
ret Test.20;
procedure Test.8 (Test.9):
let Test.24 : I64 = 2i64;
let Test.23 : I64 = CallByName Num.19 Test.9 Test.24;
ret Test.23;
procedure Test.0 (Test.30):
joinpoint Test.11 Test.1:
let Test.25 : I64 = 1i64;
let Test.13 : I64 = CallByName Num.19 Test.1 Test.25;
let Test.15 : U8 = 0u8;
let Test.14 : U8 = CallByName Test.2 Test.15;
switch Test.14:
case 0:
jump Test.11 Test.13;
case 1:
let Test.12 : I64 = CallByName Test.4 Test.13;
ret Test.12;
case 2:
let Test.12 : I64 = CallByName Test.6 Test.13;
ret Test.12;
default:
let Test.12 : I64 = CallByName Test.8 Test.13;
ret Test.12;
in
jump Test.11 Test.30;

View File

@ -0,0 +1,36 @@
procedure Num.19 (#Attr.2, #Attr.3):
let Num.257 : I64 = lowlevel NumAdd #Attr.2 #Attr.3;
ret Num.257;
procedure Test.2 (Test.3, Test.1):
let Test.17 : Int1 = false;
let Test.18 : Int1 = lowlevel Eq Test.17 Test.3;
if Test.18 then
let Test.13 : [C , C I64] = TagId(0) ;
ret Test.13;
else
let Test.14 : [C , C I64] = TagId(1) Test.1;
ret Test.14;
procedure Test.4 (Test.5, #Attr.12):
let Test.1 : I64 = UnionAtIndex (Id 1) (Index 0) #Attr.12;
let Test.16 : I64 = CallByName Num.19 Test.5 Test.1;
ret Test.16;
procedure Test.0 (Test.25):
joinpoint Test.7 Test.1:
let Test.20 : I64 = 1i64;
let Test.9 : I64 = CallByName Num.19 Test.1 Test.20;
let Test.12 : Int1 = false;
let Test.10 : [C , C I64] = CallByName Test.2 Test.12 Test.1;
let Test.11 : U8 = GetTagId Test.10;
switch Test.11:
case 0:
jump Test.7 Test.9;
default:
let Test.8 : I64 = CallByName Test.4 Test.9 Test.10;
ret Test.8;
in
jump Test.7 Test.25;

View File

@ -8,11 +8,11 @@ procedure Bool.4 (#Attr.2, #Attr.3):
procedure Test.1 (Test.2, Test.3):
let Test.17 : {Int1, Int1} = Struct {Test.2, Test.3};
let Test.34 : Int1 = StructAtIndex 0 Test.17;
let Test.33 : Int1 = StructAtIndex 1 Test.17;
let Test.19 : Int1 = CallByName Test.1 Test.33 Test.34;
let Test.27 : {} = Struct {};
joinpoint Test.28 Test.21:
let Test.32 : Int1 = StructAtIndex 0 Test.17;
let Test.31 : Int1 = StructAtIndex 1 Test.17;
let Test.19 : Int1 = CallByName Test.1 Test.31 Test.32;
let Test.26 : {} = Struct {};
joinpoint Test.27 Test.21:
let Test.23 : {} = Struct {};
joinpoint Test.24 Test.22:
let Test.20 : Int1 = CallByName Bool.11 Test.21 Test.22;
@ -21,36 +21,36 @@ procedure Test.1 (Test.2, Test.3):
let Test.18 : Int1 = CallByName Bool.4 Test.19 Test.20;
ret Test.18;
in
switch Test.33:
switch Test.31:
case 0:
let Test.25 : Str = CallByName Test.9 Test.23;
jump Test.24 Test.25;
default:
let Test.26 : Str = CallByName Test.11 Test.23;
jump Test.24 Test.26;
let Test.25 : Str = CallByName Test.11 Test.23;
jump Test.24 Test.25;
in
switch Test.34:
switch Test.32:
case 0:
let Test.29 : Str = CallByName Test.9 Test.27;
jump Test.28 Test.29;
let Test.28 : Str = CallByName Test.9 Test.26;
jump Test.27 Test.28;
default:
let Test.30 : Str = CallByName Test.11 Test.27;
jump Test.28 Test.30;
let Test.28 : Str = CallByName Test.11 Test.26;
jump Test.27 Test.28;
procedure Test.11 (Test.36):
let Test.37 : Str = "a";
ret Test.37;
procedure Test.11 (Test.34):
let Test.35 : Str = "a";
ret Test.35;
procedure Test.9 (Test.39):
let Test.40 : Str = "a";
ret Test.40;
procedure Test.9 (Test.37):
let Test.38 : Str = "a";
ret Test.38;
procedure Test.0 ():
let Test.38 : Int1 = false;
let Test.35 : Int1 = true;
let Test.13 : Int1 = CallByName Test.1 Test.38 Test.35;
let Test.36 : Int1 = false;
let Test.33 : Int1 = true;
let Test.13 : Int1 = CallByName Test.1 Test.36 Test.33;
ret Test.13;

View File

@ -7,48 +7,45 @@ procedure Num.94 (#Attr.2):
ret Num.257;
procedure Test.1 (Test.4):
let Test.16 : [C U8, C U64] = TagId(1) Test.4;
ret Test.16;
let Test.13 : [C U8, C U64] = TagId(1) Test.4;
ret Test.13;
procedure Test.1 (Test.4):
let Test.22 : [C U8, C U64] = TagId(0) Test.4;
ret Test.22;
procedure Test.5 (Test.17, #Attr.12):
let Test.4 : U64 = UnionAtIndex (Id 1) (Index 0) #Attr.12;
let Test.19 : Str = CallByName Num.94 Test.4;
let Test.19 : [C U8, C U64] = TagId(0) Test.4;
ret Test.19;
procedure Test.5 (Test.17, #Attr.12):
procedure Test.5 (Test.14, #Attr.12):
let Test.4 : U64 = UnionAtIndex (Id 1) (Index 0) #Attr.12;
let Test.16 : Str = CallByName Num.94 Test.4;
ret Test.16;
procedure Test.5 (Test.14, #Attr.12):
let Test.4 : U8 = UnionAtIndex (Id 0) (Index 0) #Attr.12;
let Test.25 : Str = CallByName Num.94 Test.4;
ret Test.25;
let Test.22 : Str = CallByName Num.94 Test.4;
ret Test.22;
procedure Test.0 ():
let Test.2 : Int1 = true;
joinpoint Test.13 Test.3:
joinpoint Test.10 Test.3:
let Test.8 : {} = Struct {};
let Test.9 : U8 = GetTagId Test.3;
joinpoint Test.10 Test.7:
ret Test.7;
in
switch Test.9:
case 0:
let Test.11 : Str = CallByName Test.5 Test.8 Test.3;
jump Test.10 Test.11;
let Test.7 : Str = CallByName Test.5 Test.8 Test.3;
ret Test.7;
default:
let Test.12 : Str = CallByName Test.5 Test.8 Test.3;
jump Test.10 Test.12;
let Test.7 : Str = CallByName Test.5 Test.8 Test.3;
ret Test.7;
in
let Test.26 : Int1 = true;
let Test.27 : Int1 = lowlevel Eq Test.26 Test.2;
if Test.27 then
let Test.15 : U64 = 123i64;
let Test.14 : [C U8, C U64] = CallByName Test.1 Test.15;
jump Test.13 Test.14;
let Test.23 : Int1 = true;
let Test.24 : Int1 = lowlevel Eq Test.23 Test.2;
if Test.24 then
let Test.12 : U64 = 123i64;
let Test.11 : [C U8, C U64] = CallByName Test.1 Test.12;
jump Test.10 Test.11;
else
let Test.21 : U8 = 18i64;
let Test.20 : [C U8, C U64] = CallByName Test.1 Test.21;
jump Test.13 Test.20;
let Test.18 : U8 = 18i64;
let Test.17 : [C U8, C U64] = CallByName Test.1 Test.18;
jump Test.10 Test.17;

View File

@ -1,83 +1,80 @@
procedure Test.11 (Test.37):
let Test.38 : Str = "";
ret Test.38;
procedure Test.11 (Test.34):
let Test.35 : Str = "";
ret Test.35;
procedure Test.13 (Test.51, Test.12):
procedure Test.13 (Test.48, Test.12):
ret Test.12;
procedure Test.15 (Test.39):
let Test.40 : Str = "";
ret Test.40;
procedure Test.15 (Test.36):
let Test.37 : Str = "";
ret Test.37;
procedure Test.16 (Test.54):
let Test.56 : Str = "s1";
ret Test.56;
procedure Test.16 (Test.51):
let Test.53 : Str = "s1";
ret Test.53;
procedure Test.2 (Test.7, Test.8):
let Test.30 : [C {} {}, C {} {}] = TagId(1) Test.7 Test.8;
ret Test.30;
let Test.27 : [C {} {}, C {} {}] = TagId(1) Test.7 Test.8;
ret Test.27;
procedure Test.2 (Test.7, Test.8):
let Test.44 : [C {} {}, C {} {}] = TagId(0) Test.7 Test.8;
ret Test.44;
let Test.41 : [C {} {}, C {} {}] = TagId(0) Test.7 Test.8;
ret Test.41;
procedure Test.3 (Test.17):
let Test.36 : {} = Struct {};
ret Test.36;
let Test.33 : {} = Struct {};
ret Test.33;
procedure Test.4 (Test.18):
inc Test.18;
ret Test.18;
procedure Test.9 (Test.29, #Attr.12):
procedure Test.9 (Test.26, #Attr.12):
let Test.8 : {} = UnionAtIndex (Id 0) (Index 1) #Attr.12;
let Test.7 : {} = UnionAtIndex (Id 0) (Index 0) #Attr.12;
let Test.49 : {} = Struct {};
let Test.48 : Str = CallByName Test.16 Test.49;
let Test.45 : Str = CallByName Test.4 Test.48;
dec Test.48;
let Test.47 : {} = Struct {};
let Test.46 : Str = CallByName Test.13 Test.47 Test.45;
ret Test.46;
let Test.46 : {} = Struct {};
let Test.45 : Str = CallByName Test.16 Test.46;
let Test.42 : Str = CallByName Test.4 Test.45;
dec Test.45;
let Test.44 : {} = Struct {};
let Test.43 : Str = CallByName Test.13 Test.44 Test.42;
ret Test.43;
procedure Test.9 (Test.29, #Attr.12):
procedure Test.9 (Test.26, #Attr.12):
let Test.8 : {} = UnionAtIndex (Id 1) (Index 1) #Attr.12;
let Test.7 : {} = UnionAtIndex (Id 1) (Index 0) #Attr.12;
let Test.35 : {} = Struct {};
let Test.34 : Str = CallByName Test.15 Test.35;
let Test.31 : {} = CallByName Test.3 Test.34;
dec Test.34;
let Test.33 : {} = Struct {};
let Test.32 : Str = CallByName Test.11 Test.33;
ret Test.32;
let Test.32 : {} = Struct {};
let Test.31 : Str = CallByName Test.15 Test.32;
let Test.28 : {} = CallByName Test.3 Test.31;
dec Test.31;
let Test.30 : {} = Struct {};
let Test.29 : Str = CallByName Test.11 Test.30;
ret Test.29;
procedure Test.0 ():
let Test.5 : Int1 = true;
joinpoint Test.25 Test.6:
joinpoint Test.22 Test.6:
let Test.20 : {} = Struct {};
let Test.21 : U8 = GetTagId Test.6;
joinpoint Test.22 Test.19:
ret Test.19;
in
switch Test.21:
case 0:
let Test.23 : Str = CallByName Test.9 Test.20 Test.6;
jump Test.22 Test.23;
let Test.19 : Str = CallByName Test.9 Test.20 Test.6;
ret Test.19;
default:
let Test.24 : Str = CallByName Test.9 Test.20 Test.6;
jump Test.22 Test.24;
let Test.19 : Str = CallByName Test.9 Test.20 Test.6;
ret Test.19;
in
let Test.57 : Int1 = true;
let Test.58 : Int1 = lowlevel Eq Test.57 Test.5;
if Test.58 then
let Test.27 : {} = Struct {};
let Test.28 : {} = Struct {};
let Test.26 : [C {} {}, C {} {}] = CallByName Test.2 Test.27 Test.28;
jump Test.25 Test.26;
let Test.54 : Int1 = true;
let Test.55 : Int1 = lowlevel Eq Test.54 Test.5;
if Test.55 then
let Test.24 : {} = Struct {};
let Test.25 : {} = Struct {};
let Test.23 : [C {} {}, C {} {}] = CallByName Test.2 Test.24 Test.25;
jump Test.22 Test.23;
else
let Test.42 : {} = Struct {};
let Test.43 : {} = Struct {};
let Test.41 : [C {} {}, C {} {}] = CallByName Test.2 Test.42 Test.43;
jump Test.25 Test.41;
let Test.39 : {} = Struct {};
let Test.40 : {} = Struct {};
let Test.38 : [C {} {}, C {} {}] = CallByName Test.2 Test.39 Test.40;
jump Test.22 Test.38;

View File

@ -1,59 +1,56 @@
procedure Test.1 (Test.5):
let Test.19 : [C , C {}, C U64] = TagId(1) Test.5;
ret Test.19;
let Test.15 : [C , C {}, C U64] = TagId(1) Test.5;
ret Test.15;
procedure Test.1 (Test.5):
let Test.27 : [C , C {}, C U64] = TagId(2) Test.5;
ret Test.27;
let Test.23 : [C , C {}, C U64] = TagId(2) Test.5;
ret Test.23;
procedure Test.2 (Test.8):
let Test.24 : Str = "";
ret Test.24;
let Test.20 : Str = "";
ret Test.20;
procedure Test.6 (Test.20, #Attr.12):
procedure Test.6 (Test.16, #Attr.12):
let Test.5 : U64 = UnionAtIndex (Id 2) (Index 0) #Attr.12;
let Test.30 : Str = "";
ret Test.30;
let Test.26 : Str = "";
ret Test.26;
procedure Test.6 (Test.20, #Attr.12):
procedure Test.6 (Test.16, #Attr.12):
let Test.5 : {} = UnionAtIndex (Id 1) (Index 0) #Attr.12;
let Test.22 : Str = "";
ret Test.22;
let Test.18 : Str = "";
ret Test.18;
procedure Test.0 ():
let Test.3 : U8 = 0u8;
joinpoint Test.16 Test.4:
joinpoint Test.12 Test.4:
let Test.10 : {} = Struct {};
let Test.11 : U8 = GetTagId Test.4;
joinpoint Test.12 Test.9:
ret Test.9;
in
switch Test.11:
case 0:
let Test.13 : Str = CallByName Test.2 Test.10;
jump Test.12 Test.13;
let Test.9 : Str = CallByName Test.2 Test.10;
ret Test.9;
case 1:
let Test.14 : Str = CallByName Test.6 Test.10 Test.4;
jump Test.12 Test.14;
let Test.9 : Str = CallByName Test.6 Test.10 Test.4;
ret Test.9;
default:
let Test.15 : Str = CallByName Test.6 Test.10 Test.4;
jump Test.12 Test.15;
let Test.9 : Str = CallByName Test.6 Test.10 Test.4;
ret Test.9;
in
switch Test.3:
case 0:
let Test.18 : {} = Struct {};
let Test.17 : [C , C {}, C U64] = CallByName Test.1 Test.18;
jump Test.16 Test.17;
let Test.14 : {} = Struct {};
let Test.13 : [C , C {}, C U64] = CallByName Test.1 Test.14;
jump Test.12 Test.13;
case 1:
let Test.23 : [C , C {}, C U64] = TagId(0) ;
jump Test.16 Test.23;
let Test.19 : [C , C {}, C U64] = TagId(0) ;
jump Test.12 Test.19;
default:
let Test.26 : U64 = 1i64;
let Test.25 : [C , C {}, C U64] = CallByName Test.1 Test.26;
jump Test.16 Test.25;
let Test.22 : U64 = 1i64;
let Test.21 : [C , C {}, C U64] = CallByName Test.1 Test.22;
jump Test.12 Test.21;

View File

@ -1,28 +1,28 @@
procedure Test.1 (Test.5):
let Test.20 : [C {}, C U64, C Str] = TagId(0) Test.5;
ret Test.20;
let Test.16 : [C {}, C U64, C Str] = TagId(0) Test.5;
ret Test.16;
procedure Test.1 (Test.5):
let Test.32 : [C {}, C U64, C Str] = TagId(1) Test.5;
ret Test.32;
let Test.28 : [C {}, C U64, C Str] = TagId(1) Test.5;
ret Test.28;
procedure Test.2 (Test.7):
let Test.26 : [C {}, C U64, C Str] = TagId(2) Test.7;
ret Test.26;
let Test.22 : [C {}, C U64, C Str] = TagId(2) Test.7;
ret Test.22;
procedure Test.6 (Test.21, #Attr.12):
procedure Test.6 (Test.17, #Attr.12):
let Test.5 : U64 = UnionAtIndex (Id 1) (Index 0) #Attr.12;
dec #Attr.12;
let Test.35 : Str = "";
ret Test.35;
let Test.31 : Str = "";
ret Test.31;
procedure Test.6 (Test.21, #Attr.12):
procedure Test.6 (Test.17, #Attr.12):
let Test.5 : {} = UnionAtIndex (Id 0) (Index 0) #Attr.12;
dec #Attr.12;
let Test.23 : Str = "";
ret Test.23;
let Test.19 : Str = "";
ret Test.19;
procedure Test.8 (Test.27, #Attr.12):
procedure Test.8 (Test.23, #Attr.12):
let Test.7 : Str = UnionAtIndex (Id 2) (Index 0) #Attr.12;
inc Test.7;
dec #Attr.12;
@ -30,39 +30,36 @@ procedure Test.8 (Test.27, #Attr.12):
procedure Test.0 ():
let Test.3 : U8 = 0u8;
joinpoint Test.17 Test.4:
joinpoint Test.13 Test.4:
let Test.11 : {} = Struct {};
let Test.12 : U8 = GetTagId Test.4;
joinpoint Test.13 Test.10:
ret Test.10;
in
switch Test.12:
case 0:
let Test.14 : Str = CallByName Test.6 Test.11 Test.4;
jump Test.13 Test.14;
let Test.10 : Str = CallByName Test.6 Test.11 Test.4;
ret Test.10;
case 1:
let Test.15 : Str = CallByName Test.6 Test.11 Test.4;
jump Test.13 Test.15;
let Test.10 : Str = CallByName Test.6 Test.11 Test.4;
ret Test.10;
default:
let Test.16 : Str = CallByName Test.8 Test.11 Test.4;
jump Test.13 Test.16;
let Test.10 : Str = CallByName Test.8 Test.11 Test.4;
ret Test.10;
in
switch Test.3:
case 0:
let Test.19 : {} = Struct {};
let Test.18 : [C {}, C U64, C Str] = CallByName Test.1 Test.19;
jump Test.17 Test.18;
let Test.15 : {} = Struct {};
let Test.14 : [C {}, C U64, C Str] = CallByName Test.1 Test.15;
jump Test.13 Test.14;
case 1:
let Test.25 : Str = "foo";
let Test.24 : [C {}, C U64, C Str] = CallByName Test.2 Test.25;
jump Test.17 Test.24;
let Test.21 : Str = "foo";
let Test.20 : [C {}, C U64, C Str] = CallByName Test.2 Test.21;
jump Test.13 Test.20;
default:
let Test.31 : U64 = 1i64;
let Test.30 : [C {}, C U64, C Str] = CallByName Test.1 Test.31;
jump Test.17 Test.30;
let Test.27 : U64 = 1i64;
let Test.26 : [C {}, C U64, C Str] = CallByName Test.1 Test.27;
jump Test.13 Test.26;

View File

@ -15,26 +15,23 @@ procedure Num.21 (#Attr.2, #Attr.3):
ret Num.257;
procedure Test.0 (Test.8):
let Test.23 : Int1 = CallByName Bool.2;
if Test.23 then
let Test.24 : Int1 = true;
ret Test.24;
let Test.20 : Int1 = CallByName Bool.2;
if Test.20 then
let Test.21 : Int1 = true;
ret Test.21;
else
let Test.22 : Int1 = false;
ret Test.22;
let Test.19 : Int1 = false;
ret Test.19;
procedure Test.5 (Test.6, Test.2):
joinpoint Test.19 Test.18:
ret Test.18;
in
switch Test.2:
case 0:
let Test.20 : U64 = CallByName Num.19 Test.6 Test.6;
jump Test.19 Test.20;
let Test.18 : U64 = CallByName Num.19 Test.6 Test.6;
ret Test.18;
default:
let Test.21 : U64 = CallByName Num.21 Test.6 Test.6;
jump Test.19 Test.21;
let Test.18 : U64 = CallByName Num.21 Test.6 Test.6;
ret Test.18;
procedure Test.7 ():

View File

@ -2,18 +2,18 @@ procedure Bool.2 ():
let Bool.23 : Int1 = true;
ret Bool.23;
procedure Test.10 (Test.28):
let Test.32 : Int1 = CallByName Bool.2;
if Test.32 then
let Test.33 : [<rnu><null>, C {}] = CallByName Test.0;
ret Test.33;
procedure Test.10 (Test.25):
let Test.29 : Int1 = CallByName Bool.2;
if Test.29 then
let Test.30 : [<rnu><null>, C {}] = CallByName Test.0;
ret Test.30;
else
let Test.29 : [<rnu><null>, C {}] = TagId(1) ;
ret Test.29;
let Test.26 : [<rnu><null>, C {}] = TagId(1) ;
ret Test.26;
procedure Test.11 (Test.30):
let Test.31 : Str = "done";
ret Test.31;
procedure Test.11 (Test.27):
let Test.28 : Str = "done";
ret Test.28;
procedure Test.2 (Test.5):
let Test.17 : [<rnu><null>, C {}] = TagId(0) Test.5;
@ -27,27 +27,24 @@ procedure Test.6 (Test.16, #Attr.12):
let Test.5 : {} = UnionAtIndex (Id 0) (Index 0) #Attr.12;
dec #Attr.12;
let Test.19 : {} = Struct {};
let Test.25 : Str = "foobar";
let Test.20 : [<rnu><null>, C {}] = CallByName Test.8 Test.25 Test.5;
dec Test.25;
let Test.22 : Str = "foobar";
let Test.20 : [<rnu><null>, C {}] = CallByName Test.8 Test.22 Test.5;
dec Test.22;
let Test.21 : U8 = GetTagId Test.20;
joinpoint Test.22 Test.18:
ret Test.18;
in
switch Test.21:
case 0:
let Test.23 : Str = CallByName Test.6 Test.19 Test.20;
jump Test.22 Test.23;
let Test.18 : Str = CallByName Test.6 Test.19 Test.20;
ret Test.18;
default:
dec Test.20;
let Test.24 : Str = CallByName Test.11 Test.19;
jump Test.22 Test.24;
let Test.18 : Str = CallByName Test.11 Test.19;
ret Test.18;
procedure Test.8 (Test.9, Test.7):
let Test.27 : [<rnu><null>, C {}] = CallByName Test.10 Test.9;
ret Test.27;
let Test.24 : [<rnu><null>, C {}] = CallByName Test.10 Test.9;
ret Test.24;
procedure Test.0 ():
let Test.13 : {} = Struct {};

View File

@ -14,27 +14,26 @@ procedure Test.11 (Test.29, #Attr.12):
procedure Test.11 (Test.29, Test.10):
ret Test.10;
procedure Test.14 (Test.36, #Attr.12):
let Test.12 : {} = UnionAtIndex (Id 1) (Index 1) #Attr.12;
let Test.13 : I64 = UnionAtIndex (Id 1) (Index 0) #Attr.12;
dec #Attr.12;
let Test.46 : {} = Struct {};
let Test.45 : {} = CallByName Test.11 Test.46 Test.12;
let Test.38 : [<r>C {}, C I64 {}] = CallByName Test.9 Test.45 Test.13;
let Test.40 : {} = Struct {};
let Test.41 : U8 = GetTagId Test.38;
joinpoint Test.42 Test.39:
ret Test.39;
procedure Test.14 (Test.62, Test.63):
joinpoint Test.37 Test.36 #Attr.12:
let Test.12 : {} = UnionAtIndex (Id 1) (Index 1) #Attr.12;
let Test.13 : I64 = UnionAtIndex (Id 1) (Index 0) #Attr.12;
dec #Attr.12;
let Test.43 : {} = Struct {};
let Test.42 : {} = CallByName Test.11 Test.43 Test.12;
let Test.38 : [<r>C {}, C I64 {}] = CallByName Test.9 Test.42 Test.13;
let Test.40 : {} = Struct {};
let Test.41 : U8 = GetTagId Test.38;
switch Test.41:
case 0:
let Test.39 : {} = CallByName Test.11 Test.40 Test.38;
ret Test.39;
default:
jump Test.37 Test.40 Test.38;
in
switch Test.41:
case 0:
let Test.43 : {} = CallByName Test.11 Test.40 Test.38;
jump Test.42 Test.43;
default:
let Test.44 : {} = CallByName Test.14 Test.40 Test.38;
jump Test.42 Test.44;
jump Test.37 Test.62 Test.63;
procedure Test.2 ():
let Test.6 : Str = "Hello";
@ -50,15 +49,15 @@ procedure Test.2 ():
ret Test.19;
procedure Test.3 (Test.8):
let Test.57 : I64 = 0i64;
let Test.58 : Int1 = lowlevel Eq Test.57 Test.8;
if Test.58 then
let Test.54 : I64 = 0i64;
let Test.55 : Int1 = lowlevel Eq Test.54 Test.8;
if Test.55 then
let Test.27 : {} = Struct {};
let Test.26 : [<r>C {}, C I64 {}] = CallByName Test.4 Test.27;
ret Test.26;
else
let Test.52 : {} = Struct {};
let Test.33 : {} = CallByName Test.4 Test.52;
let Test.49 : {} = Struct {};
let Test.33 : {} = CallByName Test.4 Test.49;
let Test.32 : [<r>C {}, C I64 {}] = CallByName Test.5 Test.33 Test.8;
ret Test.32;
@ -73,11 +72,11 @@ procedure Test.5 (Test.16, Test.13):
let Test.35 : [<r>C {}, C I64 {}] = TagId(1) Test.13 Test.16;
ret Test.35;
procedure Test.9 (Test.47, Test.8):
let Test.51 : I64 = 1i64;
let Test.50 : I64 = CallByName Num.20 Test.8 Test.51;
let Test.49 : [<r>C {}, C I64 {}] = CallByName Test.3 Test.50;
ret Test.49;
procedure Test.9 (Test.44, Test.8):
let Test.48 : I64 = 1i64;
let Test.47 : I64 = CallByName Num.20 Test.8 Test.48;
let Test.46 : [<r>C {}, C I64 {}] = CallByName Test.3 Test.47;
ret Test.46;
procedure Test.0 ():
let Test.24 : I64 = 4i64;

View File

@ -12,30 +12,27 @@ procedure Num.21 (#Attr.2, #Attr.3):
procedure Test.1 (Test.2, Test.3):
let Test.15 : U8 = GetTagId Test.2;
joinpoint Test.16 Test.14:
ret Test.14;
in
switch Test.15:
case 0:
let Test.17 : I64 = CallByName Test.7 Test.3 Test.2;
jump Test.16 Test.17;
let Test.14 : I64 = CallByName Test.7 Test.3 Test.2;
ret Test.14;
default:
let Test.18 : I64 = CallByName Test.8 Test.3 Test.2;
jump Test.16 Test.18;
let Test.14 : I64 = CallByName Test.8 Test.3 Test.2;
ret Test.14;
procedure Test.7 (Test.9, #Attr.12):
let Test.4 : I64 = UnionAtIndex (Id 0) (Index 0) #Attr.12;
let Test.24 : I64 = CallByName Num.19 Test.9 Test.4;
ret Test.24;
let Test.21 : I64 = CallByName Num.19 Test.9 Test.4;
ret Test.21;
procedure Test.8 (Test.10, #Attr.12):
let Test.6 : Int1 = UnionAtIndex (Id 1) (Index 1) #Attr.12;
let Test.5 : I64 = UnionAtIndex (Id 1) (Index 0) #Attr.12;
if Test.6 then
let Test.22 : I64 = CallByName Num.21 Test.10 Test.5;
ret Test.22;
let Test.19 : I64 = CallByName Num.21 Test.10 Test.5;
ret Test.19;
else
ret Test.10;
@ -43,15 +40,15 @@ procedure Test.0 ():
let Test.4 : I64 = 1i64;
let Test.5 : I64 = 2i64;
let Test.6 : Int1 = CallByName Bool.2;
joinpoint Test.20 Test.12:
joinpoint Test.17 Test.12:
let Test.13 : I64 = 42i64;
let Test.11 : I64 = CallByName Test.1 Test.12 Test.13;
ret Test.11;
in
let Test.23 : Int1 = CallByName Bool.2;
if Test.23 then
let Test.19 : [C I64, C I64 Int1] = TagId(0) Test.4;
jump Test.20 Test.19;
let Test.20 : Int1 = CallByName Bool.2;
if Test.20 then
let Test.16 : [C I64, C I64 Int1] = TagId(0) Test.4;
jump Test.17 Test.16;
else
let Test.19 : [C I64, C I64 Int1] = TagId(1) Test.5 Test.6;
jump Test.20 Test.19;
let Test.16 : [C I64, C I64 Int1] = TagId(1) Test.5 Test.6;
jump Test.17 Test.16;

View File

@ -12,37 +12,34 @@ procedure Num.21 (#Attr.2, #Attr.3):
procedure Test.6 (Test.8, #Attr.12):
let Test.4 : I64 = UnionAtIndex (Id 0) (Index 0) #Attr.12;
let Test.21 : I64 = CallByName Num.19 Test.8 Test.4;
ret Test.21;
let Test.18 : I64 = CallByName Num.19 Test.8 Test.4;
ret Test.18;
procedure Test.7 (Test.9, #Attr.12):
let Test.5 : I64 = UnionAtIndex (Id 1) (Index 0) #Attr.12;
let Test.19 : I64 = CallByName Num.21 Test.9 Test.5;
ret Test.19;
let Test.16 : I64 = CallByName Num.21 Test.9 Test.5;
ret Test.16;
procedure Test.0 ():
let Test.4 : I64 = 1i64;
let Test.5 : I64 = 2i64;
let Test.11 : I64 = 42i64;
joinpoint Test.18 Test.12:
joinpoint Test.15 Test.12:
let Test.13 : U8 = GetTagId Test.12;
joinpoint Test.14 Test.10:
ret Test.10;
in
switch Test.13:
case 0:
let Test.15 : I64 = CallByName Test.6 Test.11 Test.12;
jump Test.14 Test.15;
let Test.10 : I64 = CallByName Test.6 Test.11 Test.12;
ret Test.10;
default:
let Test.16 : I64 = CallByName Test.7 Test.11 Test.12;
jump Test.14 Test.16;
let Test.10 : I64 = CallByName Test.7 Test.11 Test.12;
ret Test.10;
in
let Test.20 : Int1 = CallByName Bool.2;
if Test.20 then
let Test.17 : [C I64, C I64] = TagId(0) Test.4;
jump Test.18 Test.17;
let Test.17 : Int1 = CallByName Bool.2;
if Test.17 then
let Test.14 : [C I64, C I64] = TagId(0) Test.4;
jump Test.15 Test.14;
else
let Test.17 : [C I64, C I64] = TagId(1) Test.5;
jump Test.18 Test.17;
let Test.14 : [C I64, C I64] = TagId(1) Test.5;
jump Test.15 Test.14;

View File

@ -1,29 +1,26 @@
procedure Test.1 (Test.2):
let Test.14 : Int1 = false;
ret Test.14;
let Test.11 : Int1 = false;
ret Test.11;
procedure Test.3 (Test.13):
let Test.15 : Str = "t1";
procedure Test.3 (Test.10):
let Test.12 : Str = "t1";
ret Test.12;
procedure Test.4 (Test.13):
let Test.15 : Str = "t2";
ret Test.15;
procedure Test.4 (Test.16):
let Test.18 : Str = "t2";
ret Test.18;
procedure Test.0 ():
let Test.19 : Str = "abc";
let Test.6 : Int1 = CallByName Test.1 Test.19;
dec Test.19;
let Test.16 : Str = "abc";
let Test.6 : Int1 = CallByName Test.1 Test.16;
dec Test.16;
let Test.9 : {} = Struct {};
joinpoint Test.10 Test.8:
ret Test.8;
in
switch Test.6:
case 0:
let Test.11 : Str = CallByName Test.3 Test.9;
jump Test.10 Test.11;
let Test.8 : Str = CallByName Test.3 Test.9;
ret Test.8;
default:
let Test.12 : Str = CallByName Test.4 Test.9;
jump Test.10 Test.12;
let Test.8 : Str = CallByName Test.4 Test.9;
ret Test.8;

View File

@ -3,50 +3,47 @@ procedure Bool.2 ():
ret Bool.23;
procedure Test.12 (Test.52):
let Test.75 : Int1 = false;
ret Test.75;
let Test.72 : Int1 = false;
ret Test.72;
procedure Test.13 (Test.51):
let Test.83 : Int1 = true;
ret Test.83;
let Test.80 : Int1 = true;
ret Test.80;
procedure Test.14 (Test.50):
ret Test.50;
procedure Test.15 (Test.49):
let Test.74 : {} = Struct {};
let Test.73 : Int1 = CallByName Test.12 Test.74;
ret Test.73;
let Test.71 : {} = Struct {};
let Test.70 : Int1 = CallByName Test.12 Test.71;
ret Test.70;
procedure Test.16 (Test.48):
let Test.82 : {} = Struct {};
let Test.81 : Int1 = CallByName Test.13 Test.82;
ret Test.81;
let Test.79 : {} = Struct {};
let Test.78 : Int1 = CallByName Test.13 Test.79;
ret Test.78;
procedure Test.17 (Test.47):
ret Test.47;
procedure Test.35 (Test.36, Test.76):
procedure Test.35 (Test.36, Test.73):
inc Test.36;
ret Test.36;
procedure Test.37 (Test.38, Test.84):
procedure Test.37 (Test.38, Test.81):
inc Test.38;
ret Test.38;
procedure Test.40 (Test.41, Test.65, Test.39):
let Test.68 : {} = Struct {};
joinpoint Test.69 Test.67:
ret Test.67;
in
switch Test.39:
case 0:
let Test.70 : List U8 = CallByName Test.35 Test.41 Test.68;
jump Test.69 Test.70;
let Test.67 : List U8 = CallByName Test.35 Test.41 Test.68;
ret Test.67;
default:
let Test.71 : List U8 = CallByName Test.37 Test.41 Test.68;
jump Test.69 Test.71;
let Test.67 : List U8 = CallByName Test.37 Test.41 Test.68;
ret Test.67;
procedure Test.43 (Test.44, Test.42):
@ -56,26 +53,26 @@ procedure Test.43 (Test.44, Test.42):
dec Test.59;
ret Test.58;
in
let Test.78 : Int1 = CallByName Bool.2;
if Test.78 then
let Test.80 : Str = StructAtIndex 0 Test.42;
inc Test.80;
let Test.75 : Int1 = CallByName Bool.2;
if Test.75 then
let Test.77 : Str = StructAtIndex 0 Test.42;
inc Test.77;
dec Test.42;
let Test.79 : Int1 = CallByName Test.16 Test.80;
dec Test.80;
let Test.61 : Int1 = CallByName Test.14 Test.79;
let Test.76 : Int1 = CallByName Test.16 Test.77;
dec Test.77;
let Test.61 : Int1 = CallByName Test.14 Test.76;
jump Test.62 Test.61;
else
let Test.72 : U8 = StructAtIndex 1 Test.42;
let Test.69 : U8 = StructAtIndex 1 Test.42;
dec Test.42;
let Test.63 : Int1 = CallByName Test.15 Test.72;
let Test.63 : Int1 = CallByName Test.15 Test.69;
let Test.61 : Int1 = CallByName Test.14 Test.63;
jump Test.62 Test.61;
procedure Test.0 ():
let Test.86 : Str = "";
let Test.87 : U8 = 7i64;
let Test.55 : {Str, U8} = Struct {Test.86, Test.87};
let Test.83 : Str = "";
let Test.84 : U8 = 7i64;
let Test.55 : {Str, U8} = Struct {Test.83, Test.84};
let Test.46 : {Str, U8} = CallByName Test.17 Test.55;
let Test.54 : {} = Struct {};
let Test.53 : List U8 = CallByName Test.43 Test.54 Test.46;

View File

@ -56,26 +56,23 @@ procedure Encode.23 (Encode.94, Encode.102, Encode.96):
procedure Encode.23 (Encode.94, Encode.102, Encode.96):
let Encode.117 : U8 = GetTagId Encode.102;
joinpoint Encode.118 Encode.116:
ret Encode.116;
in
switch Encode.117:
case 0:
let Encode.119 : List U8 = CallByName #Derived.2 Encode.94 Encode.96 Encode.102;
jump Encode.118 Encode.119;
let Encode.116 : List U8 = CallByName #Derived.2 Encode.94 Encode.96 Encode.102;
ret Encode.116;
default:
let Encode.120 : List U8 = CallByName #Derived.7 Encode.94 Encode.96 Encode.102;
jump Encode.118 Encode.120;
let Encode.116 : List U8 = CallByName #Derived.7 Encode.94 Encode.96 Encode.102;
ret Encode.116;
procedure Encode.23 (Encode.94, Encode.102, Encode.96):
let Encode.132 : List U8 = CallByName Json.126 Encode.94 Encode.96 Encode.102;
ret Encode.132;
let Encode.129 : List U8 = CallByName Json.126 Encode.94 Encode.96 Encode.102;
ret Encode.129;
procedure Encode.23 (Encode.94, Encode.102, Encode.96):
let Encode.136 : Str = "a Lambda Set is empty. Most likely there is a type error in your program.";
Crash Encode.136
let Encode.133 : Str = "a Lambda Set is empty. Most likely there is a type error in your program.";
Crash Encode.133
procedure Encode.25 (Encode.100, Encode.101):
let Encode.104 : List U8 = Array [];

View File

@ -2723,3 +2723,48 @@ fn unspecialized_lambda_set_unification_does_not_duplicate_identical_concrete_ty
"#
)
}
#[mono_test]
fn inline_return_joinpoints_in_bool_lambda_set() {
indoc!(
r#"
app "test" provides [f] to "./platform"
f = \x ->
caller = if Bool.false then f else \n -> n
caller (x + 1)
"#
)
}
#[mono_test]
fn inline_return_joinpoints_in_enum_lambda_set() {
indoc!(
r#"
app "test" provides [f] to "./platform"
f = \x ->
caller = \t -> when t is
A -> f
B -> \n -> n
C -> \n -> n + 1
D -> \n -> n + 2
(caller A) (x + 1)
"#
)
}
#[mono_test]
fn inline_return_joinpoints_in_union_lambda_set() {
indoc!(
r#"
app "test" provides [f] to "./platform"
f = \x ->
caller = \t -> when t is
A -> f
B -> \n -> n + x
(caller A) (x + 1)
"#
)
}

View File

@ -1,47 +0,0 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "proc-macro2"
version = "1.0.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba508cc11742c0dc5c1659771673afbab7a0efab23aa17e854cbab0837ed0b43"
dependencies = [
"unicode-xid",
]
[[package]]
name = "quote"
version = "1.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38bc8cc6a5f2e3655e0899c1b848643b2562f853f114bfec7be120678e3ace05"
dependencies = [
"proc-macro2",
]
[[package]]
name = "syn"
version = "1.0.81"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2afee18b8beb5a596ecb4a2dce128c719b4ba399d34126b9e4396e3f9860966"
dependencies = [
"proc-macro2",
"quote",
"unicode-xid",
]
[[package]]
name = "test_mono_macros"
version = "0.0.1"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "unicode-xid"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"

View File

@ -1,15 +1,16 @@
[package]
name = "test_mono_macros"
version = "0.0.1"
authors = ["The Roc Contributors"]
license = "UPL-1.0"
edition = "2021"
description = "Macros for use in test_mono."
authors.workspace = true
edition.workspace = true
license.workspace = true
version.workspace = true
[lib]
proc-macro = true
[dependencies]
syn = { version = "1.0.81", features = ["full", "extra-traits"] }
quote = "1.0.10"
proc-macro2 = "1.0.32"
proc-macro2.workspace = true
quote.workspace = true
syn.workspace = true

View File

@ -1,24 +1,25 @@
[package]
name = "test_syntax"
version = "0.0.1"
authors = ["The Roc Contributors"]
license = "UPL-1.0"
edition = "2021"
description = "Tests for the parse + fmt crates."
authors.workspace = true
edition.workspace = true
license.workspace = true
version.workspace = true
[features]
"parse_debug_trace" = ["roc_parse/parse_debug_trace"]
[dependencies]
bumpalo.workspace = true
roc_collections = { path = "../collections" }
roc_region = { path = "../region" }
roc_fmt = { path = "../fmt" }
roc_module = { path = "../module" }
roc_parse = { path = "../parse" }
roc_fmt = { path = "../fmt" }
roc_region = { path = "../region" }
roc_test_utils = { path = "../../test_utils" }
bumpalo.workspace = true
[dev-dependencies]
pretty_assertions.workspace = true
indoc.workspace = true
pretty_assertions.workspace = true
walkdir.workspace = true

View File

@ -1,654 +0,0 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "addr2line"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b"
dependencies = [
"gimli",
]
[[package]]
name = "adler"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
[[package]]
name = "ahash"
version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47"
dependencies = [
"getrandom",
"once_cell",
"version_check",
]
[[package]]
name = "arbitrary"
version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "db55d72333851e17d572bec876e390cd3b11eb1ef53ae821dd9f3b653d2b4569"
[[package]]
name = "autocfg"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "backtrace"
version = "0.3.66"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cab84319d616cfb654d03394f38ab7e6f0919e181b1b57e1fd15e7fb4077d9a7"
dependencies = [
"addr2line",
"cc",
"cfg-if",
"libc",
"miniz_oxide",
"object",
"rustc-demangle",
]
[[package]]
name = "bitmaps"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "031043d04099746d8db04daf1fa424b2bc8bd69d92b25962dcde24da39ab64a2"
dependencies = [
"typenum",
]
[[package]]
name = "bitvec"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c"
dependencies = [
"funty",
"radium",
"tap",
"wyz",
]
[[package]]
name = "bumpalo"
version = "3.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba"
[[package]]
name = "cc"
version = "1.0.73"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11"
[[package]]
name = "cfg-if"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "crossbeam-channel"
version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521"
dependencies = [
"cfg-if",
"crossbeam-utils",
]
[[package]]
name = "crossbeam-deque"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "715e8152b692bba2d374b53d4875445368fdf21a94751410af607a5ac677d1fc"
dependencies = [
"cfg-if",
"crossbeam-epoch",
"crossbeam-utils",
]
[[package]]
name = "crossbeam-epoch"
version = "0.9.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "01a9af1f4c2ef74bb8aa1f7e19706bc72d03598c8a570bb5de72243c7a9d9d5a"
dependencies = [
"autocfg",
"cfg-if",
"crossbeam-utils",
"memoffset",
"scopeguard",
]
[[package]]
name = "crossbeam-utils"
version = "0.8.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f"
dependencies = [
"cfg-if",
]
[[package]]
name = "ctor"
version = "0.1.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d2301688392eb071b0bf1a37be05c469d3cc4dbbd95df672fe28ab021e6a096"
dependencies = [
"quote",
"syn",
]
[[package]]
name = "diff"
version = "0.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8"
[[package]]
name = "doc-comment"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"
[[package]]
name = "either"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797"
[[package]]
name = "encode_unicode"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0"
[[package]]
name = "fnv"
version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
[[package]]
name = "funty"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c"
[[package]]
name = "getrandom"
version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6"
dependencies = [
"cfg-if",
"libc",
"wasi",
]
[[package]]
name = "gimli"
version = "0.26.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d"
[[package]]
name = "hashbrown"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
dependencies = [
"ahash",
"bumpalo",
]
[[package]]
name = "heck"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9"
[[package]]
name = "hermit-abi"
version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
dependencies = [
"libc",
]
[[package]]
name = "im"
version = "15.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0acd33ff0285af998aaf9b57342af478078f53492322fafc47450e09397e0e9"
dependencies = [
"bitmaps",
"rand_core",
"rand_xoshiro",
"sized-chunks",
"typenum",
"version_check",
]
[[package]]
name = "im-rc"
version = "15.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af1955a75fa080c677d3972822ec4bad316169ab1cfc6c257a942c2265dbe5fe"
dependencies = [
"bitmaps",
"rand_core",
"rand_xoshiro",
"sized-chunks",
"typenum",
"version_check",
]
[[package]]
name = "libc"
version = "0.2.131"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04c3b4822ccebfa39c02fc03d1534441b22ead323fa0f48bb7ddd8e6ba076a40"
[[package]]
name = "libfuzzer-sys"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee8c42ab62f43795ed77a965ed07994c5584cdc94fd0ebf14b22ac1524077acc"
dependencies = [
"arbitrary",
"cc",
]
[[package]]
name = "log"
version = "0.4.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
dependencies = [
"cfg-if",
]
[[package]]
name = "memchr"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
[[package]]
name = "memoffset"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4"
dependencies = [
"autocfg",
]
[[package]]
name = "miniz_oxide"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f5c75688da582b8ffc1f1799e9db273f32133c49e048f614d22ec3256773ccc"
dependencies = [
"adler",
]
[[package]]
name = "num_cpus"
version = "1.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5"
dependencies = [
"hermit-abi",
"libc",
]
[[package]]
name = "object"
version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53"
dependencies = [
"memchr",
]
[[package]]
name = "once_cell"
version = "1.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1"
[[package]]
name = "output_vt100"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "628223faebab4e3e40667ee0b2336d34a5b960ff60ea743ddfdbcf7770bcfb66"
dependencies = [
"winapi",
]
[[package]]
name = "pretty_assertions"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a25e9bcb20aa780fd0bb16b72403a9064d6b3f22f026946029acb941a50af755"
dependencies = [
"ctor",
"diff",
"output_vt100",
"yansi",
]
[[package]]
name = "proc-macro2"
version = "1.0.43"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0a2ca2c61bc9f3d74d2886294ab7b9853abd9c1ad903a3ac7815c58989bb7bab"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179"
dependencies = [
"proc-macro2",
]
[[package]]
name = "radium"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09"
[[package]]
name = "rand_core"
version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7"
[[package]]
name = "rand_xoshiro"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa"
dependencies = [
"rand_core",
]
[[package]]
name = "rayon"
version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6db3a213adf02b3bcfd2d3846bb41cb22857d131789e01df434fb7e7bc0759b7"
dependencies = [
"either",
"rayon-core",
]
[[package]]
name = "rayon-core"
version = "1.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cac410af5d00ab6884528b4ab69d1e8e146e8d471201800fa1b4524126de6ad3"
dependencies = [
"crossbeam-channel",
"crossbeam-deque",
"crossbeam-utils",
"num_cpus",
]
[[package]]
name = "remove_dir_all"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "882f368737489ea543bc5c340e6f3d34a28c39980bd9a979e47322b26f60ac40"
dependencies = [
"libc",
"log",
"num_cpus",
"rayon",
"winapi",
]
[[package]]
name = "roc_collections"
version = "0.0.1"
dependencies = [
"bitvec",
"bumpalo",
"fnv",
"hashbrown",
"im",
"im-rc",
"wyhash",
]
[[package]]
name = "roc_error_macros"
version = "0.0.1"
[[package]]
name = "roc_fmt"
version = "0.0.1"
dependencies = [
"bumpalo",
"roc_collections",
"roc_module",
"roc_parse",
"roc_region",
]
[[package]]
name = "roc_ident"
version = "0.0.1"
[[package]]
name = "roc_module"
version = "0.0.1"
dependencies = [
"bumpalo",
"roc_collections",
"roc_error_macros",
"roc_ident",
"roc_region",
"snafu",
"static_assertions",
]
[[package]]
name = "roc_parse"
version = "0.0.1"
dependencies = [
"bumpalo",
"encode_unicode",
"roc_collections",
"roc_module",
"roc_region",
]
[[package]]
name = "roc_region"
version = "0.0.1"
dependencies = [
"static_assertions",
]
[[package]]
name = "roc_test_utils"
version = "0.0.1"
dependencies = [
"pretty_assertions",
"remove_dir_all",
]
[[package]]
name = "rustc-demangle"
version = "0.1.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342"
[[package]]
name = "scopeguard"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]]
name = "sized-chunks"
version = "0.6.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "16d69225bde7a69b235da73377861095455d298f2b970996eec25ddbb42b3d1e"
dependencies = [
"bitmaps",
"typenum",
]
[[package]]
name = "snafu"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5177903bf45656592d9eb5c0e22f408fc023aae51dbe2088889b71633ba451f2"
dependencies = [
"backtrace",
"doc-comment",
"snafu-derive",
]
[[package]]
name = "snafu-derive"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "410b26ed97440d90ced3e2488c868d56a86e2064f5d7d6f417909b286afe25e5"
dependencies = [
"heck",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "static_assertions"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]]
name = "syn"
version = "1.0.99"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "58dbef6ec655055e20b86b15a8cc6d439cca19b667537ac6a1369572d151ab13"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "tap"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369"
[[package]]
name = "test_syntax"
version = "0.0.1"
dependencies = [
"bumpalo",
"roc_collections",
"roc_fmt",
"roc_module",
"roc_parse",
"roc_region",
"roc_test_utils",
]
[[package]]
name = "test_syntax-fuzz"
version = "0.0.0"
dependencies = [
"bumpalo",
"libfuzzer-sys",
"test_syntax",
]
[[package]]
name = "typenum"
version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33"
[[package]]
name = "unicode-ident"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4f5b37a154999a8f3f98cc23a628d850e154479cd94decf3414696e12e31aaf"
[[package]]
name = "version_check"
version = "0.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed"
[[package]]
name = "wasi"
version = "0.11.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
name = "winapi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
dependencies = [
"winapi-i686-pc-windows-gnu",
"winapi-x86_64-pc-windows-gnu",
]
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "wyhash"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf6e163c25e3fac820b4b453185ea2dea3b6a3e0a721d4d23d75bd33734c295"
dependencies = [
"rand_core",
]
[[package]]
name = "wyz"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30b31594f29d27036c383b53b59ed3476874d518f0efb151b27a4c275141390e"
dependencies = [
"tap",
]
[[package]]
name = "yansi"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec"

View File

@ -1,18 +1,20 @@
[package]
name = "test_syntax-fuzz"
version = "0.0.0"
authors = ["Automatically generated"]
publish = false
edition = "2021"
authors.workspace = true
edition.workspace = true
version.workspace = true
[package.metadata]
cargo-fuzz = true
[dependencies]
libfuzzer-sys = "0.3"
bumpalo = { version = "3.6.1", features = ["collections"] }
test_syntax = { path = "../../test_syntax" }
bumpalo.workspace = true
libfuzzer-sys.workspace = true
# Prevent this from interfering with workspaces
[workspace]
members = ["."]

View File

@ -1,18 +1,19 @@
[package]
name = "roc_types"
version = "0.0.1"
authors = ["The Roc Contributors"]
license = "UPL-1.0"
edition = "2021"
description = "Various representations and utilities for dealing with types in the Roc compiler."
authors.workspace = true
edition.workspace = true
license.workspace = true
version.workspace = true
[dependencies]
roc_collections = { path = "../collections" }
roc_region = { path = "../region" }
roc_debug_flags = { path = "../debug_flags" }
roc_error_macros = { path = "../../error_macros" }
roc_module = { path = "../module" }
roc_error_macros = {path="../../error_macros"}
roc_debug_flags = {path="../debug_flags"}
roc_serialize = {path="../serialize"}
roc_region = { path = "../region" }
roc_serialize = { path = "../serialize" }
ven_pretty = { path = "../../vendor/pretty" }

View File

@ -1,13 +1,14 @@
[package]
authors = ["The Roc Contributors"]
edition = "2021"
license = "UPL-1.0"
name = "roc_unify"
version = "0.0.1"
description = "Implements Roc's unification algorithm, the heartstone of Roc's type inference."
authors.workspace = true
edition.workspace = true
license.workspace = true
version.workspace = true
[dependencies]
bitflags = "1.3.2"
bitflags.workspace = true
[dependencies.roc_collections]
path = "../collections"
@ -24,11 +25,5 @@ path = "../types"
[dependencies.roc_debug_flags]
path = "../debug_flags"
[dependencies.roc_can]
path = "../can"
[dependencies.roc_solve_problem]
path = "../solve_problem"
[dependencies.roc_tracing]
path = "../../tracing"

View File

@ -1,30 +1,32 @@
[package]
name = "roc_docs"
version = "0.0.1"
license = "UPL-1.0"
authors = ["The Roc Contributors"]
edition = "2021"
description = "Generates html documentation from Roc files and is used for Rocs builtins."
authors.workspace = true
edition.workspace = true
license.workspace = true
version.workspace = true
[dependencies]
pulldown-cmark = { version = "0.9.2", default-features = false }
roc_ast = { path = "../ast" }
roc_load = { path = "../compiler/load" }
roc_builtins = { path = "../compiler/builtins" }
roc_can = { path = "../compiler/can" }
roc_code_markup = { path = "../code_markup"}
roc_module = { path = "../compiler/module" }
roc_region = { path = "../compiler/region" }
roc_types = { path = "../compiler/types" }
roc_parse = { path = "../compiler/parse" }
roc_target = { path = "../compiler/roc_target" }
roc_code_markup = { path = "../code_markup" }
roc_collections = { path = "../compiler/collections" }
roc_highlight = { path = "../highlight"}
roc_packaging = { path = "../packaging"}
roc_reporting = { path = "../reporting"}
roc_highlight = { path = "../highlight" }
roc_load = { path = "../compiler/load" }
roc_module = { path = "../compiler/module" }
roc_packaging = { path = "../packaging" }
roc_parse = { path = "../compiler/parse" }
roc_region = { path = "../compiler/region" }
roc_reporting = { path = "../reporting" }
roc_target = { path = "../compiler/roc_target" }
roc_types = { path = "../compiler/types" }
bumpalo.workspace = true
snafu.workspace = true
peg.workspace = true
pulldown-cmark.workspace = true
snafu.workspace = true
[dev-dependencies]
pretty_assertions.workspace = true

View File

@ -1,11 +1,12 @@
[package]
name = "roc_docs_cli"
version = "0.0.1"
license = "UPL-1.0"
authors = ["The Roc Contributors"]
edition = "2021"
description = "Provides a binary that is only used for static build servers."
authors.workspace = true
edition.workspace = true
license.workspace = true
version.workspace = true
# This binary is only used on static build servers, e.g. Netlify.
# Having its own (extremely minimal) CLI means docs can be generated
# on a build server after building this crate from source, without
@ -19,7 +20,8 @@ bench = false
[dependencies]
roc_docs = { path = "../docs" }
clap = { version = "3.2.20", default-features = false, features = ["std", "color", "suggestions", "derive"] }
clap.workspace = true
[target.'cfg(windows)'.dependencies]
libc.workspace = true
libc.workspace = true

View File

@ -1,11 +1,12 @@
[package]
name = "roc_editor"
version = "0.0.1"
authors = ["The Roc Contributors"]
license = "UPL-1.0"
edition = "2021"
description = "An editor for Roc"
authors.workspace = true
edition.workspace = true
license.workspace = true
version.workspace = true
[package.metadata.cargo-udeps.ignore]
# confy is currently unused but should not be removed
normal = ["confy"]
@ -17,54 +18,48 @@ default = []
[dependencies]
roc_ast = { path = "../ast" }
roc_collections = { path = "../compiler/collections" }
roc_load = { path = "../compiler/load" }
roc_builtins = { path = "../compiler/builtins" }
roc_can = { path = "../compiler/can" }
roc_code_markup = { path = "../code_markup"}
roc_parse = { path = "../compiler/parse" }
roc_region = { path = "../compiler/region" }
roc_code_markup = { path = "../code_markup" }
roc_collections = { path = "../compiler/collections" }
roc_load = { path = "../compiler/load" }
roc_module = { path = "../compiler/module" }
roc_problem = { path = "../compiler/problem" }
roc_types = { path = "../compiler/types" }
roc_unify = { path = "../compiler/unify" }
roc_utils = { path = "../utils"}
roc_packaging = { path = "../packaging" }
roc_parse = { path = "../compiler/parse" }
roc_problem = { path = "../compiler/problem" }
roc_region = { path = "../compiler/region" }
roc_reporting = { path = "../reporting" }
roc_solve = { path = "../compiler/solve" }
roc_types = { path = "../compiler/types" }
roc_unify = { path = "../compiler/unify" }
roc_utils = { path = "../utils" }
ven_graph = { path = "../vendor/pathfinding" }
bumpalo = { version = "3.11.1", features = ["collections"] }
arrayvec = "0.7.2"
libc = "0.2.135"
page_size = "0.4.2"
# once winit 0.26 is out, check if copypasta can be updated simultaneously so they use the same versions for their dependencies. This will save build time.
winit = "0.26.0"
wgpu = "0.12.0"
wgpu_glyph = "0.16.0"
glyph_brush = "0.7.5"
log = "0.4.14"
futures = "0.3.24"
cgmath = "0.18.0"
snafu = { version = "0.7.1", features = ["backtraces"] }
colored = "2.0.0"
pest = "2.3.1"
pest_derive = "2.3.1"
copypasta = "0.8.1"
palette = "0.6.1"
confy = { git = 'https://github.com/rust-cli/confy', features = [
"yaml_conf"
], default-features = false }
serde = { version = "1.0.144", features = ["derive"] }
nonempty = "0.8.0"
threadpool = "1.8.1"
arrayvec.workspace = true
bumpalo.workspace = true
bytemuck.workspace = true
cgmath.workspace = true
colored.workspace = true
confy.workspace = true
copypasta.workspace = true
fs_extra.workspace = true
[dependencies.bytemuck]
version = "1.12.1"
features = ["derive"]
futures.workspace = true
glyph_brush.workspace = true
libc.workspace = true
log.workspace = true
nonempty.workspace = true
page_size.workspace = true
palette.workspace = true
pest.workspace = true
pest_derive.workspace = true
serde.workspace = true
snafu.workspace = true
threadpool.workspace = true
wgpu.workspace = true
wgpu_glyph.workspace = true
winit.workspace = true
[dev-dependencies]
rand = "0.8.4"
tempfile = "3.2.0"
uuid = { version = "1.1.2", features = ["v4"] }
rand.workspace = true
tempfile.workspace = true
uuid.workspace = true

View File

@ -1,9 +1,10 @@
[package]
name = "roc_error_macros"
version = "0.0.1"
authors = ["The Roc Contributors"]
license = "UPL-1.0"
edition = "2021"
description = "Provides macros for consistent reporting of errors in Roc's rust code."
authors.workspace = true
edition.workspace = true
license.workspace = true
version.workspace = true
[dependencies]

View File

@ -1,37 +1,38 @@
[package]
name = "roc_glue"
version = "0.0.1"
authors = ["The Roc Contributors"]
license = "UPL-1.0"
edition = "2021"
description = "Generates code needed for platform hosts to communicate with Roc apps. This tool is not necessary for writing a platform in another language, however, it's a great convenience! Currently supports Rust platforms, and the plan is to support any language via a plugin model."
authors.workspace = true
edition.workspace = true
license.workspace = true
version.workspace = true
[dependencies]
roc_std = { path = "../roc_std"}
roc_can = { path = "../compiler/can" }
roc_mono = { path = "../compiler/mono" }
roc_load = { path = "../compiler/load" }
roc_reporting = { path = "../reporting" }
roc_packaging = { path = "../packaging" }
roc_types = { path = "../compiler/types" }
roc_builtins = { path = "../compiler/builtins" }
roc_module = { path = "../compiler/module" }
roc_can = { path = "../compiler/can" }
roc_collections = { path = "../compiler/collections" }
roc_target = { path = "../compiler/roc_target" }
roc_error_macros = { path = "../error_macros" }
roc_load = { path = "../compiler/load" }
roc_module = { path = "../compiler/module" }
roc_mono = { path = "../compiler/mono" }
roc_packaging = { path = "../packaging" }
roc_reporting = { path = "../reporting" }
roc_std = { path = "../roc_std" }
roc_target = { path = "../compiler/roc_target" }
roc_tracing = { path = "../tracing" }
bumpalo = { version = "3.11.1", features = ["collections"] }
target-lexicon = "0.12.3"
clap = { version = "3.2.20", default-features = false, features = ["std", "color", "suggestions", "derive"] }
strum = "0.24.0"
strum_macros = "0.24"
indexmap = "1.8.1"
fnv = "1.0.7"
roc_types = { path = "../compiler/types" }
bumpalo.workspace = true
fnv.workspace = true
indexmap.workspace = true
strum.workspace = true
strum_macros.workspace = true
target-lexicon.workspace = true
[dev-dependencies]
pretty_assertions = "1.3.0"
tempfile = "3.2.0"
indoc = "1.0.7"
cli_utils = { path = "../cli_utils" }
roc_test_utils = { path = "../test_utils" }
dircpy = "0.3.13"
dircpy.workspace = true
indoc.workspace = true
pretty_assertions.workspace = true
tempfile.workspace = true

View File

@ -1,37 +0,0 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "host"
version = "0.0.1"
dependencies = [
"indoc",
"libc",
"roc_std",
]
[[package]]
name = "indoc"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05a0bd019339e5d968b37855180087b7b9d512c5046fbd244cf8c95687927d6e"
[[package]]
name = "libc"
version = "0.2.92"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56d855069fafbb9b344c0f962150cd2c1187975cb1c22c1522c240d8c4986714"
[[package]]
name = "roc_std"
version = "0.0.1"
dependencies = [
"static_assertions",
]
[[package]]
name = "static_assertions"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f406d6ee68db6796e11ffd7b4d171864c58b7451e79ef9460ea33c287a1f89a7"

View File

@ -1,11 +1,13 @@
[package]
name = "roc_highlight"
version = "0.0.1"
authors = ["The Roc Contributors"]
license = "UPL-1.0"
edition = "2021"
description = "For syntax highlighting, starts with a string and returns our markup nodes."
authors.workspace = true
edition.workspace = true
license.workspace = true
version.workspace = true
[dependencies]
peg = "0.8.1"
roc_code_markup = { path = "../code_markup"}
roc_code_markup = { path = "../code_markup" }
peg.workspace = true

View File

@ -1,33 +1,34 @@
[package]
name = "roc_linker"
version = "0.0.1"
authors = ["The Roc Contributors"]
license = "UPL-1.0"
repository = "https://github.com/roc-lang/roc"
edition = "2021"
description = "A surgical linker for Roc"
authors.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true
version.workspace = true
[lib]
name = "roc_linker"
path = "src/lib.rs"
[dependencies]
roc_mono = { path = "../compiler/mono" }
roc_collections = { path = "../compiler/collections" }
roc_error_macros = { path = "../error_macros" }
roc_module = { path = "../compiler/module" }
roc_load = { path = "../compiler/load" }
roc_target = { path = "../compiler/roc_target" }
roc_mono = { path = "../compiler/mono" }
roc_packaging = { path = "../packaging" }
roc_reporting = { path = "../reporting" }
roc_target = { path = "../compiler/roc_target" }
bincode.workspace = true
bumpalo.workspace = true
iced-x86.workspace = true
mach_object.workspace = true
memmap2.workspace = true
object.workspace = true
mach_object.workspace = true
serde.workspace = true
bincode.workspace = true
target-lexicon.workspace = true
tempfile.workspace = true

View File

@ -1,33 +1,29 @@
[package]
name = "roc_packaging"
version = "0.0.1"
authors = ["The Roc Contributors"]
license = "UPL-1.0"
repository = "https://github.com/roc-lang/roc"
edition = "2021"
description = "Functionality for packaging Roc source code - e.g. for distribution over the network"
authors.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true
version.workspace = true
[dependencies]
roc_parse = { path = "../compiler/parse" }
roc_error_macros = { path = "../error_macros" }
roc_parse = { path = "../compiler/parse" }
tar = "0.4.38" # used for `roc build --tar`
brotli = "3.3.4" # used for decompressing tarballs over HTTPS, if the server supports brotli
flate2 = "1.0.24"
walkdir = "2.3.2"
blake3 = "1.3.1"
base64-url = "1.4.13"
base64-url.workspace = true
blake3.workspace = true
brotli.workspace = true # used for decompressing tarballs over HTTPS, if the server supports brotli
bumpalo.workspace = true
flate2.workspace = true
fs_extra.workspace = true
tar.workspace = true # used for `roc build --tar`
tempfile.workspace = true
walkdir.workspace = true
[target.'cfg(not(target_family = "wasm"))'.dependencies]
# default-features=false removes libopenssl as a dependency on Linux, which might not be available!
reqwest = { version = "0.11.13", default-features = false, features = [ "blocking", "rustls-tls" ] }
reqwest.workspace = true
[dev-dependencies]
pretty_assertions = "1.3.0"
indoc = "1.0.7"
tempfile.workspace = true
tempfile.workspace = true

View File

@ -1,11 +1,11 @@
[package]
edition = "2021"
name = "roc_repl_cli"
version = "0.0.1"
authors = ["The Roc Contributors"]
license = "UPL-1.0"
description = "Command Line Interface(CLI) functionality for the Read-Evaluate-Print-Loop (REPL)."
authors.workspace = true
edition.workspace = true
license.workspace = true
version.workspace = true
[features]
# pipe target to roc_build
@ -16,30 +16,30 @@ target-x86 = ["roc_build/target-x86"]
target-x86_64 = ["roc_build/target-x86_64"]
[dependencies]
inkwell.workspace = true
roc_build = { path = "../compiler/build" }
roc_builtins = { path = "../compiler/builtins" }
roc_collections = { path = "../compiler/collections" }
roc_gen_llvm = { path = "../compiler/gen_llvm" }
roc_load = { path = "../compiler/load" }
roc_module = { path = "../compiler/module" }
roc_mono = { path = "../compiler/mono" }
roc_parse = { path = "../compiler/parse" }
roc_region = { path = "../compiler/region" }
roc_repl_eval = { path = "../repl_eval" }
roc_reporting = { path = "../reporting" }
roc_std = { path = "../roc_std" }
roc_target = { path = "../compiler/roc_target" }
roc_types = { path = "../compiler/types" }
bumpalo.workspace = true
const_format.workspace = true
inkwell.workspace = true
libloading.workspace = true
rustyline.workspace = true
rustyline-derive.workspace = true
rustyline.workspace = true
target-lexicon.workspace = true
unicode-segmentation.workspace = true
roc_build = {path = "../compiler/build"}
roc_builtins = {path = "../compiler/builtins"}
roc_collections = {path = "../compiler/collections"}
roc_gen_llvm = {path = "../compiler/gen_llvm"}
roc_load = {path = "../compiler/load"}
roc_mono = {path = "../compiler/mono"}
roc_parse = {path = "../compiler/parse"}
roc_repl_eval = {path = "../repl_eval"}
roc_reporting = {path = "../reporting"}
roc_std = {path = "../roc_std"}
roc_target = {path = "../compiler/roc_target"}
roc_types = {path = "../compiler/types"}
roc_region = { path = "../compiler/region" }
roc_module = { path = "../compiler/module" }
[lib]
name = "roc_repl_cli"
path = "src/lib.rs"

View File

@ -1,28 +1,27 @@
[package]
edition = "2021"
name = "roc_repl_eval"
version = "0.0.1"
authors = ["The Roc Contributors"]
license = "UPL-1.0"
description = "Provides the functionality for the REPL to evaluate Roc expressions."
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
authors.workspace = true
edition.workspace = true
license.workspace = true
version.workspace = true
[dependencies]
bumpalo.workspace = true
roc_builtins = { path = "../compiler/builtins" }
roc_can = { path = "../compiler/can" }
roc_collections = { path = "../compiler/collections" }
roc_fmt = { path = "../compiler/fmt" }
roc_load = { path = "../compiler/load" }
roc_module = { path = "../compiler/module" }
roc_mono = { path = "../compiler/mono" }
roc_packaging = { path = "../packaging" }
roc_parse = { path = "../compiler/parse" }
roc_problem = { path = "../compiler/problem" }
roc_region = { path = "../compiler/region" }
roc_reporting = { path = "../reporting" }
roc_std = { path = "../roc_std" }
roc_target = { path = "../compiler/roc_target" }
roc_types = { path = "../compiler/types" }
roc_builtins = {path = "../compiler/builtins"}
roc_can = {path = "../compiler/can"}
roc_collections = {path = "../compiler/collections"}
roc_fmt = {path = "../compiler/fmt"}
roc_load = {path = "../compiler/load"}
roc_module = {path = "../compiler/module"}
roc_mono = {path = "../compiler/mono"}
roc_parse = {path = "../compiler/parse"}
roc_problem = {path = "../compiler/problem"}
roc_region = {path = "../compiler/region"}
roc_packaging = {path = "../packaging"}
roc_reporting = {path = "../reporting"}
roc_std = {path = "../roc_std"}
roc_target = {path = "../compiler/roc_target"}
roc_types = {path = "../compiler/types"}
bumpalo.workspace = true

View File

@ -1,45 +1,45 @@
[package]
name = "roc_repl_expect"
version = "0.0.1"
edition = "2021"
authors = ["The Roc Contributors"]
license = "UPL-1.0"
description = "Supports evaluating expect and printing contextual information when they fail."
authors.workspace = true
edition.workspace = true
license.workspace = true
version.workspace = true
[dependencies]
roc_build = { path = "../compiler/build" }
roc_builtins = { path = "../compiler/builtins" }
roc_can = { path = "../compiler/can" }
roc_collections = { path = "../compiler/collections" }
roc_error_macros = { path = "../error_macros" }
roc_gen_llvm = { path = "../compiler/gen_llvm" }
roc_load = { path = "../compiler/load" }
roc_module = { path = "../compiler/module" }
roc_mono = { path = "../compiler/mono" }
roc_packaging = { path = "../packaging" }
roc_parse = { path = "../compiler/parse" }
roc_region = { path = "../compiler/region" }
roc_repl_eval = { path = "../repl_eval" }
roc_reporting = { path = "../reporting" }
roc_std = { path = "../roc_std" }
roc_target = { path = "../compiler/roc_target" }
roc_types = { path = "../compiler/types" }
bumpalo.workspace = true
target-lexicon.workspace = true
inkwell.workspace = true
libc.workspace = true
libloading.workspace = true
signal-hook.workspace = true
libc.workspace = true
inkwell.workspace = true
roc_builtins = {path = "../compiler/builtins"}
roc_can = {path = "../compiler/can"}
roc_collections = {path = "../compiler/collections"}
roc_load = {path = "../compiler/load"}
roc_mono = {path = "../compiler/mono"}
roc_parse = {path = "../compiler/parse"}
roc_module = {path = "../compiler/module"}
roc_repl_eval = {path = "../repl_eval"}
roc_packaging = {path = "../packaging"}
roc_reporting = {path = "../reporting"}
roc_std = {path = "../roc_std"}
roc_target = {path = "../compiler/roc_target"}
roc_types = {path = "../compiler/types"}
roc_gen_llvm = {path = "../compiler/gen_llvm"}
roc_region = { path = "../compiler/region" }
roc_build = { path = "../compiler/build" }
roc_error_macros = { path = "../error_macros" }
target-lexicon.workspace = true
[dev-dependencies]
test_gen = { path = "../compiler/test_gen" }
roc_build = { path = "../compiler/build", features = ["target-aarch64", "target-x86_64"] }
roc_build = { path = "../compiler/build", features = ["target-aarch64", "target-x86_64"] }
tempfile.workspace = true
indoc.workspace = true
pretty_assertions.workspace = true
strip-ansi-escapes.workspace = true
tempfile.workspace = true
[lib]

View File

@ -1,37 +1,35 @@
[package]
edition = "2021"
name = "repl_test"
version = "0.0.1"
authors = ["The Roc Contributors"]
license = "UPL-1.0"
description = "Tests the roc REPL."
authors.workspace = true
edition.workspace = true
license.workspace = true
version.workspace = true
[build-dependencies]
roc_cli = {path = "../cli"}
roc_cli = { path = "../cli" }
[dev-dependencies]
indoc = "1.0.7"
strip-ansi-escapes = "0.1.1"
bumpalo.workspace = true
roc_build = { path = "../compiler/build" }
roc_repl_cli = {path = "../repl_cli"}
roc_test_utils = {path = "../test_utils"}
roc_wasm_interp = {path = "../wasm_interp"}
roc_repl_cli = { path = "../repl_cli" }
roc_test_utils = { path = "../test_utils" }
roc_wasm_interp = { path = "../wasm_interp" }
bumpalo.workspace = true
indoc.workspace = true
strip-ansi-escapes.workspace = true
[features]
default = ["target-aarch64", "target-x86_64", "target-wasm32"]
wasm = ["target-wasm32"]
target-arm = ["roc_build/target-arm", "roc_repl_cli/target-arm"]
target-aarch64 = ["roc_build/target-aarch64", "roc_repl_cli/target-aarch64"]
target-arm = ["roc_build/target-arm", "roc_repl_cli/target-arm"]
target-wasm32 = ["roc_build/target-wasm32", "roc_repl_cli/target-wasm32"]
target-x86 = ["roc_build/target-x86", "roc_repl_cli/target-x86"]
target-x86_64 = ["roc_build/target-x86_64", "roc_repl_cli/target-x86_64"]
target-wasm32 = ["roc_build/target-wasm32", "roc_repl_cli/target-wasm32"]
wasm = ["target-wasm32"]
target-all = [
"target-aarch64",
"target-arm",
"target-x86",
"target-x86_64",
"target-wasm32"
]
target-all = ["target-aarch64", "target-arm", "target-x86", "target-x86_64", "target-wasm32"]
[package.metadata.cargo-udeps.ignore]
development = ["roc_wasm_interp"]

View File

@ -990,7 +990,7 @@ fn issue_2343_complete_mono_with_shadowed_vars() {
^
Since these variables have the same name, it's easy to use the wrong
one on accident. Give one of them a new name.
one by accident. Give one of them a new name.
"#
),
);

View File

@ -1,36 +1,38 @@
[package]
edition = "2021"
name = "roc_repl_wasm"
version = "0.0.1"
authors = ["The Roc Contributors"]
license = "UPL-1.0"
description = "Provides a build of the REPL for the Roc website using WebAssembly."
authors = ["The Roc Contributors"]
edition = "2021"
license = "UPL-1.0"
version = "0.0.1"
[lib]
crate-type = ["cdylib"]
[build-dependencies]
roc_builtins = {path = "../compiler/builtins"}
roc_utils = {path = "../utils"}
roc_builtins = { path = "../compiler/builtins" }
wasi_libc_sys = { path = "../wasi-libc-sys" }
tempfile.workspace = true
[dependencies]
bumpalo.workspace = true
console_error_panic_hook = {version = "0.1.7", optional = true}
futures = {version = "0.3.24", optional = true}
js-sys = "0.3.60"
wasm-bindgen = "0.2.79"
wasm-bindgen-futures = "0.4.33"
console_error_panic_hook = { workspace = true, optional = true }
futures = { workspace = true, optional = true }
getrandom = { version = "0.2", features = ["js"] } # not a direct dependency, needed because of https://docs.rs/getrandom/latest/getrandom/#webassembly-support
js-sys.workspace = true
wasm-bindgen-futures.workspace = true
wasm-bindgen.workspace = true
roc_collections = {path = "../compiler/collections"}
roc_gen_wasm = {path = "../compiler/gen_wasm"}
roc_load = {path = "../compiler/load"}
roc_parse = {path = "../compiler/parse"}
roc_repl_eval = {path = "../repl_eval"}
roc_reporting = {path = "../reporting"}
roc_target = {path = "../compiler/roc_target"}
roc_types = {path = "../compiler/types"}
roc_collections = { path = "../compiler/collections" }
roc_gen_wasm = { path = "../compiler/gen_wasm" }
roc_load = { path = "../compiler/load" }
roc_parse = { path = "../compiler/parse" }
roc_repl_eval = { path = "../repl_eval" }
roc_reporting = { path = "../reporting" }
roc_target = { path = "../compiler/roc_target" }
roc_types = { path = "../compiler/types" }
[features]
wasi_test = ["futures"]

View File

@ -1,40 +1,42 @@
[package]
name = "roc_reporting"
version = "0.0.1"
authors = ["The Roc Contributors"]
license = "UPL-1.0"
edition = "2021"
description = "Responsible for generating warning and error messages."
authors.workspace = true
edition.workspace = true
license.workspace = true
version.workspace = true
[dependencies]
roc_can = { path = "../compiler/can" }
roc_collections = { path = "../compiler/collections" }
roc_error_macros = { path = "../error_macros" }
roc_exhaustive = { path = "../compiler/exhaustive" }
roc_region = { path = "../compiler/region" }
roc_fmt = { path = "../compiler/fmt" }
roc_module = { path = "../compiler/module" }
roc_parse = { path = "../compiler/parse" }
roc_problem = { path = "../compiler/problem" }
roc_types = { path = "../compiler/types" }
roc_can = { path = "../compiler/can" }
roc_fmt = { path = "../compiler/fmt" }
roc_region = { path = "../compiler/region" }
roc_solve_problem = { path = "../compiler/solve_problem" }
roc_std = { path = "../roc_std" }
roc_types = { path = "../compiler/types" }
ven_pretty = { path = "../vendor/pretty" }
distance.workspace = true
bumpalo.workspace = true
distance.workspace = true
[dev-dependencies]
roc_builtins = { path = "../compiler/builtins" }
roc_constrain = { path = "../compiler/constrain" }
roc_derive = { path = "../compiler/derive" }
roc_builtins = { path = "../compiler/builtins" }
roc_load = { path = "../compiler/load" }
roc_problem = { path = "../compiler/problem" }
roc_packaging = { path = "../packaging" }
roc_parse = { path = "../compiler/parse" }
roc_problem = { path = "../compiler/problem" }
roc_solve = { path = "../compiler/solve" }
roc_target = { path = "../compiler/roc_target" }
roc_test_utils = { path = "../test_utils" }
roc_solve = { path = "../compiler/solve" }
roc_packaging = { path = "../packaging" }
pretty_assertions.workspace = true
indoc.workspace = true
insta.workspace = true
pretty_assertions.workspace = true

View File

@ -1539,7 +1539,7 @@ fn report_shadowing<'b>(
alloc.concat([
alloc.reflow("Since these "),
alloc.reflow(what_plural),
alloc.reflow(" have the same name, it's easy to use the wrong one on accident. Give one of them a new name."),
alloc.reflow(" have the same name, it's easy to use the wrong one by accident. Give one of them a new name."),
]),
])
};

View File

@ -543,7 +543,7 @@ mod test_reporting {
^
Since these variables have the same name, it's easy to use the wrong
one on accident. Give one of them a new name.
one by accident. Give one of them a new name.
"###
);
@ -575,7 +575,7 @@ mod test_reporting {
^^^^^^^^^^^^^^^^^^^^^^^^
Since these aliases have the same name, it's easy to use the wrong one
on accident. Give one of them a new name.
by accident. Give one of them a new name.
"###
);
@ -8425,7 +8425,7 @@ In roc, functions are always written as a lambda, like{}
^^^^^^^^^
Since these variables have the same name, it's easy to use the wrong
one on accident. Give one of them a new name.
one by accident. Give one of them a new name.
"#
);
@ -8454,7 +8454,7 @@ In roc, functions are always written as a lambda, like{}
^^^^^^^
Since these abilities have the same name, it's easy to use the wrong
one on accident. Give one of them a new name.
one by accident. Give one of them a new name.
"#
);
@ -9739,7 +9739,7 @@ In roc, functions are always written as a lambda, like{}
^^^^
Since these variables have the same name, it's easy to use the wrong
one on accident. Give one of them a new name.
one by accident. Give one of them a new name.
UNNECESSARY DEFINITION /code/proj/Main.roc

View File

@ -1,297 +0,0 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "aho-corasick"
version = "0.7.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f"
dependencies = [
"memchr",
]
[[package]]
name = "ansi_term"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
dependencies = [
"winapi",
]
[[package]]
name = "arrayvec"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6"
[[package]]
name = "cfg-if"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "ctor"
version = "0.1.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ccc0a48a9b826acdf4028595adc9db92caea352f7af011a3034acd172a52a0aa"
dependencies = [
"quote",
"syn",
]
[[package]]
name = "diff"
version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e25ea47919b1560c4e3b7fe0aaab9becf5b84a10325ddf7db0f0ba5e1026499"
[[package]]
name = "env_logger"
version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a19187fea3ac7e84da7dacf48de0c45d63c6a76f9490dae389aead16c243fce3"
dependencies = [
"log",
"regex",
]
[[package]]
name = "getrandom"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d39cd93900197114fa1fcb7ae84ca742095eed9442088988ae74fa744e930e77"
dependencies = [
"cfg-if",
"libc",
"wasi",
]
[[package]]
name = "indoc"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e7906a9fababaeacb774f72410e497a1d18de916322e33797bb2cd29baa23c9e"
dependencies = [
"unindent",
]
[[package]]
name = "itoa"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c8af84674fe1f223a982c933a0ee1086ac4d4052aa0fb8060c12c6ad838e754"
[[package]]
name = "libc"
version = "0.2.139"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"
[[package]]
name = "log"
version = "0.4.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710"
dependencies = [
"cfg-if",
]
[[package]]
name = "memchr"
version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
[[package]]
name = "output_vt100"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "628223faebab4e3e40667ee0b2336d34a5b960ff60ea743ddfdbcf7770bcfb66"
dependencies = [
"winapi",
]
[[package]]
name = "pretty_assertions"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "76d5b548b725018ab5496482b45cb8bef21e9fed1858a6d674e3a8a0f0bb5d50"
dependencies = [
"ansi_term",
"ctor",
"diff",
"output_vt100",
]
[[package]]
name = "proc-macro2"
version = "1.0.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029"
dependencies = [
"unicode-xid",
]
[[package]]
name = "quickcheck"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "588f6378e4dd99458b60ec275b4477add41ce4fa9f64dcba6f15adccb19b50d6"
dependencies = [
"env_logger",
"log",
"rand",
]
[[package]]
name = "quickcheck_macros"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b22a693222d716a9587786f37ac3f6b4faedb5b80c23914e7303ff5a1d8016e9"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "quote"
version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "864d3e96a899863136fc6e99f3d7cae289dafe43bf2c5ac19b70df7210c0a145"
dependencies = [
"proc-macro2",
]
[[package]]
name = "rand"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
dependencies = [
"rand_core",
]
[[package]]
name = "rand_core"
version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7"
dependencies = [
"getrandom",
]
[[package]]
name = "regex"
version = "1.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
]
[[package]]
name = "regex-syntax"
version = "0.6.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
[[package]]
name = "roc_std"
version = "0.0.1"
dependencies = [
"arrayvec",
"indoc",
"libc",
"pretty_assertions",
"quickcheck",
"quickcheck_macros",
"serde",
"serde_json",
"static_assertions",
]
[[package]]
name = "ryu"
version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09"
[[package]]
name = "serde"
version = "1.0.143"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53e8e5d5b70924f74ff5c6d64d9a5acd91422117c60f48c4e07855238a254553"
[[package]]
name = "serde_json"
version = "1.0.83"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38dd04e3c8279e75b31ef29dbdceebfe5ad89f4d0937213c53f7d49d01b3d5a7"
dependencies = [
"itoa",
"ryu",
"serde",
]
[[package]]
name = "static_assertions"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]]
name = "syn"
version = "1.0.86"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a65b3f4ffa0092e9887669db0eae07941f023991ab58ea44da8fe8e2d511c6b"
dependencies = [
"proc-macro2",
"quote",
"unicode-xid",
]
[[package]]
name = "unicode-xid"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
[[package]]
name = "unindent"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "514672a55d7380da379785a4d70ca8386c8883ff7eaae877be4d2081cebe73d8"
[[package]]
name = "wasi"
version = "0.10.2+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"
[[package]]
name = "winapi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
dependencies = [
"winapi-i686-pc-windows-gnu",
"winapi-x86_64-pc-windows-gnu",
]
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"

View File

@ -1,26 +1,29 @@
[package]
authors = ["The Roc Contributors"]
description = "Rust representations of Roc data structures"
edition = "2021"
license = "UPL-1.0"
name = "roc_std"
description = "Rust representations of Roc data structures"
readme = "README.md"
repository = "https://github.com/roc-lang/roc"
version = "0.0.1"
authors.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true
version.workspace = true
[dependencies]
static_assertions = "1.1.0"
arrayvec = "0.7.2"
serde = { version = "1", optional = true }
arrayvec.workspace = true
serde = { workspace = true, optional = true }
static_assertions.workspace = true
[dev-dependencies]
indoc = "1.0.3"
libc = "0.2.135"
pretty_assertions = "1.0.0"
quickcheck = "1.0.3"
quickcheck_macros = "1.0.0"
serde_json = "1.0.83"
libc.workspace = true
pretty_assertions.workspace = true
quickcheck.workspace = true
quickcheck_macros.workspace = true
serde_json.workspace = true
[features]
std = []
serde = ["dep:serde"]
std = []
[package.metadata.cargo-udeps.ignore]
development = ["quickcheck_macros", "serde_json"]

View File

@ -46,7 +46,14 @@ impl<K, V> RocDict<K, V> {
}
impl<K: Hash, V> RocDict<K, V> {
pub fn from_iter<I: Iterator<Item = (K, V)>>(src: I) -> Self {
unsafe fn insert_unchecked(&mut self, _key: K, _val: V) {
todo!();
}
}
impl<K: Hash, V> FromIterator<(K, V)> for RocDict<K, V> {
fn from_iter<T: IntoIterator<Item = (K, V)>>(into_iter: T) -> Self {
let src = into_iter.into_iter();
let mut ret = Self::with_capacity(src.size_hint().0);
for (key, val) in src {
@ -57,16 +64,6 @@ impl<K: Hash, V> RocDict<K, V> {
ret
}
unsafe fn insert_unchecked(&mut self, _key: K, _val: V) {
todo!();
}
}
impl<'a, K: Hash, V> FromIterator<(K, V)> for RocDict<K, V> {
fn from_iter<T: IntoIterator<Item = (K, V)>>(into_iter: T) -> Self {
RocDict::from_iter(into_iter.into_iter())
}
}
impl<'a, K, V> IntoIterator for &'a RocDict<K, V> {

View File

@ -159,7 +159,7 @@ impl<T> RocList<T> {
/// bytes over - in other words, calling this `as_slice` method and then calling `to_vec`
/// on that.
pub fn as_slice(&self) -> &[T] {
&*self
self
}
/// Note that there is no way to convert directly to a Vec.

View File

@ -5,12 +5,7 @@ use core::{
};
#[derive(Default, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(C)]
struct Unit;
#[derive(Default, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(transparent)]
pub struct RocSet<T>(RocDict<T, Unit>);
pub struct RocSet<T>(RocDict<T, ()>);
impl<T> RocSet<T> {
pub fn len(&self) -> usize {
@ -32,10 +27,11 @@ impl<T> RocSet<T> {
}
}
impl<T: Hash> RocSet<T> {
#[allow(unused)]
pub fn from_iter<I: Iterator<Item = T>>(src: I) -> Self {
Self(RocDict::from_iter(src.map(|elem| (elem, Unit))))
impl<T: Hash> FromIterator<T> for RocSet<T> {
fn from_iter<I: IntoIterator<Item = T>>(into_iter: I) -> Self {
Self(RocDict::from_iter(
into_iter.into_iter().map(|elem| (elem, ())),
))
}
}

View File

@ -154,7 +154,7 @@ impl RocStr {
/// bytes over - in other words, calling this `as_str` method and then calling `to_string`
/// on that.
pub fn as_str(&self) -> &str {
&*self
self
}
/// Create an empty RocStr with enough space preallocated to store
@ -562,8 +562,8 @@ impl Deref for RocStr {
fn deref(&self) -> &Self::Target {
match self.as_enum_ref() {
RocStrInnerRef::HeapAllocated(h) => unsafe { core::str::from_utf8_unchecked(&*h) },
RocStrInnerRef::SmallString(s) => &*s,
RocStrInnerRef::HeapAllocated(h) => unsafe { core::str::from_utf8_unchecked(h) },
RocStrInnerRef::SmallString(s) => s,
}
}
}

View File

@ -1,7 +1,7 @@
#![allow(clippy::missing_safety_doc)]
#[macro_use]
extern crate pretty_assertions;
// #[macro_use]
// extern crate indoc;
extern crate quickcheck;
extern crate roc_std;

View File

@ -1,13 +1,14 @@
[package]
name = "roc_test_utils"
version = "0.0.1"
authors = ["The Roc Contributors"]
license = "UPL-1.0"
edition = "2021"
description = "Utility functions used all over the code base."
authors.workspace = true
edition.workspace = true
license.workspace = true
version.workspace = true
[dependencies]
pretty_assertions = "1.3.0"
remove_dir_all = "0.7.0"
pretty_assertions.workspace = true
remove_dir_all.workspace = true
[dev-dependencies]

Some files were not shown because too many files have changed in this diff Show More