diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 00000000000..9b22ec478fb --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,1504 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "Inflector" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" +dependencies = [ + "lazy_static 1.4.0", + "regex", +] + +[[package]] +name = "addr2line" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03345e98af8f3d786b6d9f656ccfa6ac316d954e92bc4841f0bba20789d5fb5a" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[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.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" +dependencies = [ + "winapi", +] + +[[package]] +name = "anyhow" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28b2cd92db5cbd74e8e5028f7e27dd7aa3090e89e4f2a197cc7c8dfb69c7063b" + +[[package]] +name = "async-trait" +version = "0.1.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b98e84bbb4cbcdd97da190ba0c58a1bb0de2c1fdf67d159e192ed766aeca722" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[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 = "auto_impl" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42cbf586c80ada5e5ccdecae80d3ef0854f224e2dd74435f8d87e6831b8d0a38" +dependencies = [ + "proc-macro-error", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "autocfg" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" + +[[package]] +name = "backtrace" +version = "0.3.59" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4717cfcbfaa661a0fd48f8453951837ae7e8f81e481fbb136e3202d72805a744" +dependencies = [ + "addr2line", + "cc", + "cfg-if 1.0.0", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + +[[package]] +name = "base64" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c4a342b450b268e1be8036311e2c613d7f8a7ed31214dff1cc3b60852a3168d" +dependencies = [ + "byteorder", + "safemem", +] + +[[package]] +name = "bitflags" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" + +[[package]] +name = "block-buffer" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" +dependencies = [ + "block-padding 0.1.5", + "byte-tools", + "byteorder", + "generic-array 0.12.4", +] + +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "block-padding 0.2.1", + "generic-array 0.14.4", +] + +[[package]] +name = "block-padding" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" +dependencies = [ + "byte-tools", +] + +[[package]] +name = "block-padding" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" + +[[package]] +name = "bumpalo" +version = "3.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c59e7af012c713f529e7a3ee57ce9b31ddd858d4b512923602f74608b009631" + +[[package]] +name = "byte-tools" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" + +[[package]] +name = "byteorder" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" + +[[package]] +name = "bytes" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040" + +[[package]] +name = "cc" +version = "1.0.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a72c244c1ff497a746a7e1fb3d14bd08420ecda70c8f25c7112f2781652d787" + +[[package]] +name = "cfg-if" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "clap" +version = "2.33.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" +dependencies = [ + "ansi_term", + "atty", + "bitflags", + "strsim", + "textwrap", + "unicode-width", + "vec_map", +] + +[[package]] +name = "core_lang" +version = "0.1.0" +dependencies = [ + "Inflector", + "either", + "fuel-asm", + "fuel-vm-rust", + "pest", + "pest_derive", + "petgraph", + "thiserror", + "uuid-b64", +] + +[[package]] +name = "cpufeatures" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed00c67cb5d0a7d64a44f6ad2668db7e7530311dd53ea79bcd4fb022c64911c8" +dependencies = [ + "libc", +] + +[[package]] +name = "dashmap" +version = "4.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e77a43b28d0668df09411cb0bc9a8c2adc40f9a048afe863e05fd43251e8e39c" +dependencies = [ + "cfg-if 1.0.0", + "num_cpus", +] + +[[package]] +name = "digest" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" +dependencies = [ + "generic-array 0.12.4", +] + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array 0.14.4", +] + +[[package]] +name = "either" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" + +[[package]] +name = "error-chain" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff511d5dc435d703f4971bc399647c9bc38e20cb41452e3b9feb4765419ed3f3" +dependencies = [ + "backtrace", +] + +[[package]] +name = "fake-simd" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" + +[[package]] +name = "fixedbitset" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d" + +[[package]] +name = "forc" +version = "0.1.0" +dependencies = [ + "core_lang", + "line-col", + "pest", + "serde", + "source-span", + "structopt", + "termcolor", + "toml", + "whoami", +] + +[[package]] +name = "form_urlencoded" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" +dependencies = [ + "matches", + "percent-encoding", +] + +[[package]] +name = "fuchsia-cprng" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" + +[[package]] +name = "fuel-asm" +version = "0.1.0" +source = "git+ssh://git@github.com/FuelLabs/fuel-asm.git#2a0c2f8482434f438bea47fb7f0b08408a29112c" + +[[package]] +name = "fuel-tx" +version = "0.1.0" +source = "git+ssh://git@github.com/FuelLabs/fuel-tx.git#47c98bc74ac0e3a753fcb3a73850db1095de0fab" +dependencies = [ + "fuel-asm", + "itertools", + "sha2", +] + +[[package]] +name = "fuel-vm-rust" +version = "0.1.0" +source = "git+ssh://git@github.com/FuelLabs/fuel-core.git#34d7066aaf448d5e22ef0eec56df5f1dd0d578f7" +dependencies = [ + "fuel-asm", + "fuel-tx", + "itertools", + "secp256k1", + "sha3", + "tracing", +] + +[[package]] +name = "futures" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e7e43a803dae2fa37c1f6a8fe121e1f7bf9548b4dfc0522a42f34145dadfc27" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e682a68b29a882df0545c143dc3646daefe80ba479bcdede94d5a703de2871e2" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0402f765d8a89a26043b889b26ce3c4679d268fa6bb22cd7c6aad98340e179d1" + +[[package]] +name = "futures-io" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acc499defb3b348f8d8f3f66415835a9131856ff7714bf10dadfc4ec4bdb29a1" + +[[package]] +name = "futures-macro" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4c40298486cdf52cc00cd6d6987892ba502c7656a16a4192a9992b1ccedd121" +dependencies = [ + "autocfg", + "proc-macro-hack", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a57bead0ceff0d6dde8f465ecd96c9338121bb7717d3e7b108059531870c4282" + +[[package]] +name = "futures-task" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a16bef9fc1a4dddb5bee51c989e3fbba26569cbb0e31f5b303c184e3dd33dae" + +[[package]] +name = "futures-util" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "feb5c238d27e2bf94ffdfd27b2c29e3df4a68c4193bb6427384259e2bf191967" +dependencies = [ + "autocfg", + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "proc-macro-hack", + "proc-macro-nested", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" +dependencies = [ + "typenum", +] + +[[package]] +name = "generic-array" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "gimli" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e4075386626662786ddb0ec9081e7c7eeb1ba31951f447ca780ef9f5d568189" + +[[package]] +name = "hashbrown" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" + +[[package]] +name = "heck" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cbf45460356b7deeb5e3415b5563308c0a9b057c85e12b06ad551f98d0a6ac" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "hermit-abi" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" +dependencies = [ + "libc", +] + +[[package]] +name = "httparse" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3a87b616e37e93c22fb19bcd386f02f3af5ea98a25670ad0fce773de23c5e68" + +[[package]] +name = "idna" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" +dependencies = [ + "matches", + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "indexmap" +version = "1.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "824845a0bf897a9042383849b02c1bc219c2383772efcd5c6f9766fa4b81aef3" +dependencies = [ + "autocfg", + "hashbrown", +] + +[[package]] +name = "inlinable_string" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3094308123a0e9fd59659ce45e22de9f53fc1d2ac6e1feb9fef988e4f76cad77" +dependencies = [ + "serde", +] + +[[package]] +name = "itertools" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37d572918e350e82412fe766d24b15e6682fb2ed2bbe018280caa810397cb319" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" + +[[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 = "keccak" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67c21572b4949434e4fc1e1978b99c5f77064153c59d998bf13ecd96fb5ecba7" + +[[package]] +name = "lazy_static" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73" + +[[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.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "789da6d93f1b866ffe175afc5322a4d76c038605a1c3319bb57b06967ca98a36" + +[[package]] +name = "line-col" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e69cdf6b85b5c8dce514f694089a2cf8b1a702f6cd28607bcb3cf296c9778db" + +[[package]] +name = "log" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" +dependencies = [ + "cfg-if 1.0.0", +] + +[[package]] +name = "lsp-types" +version = "0.89.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48b8a871b0a450bcec0e26d74a59583c8173cb9fb7d7f98889e18abb84838e0f" +dependencies = [ + "bitflags", + "serde", + "serde_json", + "serde_repr", + "url", +] + +[[package]] +name = "lspower" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3167a7555dbacd9ddf3c42eefcc2d4d5e46bb79cd1702bb25d4152bdf537d4b4" +dependencies = [ + "anyhow", + "async-trait", + "auto_impl", + "bytes", + "dashmap", + "futures", + "httparse", + "log", + "lsp-types", + "lspower-macros", + "serde", + "serde_json", + "thiserror", + "tokio", + "tokio-util", + "tower-service", + "twoway", +] + +[[package]] +name = "lspower-macros" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca1d48da0e4a6100b4afd52fae99f36d47964a209624021280ad9ffdd410e83d" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "maplit" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" + +[[package]] +name = "matches" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" + +[[package]] +name = "memchr" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc" + +[[package]] +name = "miniz_oxide" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b" +dependencies = [ + "adler", + "autocfg", +] + +[[package]] +name = "mio" +version = "0.7.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf80d3e903b34e0bd7282b218398aec54e082c840d9baf8339e0080a0c542956" +dependencies = [ + "libc", + "log", + "miow", + "ntapi", + "winapi", +] + +[[package]] +name = "miow" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" +dependencies = [ + "winapi", +] + +[[package]] +name = "ntapi" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44" +dependencies = [ + "winapi", +] + +[[package]] +name = "num_cpus" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "numtoa" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" + +[[package]] +name = "object" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a5b3dd1c072ee7963717671d1ca129f1048fda25edea6b752bfc71ac8854170" + +[[package]] +name = "opaque-debug" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" + +[[package]] +name = "opaque-debug" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" + +[[package]] +name = "percent-encoding" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" + +[[package]] +name = "pest" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53" +dependencies = [ + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "833d1ae558dc601e9a60366421196a8d94bc0ac980476d0b67e1d0988d72b2d0" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99b8db626e31e5b81787b9783425769681b347011cc59471e33ea46d2ea0cf55" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pest_meta" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54be6e404f5317079812fc8f9f5279de376d8856929e21c184ecf6bbd692a11d" +dependencies = [ + "maplit", + "pest", + "sha-1", +] + +[[package]] +name = "petgraph" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "467d164a6de56270bd7c4d070df81d07beace25012d5103ced4e9ff08d6afdb7" +dependencies = [ + "fixedbitset", + "indexmap", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc0e1f259c92177c30a4c9d177246edd0a3568b25756a977d0632cf8fa37e905" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[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-macro-hack" +version = "0.5.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" + +[[package]] +name = "proc-macro-nested" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086" + +[[package]] +name = "proc-macro2" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0d8caf72986c1a598726adc988bb5984792ef84f5ee5aa50209145ee8077038" +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 = "rand" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" +dependencies = [ + "fuchsia-cprng", + "libc", + "rand_core 0.3.1", + "rdrand", + "winapi", +] + +[[package]] +name = "rand_core" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" +dependencies = [ + "rand_core 0.4.2", +] + +[[package]] +name = "rand_core" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" + +[[package]] +name = "rdrand" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" +dependencies = [ + "rand_core 0.3.1", +] + +[[package]] +name = "redox_syscall" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "742739e41cd49414de871ea5e549afb7e2a3ac77b589bcbebe8c82fab37147fc" +dependencies = [ + "bitflags", +] + +[[package]] +name = "redox_termios" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f" +dependencies = [ + "redox_syscall", +] + +[[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 = "ropey" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f3ef16589fdbb3e8fbce3dca944c08e61f39c7f16064b21a257d68ea911a83" +dependencies = [ + "smallvec", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "410f7acf3cb3a44527c5d9546bad4bf4e6c460915d5f9f2fc524498bfe8f70ce" + +[[package]] +name = "ryu" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" + +[[package]] +name = "safemem" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e27a8b19b835f7aea908818e871f5cc3a5a186550c30773be987e155e8163d8f" + +[[package]] +name = "secp256k1" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee5070fdc6f26ca5be6dcfc3d07c76fdb974a63a8b246b459854274145f5a258" +dependencies = [ + "secp256k1-sys", +] + +[[package]] +name = "secp256k1-sys" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67e4b6455ee49f5901c8985b88f98fb0a0e1d90a6661f5a03f4888bd987dad29" +dependencies = [ + "cc", +] + +[[package]] +name = "serde" +version = "1.0.126" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec7505abeacaec74ae4778d9d9328fe5a5d04253220a85c4ee022239fc996d03" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.126" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "963a7dbc9895aeac7ac90e74f34a5d5261828f79df35cbed41e10189d3804d43" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_repr" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98d0516900518c29efa217c298fa1f4e6c6ffc85ae29fd7f4ee48f176e1a9ed5" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sha-1" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df" +dependencies = [ + "block-buffer 0.7.3", + "digest 0.8.1", + "fake-simd", + "opaque-debug 0.2.3", +] + +[[package]] +name = "sha2" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b362ae5752fd2137731f9fa25fd4d9058af34666ca1966fb969119cc35719f12" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if 1.0.0", + "cpufeatures", + "digest 0.9.0", + "opaque-debug 0.3.0", +] + +[[package]] +name = "sha3" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f81199417d4e5de3f04b1e871023acea7389672c4135918f05aa9cbf2f2fa809" +dependencies = [ + "block-buffer 0.9.0", + "digest 0.9.0", + "keccak", + "opaque-debug 0.3.0", +] + +[[package]] +name = "slab" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f173ac3d1a7e3b28003f40de0b5ce7fe2710f9b9dc3fc38664cebee46b3b6527" + +[[package]] +name = "smallvec" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" + +[[package]] +name = "source-span" +version = "2.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "403a235b99be82b668acac73519cc19f3cf5be5ed0be388eda888261bb75536b" +dependencies = [ + "termion", +] + +[[package]] +name = "strsim" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" + +[[package]] +name = "structopt" +version = "0.3.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5277acd7ee46e63e5168a80734c9f6ee81b1367a7d8772a2d765df2a3705d28c" +dependencies = [ + "clap", + "lazy_static 1.4.0", + "structopt-derive", +] + +[[package]] +name = "structopt-derive" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ba9cdfda491b814720b6b06e0cac513d922fc407582032e8706e9f137976f90" +dependencies = [ + "heck", + "proc-macro-error", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sway-server" +version = "0.1.0" +dependencies = [ + "core_lang", + "dashmap", + "lspower", + "pest", + "ropey", + "serde_json", + "tokio", +] + +[[package]] +name = "syn" +version = "1.0.72" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1e8cdbefb79a9a5a65e0db8b47b723ee907b7c7f8496c76a1770b5c310bab82" +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 = "termion" +version = "1.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "077185e2eac69c3f8379a4298e1e07cd36beb962290d4a51199acf0fdc10607e" +dependencies = [ + "libc", + "numtoa", + "redox_syscall", + "redox_termios", +] + +[[package]] +name = "test_suite" +version = "0.1.0" +dependencies = [ + "forc", + "fuel-asm", + "fuel-tx", + "fuel-vm-rust", +] + +[[package]] +name = "textwrap" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +dependencies = [ + "unicode-width", +] + +[[package]] +name = "thiserror" +version = "1.0.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa6f76457f59514c7eeb4e59d891395fab0b2fd1d40723ae737d64153392e9c6" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a36768c0fbf1bb15eca10defa29526bda730a2376c2ab4393ccfa16fb1a318d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tinyvec" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b5220f05bb7de7f3f53c7c065e1199b3172696fe2db9f9c4d8ad9b4ee74c342" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" + +[[package]] +name = "tokio" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a38d31d7831c6ed7aad00aa4c12d9375fd225a6dd77da1d25b707346319a975" +dependencies = [ + "autocfg", + "bytes", + "libc", + "memchr", + "mio", + "num_cpus", + "pin-project-lite", + "tokio-macros", +] + +[[package]] +name = "tokio-macros" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c49e3df43841dafb86046472506755d8501c5615673955f6aa17181125d13c37" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tokio-util" +version = "0.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1caa0b0c8d94a049db56b5acf8cba99dc0623aab1b26d5b5f5e2d945846b3592" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "log", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "toml" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa" +dependencies = [ + "serde", +] + +[[package]] +name = "tower-service" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" + +[[package]] +name = "tracing" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09adeb8c97449311ccd28a427f96fb563e7fd31aabf994189879d9da2394b89d" +dependencies = [ + "cfg-if 1.0.0", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c42e6fa53307c8a17e4ccd4dc81cf5ec38db9209f59b222210375b54ee40d1e2" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing-core" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9ff14f98b1a4b289c6248a023c1c2fa1491062964e9fed67ab29c4e4da4a052" +dependencies = [ + "lazy_static 1.4.0", +] + +[[package]] +name = "twoway" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c57ffb460d7c24cd6eda43694110189030a3d1dfe418416d9468fd1c1d290b47" +dependencies = [ + "memchr", + "unchecked-index", +] + +[[package]] +name = "typenum" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06" + +[[package]] +name = "ucd-trie" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" + +[[package]] +name = "unchecked-index" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eeba86d422ce181a719445e51872fa30f1f7413b62becb52e95ec91aa262d85c" + +[[package]] +name = "unicode-bidi" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eeb8be209bb1c96b7c177c7420d26e04eccacb0eeae6b980e35fcb74678107e0" +dependencies = [ + "matches", +] + +[[package]] +name = "unicode-normalization" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33717dca7ac877f497014e10d73f3acf948c342bee31b5ca7892faf94ccc6b49" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-segmentation" +version = "1.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0d2e7be6ae3a5fa87eed5fb451aff96f2573d2694942e40543ae0bbe19c796" + +[[package]] +name = "unicode-width" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" + +[[package]] +name = "unicode-xid" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" + +[[package]] +name = "url" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" +dependencies = [ + "form_urlencoded", + "idna", + "matches", + "percent-encoding", + "serde", +] + +[[package]] +name = "uuid" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1436e58182935dcd9ce0add9ea0b558e8a87befe01c1a301e6020aeb0876363" +dependencies = [ + "cfg-if 0.1.10", + "rand", +] + +[[package]] +name = "uuid-b64" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12b9cb172a0b1f4e0bf63b807d67ff9ff0d9fba2bcc5f30d3aacb7240e02fc1b" +dependencies = [ + "base64", + "error-chain", + "inlinable_string", + "lazy_static 0.2.11", + "uuid", +] + +[[package]] +name = "vec_map" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" + +[[package]] +name = "version_check" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" + +[[package]] +name = "wasm-bindgen" +version = "0.2.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d54ee1d4ed486f78874278e63e4069fc1ab9f6a18ca492076ffb90c5eb2997fd" +dependencies = [ + "cfg-if 1.0.0", + "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 1.4.0", + "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 = "whoami" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4abacf325c958dfeaf1046931d37f2a901b6dfe0968ee965a29e94c6766b2af6" +dependencies = [ + "wasm-bindgen", + "web-sys", +] + +[[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" diff --git a/core_lang/src/asm_generation/expression/enum_instantiation.rs b/core_lang/src/asm_generation/expression/enum_instantiation.rs index da6998c69e1..9988d897524 100644 --- a/core_lang/src/asm_generation/expression/enum_instantiation.rs +++ b/core_lang/src/asm_generation/expression/enum_instantiation.rs @@ -56,7 +56,7 @@ pub(crate) fn convert_enum_instantiation_to_asm<'sc>( asm_buf.push(Op::unowned_stack_allocate_memory( VirtualImmediate24::new_unchecked( - size_of_enum, + size_of_enum * 8, "this size is manually checked to be lower than 2^24", ), )); diff --git a/core_lang/src/asm_generation/expression/structs.rs b/core_lang/src/asm_generation/expression/structs.rs index 3b45fa85b23..4a7e0ee1415 100644 --- a/core_lang/src/asm_generation/expression/structs.rs +++ b/core_lang/src/asm_generation/expression/structs.rs @@ -85,7 +85,7 @@ pub(crate) fn convert_struct_expression_to_asm<'sc>( // we call `new_unchecked` here because we have validated the size is okay above asm_buf.push(Op::unowned_stack_allocate_memory( VirtualImmediate24::new_unchecked( - this_allocation, + this_allocation * 8, // this_allocation is words but this op takes bytes "struct size was checked manually to be within 12 bits", ), )); diff --git a/core_lang/src/asm_generation/finalized_asm.rs b/core_lang/src/asm_generation/finalized_asm.rs index d92f6226aa7..b36057cfa33 100644 --- a/core_lang/src/asm_generation/finalized_asm.rs +++ b/core_lang/src/asm_generation/finalized_asm.rs @@ -1,7 +1,7 @@ use super::{DataSection, InstructionSet}; use crate::error::*; use either::Either; -use std::io::Write; +use std::io::Read; /// Represents an ASM set which has had register allocation, jump elimination, and optimization /// applied to it pub enum FinalizedAsm<'sc> { @@ -17,7 +17,6 @@ pub enum FinalizedAsm<'sc> { // Libraries do not generate any asm. Library, } - impl<'sc> FinalizedAsm<'sc> { pub(crate) fn to_bytecode(&self) -> CompileResult<'sc, Vec> { use FinalizedAsm::*; @@ -54,19 +53,22 @@ fn to_bytecode<'sc>( let offset_to_data_section = (program_section.ops.len() * 4) as u64; // each op is four bytes, so the length of the buf is then number of ops times four. - let mut buf = vec![0; program_section.ops.len() * 4]; + let mut buf = vec![0; (program_section.ops.len() * 4) + 4]; - for (ix, op) in program_section.ops.iter().enumerate() { + let mut half_word_ix = 0; + for op in program_section.ops.iter() { let op = op.to_fuel_asm(offset_to_data_section, data_section); match op { Either::Right(data) => { for i in 0..data.len() { - buf[ix + i] = data[i]; + buf[(half_word_ix * 4) + i] = data[i]; } + half_word_ix += 2; } Either::Left(mut op) => { - op.write(&buf[ix * 4..]) + op.read(&mut buf[half_word_ix * 4..]) .expect("Failed to write to in-memory buffer."); + half_word_ix += 1; } } } diff --git a/core_lang/src/asm_generation/mod.rs b/core_lang/src/asm_generation/mod.rs index a23efab0f93..71227e48adf 100644 --- a/core_lang/src/asm_generation/mod.rs +++ b/core_lang/src/asm_generation/mod.rs @@ -158,6 +158,8 @@ impl<'sc> AbstractInstructionSet<'sc> { } buf.push(self.ops[i].clone()); } + // the last item cannot sequentially jump by definition so we add it in here + self.ops.last().map(|x| buf.push(x.clone())); // scan through the jumps and remove any labels that are unused // this could of course be N instead of 2N if i did this in the above for loop. @@ -346,20 +348,20 @@ pub struct DataSection<'sc> { impl<'sc> DataSection<'sc> { /// Given a [DataId], calculate the offset _from the beginning of the data section_ to the data - /// in words. + /// in bytes. pub(crate) fn offset_to_id(&self, id: &DataId) -> usize { self.value_pairs .iter() .take(id.0 as usize) - .map(|x| x.as_type().stack_size_of()) - .sum::() as usize + .map(|x| x.to_bytes().len()) + .sum() } pub(crate) fn serialize_to_bytes(&self) -> Vec { // not the exact right capacity but serves as a lower bound let mut buf = Vec::with_capacity(self.value_pairs.len()); for val in &self.value_pairs { - buf.append(&mut val.to_bytes()); + buf.append(&mut val.to_bytes().to_vec()); } buf } @@ -657,7 +659,6 @@ impl<'sc> HllAsmSet<'sc> { impl<'sc> JumpOptimizedAsmSet<'sc> { fn allocate_registers(self) -> RegisterAllocatedAsmSet<'sc> { - // TODO implement this -- noop for now match self { JumpOptimizedAsmSet::Library => RegisterAllocatedAsmSet::Library, JumpOptimizedAsmSet::ScriptMain { @@ -811,6 +812,31 @@ fn convert_node_to_asm<'sc>( errors, ) } + TypedAstNodeContent::ReturnStatement(exp) => { + // if a return register was specified, we use it. If not, we generate a register but + // it is going to get thrown away later (in coalescing) as it is never read + let return_register = if let Some(return_register) = return_register { + return_register.clone() + } else { + register_sequencer.next() + }; + let ops = type_check!( + convert_expression_to_asm( + &exp.expr, + namespace, + &return_register, + register_sequencer + ), + return err(warnings, errors), + warnings, + errors + ); + ok( + NodeAsmResult::ReturnStatement { asm: ops }, + warnings, + errors, + ) + } _ => { errors.push(CompileError::Unimplemented( "The ASM for this construct has not been written yet.", @@ -849,6 +875,7 @@ fn build_preamble(register_sequencer: &mut RegisterSequencer) -> [Op<'static>; 6 comment: "data section offset".into(), owning_span: None, }, + Op::unowned_jump_label_comment(label, "end of metadata"), // word 3 -- load the data offset into $ds Op { opcode: Either::Left(VirtualOp::DataSectionRegisterLoadPlaceholder), @@ -865,7 +892,5 @@ fn build_preamble(register_sequencer: &mut RegisterSequencer) -> [Op<'static>; 6 comment: "".into(), owning_span: None, }, - // word 3 - Op::unowned_jump_label_comment(label, "end of metadata"), ] } diff --git a/core_lang/src/asm_lang/allocated_ops.rs b/core_lang/src/asm_lang/allocated_ops.rs index 5752e9e27bd..3e4484b541b 100644 --- a/core_lang/src/asm_lang/allocated_ops.rs +++ b/core_lang/src/asm_lang/allocated_ops.rs @@ -340,7 +340,8 @@ impl<'sc> AllocatedOp<'sc> { fn realize_lw(dest: &AllocatedRegister, data_id: &DataId, data_section: &DataSection) -> VmOp { let dest = dest.to_register_id(); - let offset = data_section.offset_to_id(data_id) as u64; + // all data is word-aligned right now, and `offset_to_id` returns the offset in bytes + let offset = (data_section.offset_to_id(data_id) / 8) as u64; let offset = match VirtualImmediate12::new(offset, Span::new(" ", 0, 0).unwrap()) { Ok ( value ) => value, Err (_) => panic!("Unable to offset into the data section more than 2^12 bits. Unsupported data section length.") diff --git a/core_lang/src/parse_tree/literal.rs b/core_lang/src/parse_tree/literal.rs index c80b8caff50..ffc75beb50a 100644 --- a/core_lang/src/parse_tree/literal.rs +++ b/core_lang/src/parse_tree/literal.rs @@ -19,6 +19,7 @@ pub enum Literal<'sc> { } impl<'sc> Literal<'sc> { + #[allow(dead_code)] pub(crate) fn as_type(&self) -> ResolvedType<'sc> { use Literal::*; match self { @@ -144,15 +145,24 @@ impl<'sc> Literal<'sc> { Err(compile_err) => err(Vec::new(), vec![compile_err]), } } - pub(crate) fn to_bytes(&self) -> Vec { + /// Converts a literal to a big-endian representation. This is padded to words. + pub(crate) fn to_bytes(&self) -> [u8; 8] { use Literal::*; match self { - // TODO are we big endian? - U8(val) => val.to_be_bytes().to_vec(), - U16(val) => val.to_be_bytes().to_vec(), - U32(val) => val.to_be_bytes().to_vec(), - U64(val) => val.to_be_bytes().to_vec(), - Boolean(b) => (if *b { 1u64 } else { 0u64 }).to_be_bytes().to_vec(), + U8(val) => [0, 0, 0, 0, 0, 0, 0, val.to_be_bytes()[0]], + U16(val) => { + let bytes = val.to_be_bytes(); + [0, 0, 0, 0, 0, 0, bytes[0], bytes[1]] + } + U32(val) => { + let bytes = val.to_be_bytes(); + [0, 0, 0, 0, bytes[0], bytes[1], bytes[2], bytes[3]] + } + U64(val) => val.to_be_bytes(), + Boolean(b) => { + let bytes = (if *b { 1u64 } else { 0u64 }).to_be_bytes(); + [0, 0, 0, 0, 0, 0, 0, bytes[0]] + } a => todo!("{:?}", a), } } diff --git a/example_project/fuel_project/src/main.sw b/example_project/fuel_project/src/main.sw index 95607ae29fb..84a7820e3ab 100644 --- a/example_project/fuel_project/src/main.sw +++ b/example_project/fuel_project/src/main.sw @@ -1,4 +1,4 @@ -script; +predicate; struct Rgb { red: u64, green: u64, diff --git a/forc/src/cli/commands/build.rs b/forc/src/cli/commands/build.rs index efd36d1f659..0111bf7f90f 100644 --- a/forc/src/cli/commands/build.rs +++ b/forc/src/cli/commands/build.rs @@ -14,6 +14,7 @@ pub(crate) fn exec(command: Command) -> Result<(), String> { if command.asm { forc_build::print_asm(command.path) } else { - forc_build::build(command.path) + forc_build::build(command.path)?; + Ok(()) } } diff --git a/forc/src/ops/forc_build.rs b/forc/src/ops/forc_build.rs index bb4271aee3f..3ccca746580 100644 --- a/forc/src/ops/forc_build.rs +++ b/forc/src/ops/forc_build.rs @@ -46,7 +46,7 @@ pub fn print_asm(path: Option) -> Result<(), String> { Ok(()) } -pub fn build(path: Option) -> Result<(), String> { +pub fn build(path: Option) -> Result, String> { // find manifest directory, even if in subdirectory let this_dir = if let Some(path) = path { PathBuf::from(path) @@ -82,7 +82,7 @@ pub fn build(path: Option) -> Result<(), String> { println!("Bytecode size is {} bytes.", main.len()); - Ok(()) + Ok(main) } /// Continually go up in the file tree until a manifest (Forc.toml) is found. diff --git a/stdlib/src/main.sw b/stdlib/src/main.sw index 56a039a43c4..91d58f75c03 100644 --- a/stdlib/src/main.sw +++ b/stdlib/src/main.sw @@ -7,6 +7,14 @@ pub trait Subtract { fn subtract(self, other: Self) -> Self; } +pub trait Multiply { + fn multiply(self, other: Self) -> Self; +} + +pub trait Divide { + fn divide(self, other: Self) -> Self; +} + impl Subtract for u64 { fn subtract(self, other: Self) -> Self { // TODO write asm diff --git a/test_suite/Cargo.toml b/test_suite/Cargo.toml index 3d411a321f9..62277ba82d3 100644 --- a/test_suite/Cargo.toml +++ b/test_suite/Cargo.toml @@ -8,3 +8,6 @@ edition = "2018" [dependencies] forc = { path = "../forc" } +fuel-tx = { git = "ssh://git@github.com/FuelLabs/fuel-tx.git" } +fuel-vm-rust = { git = "ssh://git@github.com/FuelLabs/fuel-core.git" } +fuel-asm = { git = "ssh://git@github.com/FuelLabs/fuel-asm.git" } diff --git a/test_suite/src/basic_compilation_tests/harness.rs b/test_suite/src/basic_compilation_tests/harness.rs deleted file mode 100644 index a55384e43ec..00000000000 --- a/test_suite/src/basic_compilation_tests/harness.rs +++ /dev/null @@ -1,19 +0,0 @@ -use forc; - -/// Returns `true` if a file compiled without any errors or warnings, -/// and `false` if it did not. -pub(crate) fn should_compile(file_name: &str) -> bool { - println!("Compiling {}", file_name); - let manifest_dir = env!("CARGO_MANIFEST_DIR"); - let res = forc::ops::forc_build::build(Some(format!( - "{}/src/basic_compilation_tests/test_programs/{}", - manifest_dir, file_name - ))); - match res { - Ok(_) => true, - Err(_) => { - println!("Project \"{}\" failed to compile. ", file_name); - return false; - } - } -} diff --git a/test_suite/src/basic_compilation_tests/mod.rs b/test_suite/src/basic_compilation_tests/mod.rs deleted file mode 100644 index 23c5e65fbf5..00000000000 --- a/test_suite/src/basic_compilation_tests/mod.rs +++ /dev/null @@ -1,7 +0,0 @@ -//! This module contains a harness and test code that verifies -//! a set of known-good programs compile. - -mod harness; -mod test_cases; - -pub use test_cases::run; diff --git a/test_suite/src/basic_compilation_tests/test_cases.rs b/test_suite/src/basic_compilation_tests/test_cases.rs deleted file mode 100644 index 118bc11033e..00000000000 --- a/test_suite/src/basic_compilation_tests/test_cases.rs +++ /dev/null @@ -1,12 +0,0 @@ -pub fn run() { - let project_names = vec!["script_1", "script_2", "script_3"]; - assert!(project_names.into_iter().all(|name| { - let result = crate::basic_compilation_tests::harness::should_compile(name); - if !result { - println!("Failure: {} should have compiled.", name); - false - } else { - true - } - })); -} diff --git a/test_suite/src/e2e_vm_tests/harness.rs b/test_suite/src/e2e_vm_tests/harness.rs new file mode 100644 index 00000000000..a54765067ba --- /dev/null +++ b/test_suite/src/e2e_vm_tests/harness.rs @@ -0,0 +1,50 @@ +use forc; + +use fuel_tx::Transaction; +use fuel_vm_rust::interpreter::Interpreter; + +/// Very basic check that code does indeed run in the VM. +/// `true` if it does, `false` if not. +pub(crate) fn runs_in_vm(file_name: &str) { + let script = compile_to_bytes(file_name); + let gas_price = 10; + let gas_limit = 10000; + let maturity = 100; + let script_data = vec![]; + let inputs = vec![]; + let outputs = vec![]; + let witness = vec![]; + let tx = Transaction::script( + gas_price, + gas_limit, + maturity, + script, + script_data, + inputs, + outputs, + witness, + ); + let block_height = (u32::MAX >> 1) as u64; + tx.validate(block_height).unwrap(); + Interpreter::execute_tx(tx).unwrap(); +} + +/// Returns `true` if a file compiled without any errors or warnings, +/// and `false` if it did not. +pub(crate) fn compile_to_bytes(file_name: &str) -> Vec { + println!("Compiling {}", file_name); + let manifest_dir = env!("CARGO_MANIFEST_DIR"); + let res = forc::ops::forc_build::build(Some(format!( + "{}/src/e2e_vm_tests/test_programs/{}", + manifest_dir, file_name + ))); + match res { + Ok(bytes) => bytes, + Err(_) => { + panic!( + "TEST FAILURE: Project \"{}\" failed to compile. ", + file_name + ); + } + } +} diff --git a/test_suite/src/e2e_vm_tests/mod.rs b/test_suite/src/e2e_vm_tests/mod.rs new file mode 100644 index 00000000000..1651f9a1394 --- /dev/null +++ b/test_suite/src/e2e_vm_tests/mod.rs @@ -0,0 +1,8 @@ +mod harness; + +pub fn run() { + let project_names = vec!["script_1", "script_2", "script_3"]; + project_names.into_iter().for_each(|name| { + crate::e2e_vm_tests::harness::runs_in_vm(name); + }); +} diff --git a/test_suite/src/basic_compilation_tests/test_programs/script_1/Forc.toml b/test_suite/src/e2e_vm_tests/test_programs/script_1/Forc.toml similarity index 100% rename from test_suite/src/basic_compilation_tests/test_programs/script_1/Forc.toml rename to test_suite/src/e2e_vm_tests/test_programs/script_1/Forc.toml diff --git a/test_suite/src/basic_compilation_tests/test_programs/script_1/src/main.sw b/test_suite/src/e2e_vm_tests/test_programs/script_1/src/main.sw similarity index 100% rename from test_suite/src/basic_compilation_tests/test_programs/script_1/src/main.sw rename to test_suite/src/e2e_vm_tests/test_programs/script_1/src/main.sw diff --git a/test_suite/src/basic_compilation_tests/test_programs/script_3/Forc.toml b/test_suite/src/e2e_vm_tests/test_programs/script_2/Forc.toml similarity index 89% rename from test_suite/src/basic_compilation_tests/test_programs/script_3/Forc.toml rename to test_suite/src/e2e_vm_tests/test_programs/script_2/Forc.toml index d9c16b43ac1..75bf79bae15 100644 --- a/test_suite/src/basic_compilation_tests/test_programs/script_3/Forc.toml +++ b/test_suite/src/e2e_vm_tests/test_programs/script_2/Forc.toml @@ -1,7 +1,7 @@ [project] author = "Alexander Hansen " license = "MIT" -name = "script_1" +name = "script_2" entry = "main.sw" diff --git a/test_suite/src/basic_compilation_tests/test_programs/script_2/src/main.sw b/test_suite/src/e2e_vm_tests/test_programs/script_2/src/main.sw similarity index 100% rename from test_suite/src/basic_compilation_tests/test_programs/script_2/src/main.sw rename to test_suite/src/e2e_vm_tests/test_programs/script_2/src/main.sw diff --git a/test_suite/src/basic_compilation_tests/test_programs/script_2/Forc.toml b/test_suite/src/e2e_vm_tests/test_programs/script_3/Forc.toml similarity index 89% rename from test_suite/src/basic_compilation_tests/test_programs/script_2/Forc.toml rename to test_suite/src/e2e_vm_tests/test_programs/script_3/Forc.toml index d9c16b43ac1..f4dbab55663 100644 --- a/test_suite/src/basic_compilation_tests/test_programs/script_2/Forc.toml +++ b/test_suite/src/e2e_vm_tests/test_programs/script_3/Forc.toml @@ -1,7 +1,7 @@ [project] author = "Alexander Hansen " license = "MIT" -name = "script_1" +name = "script_3" entry = "main.sw" diff --git a/test_suite/src/basic_compilation_tests/test_programs/script_3/src/main.sw b/test_suite/src/e2e_vm_tests/test_programs/script_3/src/main.sw similarity index 93% rename from test_suite/src/basic_compilation_tests/test_programs/script_3/src/main.sw rename to test_suite/src/e2e_vm_tests/test_programs/script_3/src/main.sw index a222cce5d42..66b9f49e96d 100644 --- a/test_suite/src/basic_compilation_tests/test_programs/script_3/src/main.sw +++ b/test_suite/src/e2e_vm_tests/test_programs/script_3/src/main.sw @@ -1,7 +1,7 @@ script; // This test tests two-pass compilation and allowing usages before declarations. -fn main() { +fn main() -> bool { // fn before decl let x = the_number_five(); // enum before decl @@ -11,6 +11,7 @@ fn main() { a: true, b: false }; + return true; } struct FuelStruct { diff --git a/test_suite/src/main.rs b/test_suite/src/main.rs index 3ecb21cd749..3fd8915bac1 100644 --- a/test_suite/src/main.rs +++ b/test_suite/src/main.rs @@ -1,5 +1,5 @@ -mod basic_compilation_tests; +mod e2e_vm_tests; fn main() { - basic_compilation_tests::run(); + e2e_vm_tests::run(); }