From e2159065a5efae0167aaa8dbd5d67323897b0a27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Flemstr=C3=B6m?= Date: Sat, 26 Jan 2019 18:33:47 +0100 Subject: [PATCH 01/22] Start moving from specs to salsa --- Cargo.lock | 427 +++++++++++------- Cargo.toml | 16 +- build.rs | 2 +- specs-visitor-derive/Cargo.toml | 4 +- src/codegen/tests.rs | 4 +- src/error.rs | 4 +- src/ir/builder.rs | 8 +- src/ir/mod.rs | 4 +- src/ir/tests.rs | 4 +- src/lib.rs | 12 +- src/source/db.rs | 47 ++ src/source/mod.rs | 33 ++ src/{ => syntax}/ast/ast_node.rs | 2 +- src/{ => syntax}/ast/map_context.rs | 4 +- src/{ => syntax}/ast/mod.rs | 40 +- src/syntax/db.rs | 1 + src/syntax/mod.rs | 3 + .../parser/grammar.lalrpop} | 4 +- src/{ => syntax}/parser/mod.rs | 82 ++-- src/{ => syntax}/parser/util.rs | 17 +- 20 files changed, 452 insertions(+), 266 deletions(-) create mode 100644 src/source/db.rs create mode 100644 src/source/mod.rs rename src/{ => syntax}/ast/ast_node.rs (99%) rename src/{ => syntax}/ast/map_context.rs (99%) rename src/{ => syntax}/ast/mod.rs (91%) create mode 100644 src/syntax/db.rs create mode 100644 src/syntax/mod.rs rename src/{parser/tin.lalrpop => syntax/parser/grammar.lalrpop} (99%) rename src/{ => syntax}/parser/mod.rs (94%) rename src/{ => syntax}/parser/util.rs (97%) diff --git a/Cargo.lock b/Cargo.lock index 9057ee9..86c2512 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -14,7 +14,7 @@ name = "aho-corasick" version = "0.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "memchr 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.1.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -51,7 +51,7 @@ name = "atty" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -69,7 +69,7 @@ dependencies = [ "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -80,7 +80,7 @@ version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -108,7 +108,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "block-padding 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "byte-tools 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "generic-array 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -127,7 +127,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "byteorder" -version = "1.2.7" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -197,29 +197,29 @@ dependencies = [ [[package]] name = "cranelift" -version = "0.26.0" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cranelift-codegen 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cranelift-frontend 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-codegen 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-frontend 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cranelift-bforest" -version = "0.26.0" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cranelift-entity 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-entity 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cranelift-codegen" -version = "0.26.0" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cranelift-bforest 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cranelift-codegen-meta 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cranelift-entity 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-bforest 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-codegen-meta 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-entity 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -228,59 +228,59 @@ dependencies = [ [[package]] name = "cranelift-codegen-meta" -version = "0.26.0" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cranelift-entity 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-entity 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cranelift-entity" -version = "0.26.0" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "cranelift-frontend" -version = "0.26.0" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cranelift-codegen 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-codegen 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "target-lexicon 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cranelift-module" -version = "0.26.0" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cranelift-codegen 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cranelift-entity 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-codegen 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-entity 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cranelift-native" -version = "0.26.0" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cranelift-codegen 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-codegen 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)", "raw-cpuid 6.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "target-lexicon 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cranelift-simplejit" -version = "0.26.0" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cranelift-codegen 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cranelift-module 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cranelift-native 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-codegen 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-module 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-native 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)", "errno 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", - "region 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "region 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "target-lexicon 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -304,8 +304,8 @@ dependencies = [ "crossbeam-epoch 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -392,8 +392,18 @@ name = "derivative" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.25 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "derive-new" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -422,8 +432,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)", "strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -439,7 +449,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "ena" -version = "0.10.1" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -473,7 +483,7 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "errno-dragonfly 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -483,7 +493,7 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -500,8 +510,8 @@ name = "failure_derive" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.25 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)", "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -521,6 +531,11 @@ name = "fnv" version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "fuchsia-cprng" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "fuchsia-zircon" version = "0.3.3" @@ -540,7 +555,7 @@ name = "fxhash" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -581,6 +596,11 @@ dependencies = [ "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "indexmap" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "itertools" version = "0.7.11" @@ -613,7 +633,7 @@ dependencies = [ [[package]] name = "lalrpop" -version = "0.16.2" +version = "0.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "ascii-canvas 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -621,14 +641,14 @@ dependencies = [ "bit-set 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "docopt 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "ena 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)", - "lalrpop-util 0.16.2 (registry+https://github.com/rust-lang/crates.io-index)", + "ena 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lalrpop-util 0.16.3 (registry+https://github.com/rust-lang/crates.io-index)", "petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -637,7 +657,7 @@ dependencies = [ [[package]] name = "lalrpop-util" -version = "0.16.2" +version = "0.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -647,7 +667,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libc" -version = "0.2.47" +version = "0.2.48" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -672,17 +692,16 @@ name = "mach" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "memchr" -version = "2.1.2" +version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", - "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -710,7 +729,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "nonzero_signed" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -739,7 +758,7 @@ name = "num_cpus" version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -747,6 +766,14 @@ name = "opaque-debug" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "ordered-float" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "ordermap" version = "0.3.5" @@ -786,14 +813,23 @@ dependencies = [ "parking_lot_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "parking_lot" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "parking_lot_core" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -802,10 +838,22 @@ name = "parking_lot_core" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "parking_lot_core" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -861,7 +909,7 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "0.4.25" +version = "0.4.26" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -879,33 +927,33 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "quote" -version = "0.6.10" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.25 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-cprng 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand" -version = "0.5.5" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-cprng 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -915,9 +963,9 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_os 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -932,20 +980,20 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_core" -version = "0.2.2" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_core" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -953,7 +1001,7 @@ name = "rand_hc" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -961,7 +1009,7 @@ name = "rand_isaac" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -971,8 +1019,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -982,7 +1030,7 @@ name = "rand_pcg" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -991,7 +1039,7 @@ name = "rand_xorshift" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1021,7 +1069,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1030,12 +1078,12 @@ name = "rdrand" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "redox_syscall" -version = "0.1.50" +version = "0.1.51" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1043,7 +1091,7 @@ name = "redox_termios" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1052,15 +1100,15 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex-syntax" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1068,20 +1116,33 @@ dependencies = [ [[package]] name = "region" -version = "1.0.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", "mach 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "relative-path" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "rustc-demangle" version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "rustc-hash" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rustc_version" version = "0.2.3" @@ -1095,6 +1156,32 @@ name = "ryu" version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "salsa" +version = "0.10.0-alpha5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "derive-new 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "salsa-macros 0.10.0-alpha5 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "salsa-macros" +version = "0.10.0-alpha5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "same-file" version = "1.0.4" @@ -1123,27 +1210,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde" -version = "1.0.84" +version = "1.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde_derive" -version = "1.0.84" +version = "1.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.25 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_json" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1166,7 +1253,7 @@ dependencies = [ "fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "mopa 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1174,8 +1261,8 @@ name = "shred-derive" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.25 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1195,7 +1282,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "smallvec" -version = "0.6.7" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1212,7 +1299,7 @@ dependencies = [ "hibitset 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "mopa 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "nonzero_signed 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "nonzero_signed 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "shred 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "shred-derive 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1225,8 +1312,8 @@ name = "specs-derive" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.25 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1242,8 +1329,8 @@ dependencies = [ name = "specs-visitor-derive" version = "0.3.0" dependencies = [ - "proc-macro2 0.4.25 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", "specs 0.14.3 (registry+https://github.com/rust-lang/crates.io-index)", "specs-visitor 0.3.0", "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1263,7 +1350,7 @@ dependencies = [ "new_debug_unreachable 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "phf_shared 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", "precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache_codegen 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1275,8 +1362,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "phf_generator 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", "phf_shared 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.25 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1305,8 +1392,8 @@ version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.25 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1325,8 +1412,8 @@ name = "syn" version = "0.15.26" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.25 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1343,8 +1430,8 @@ name = "synstructure" version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.25 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1356,7 +1443,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1381,8 +1468,8 @@ name = "termion" version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)", "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1407,8 +1494,8 @@ name = "time" version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1416,27 +1503,31 @@ dependencies = [ name = "tin" version = "0.3.0" dependencies = [ - "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "cargo-husky 1.2.2-alpha.0 (git+https://github.com/dflemstr/cargo-husky.git?branch=run-for-all)", "codespan 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "codespan-reporting 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cranelift 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cranelift-module 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cranelift-simplejit 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-module 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-simplejit 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)", "dot 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "enum-primitive-derive 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lalrpop 0.16.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lalrpop-util 0.16.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lalrpop 0.16.3 (registry+https://github.com/rust-lang/crates.io-index)", + "lalrpop-util 0.16.3 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "ordered-float 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "pretty_env_logger 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "salsa 0.10.0-alpha5 (registry+https://github.com/rust-lang/crates.io-index)", "specs 0.14.3 (registry+https://github.com/rust-lang/crates.io-index)", "specs-derive 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "specs-visitor 0.3.0", @@ -1506,11 +1597,6 @@ name = "vec_map" version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "version_check" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "void" version = "1.0.2" @@ -1594,7 +1680,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum block-buffer 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49665c62e0e700857531fa5d3763e91b539ff1abeebd56808d378b495870d60d" "checksum block-padding 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4fc4358306e344bf9775d0197fd00d2603e5afb0771bb353538630f022068ea3" "checksum byte-tools 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "980479e6fde23246dfb54d47580d66b4e99202e7579c5eaa9fe10ecb5ebd2182" -"checksum byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "94f88df23a25417badc922ab0f5716cc1330e87f71ddd9203b3a3ccd9cedf75d" +"checksum byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a019b10a2a7cdeb292db131fc8113e57ea2a908f6e7894b0c3c671893b65dbeb" "checksum cargo-husky 1.2.2-alpha.0 (git+https://github.com/dflemstr/cargo-husky.git?branch=run-for-all)" = "" "checksum cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4a8b715cb4597106ea87c7c84b2f1d452c7492033765df7f32651e66fcf749" "checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4" @@ -1603,15 +1689,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" "checksum codespan 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "172b4fa8eec616659e19bdd41d33a3c29cd6913b9b747054c0429865c1f210ec" "checksum codespan-reporting 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b5b329932b380f719f861e2844dcafea53e31821a53b76a1218364d3433cb472" -"checksum cranelift 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9927ebe8175752af7db402c19664df375df4ad254f1f0ac292a30b3d700ffd22" -"checksum cranelift-bforest 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)" = "40f8ff24e9a6c89b8a846b14df9a34d2cac17cea7bdb5c81ed6b4744ee0e38bf" -"checksum cranelift-codegen 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)" = "42f5b809bd885c368e01aeec8fe04f21dcb07569834b907d75b4a7bed8d067eb" -"checksum cranelift-codegen-meta 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)" = "014c23ed3ebdc8377d41540af638245207dd169f421df042dfccc867465734ed" -"checksum cranelift-entity 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d4df40e26c0cf7b4d86919cb995bb412ee3001cc18e4f3c83a903f30b7007d8b" -"checksum cranelift-frontend 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)" = "789907218eeebebcea8122c2053d71affac91c96ce72cea35ebfdbbf547e82af" -"checksum cranelift-module 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9c9e78b62689c0615e242fbdd1b61a097a7b96da09b3e653f64f0052062da4ee" -"checksum cranelift-native 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)" = "474bee81d620a473bf43411a3d6f10ffbf7965141dc5e5b76d8d2151dde3285d" -"checksum cranelift-simplejit 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cc9176eff6c1730eb193e10fac5c2ae5d04564ff21d3916d72eb9680ced977b5" +"checksum cranelift 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a423fcf313f7090382c7b715c930a1f485cbca1b39289d6303ec11251a358" +"checksum cranelift-bforest 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c88db0c2fc38b2cedee1b94ee2dc7bf80e4ce31467c8005743f485af66e240d8" +"checksum cranelift-codegen 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ce2e412970cfda0fa11806758d79a46c02b8fa1b91c35a8d3e2b4c947ce0c35" +"checksum cranelift-codegen-meta 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)" = "43131e662da7e0243cff28edfbc094a62968a4b57849f77a6c1e3685e9e6e1e6" +"checksum cranelift-entity 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c4ccc3743848cbb53e58b62685703dc12ea553c3bc8f21db76f23c68054eb69a" +"checksum cranelift-frontend 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)" = "89ecc8b49d4ab98f2c121832fee365da88b7b0ffad77d4e328015b1fd1f7f4b1" +"checksum cranelift-module 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)" = "93dc35e9baba6b538fa82a2a549f93efeef3cb9679b642e705a61e01a88986ef" +"checksum cranelift-native 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9876722d8a172bdb14bb6e281b7207ae0baae852235e5d37f0eb592504989f44" +"checksum cranelift-simplejit 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ce21c3e9fd47f708d7a98716aba8412076a2612ddfbaab100d0e9da92b220fa" "checksum crossbeam 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d7408247b1b87f480890f28b670c5f8d9a8a4274833433fe74dc0dfd46d33650" "checksum crossbeam-channel 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7b85741761b7f160bc5e7e0c14986ef685b7f8bf9b7ad081c60c604bb4649827" "checksum crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f739f8c5363aca78cfb059edf753d8f0d36908c348f3d8d1503f03d8b75d9cf3" @@ -1623,13 +1709,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "677d453a17e8bd2b913fa38e8b9cf04bcdbb5be790aa294f2389661d72036015" "checksum crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "41ee4864f4797060e52044376f7d107429ce1fb43460021b126424b7180ee21a" "checksum derivative 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6073e9676dbebdddeabaeb63e3b7cefd23c86f5c41d381ee1237cc77b1079898" +"checksum derive-new 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "6ca414e896ae072546f4d789f452daaecf60ddee4c9df5dc6d5936d769e3d87c" "checksum diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "3c2b69f912779fbb121ceb775d74d51e915af17aaebc38d28a592843a2dd0a3a" "checksum difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198" "checksum digest 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05f47366984d3ad862010e22c7ce81a7dbcaebbdfb37241a620f8b6596ee135c" "checksum docopt 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "db2906c2579b5b7207fc1e328796a9a8835dc44e22dbe8e460b1d636f9a7b225" "checksum dot 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a74b6c4d4a1cff5f454164363c16b72fa12463ca6b31f4b5f2035a65fa3d5906" "checksum either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3be565ca5c557d7f59e7cfcf1844f9e3033650c929c6566f511e8005f205c1d0" -"checksum ena 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "25b4e5febb25f08c49f1b07dc33a182729a6b21edfb562b5aef95f78e0dbe5bb" +"checksum ena 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f56c93cc076508c549d9bb747f79aa9b4eb098be7b8cad8830c3137ef52d1e00" "checksum enum-primitive-derive 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2b90e520ec62c1864c8c78d637acbfe8baf5f63240f2fb8165b8325c07812dd" "checksum env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "afb070faf94c85d17d50ca44f6ad076bce18ae92f0037d350947240a36e9d42e" "checksum errno 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c2a071601ed01b988f896ab14b95e67335d1eeb50190932a1320f7fe3cadc84e" @@ -1639,6 +1726,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" "checksum fixedbitset 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "86d4de0081402f5e88cdac65c8dcdcc73118c1a7a465e2a05f0da05843a8ea33" "checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" +"checksum fuchsia-cprng 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "81f7f8eb465745ea9b02e2704612a9946a59fa40572086c6fd49d6ddcf30bf31" "checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" "checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" "checksum fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" @@ -1647,51 +1735,55 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" "checksum hibitset 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6527bc88f32e0d3926c7572874b2bf17a19b36978aacd0aacf75f7d27a5992d0" "checksum humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ca7e5f2e110db35f93b837c81797f3714500b81d517bf20c431b16d3ca4f114" +"checksum indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7e81a7c05f79578dbc15793d8b619db9ba32b4577003ef3af1a91c416798c58d" "checksum itertools 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0d47946d458e94a1b7bcabbf6521ea7c037062c81f534615abcad76e84d4970d" "checksum itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5b8467d9c1cebe26feb08c640139247fac215782d35371ade9a2136ed6085358" "checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -"checksum lalrpop 0.16.2 (registry+https://github.com/rust-lang/crates.io-index)" = "02888049e197dff0c5c9fd503bd2458ea373c5e845c2f5460db1f9e43050d55e" -"checksum lalrpop-util 0.16.2 (registry+https://github.com/rust-lang/crates.io-index)" = "488da0d45c65af229321623c62660627d02b0e7fbc768a4c3fcd121815404ef1" +"checksum lalrpop 0.16.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4e2e80bee40b22bca46665b4ef1f3cd88ed0fb043c971407eac17a0712c02572" +"checksum lalrpop-util 0.16.3 (registry+https://github.com/rust-lang/crates.io-index)" = "33b27d8490dbe1f9704b0088d61e8d46edc10d5673a8829836c6ded26a9912c7" "checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1" -"checksum libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)" = "48450664a984b25d5b479554c29cc04e3150c97aa4c01da5604a2d4ed9151476" +"checksum libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "e962c7641008ac010fa60a7dfdc1712449f29c44ef2d4702394aea943ee75047" "checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c" "checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" "checksum mach 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "86dd2487cdfea56def77b88438a2c915fb45113c5319bfe7e14306ca4cd0b0e1" -"checksum memchr 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "db4c41318937f6e76648f42826b1d9ade5c09cafb5aef7e351240a70f39206e9" +"checksum memchr 2.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e1dd4eaac298c32ce07eb6ed9242eda7d82955b9170b7d6db59b2e02cc63fcb8" "checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3" "checksum mopa 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a785740271256c230f57462d3b83e52f998433a7062fc18f96d5999474a9f915" "checksum new_debug_unreachable 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0cdc457076c78ab54d5e0d6fa7c47981757f1e34dc39ff92787f217dede586c4" "checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" -"checksum nonzero_signed 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d9813c459ba38abf9c40eecc8d59738eb7ebcfc45a857030967372dcb83e18de" +"checksum nonzero_signed 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "02783a0482333b0d3f5f5411b8fb60454a596696da041da0470ac9ef3e6e37d8" "checksum num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "e83d528d2677f0518c570baf2b7abdcf0cd2d248860b68507bdcb3e91d4c0cea" "checksum num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31" "checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1" "checksum num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5a69d464bdc213aaaff628444e99578ede64e9c854025aa43b9796530afa9238" "checksum opaque-debug 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "51ecbcb821e1bd256d456fe858aaa7f380b63863eab2eb86eee1bd9f33dd6682" +"checksum ordered-float 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2f0015e9e8e28ee20c581cfbfe47c650cedeb9ed0721090e0b7ebb10b9cdbcc2" "checksum ordermap 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a86ed3f5f244b372d6b1a00b72ef7f8876d0bc6a78a4c9985c53614041512063" "checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37" "checksum owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49a4b8ea2179e6a2e27411d3bca09ca6dd630821cf6894c6c7c8467a8ee7ef13" "checksum parking_lot 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d4d05f1349491390b1730afba60bb20d55761bef489a954546b58b4b34e1e2ac" "checksum parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f0802bff09003b291ba756dc7e79313e51cc31667e94afbe847def490424cde5" +"checksum parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab41b4aed082705d1056416ae4468b6ea99d52599ecf3169b00088d43113e337" "checksum parking_lot_core 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "4db1a8ccf734a7bce794cc19b3df06ed87ab2f3907036b693c68f56b4d4537fa" "checksum parking_lot_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad7f7e6ebdc79edff6fdcb87a55b620174f7a989e3eb31b65231f4af57f00b8c" +"checksum parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94c8c7923936b28d546dfd14d4472eaf34c99b14e1c973a32b3e6d4eb04298c9" "checksum petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)" = "9c3659d1ee90221741f65dd128d9998311b0e40c5d3c23a62445938214abce4f" "checksum phf_generator 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)" = "09364cc93c159b8b06b1f4dd8a4398984503483891b0c26b867cf431fb132662" "checksum phf_shared 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)" = "234f71a15de2288bcb7e3b6515828d22af7ec8598ee6d24c3b526fa0a80b67a0" "checksum precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" "checksum pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3a029430f0d744bc3d15dd474d591bed2402b645d024583082b9f63bb936dac6" "checksum pretty_env_logger 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "df8b3f4e0475def7d9c2e5de8e5a1306949849761e107b360d03e98eafaffd61" -"checksum proc-macro2 0.4.25 (registry+https://github.com/rust-lang/crates.io-index)" = "d3797b7142c9aa74954e351fc089bbee7958cebbff6bf2815e7ffff0b19f547d" +"checksum proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)" = "38fddd23d98b2144d197c0eca5705632d4fe2667d14a6be5df8934f8d74f1978" "checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" "checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" -"checksum quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "53fa22a1994bd0f9372d7a816207d8a2677ad0325b073f5c5332760f0fb62b5c" -"checksum rand 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "dee497e66d8d76bf08ce20c8d36e16f93749ab0bf89975b4f8ae5cee660c2da2" -"checksum rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e464cd887e869cddcae8792a4ee31d23c7edd516700695608f5b98c67ee0131c" +"checksum quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)" = "cdd8e04bd9c52e0342b406469d494fcb033be4bdbe5c606016defbb1681411e1" +"checksum rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" +"checksum rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9" "checksum rand 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3906503e80ac6cbcacb2c2973fa8e473f24d7e2747c8c92bb230c2441cad96b5" "checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" -"checksum rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1961a422c4d189dfb50ffa9320bf1f2a9bd54ecb92792fb9477f99a1045f3372" -"checksum rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0905b6b7079ec73b314d4c748701f6931eb79fd97c668caa3f1899b22b32c6db" +"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" +"checksum rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d0e7a549d590831370895ab7ba4ea0c1b6b011d106b5ff2da6eee112615e6dc0" "checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" "checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" "checksum rand_os 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f46fbd5550acf75b0c2730f5dd1873751daf9beb8f11b44027778fae50d7feca" @@ -1701,27 +1793,31 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "373814f27745b2686b350dd261bfd24576a6fb0e2c5919b3a2b6005f820b0473" "checksum rayon-core 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b055d1e92aba6877574d8fe604a63c8b5df60f60e5982bf7ccbb1338ea527356" "checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" -"checksum redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)" = "52ee9a534dc1301776eff45b4fa92d2c39b1d8c3d3357e6eb593e0d795506fc2" +"checksum redox_syscall 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)" = "423e376fffca3dfa06c9e9790a9ccd282fafb3cc6e6397d01dbf64f9bacc6b85" "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" "checksum regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37e7cbbd370869ce2e8dff25c7018702d10b21a20ef7135316f8daecd6c25b7f" -"checksum regex-syntax 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4e47a2ed29da7a9e1960e1639e7a982e6edc6d49be308a3b02daf511504a16d1" -"checksum region 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cff177f64744f6f2a2054d231279383e59b0857b4d58dc2e8881e60b58aec8e5" +"checksum regex-syntax 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "8c2f35eedad5295fdf00a63d7d4b238135723f92b434ec06774dad15c7ab0861" +"checksum region 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ace21a7fc79cffefeb66f2cc3ef22c7687015023bf7f85bec8840f0d46cb51cc" +"checksum relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0e7790c7f1cc73d831d28dc5a7deb316a006e7848e6a7f467cdb10a0a9e0fb1c" "checksum rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "adacaae16d02b6ec37fdc7acfcddf365978de76d1983d3ee22afc260e1ca9619" +"checksum rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7540fc8b0c49f096ee9c961cda096467dce8084bec6bdca2fc83895fd9b28cb8" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" "checksum ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "eb9e9b8cde282a9fe6a42dd4681319bfb63f121b8a8ee9439c6f4107e58a46f7" +"checksum salsa 0.10.0-alpha5 (registry+https://github.com/rust-lang/crates.io-index)" = "8b5e2535d707dc5ced81106d3b71d806cfeef8a6e8a567472fde7ffd56b770dd" +"checksum salsa-macros 0.10.0-alpha5 (registry+https://github.com/rust-lang/crates.io-index)" = "e7c5da4c649f6d4fc1864fcd9a379b1f7c6d570b278559c84a6e15981c949cc6" "checksum same-file 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8f20c4be53a8a1ff4c1f1b2bd14570d2f634628709752f0702ecdd2b3f9a5267" "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)" = "0e732ed5a5592c17d961555e3b552985baf98d50ce418b7b655f31f6ba7eb1b7" -"checksum serde_derive 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)" = "b4d6115a3ca25c224e409185325afc16a0d5aaaabc15c42b09587d6f1ba39a5b" -"checksum serde_json 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)" = "574378d957d6dcdf1bbb5d562a15cbd5e644159432f84634b94e485267abbcc7" +"checksum serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)" = "534b8b91a95e0f71bca3ed5824752d558da048d4248c91af873b63bd60519752" +"checksum serde_derive 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)" = "a915306b0f1ac5607797697148c223bedeaa36bcc2e28a01441cd638cc6567b4" +"checksum serde_json 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)" = "4b90a9fbe1211e57d3e1c15670f1cb00802988fb23a1a4aad7a2b63544f1920e" "checksum sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b4d8bfd0e469f417657573d8451fb33d16cfe0989359b93baf3a1ffc639543d" "checksum shred 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c75ec29e8d2959ad96a1087fe4cadb926c6fc17cbae9812314fa8efe720aa2a" "checksum shred-derive 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9fcf34e5e5302d3024aba7afc291f6d1ca7573ed035d3c0796976ba3f10691a1" "checksum shrev 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ec60ed6f60a4b3cdc2ceacf57215db3408fbd8990f66a38686a31558cd9da482" "checksum siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0b8de496cf83d4ed58b6be86c3a275b8602f6ffe98d3024a869e124147a9a3ac" -"checksum smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "b73ea3738b47563803ef814925e69be00799a8c07420be8b996f8e98fb2336db" +"checksum smallvec 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "88aea073965ab29f6edb5493faf96ad662fb18aa9eeb186a3b7057951605ed15" "checksum specs 0.14.3 (registry+https://github.com/rust-lang/crates.io-index)" = "de65613ada4338aa7ba71eca60eca24c60483433eec0077bc4f33cfc31f4bdf0" "checksum specs-derive 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a63549fa0d4a6f76e99e6634c328f25d0c9fa8ad6f8498aef74f6c35c0b269e5" "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" @@ -1752,7 +1848,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" "checksum utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "796f7e48bef87609f7ade7e06495a87d5cd06c7866e6a5cbfceffc558a243737" "checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" -"checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" "checksum walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "9d9d7ed3431229a144296213105a390676cc49c9b6a72bd19f3176c98e129fa1" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" diff --git a/Cargo.toml b/Cargo.toml index 9b4734d..d3b235f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,19 +8,19 @@ repository = "https://github.com/dflemstr/tin" edition = "2018" [build-dependencies] -lalrpop = "0.16.2" +lalrpop = "0.16.3" failure = "0.1.5" regex = "1.1.0" walkdir = "2.2.7" [dependencies] -cranelift = "0.26.0" -cranelift-module = "0.26.0" -cranelift-simplejit = "0.26.0" +cranelift = "0.28.0" +cranelift-module = "0.28.0" +cranelift-simplejit = "0.28.0" dot = "0.1.4" env_logger = "0.6.0" failure = "0.1.5" -lalrpop-util = "0.16.2" +lalrpop-util = "0.16.3" log = "0.4.6" regex = "1.1.0" specs = { version = "0.14.3", default_features = false } @@ -30,13 +30,17 @@ specs-visitor = { version = "0.3.0", path = "specs-visitor", default_features = pretty_env_logger = "0.3.0" structopt = "0.2.14" lazy_static = "1.2.0" -byteorder = "1.2.7" +byteorder = "1.3.1" rayon = { version = "1.0.3", optional = true } itertools = "0.8.0" codespan = "0.2.0" codespan-reporting = "0.2.0" enum-primitive-derive = "0.1.2" num-traits = "0.2.6" +salsa = "0.10.0-alpha5" +relative-path = "0.4.0" +rustc-hash = "1.0.1" +ordered-float = "1.0.1" [features] default = ["parallel"] diff --git a/build.rs b/build.rs index 0725f23..aedba6d 100644 --- a/build.rs +++ b/build.rs @@ -5,7 +5,7 @@ use std::path; fn main() -> Result<(), failure::Error> { use std::io::Write; - println!("cargo:rerun-if-changed=src/parser/tin.lalrpop"); + println!("cargo:rerun-if-changed=src/syntax/parser/grammar.lalrpop"); lalrpop::process_root().unwrap(); let out_dir_str = env::var_os("OUT_DIR").unwrap(); diff --git a/specs-visitor-derive/Cargo.toml b/specs-visitor-derive/Cargo.toml index 3010a17..d98cce7 100644 --- a/specs-visitor-derive/Cargo.toml +++ b/specs-visitor-derive/Cargo.toml @@ -12,8 +12,8 @@ proc-macro = true [dependencies] synstructure = "0.10.1" -quote = "0.6.10" -proc-macro2 = "0.4.25" +quote = "0.6.11" +proc-macro2 = "0.4.26" [dev-dependencies] specs = "0.14.3" diff --git a/src/codegen/tests.rs b/src/codegen/tests.rs index 4f6bdff..1aaa409 100644 --- a/src/codegen/tests.rs +++ b/src/codegen/tests.rs @@ -2,8 +2,8 @@ use env_logger; use failure; use super::*; -use crate::ast; use crate::ir; +use crate::syntax::ast; use crate::test_util; #[test] @@ -345,7 +345,7 @@ main = || -> f32 { a = 2f32; b = 1f32; a - b }; } fn compile_module(name: &'static str, source: &str) -> Result { - use crate::parser::Parse; + use crate::syntax::parser::Parse; let mut codemap = codespan::CodeMap::new(); let span = codemap diff --git a/src/error.rs b/src/error.rs index d6d93a4..4c78a05 100644 --- a/src/error.rs +++ b/src/error.rs @@ -4,7 +4,7 @@ use std::result; use crate::diagnostic; use crate::interpreter; use crate::ir; -use crate::parser; +use crate::syntax::parser; /// An error that occurs while interacting with Tin. #[derive(Clone, Debug, Fail, PartialEq)] @@ -19,7 +19,7 @@ pub enum Error { #[fail(display = "IR error")] Ir(#[cause] ir::error::Error), /// Parsing the source code failed. - #[fail(display = "parser error")] + #[fail(display = "syntax error")] Parser(#[cause] parser::Error), } diff --git a/src/ir/builder.rs b/src/ir/builder.rs index 3e09f09..6b11432 100644 --- a/src/ir/builder.rs +++ b/src/ir/builder.rs @@ -3,13 +3,13 @@ use std::mem; use specs; -use crate::ast; use crate::ir::component::element; use crate::ir::component::location; use crate::ir::component::replacement; use crate::ir::component::symbol; use crate::ir::error; -use crate::parser; +use crate::syntax::ast; +use crate::syntax::parser; pub struct Builder<'a> { world: &'a mut specs::World, @@ -190,8 +190,8 @@ impl<'a> Builder<'a> { ast::NumberValue::I16(n) => element::Number::I16(n), ast::NumberValue::I32(n) => element::Number::I32(n), ast::NumberValue::I64(n) => element::Number::I64(n), - ast::NumberValue::F32(n) => element::Number::F32(n), - ast::NumberValue::F64(n) => element::Number::F64(n), + ast::NumberValue::F32(n) => element::Number::F32(n.into_inner()), + ast::NumberValue::F64(n) => element::Number::F64(n.into_inner()), ast::NumberValue::Invalid => panic!("'invalid' AST nodes should not escape the parser"), } } diff --git a/src/ir/mod.rs b/src/ir/mod.rs index 95356e4..7a20bbf 100644 --- a/src/ir/mod.rs +++ b/src/ir/mod.rs @@ -3,8 +3,8 @@ use std::fmt; use specs; -use crate::ast; -use crate::parser; +use crate::syntax::ast; +use crate::syntax::parser; pub mod builder; pub mod component; diff --git a/src/ir/tests.rs b/src/ir/tests.rs index abbdd94..93e1563 100644 --- a/src/ir/tests.rs +++ b/src/ir/tests.rs @@ -2,7 +2,7 @@ use env_logger; use failure; use super::*; -use crate::ast; +use crate::syntax::ast; use crate::test_util; #[test] @@ -123,7 +123,7 @@ a = || -> u32 { } fn check_module(name: &'static str, source: &str) -> Result<(), String> { - use crate::parser::Parse; + use crate::syntax::parser::Parse; let mut codemap = codespan::CodeMap::new(); let span = codemap diff --git a/src/lib.rs b/src/lib.rs index a984efe..6747a56 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -64,12 +64,12 @@ extern crate pretty_assertions; use std::fmt; -mod ast; mod best_iter; mod codegen; mod interpreter; mod ir; -mod parser; +mod source; +mod syntax; mod value; #[cfg(test)] @@ -87,17 +87,17 @@ pub use crate::error::Result; pub struct Tin { ir: ir::Ir, codemap: codespan::CodeMap, - parser: as parser::Parse>::Parser, + parser: as syntax::parser::Parse>::Parser, } impl Tin { /// Creates a new instance of the Tin runtime. pub fn new() -> Tin { - use crate::parser::Parse; + use crate::syntax::parser::Parse; let ir = ir::Ir::new(); let codemap = codespan::CodeMap::new(); - let parser = ast::Module::new_parser(); + let parser = syntax::ast::Module::new_parser(); Tin { ir, @@ -151,7 +151,7 @@ impl Tin { .codemap .add_filemap(file_name.into(), source.to_owned()) .span(); - let module = parser::Parser::parse(&mut self.parser, span, source)?; + let module = syntax::parser::Parser::parse(&mut self.parser, span, source)?; self.ir.load(&module)?; Ok(()) diff --git a/src/source/db.rs b/src/source/db.rs new file mode 100644 index 0000000..c447d0c --- /dev/null +++ b/src/source/db.rs @@ -0,0 +1,47 @@ +// This code is largely copied from rust-analyzer +#![allow(non_camel_case_types)] +use std::sync; + +use crate::source; +use crate::syntax; + +#[salsa::query_group(SourceStorage)] +pub trait Source: salsa::Database { + /// Text of the file. + #[salsa::input] + fn file_text(&self, file_id: source::FileId) -> sync::Arc; + + /// Span of the file. + #[salsa::input] + fn file_span(&self, file_id: source::FileId) -> codespan::ByteSpan; + + /// Parses the file into an AST module. + fn parse( + &self, + file_id: source::FileId, + ) -> Result>, syntax::parser::Error>; + + /// Path to a file, relative to the root of its source root. + #[salsa::input] + fn file_relative_path(&self, file_id: source::FileId) -> relative_path::RelativePathBuf; + + /// Source root of the file. + #[salsa::input] + fn file_source_root(&self, file_id: source::FileId) -> source::SourceRootId; + + /// Contents of the source root. + #[salsa::input] + fn source_root(&self, id: source::SourceRootId) -> sync::Arc; +} + +fn parse( + source: &impl Source, + file_id: source::FileId, +) -> Result>, syntax::parser::Error> { + use crate::syntax::parser::Parse; + + let text = source.file_text(file_id); + let span = source.file_span(file_id); + + syntax::ast::Module::parse(span, &*text).map(sync::Arc::new) +} diff --git a/src/source/mod.rs b/src/source/mod.rs new file mode 100644 index 0000000..39b1a79 --- /dev/null +++ b/src/source/mod.rs @@ -0,0 +1,33 @@ +// This code is largely copied from rust-analyzer + +//! This module specifies the input to the compiler. +//! +//! In some sense, this is **the** most important module, because all other fancy stuff is strictly +//! derived from this input. +//! +//! Note that neither this module, nor any other part of the compiler do actual IO. +//! +pub mod db; + +/// `FileId` is an integer which uniquely identifies a file. +/// +/// File paths are messy and system-dependent, so most of the code should work directly with +/// `FileId`, without inspecting the path. The mapping between `FileId` and path and `SourceRoot` +/// is constant. A file rename is represented as a pair of deletion/creation. +#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct FileId(u32); + +/// Files are grouped into source roots. +/// +/// A source root is a directory on the file systems which is watched for changes. Source roots +/// *might* be nested: in this case, a file belongs to the nearest enclosing source root. Paths to +/// files are always relative to a source root, and the compiler does not know the root path of the +/// source root at all. So, a file from one source root can't refer to a file in another source root +/// by path. +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)] +pub struct SourceRootId(u32); + +#[derive(Default, Clone, Debug, PartialEq, Eq)] +pub struct SourceRoot { + pub files: rustc_hash::FxHashMap, +} diff --git a/src/ast/ast_node.rs b/src/syntax/ast/ast_node.rs similarity index 99% rename from src/ast/ast_node.rs rename to src/syntax/ast/ast_node.rs index 6571ece..ebecdb4 100644 --- a/src/ast/ast_node.rs +++ b/src/syntax/ast/ast_node.rs @@ -1,7 +1,7 @@ //! Generic node manipulation of AST nodes. use std::fmt; -use crate::ast; +use crate::syntax::ast; /// A Tin AST node. pub trait AstNode: fmt::Debug + Sized { diff --git a/src/ast/map_context.rs b/src/syntax/ast/map_context.rs similarity index 99% rename from src/ast/map_context.rs rename to src/syntax/ast/map_context.rs index a01d335..fe5820c 100644 --- a/src/ast/map_context.rs +++ b/src/syntax/ast/map_context.rs @@ -1,8 +1,8 @@ //! AST node context mapping helpers. use std::fmt; -use crate::ast; -use crate::ast::ast_node; +use crate::syntax::ast; +use crate::syntax::ast::ast_node; /// A context mapping over some AST node. pub trait MapContext: ast_node::AstNode { diff --git a/src/ast/mod.rs b/src/syntax/ast/mod.rs similarity index 91% rename from src/ast/mod.rs rename to src/syntax/ast/mod.rs index 2ac77c5..58ce2df 100644 --- a/src/ast/mod.rs +++ b/src/syntax/ast/mod.rs @@ -46,7 +46,7 @@ pub enum Kind { } /// A complete Tin module. -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Module { /// This node's AST context. pub context: C, @@ -55,7 +55,7 @@ pub struct Module { } /// An identifier. -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Identifier { /// This node's AST context. pub context: C, @@ -64,7 +64,7 @@ pub struct Identifier { } /// Any valid expression. -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq)] pub enum Expression { /// A numeric literal. NumberLiteral(NumberLiteral), @@ -94,7 +94,7 @@ pub enum Expression { } /// A numeric literal. -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct NumberLiteral { /// This node's AST context. pub context: C, @@ -103,7 +103,7 @@ pub struct NumberLiteral { } /// All syntactic number literal value variants. -#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)] +#[derive(Clone, Copy, Debug, Eq, PartialEq, PartialOrd)] pub enum NumberValue { /// Unsigned 8-bit integer value. U8(u8), @@ -122,15 +122,15 @@ pub enum NumberValue { /// Signed 64-bit integer value. I64(i64), /// Floating point 32-bit value. - F32(f32), + F32(ordered_float::OrderedFloat), /// Floating point 64-bit value. - F64(f64), + F64(ordered_float::OrderedFloat), /// The number value is invalid (e.g. out of bounds). Invalid, } /// A string literal. -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct StringLiteral { /// This node's AST context. pub context: C, @@ -139,7 +139,7 @@ pub struct StringLiteral { } /// All syntactic string literal value variants. -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq)] pub enum StringValue { /// A plain string. String(String), @@ -148,7 +148,7 @@ pub enum StringValue { } /// A symbol. -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Symbol { /// This node's AST context. pub context: C, @@ -157,7 +157,7 @@ pub struct Symbol { } /// A tuple expression. -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Tuple { /// This node's AST context. pub context: C, @@ -166,7 +166,7 @@ pub struct Tuple { } /// A record expression. -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Record { /// This node's AST context. pub context: C, @@ -204,7 +204,7 @@ pub enum UnOperator { } /// An operator application with one operand. -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct UnOp { /// This node's AST context. pub context: C, @@ -279,7 +279,7 @@ pub enum BiOperator { } /// An operator application with two operands. -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct BiOp { /// This node's AST context. pub context: C, @@ -292,7 +292,7 @@ pub struct BiOp { } /// A lambda expression. -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Lambda { /// This node's AST context. pub context: C, @@ -307,7 +307,7 @@ pub struct Lambda { } /// A valid statement. -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq)] pub enum Statement { /// A statement that defines a new identifier. Variable(Variable), @@ -316,7 +316,7 @@ pub enum Statement { } /// A variable definition. -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Variable { /// This node's AST context. pub context: C, @@ -327,7 +327,7 @@ pub struct Variable { } /// A field selection expression. -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Select { /// This node's AST context. pub context: C, @@ -338,7 +338,7 @@ pub struct Select { } /// A function application expression. -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Apply { /// This node's AST context. pub context: C, @@ -350,7 +350,7 @@ pub struct Apply { } /// A lambda parameter declaration. -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Parameter { /// This node's AST context. pub context: C, diff --git a/src/syntax/db.rs b/src/syntax/db.rs new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/src/syntax/db.rs @@ -0,0 +1 @@ + diff --git a/src/syntax/mod.rs b/src/syntax/mod.rs new file mode 100644 index 0000000..34059ff --- /dev/null +++ b/src/syntax/mod.rs @@ -0,0 +1,3 @@ +pub mod ast; +pub mod db; +pub mod parser; diff --git a/src/parser/tin.lalrpop b/src/syntax/parser/grammar.lalrpop similarity index 99% rename from src/parser/tin.lalrpop rename to src/syntax/parser/grammar.lalrpop index 25bd6f8..9656fe7 100644 --- a/src/parser/tin.lalrpop +++ b/src/syntax/parser/grammar.lalrpop @@ -1,7 +1,7 @@ use lalrpop_util; -use crate::ast; -use crate::parser; +use crate::syntax::ast; +use crate::syntax::parser; grammar<'err>(span: codespan::ByteSpan, errors: &'err mut Vec, parser::Error>>); diff --git a/src/parser/mod.rs b/src/syntax/parser/mod.rs similarity index 94% rename from src/parser/mod.rs rename to src/syntax/parser/mod.rs index 1ede97f..49d2e0b 100644 --- a/src/parser/mod.rs +++ b/src/syntax/parser/mod.rs @@ -3,8 +3,8 @@ use std::num; use lalrpop_util; -use crate::ast; use crate::diagnostic; +use crate::syntax::ast; mod util; @@ -15,12 +15,12 @@ lalrpop_mod!( #[allow(missing_debug_implementations)] #[allow(trivial_numeric_casts)] #[allow(unused)] - tin, - "/parser/tin.rs" + grammar, + "/syntax/parser/grammar.rs" ); /// The context of a parsed AST node. -#[derive(Clone, Copy, Debug, PartialEq)] +#[derive(Clone, Copy, Debug, Eq, PartialEq)] pub struct Context { /// The source code span that this AST was parsed from. pub span: codespan::ByteSpan, @@ -29,7 +29,7 @@ pub struct Context { } /// An error that occurs while parsing Tin. -#[derive(Clone, Debug, Fail, PartialEq)] +#[derive(Clone, Debug, Eq, Fail, PartialEq)] pub enum Error { /// There was an invalid token in the code. #[fail(display = "invalid token")] @@ -167,21 +167,23 @@ fn handle_parse_result( macro_rules! parser_impl { ($stat:ident, $parser:ident, $result:ty) => { lazy_static! { - static ref $stat: crate::parser::tin::$parser = { crate::parser::tin::$parser::new() }; + static ref $stat: crate::syntax::parser::grammar::$parser = + { crate::syntax::parser::grammar::$parser::new() }; } impl Parse for $result { - type Parser = &'static crate::parser::tin::$parser; + type Parser = &'static crate::syntax::parser::grammar::$parser; fn new_parser() -> Self::Parser { &*$stat } } - impl Parser<$result> for &'static crate::parser::tin::$parser { + impl Parser<$result> for &'static crate::syntax::parser::grammar::$parser { fn parse(&mut self, span: codespan::ByteSpan, source: &str) -> Result<$result, Error> { let mut errors = Vec::new(); - let result = crate::parser::tin::$parser::parse(self, span, &mut errors, source); + let result = + crate::syntax::parser::grammar::$parser::parse(self, span, &mut errors, source); handle_parse_result(source, span, result, errors) } } @@ -389,8 +391,8 @@ impl diagnostic::Diagnostics for Error { mod tests { use env_logger; - use crate::ast; - use crate::ast::MapContext; + use crate::syntax::ast; + use crate::syntax::ast::MapContext; #[test] fn e2e() { @@ -476,7 +478,7 @@ help: valid tokens at this point: [Comment, IdentifierName] let expected = Ok(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), - value: ast::NumberValue::F64(1.0), + value: ast::NumberValue::F64(1.0.into()), })); let actual = parse_expression("test", r#"1f64"#); assert_eq!(expected, actual); @@ -488,7 +490,7 @@ help: valid tokens at this point: [Comment, IdentifierName] let expected = Ok(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), - value: ast::NumberValue::F64(0.0), + value: ast::NumberValue::F64(0.0.into()), })); let actual = parse_expression("test", r#"f64"#); assert_eq!(expected, actual); @@ -500,7 +502,7 @@ help: valid tokens at this point: [Comment, IdentifierName] let expected = Ok(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), - value: ast::NumberValue::F64(-1.0), + value: ast::NumberValue::F64(ordered_float::OrderedFloat::from(-1.0)), })); let actual = parse_expression("test", r#"-1f64"#); assert_eq!(expected, actual); @@ -512,7 +514,7 @@ help: valid tokens at this point: [Comment, IdentifierName] let expected = Ok(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), - value: ast::NumberValue::F64(0.0), + value: ast::NumberValue::F64(ordered_float::OrderedFloat::from(0.0)), })); let actual = parse_expression("test", r#"0f64"#); assert_eq!(expected, actual); @@ -524,7 +526,7 @@ help: valid tokens at this point: [Comment, IdentifierName] let expected = Ok(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), - value: ast::NumberValue::F64(-0.0), + value: ast::NumberValue::F64(ordered_float::OrderedFloat::from(-0.0)), })); let actual = parse_expression("test", r#"-0f64"#); assert_eq!(expected, actual); @@ -536,7 +538,7 @@ help: valid tokens at this point: [Comment, IdentifierName] let expected = Ok(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), - value: ast::NumberValue::F64(1.5), + value: ast::NumberValue::F64(ordered_float::OrderedFloat::from(1.5)), })); let actual = parse_expression("test", r#"1.5f64"#); assert_eq!(expected, actual); @@ -548,7 +550,7 @@ help: valid tokens at this point: [Comment, IdentifierName] let expected = Ok(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), - value: ast::NumberValue::F64(-1.5), + value: ast::NumberValue::F64(ordered_float::OrderedFloat::from(-1.5)), })); let actual = parse_expression("test", r#"-1.5f64"#); assert_eq!(expected, actual); @@ -560,7 +562,7 @@ help: valid tokens at this point: [Comment, IdentifierName] let expected = Ok(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), - value: ast::NumberValue::F64(1500.0), + value: ast::NumberValue::F64(ordered_float::OrderedFloat::from(1500.0)), })); let actual = parse_expression("test", r#"1.5000e3f64"#); assert_eq!(expected, actual); @@ -572,7 +574,7 @@ help: valid tokens at this point: [Comment, IdentifierName] let expected = Ok(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), - value: ast::NumberValue::F64(-1500.0), + value: ast::NumberValue::F64(ordered_float::OrderedFloat::from(-1500.0)), })); let actual = parse_expression("test", r#"-1.5000e3f64"#); assert_eq!(expected, actual); @@ -584,7 +586,7 @@ help: valid tokens at this point: [Comment, IdentifierName] let expected = Ok(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), - value: ast::NumberValue::F64(1500.0), + value: ast::NumberValue::F64(ordered_float::OrderedFloat::from(1500.0)), })); let actual = parse_expression("test", r#"1.5000E3f64"#); assert_eq!(expected, actual); @@ -596,7 +598,7 @@ help: valid tokens at this point: [Comment, IdentifierName] let expected = Ok(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), - value: ast::NumberValue::F64(-1500.0), + value: ast::NumberValue::F64(ordered_float::OrderedFloat::from(-1500.0)), })); let actual = parse_expression("test", r#"-1.5000E3f64"#); assert_eq!(expected, actual); @@ -608,7 +610,7 @@ help: valid tokens at this point: [Comment, IdentifierName] let expected = Ok(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), - value: ast::NumberValue::F64(0.0015), + value: ast::NumberValue::F64(ordered_float::OrderedFloat::from(0.0015)), })); let actual = parse_expression("test", r#"1.5000e-3f64"#); assert_eq!(expected, actual); @@ -620,7 +622,7 @@ help: valid tokens at this point: [Comment, IdentifierName] let expected = Ok(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), - value: ast::NumberValue::F64(1500.0), + value: ast::NumberValue::F64(ordered_float::OrderedFloat::from(1500.0)), })); let actual = parse_expression("test", r#"1.5000e0003f64"#); assert_eq!(expected, actual); @@ -632,7 +634,7 @@ help: valid tokens at this point: [Comment, IdentifierName] let expected = Ok(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), - value: ast::NumberValue::F64(1500.0), + value: ast::NumberValue::F64(ordered_float::OrderedFloat::from(1500.0)), })); let actual = parse_expression("test", r#"1.5000e+3f64"#); assert_eq!(expected, actual); @@ -644,7 +646,7 @@ help: valid tokens at this point: [Comment, IdentifierName] let expected = Ok(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), - value: ast::NumberValue::F64(1.5), + value: ast::NumberValue::F64(ordered_float::OrderedFloat::from(1.5)), })); let actual = parse_expression("test", r#"1.5000e0f64"#); assert_eq!(expected, actual); @@ -656,7 +658,7 @@ help: valid tokens at this point: [Comment, IdentifierName] let expected = Ok(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), - value: ast::NumberValue::F64(1.5), + value: ast::NumberValue::F64(ordered_float::OrderedFloat::from(1.5)), })); let actual = parse_expression("test", r#"1.5000e+0f64"#); assert_eq!(expected, actual); @@ -707,11 +709,11 @@ help: valid tokens at this point: [Comment, IdentifierName] fields: vec![ ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), - value: ast::NumberValue::F64(1.0), + value: ast::NumberValue::F64(ordered_float::OrderedFloat::from(1.0)), }), ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), - value: ast::NumberValue::F64(2.0), + value: ast::NumberValue::F64(ordered_float::OrderedFloat::from(2.0)), }), ], })); @@ -728,11 +730,11 @@ help: valid tokens at this point: [Comment, IdentifierName] fields: vec![ ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), - value: ast::NumberValue::F64(1.0), + value: ast::NumberValue::F64(ordered_float::OrderedFloat::from(1.0)), }), ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), - value: ast::NumberValue::F64(2.0), + value: ast::NumberValue::F64(ordered_float::OrderedFloat::from(2.0)), }), ], })); @@ -748,7 +750,7 @@ help: valid tokens at this point: [Comment, IdentifierName] context: (), fields: vec![ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), - value: ast::NumberValue::F64(1.0), + value: ast::NumberValue::F64(ordered_float::OrderedFloat::from(1.0)), })], })); let actual = parse_expression("test", r#"(1f64,)"#); @@ -795,7 +797,7 @@ help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", }, ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), - value: ast::NumberValue::F64(1.0), + value: ast::NumberValue::F64(ordered_float::OrderedFloat::from(1.0)), }), ), ( @@ -830,7 +832,7 @@ help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", }, ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), - value: ast::NumberValue::F64(1.0), + value: ast::NumberValue::F64(ordered_float::OrderedFloat::from(1.0)), }), ), ( @@ -864,7 +866,7 @@ help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", }, ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), - value: ast::NumberValue::F64(1.0), + value: ast::NumberValue::F64(ordered_float::OrderedFloat::from(1.0)), }), )] .into_iter() @@ -887,7 +889,7 @@ help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", }, ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), - value: ast::NumberValue::F64(1.0), + value: ast::NumberValue::F64(ordered_float::OrderedFloat::from(1.0)), }), )] .into_iter() @@ -1642,7 +1644,7 @@ help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", } fn parse_module(name: &'static str, source: &str) -> Result, String> { - use crate::parser::Parse; + use crate::syntax::parser::Parse; let mut code_map = codespan::CodeMap::new(); let span = code_map @@ -1650,14 +1652,14 @@ help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", .span(); let mut errors = Vec::new(); - let result = crate::ast::Module::new_parser().parse(span, &mut errors, source); + let result = crate::syntax::ast::Module::new_parser().parse(span, &mut errors, source); super::handle_parse_result(source, span, result, errors) .map(|r| r.map_context(&mut |_| ())) .map_err(|e| crate::diagnostic::to_string(&code_map, &e)) } fn parse_expression(name: &'static str, source: &str) -> Result, String> { - use crate::parser::Parse; + use crate::syntax::parser::Parse; let mut code_map = codespan::CodeMap::new(); let span = code_map @@ -1665,7 +1667,7 @@ help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", .span(); let mut errors = Vec::new(); - let result = crate::ast::Expression::new_parser().parse(span, &mut errors, source); + let result = crate::syntax::ast::Expression::new_parser().parse(span, &mut errors, source); super::handle_parse_result(source, span, result, errors) .map(|r| r.map_context(&mut |_| ())) .map_err(|e| crate::diagnostic::to_string(&code_map, &e)) diff --git a/src/parser/util.rs b/src/syntax/parser/util.rs similarity index 97% rename from src/parser/util.rs rename to src/syntax/parser/util.rs index 6f62fa9..4004785 100644 --- a/src/parser/util.rs +++ b/src/syntax/parser/util.rs @@ -1,8 +1,8 @@ use std::char; use std::num; -use crate::ast; -use crate::parser; +use crate::syntax::ast; +use crate::syntax::parser; fn parse_integer_literal( span: codespan::ByteSpan, @@ -34,26 +34,27 @@ where } } -fn parse_float_literal( +fn parse_float_literal( span: codespan::ByteSpan, input: &str, errors: &mut Vec>, suffix_len: usize, - default: I, + default: F, parser: P, ctor: C, ) -> ast::NumberValue where - P: FnOnce(&str) -> Result, - C: FnOnce(I) -> ast::NumberValue, + F: num_traits::float::Float, + P: FnOnce(&str) -> Result, + C: FnOnce(ordered_float::OrderedFloat) -> ast::NumberValue, { let input = &input[..input.len() - suffix_len]; if input.is_empty() { - ctor(default) + ctor(default.into()) } else { match parser(input) { - Ok(value) => ctor(value), + Ok(value) => ctor(value.into()), Err(cause) => { errors.push(lalrpop_util::ParseError::User { error: parser::Error::IllegalFloatLiteral { token: span, cause }, From 8e0aa72840d962c255856fa1762eae308fe1a091 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Flemstr=C3=B6m?= Date: Mon, 8 Apr 2019 18:46:10 +0200 Subject: [PATCH 02/22] More WIP salsa refactors --- Cargo.lock | 662 +++++++++--------- Cargo.toml | 38 +- rust-toolchain | 2 +- specs-visitor-derive/Cargo.toml | 2 +- src/best_iter.rs | 184 ----- src/codegen/data.rs | 4 +- src/codegen/function.rs | 70 +- src/codegen/mod.rs | 26 +- src/graph.rs | 15 +- src/interpreter/error.rs | 2 +- src/interpreter/mod.rs | 26 +- src/ir/builder.rs | 487 ++++++------- src/ir/component/constexpr/error.rs | 11 - src/ir/component/constexpr/mod.rs | 12 - src/ir/component/location.rs | 6 - src/ir/component/mod.rs | 34 - src/ir/component/replacement.rs | 10 - src/ir/component/ty/error.rs | 69 -- src/ir/db.rs | 72 ++ src/ir/{component => }/element.rs | 76 +- src/ir/error.rs | 58 -- src/ir/location.rs | 2 + src/ir/mod.rs | 144 +--- src/ir/{component => }/symbol.rs | 8 +- src/ir/system/apply_replacements.rs | 90 --- src/ir/system/infer_constexpr.rs | 79 --- src/ir/system/mod.rs | 4 - src/ir/world.rs | 61 ++ src/layout/db.rs | 9 + .../infer_layouts.rs => layout/infer.rs} | 177 ++--- src/{ir/component/layout.rs => layout/mod.rs} | 11 +- src/lib.rs | 9 +- src/module.rs | 10 +- src/source/db.rs | 23 +- src/syntax/db.rs | 25 + src/{ir/component => }/ty/class.rs | 4 +- src/ty/error.rs | 87 +++ src/{ir/system/infer_types.rs => ty/infer.rs} | 105 +-- src/{ir/component => }/ty/mod.rs | 19 +- src/value.rs | 18 +- 40 files changed, 1046 insertions(+), 1705 deletions(-) delete mode 100644 src/best_iter.rs delete mode 100644 src/ir/component/constexpr/error.rs delete mode 100644 src/ir/component/constexpr/mod.rs delete mode 100644 src/ir/component/location.rs delete mode 100644 src/ir/component/mod.rs delete mode 100644 src/ir/component/replacement.rs delete mode 100644 src/ir/component/ty/error.rs create mode 100644 src/ir/db.rs rename src/ir/{component => }/element.rs (73%) create mode 100644 src/ir/location.rs rename src/ir/{component => }/symbol.rs (86%) delete mode 100644 src/ir/system/apply_replacements.rs delete mode 100644 src/ir/system/infer_constexpr.rs delete mode 100644 src/ir/system/mod.rs create mode 100644 src/ir/world.rs create mode 100644 src/layout/db.rs rename src/{ir/system/infer_layouts.rs => layout/infer.rs} (74%) rename src/{ir/component/layout.rs => layout/mod.rs} (91%) rename src/{ir/component => }/ty/class.rs (84%) create mode 100644 src/ty/error.rs rename src/{ir/system/infer_types.rs => ty/infer.rs} (89%) rename src/{ir/component => }/ty/mod.rs (88%) diff --git a/Cargo.lock b/Cargo.lock index 86c2512..07cf16d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,20 +1,22 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. [[package]] name = "afl" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "xdg 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "aho-corasick" -version = "0.6.9" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "memchr 2.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -22,7 +24,7 @@ name = "ansi_term" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -51,9 +53,9 @@ name = "atty" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -63,15 +65,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "backtrace" -version = "0.3.13" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -79,21 +81,21 @@ name = "backtrace-sys" version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "bit-set" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bit-vec 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bit-vec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "bit-vec" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -106,23 +108,23 @@ name = "block-buffer" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "block-padding 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "byte-tools 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "block-padding 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "generic-array 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "block-padding" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byte-tools 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "byte-tools" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -132,17 +134,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "cargo-husky" -version = "1.2.2-alpha.0" -source = "git+https://github.com/dflemstr/cargo-husky.git?branch=run-for-all#1048516a597ac7982e4ccb28d7f9602ed5307ab2" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "cc" -version = "1.0.28" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "cfg-if" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -157,14 +159,14 @@ dependencies = [ [[package]] name = "clap" -version = "2.32.0" +version = "2.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -179,110 +181,110 @@ dependencies = [ [[package]] name = "codespan" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)", + "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "codespan-reporting" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "codespan 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "codespan 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cranelift" -version = "0.28.0" +version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cranelift-codegen 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cranelift-frontend 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-codegen 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-frontend 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cranelift-bforest" -version = "0.28.0" +version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cranelift-entity 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-entity 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cranelift-codegen" -version = "0.28.0" +version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cranelift-bforest 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cranelift-codegen-meta 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cranelift-entity 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-bforest 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-codegen-meta 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-entity 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "target-lexicon 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "target-lexicon 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cranelift-codegen-meta" -version = "0.28.0" +version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cranelift-entity 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-entity 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cranelift-entity" -version = "0.28.0" +version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "cranelift-frontend" -version = "0.28.0" +version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cranelift-codegen 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-codegen 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "target-lexicon 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "target-lexicon 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cranelift-module" -version = "0.28.0" +version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cranelift-codegen 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cranelift-entity 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-codegen 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-entity 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cranelift-native" -version = "0.28.0" +version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cranelift-codegen 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-codegen 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", "raw-cpuid 6.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "target-lexicon 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "target-lexicon 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cranelift-simplejit" -version = "0.28.0" +version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cranelift-codegen 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cranelift-module 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cranelift-native 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-codegen 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-module 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-native 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", "errno 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "region 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "target-lexicon 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "target-lexicon 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -305,7 +307,7 @@ dependencies = [ "crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -332,9 +334,9 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -346,9 +348,9 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -359,9 +361,9 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -371,7 +373,7 @@ name = "crossbeam-utils" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -381,10 +383,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "crossbeam-utils" -version = "0.6.3" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "ctor" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -392,9 +404,9 @@ name = "derivative" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -402,9 +414,9 @@ name = "derive-new" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -427,14 +439,13 @@ dependencies = [ [[package]] name = "docopt" -version = "1.0.2" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)", - "strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "strsim 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -444,7 +455,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "either" -version = "1.5.0" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -467,13 +478,13 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -483,8 +494,8 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "errno-dragonfly 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -493,7 +504,7 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -501,7 +512,7 @@ name = "failure" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -510,9 +521,9 @@ name = "failure_derive" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)", "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -533,21 +544,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "fuchsia-cprng" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "fuchsia-zircon" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "fuchsia-zircon-sys" -version = "0.3.3" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -601,20 +598,12 @@ name = "indexmap" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "itertools" -version = "0.7.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "itertools" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "either 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -638,17 +627,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "ascii-canvas 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "bit-set 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bit-set 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "docopt 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "docopt 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "ena 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "lalrpop-util 0.16.3 (registry+https://github.com/rust-lang/crates.io-index)", "petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -662,12 +651,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "lazy_static" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libc" -version = "0.2.48" +version = "0.2.51" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -684,7 +673,7 @@ name = "log" version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -692,17 +681,13 @@ name = "mach" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "memchr" -version = "2.1.3" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] name = "memoffset" @@ -716,11 +701,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "new_debug_unreachable" -version = "1.0.1" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] name = "nodrop" @@ -755,20 +737,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "num_cpus" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "opaque-debug" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "ordered-float" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -779,6 +761,14 @@ name = "ordermap" version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "output_vt100" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "owning_ref" version = "0.3.3" @@ -827,10 +817,10 @@ name = "parking_lot_core" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -838,11 +828,11 @@ name = "parking_lot_core" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -850,11 +840,11 @@ name = "parking_lot_core" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -872,7 +862,7 @@ version = "0.7.24" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "phf_shared 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -890,11 +880,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "pretty_assertions" -version = "0.5.1" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ctor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "output_vt100 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -903,13 +895,13 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "env_logger 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "proc-macro2" -version = "0.4.26" +version = "0.4.27" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -930,7 +922,7 @@ name = "quote" version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -938,11 +930,11 @@ name = "rand" version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "fuchsia-cprng 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -951,27 +943,28 @@ version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "fuchsia-cprng 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_os 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_pcg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_jitter 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1012,26 +1005,36 @@ dependencies = [ "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rand_jitter" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rand_os" -version = "0.1.1" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_pcg" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1048,7 +1051,7 @@ version = "6.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1058,7 +1061,7 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "either 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "rayon-core 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1068,9 +1071,9 @@ version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1083,7 +1086,7 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.1.51" +version = "0.1.53" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1091,24 +1094,24 @@ name = "redox_termios" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "redox_syscall 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.53 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex" -version = "1.1.0" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex-syntax" -version = "0.6.5" +version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1120,9 +1123,9 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "mach 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1158,7 +1161,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "salsa" -version = "0.10.0-alpha5" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "derive-new 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1167,19 +1170,19 @@ dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "salsa-macros 0.10.0-alpha5 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", + "salsa-macros 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "salsa-macros" -version = "0.10.0-alpha5" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1187,7 +1190,7 @@ name = "same-file" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1210,27 +1213,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde" -version = "1.0.85" +version = "1.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "serde_derive" -version = "1.0.85" +version = "1.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_json" -version = "1.0.37" +version = "1.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1241,7 +1247,7 @@ dependencies = [ "block-buffer 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "digest 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "opaque-debug 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1253,7 +1259,7 @@ dependencies = [ "fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "mopa 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1261,9 +1267,9 @@ name = "shred-derive" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1282,11 +1288,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "smallvec" -version = "0.6.8" +version = "0.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] name = "specs" @@ -1307,16 +1310,6 @@ dependencies = [ "tuple_utils 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "specs-derive" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "specs-visitor" version = "0.3.0" @@ -1329,7 +1322,7 @@ dependencies = [ name = "specs-visitor-derive" version = "0.3.0" dependencies = [ - "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", "specs 0.14.3 (registry+https://github.com/rust-lang/crates.io-index)", "specs-visitor 0.3.0", @@ -1346,11 +1339,11 @@ name = "string_cache" version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "new_debug_unreachable 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "new_debug_unreachable 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "phf_shared 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", "precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache_codegen 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1362,7 +1355,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "phf_generator 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", "phf_shared 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1374,27 +1367,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "strsim" -version = "0.7.0" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "strsim" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "structopt" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", - "structopt-derive 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", + "structopt-derive 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "structopt-derive" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1409,10 +1407,10 @@ dependencies = [ [[package]] name = "syn" -version = "0.15.26" +version = "0.15.30" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1430,20 +1428,20 @@ name = "synstructure" version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "target-lexicon" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1468,14 +1466,14 @@ name = "termion" version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.53 (registry+https://github.com/rust-lang/crates.io-index)", "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "textwrap" -version = "0.10.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1486,7 +1484,7 @@ name = "thread_local" version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1494,9 +1492,9 @@ name = "time" version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.53 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1504,35 +1502,30 @@ name = "tin" version = "0.3.0" dependencies = [ "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cargo-husky 1.2.2-alpha.0 (git+https://github.com/dflemstr/cargo-husky.git?branch=run-for-all)", - "codespan 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "codespan-reporting 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cranelift 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cranelift-module 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cranelift-simplejit 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cargo-husky 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "codespan 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "codespan-reporting 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-module 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-simplejit 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", "dot 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "enum-primitive-derive 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "env_logger 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "lalrpop 0.16.3 (registry+https://github.com/rust-lang/crates.io-index)", "lalrpop-util 0.16.3 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "ordered-float 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "ordered-float 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "pretty_assertions 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "pretty_env_logger 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "salsa 0.10.0-alpha5 (registry+https://github.com/rust-lang/crates.io-index)", - "specs 0.14.3 (registry+https://github.com/rust-lang/crates.io-index)", - "specs-derive 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "specs-visitor 0.3.0", - "specs-visitor-derive 0.3.0", - "structopt 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "salsa 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "structopt 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", "walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1579,14 +1572,6 @@ name = "unicode-xid" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "unreachable" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "utf8-ranges" version = "1.0.2" @@ -1597,19 +1582,14 @@ name = "vec_map" version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "void" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "walkdir" version = "2.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "same-file 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1619,7 +1599,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "winapi" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1638,10 +1618,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "winapi-util" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1654,8 +1634,8 @@ name = "wincolor" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1665,39 +1645,39 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [metadata] "checksum afl 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf91d62aed05ac9b289ba6c5412e7ac61404254c20ed040ecf8448902834c3c" -"checksum aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1e9a933f4e58658d7b12defcf96dc5c720f20832deebe3e0a19efd3b6aaeeb9e" +"checksum aho-corasick 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e6f484ae0c99fec2e858eb6134949117399f222608d84cadb3f58c1f97c2364c" "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" "checksum arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "92c7fb76bc8826a8b33b4ee5bb07a247a81e76764ab4d55e8f73e3a4d8808c71" "checksum ascii-canvas 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b385d69402821a1c254533a011a312531cbcc0e3e24f19bbb4747a5a2daf37e2" "checksum atom 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3c86699c3f02778ec07158376991c8f783dd1f2f95c579ffaf0738dc984b2fe2" "checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" "checksum autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a6d640bee2da49f60a4068a7fae53acde8982514ab7bae8b8cea9e88cbcfd799" -"checksum backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)" = "b5b493b66e03090ebc4343eb02f94ff944e0cbc9ac6571491d170ba026741eb5" +"checksum backtrace 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "f106c02a3604afcdc0df5d36cc47b44b55917dbaf3d808f71c163a0ddba64637" "checksum backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6" -"checksum bit-set 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6f1efcc46c18245a69c38fcc5cc650f16d3a59d034f3106e9ed63748f695730a" -"checksum bit-vec 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4440d5cb623bb7390ae27fec0bb6c61111969860f8e3ae198bfa0663645e67cf" +"checksum bit-set 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e84c238982c4b1e1ee668d136c510c67a13465279c0cb367ea6baf6310620a80" +"checksum bit-vec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f59bbe95d4e52a6398ec21238d31577f2b28a9d86807f06ca59d191d8440d0bb" "checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" "checksum block-buffer 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49665c62e0e700857531fa5d3763e91b539ff1abeebd56808d378b495870d60d" -"checksum block-padding 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4fc4358306e344bf9775d0197fd00d2603e5afb0771bb353538630f022068ea3" -"checksum byte-tools 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "980479e6fde23246dfb54d47580d66b4e99202e7579c5eaa9fe10ecb5ebd2182" +"checksum block-padding 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d75255892aeb580d3c566f213a2b6fdc1c66667839f45719ee1d30ebf2aea591" +"checksum byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" "checksum byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a019b10a2a7cdeb292db131fc8113e57ea2a908f6e7894b0c3c671893b65dbeb" -"checksum cargo-husky 1.2.2-alpha.0 (git+https://github.com/dflemstr/cargo-husky.git?branch=run-for-all)" = "" -"checksum cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4a8b715cb4597106ea87c7c84b2f1d452c7492033765df7f32651e66fcf749" -"checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4" +"checksum cargo-husky 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "22f6d8b2af30e25d3ee4d72cdb7a127033ee6ee0ec50b47cdb6737e282797652" +"checksum cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)" = "5e5f3fee5eeb60324c2781f1e41286bdee933850fff9b3c672587fed5ec58c83" +"checksum cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "11d43355396e872eefb45ce6342e4374ed7bc2b3a502d1b28e36d6e23c05d1f4" "checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878" -"checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e" +"checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" -"checksum codespan 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "172b4fa8eec616659e19bdd41d33a3c29cd6913b9b747054c0429865c1f210ec" -"checksum codespan-reporting 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b5b329932b380f719f861e2844dcafea53e31821a53b76a1218364d3433cb472" -"checksum cranelift 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a423fcf313f7090382c7b715c930a1f485cbca1b39289d6303ec11251a358" -"checksum cranelift-bforest 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c88db0c2fc38b2cedee1b94ee2dc7bf80e4ce31467c8005743f485af66e240d8" -"checksum cranelift-codegen 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ce2e412970cfda0fa11806758d79a46c02b8fa1b91c35a8d3e2b4c947ce0c35" -"checksum cranelift-codegen-meta 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)" = "43131e662da7e0243cff28edfbc094a62968a4b57849f77a6c1e3685e9e6e1e6" -"checksum cranelift-entity 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c4ccc3743848cbb53e58b62685703dc12ea553c3bc8f21db76f23c68054eb69a" -"checksum cranelift-frontend 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)" = "89ecc8b49d4ab98f2c121832fee365da88b7b0ffad77d4e328015b1fd1f7f4b1" -"checksum cranelift-module 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)" = "93dc35e9baba6b538fa82a2a549f93efeef3cb9679b642e705a61e01a88986ef" -"checksum cranelift-native 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9876722d8a172bdb14bb6e281b7207ae0baae852235e5d37f0eb592504989f44" -"checksum cranelift-simplejit 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ce21c3e9fd47f708d7a98716aba8412076a2612ddfbaab100d0e9da92b220fa" +"checksum codespan 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "004def512a9848b23a68ed110927d102b0e6d9f3dc732e28570879afde051f8c" +"checksum codespan-reporting 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab081a14ab8f9598ce826890fe896d0addee68c7a58ab49008369ccbb51510a8" +"checksum cranelift 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)" = "135f36eed3a578925d4b8dd506e4df596c55615d2603c47e8638b8f6acc5bf22" +"checksum cranelift-bforest 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e5a357d20666bf4a8c2d626a19f1b59dbca66cd844fb1e66c5612254fd0f7505" +"checksum cranelift-codegen 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ab00cb149a5bb0f7e6dd391357356a5d71c335a431e8eece94f32da2d5a043f7" +"checksum cranelift-codegen-meta 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e3797a2f450ac71297e083dd440d0cdd0d3bceabe4a3ca6bcb9e4077e9c0327d" +"checksum cranelift-entity 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5b66e28877b75b3d2b31250f780bb5db8f68ae3df681cd56add803b2567ac4fd" +"checksum cranelift-frontend 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b72d55fd732b1f7a99d043a36c54a5679b6ec8bc777c8d954fb97c4fa0fce7eb" +"checksum cranelift-module 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)" = "83558a9230d46c75091fb6a1fe357ac693a669a85396da3c37a4ccd7d9f4acc3" +"checksum cranelift-native 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d0239f34836621a127c2132980b2f5c32a1be1c40e2d1a9a1a9bd5af33c12aee" +"checksum cranelift-simplejit 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)" = "caa00fb269e166f786a2c8e10e5866e365c7620c3686a7b592292f6d9cb0e2ff" "checksum crossbeam 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d7408247b1b87f480890f28b670c5f8d9a8a4274833433fe74dc0dfd46d33650" "checksum crossbeam-channel 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7b85741761b7f160bc5e7e0c14986ef685b7f8bf9b7ad081c60c604bb4649827" "checksum crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f739f8c5363aca78cfb059edf753d8f0d36908c348f3d8d1503f03d8b75d9cf3" @@ -1707,18 +1687,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum crossbeam-epoch 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2449aaa4ec7ef96e5fb24db16024b935df718e9ae1cec0a1e68feeca2efca7b8" "checksum crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2760899e32a1d58d5abb31129f8fae5de75220bc2176e77ff7c627ae45c918d9" "checksum crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "677d453a17e8bd2b913fa38e8b9cf04bcdbb5be790aa294f2389661d72036015" -"checksum crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "41ee4864f4797060e52044376f7d107429ce1fb43460021b126424b7180ee21a" +"checksum crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f8306fcef4a7b563b76b7dd949ca48f52bc1141aa067d2ea09565f3e2652aa5c" +"checksum ctor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "e5cc1c7c759bf979c651ce1da82d06065375e2223b65c070190b8000787da58b" "checksum derivative 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6073e9676dbebdddeabaeb63e3b7cefd23c86f5c41d381ee1237cc77b1079898" "checksum derive-new 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "6ca414e896ae072546f4d789f452daaecf60ddee4c9df5dc6d5936d769e3d87c" "checksum diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "3c2b69f912779fbb121ceb775d74d51e915af17aaebc38d28a592843a2dd0a3a" "checksum difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198" "checksum digest 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05f47366984d3ad862010e22c7ce81a7dbcaebbdfb37241a620f8b6596ee135c" -"checksum docopt 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "db2906c2579b5b7207fc1e328796a9a8835dc44e22dbe8e460b1d636f9a7b225" +"checksum docopt 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7f525a586d310c87df72ebcd98009e57f1cc030c8c268305287a476beb653969" "checksum dot 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a74b6c4d4a1cff5f454164363c16b72fa12463ca6b31f4b5f2035a65fa3d5906" -"checksum either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3be565ca5c557d7f59e7cfcf1844f9e3033650c929c6566f511e8005f205c1d0" +"checksum either 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5527cfe0d098f36e3f8839852688e63c8fff1c90b2b405aef730615f9a7bcf7b" "checksum ena 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f56c93cc076508c549d9bb747f79aa9b4eb098be7b8cad8830c3137ef52d1e00" "checksum enum-primitive-derive 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2b90e520ec62c1864c8c78d637acbfe8baf5f63240f2fb8165b8325c07812dd" -"checksum env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "afb070faf94c85d17d50ca44f6ad076bce18ae92f0037d350947240a36e9d42e" +"checksum env_logger 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b61fa891024a945da30a9581546e8cfaf5602c7b3f4c137a2805cf388f92075a" "checksum errno 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c2a071601ed01b988f896ab14b95e67335d1eeb50190932a1320f7fe3cadc84e" "checksum errno-dragonfly 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "14ca354e36190500e1e1fb267c647932382b54053c50b14970856c0b00a35067" "checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" @@ -1726,9 +1707,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" "checksum fixedbitset 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "86d4de0081402f5e88cdac65c8dcdcc73118c1a7a465e2a05f0da05843a8ea33" "checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" -"checksum fuchsia-cprng 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "81f7f8eb465745ea9b02e2704612a9946a59fa40572086c6fd49d6ddcf30bf31" -"checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" -"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" +"checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" "checksum fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" "checksum gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)" = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2" "checksum generic-array 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3c0f28c2f5bfb5960175af447a2da7c18900693738343dc896ffbcabd9839592" @@ -1736,30 +1715,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum hibitset 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6527bc88f32e0d3926c7572874b2bf17a19b36978aacd0aacf75f7d27a5992d0" "checksum humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ca7e5f2e110db35f93b837c81797f3714500b81d517bf20c431b16d3ca4f114" "checksum indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7e81a7c05f79578dbc15793d8b619db9ba32b4577003ef3af1a91c416798c58d" -"checksum itertools 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0d47946d458e94a1b7bcabbf6521ea7c037062c81f534615abcad76e84d4970d" "checksum itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5b8467d9c1cebe26feb08c640139247fac215782d35371ade9a2136ed6085358" "checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum lalrpop 0.16.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4e2e80bee40b22bca46665b4ef1f3cd88ed0fb043c971407eac17a0712c02572" "checksum lalrpop-util 0.16.3 (registry+https://github.com/rust-lang/crates.io-index)" = "33b27d8490dbe1f9704b0088d61e8d46edc10d5673a8829836c6ded26a9912c7" -"checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1" -"checksum libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "e962c7641008ac010fa60a7dfdc1712449f29c44ef2d4702394aea943ee75047" +"checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" +"checksum libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)" = "bedcc7a809076656486ffe045abeeac163da1b558e963a31e29fbfbeba916917" "checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c" "checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" "checksum mach 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "86dd2487cdfea56def77b88438a2c915fb45113c5319bfe7e14306ca4cd0b0e1" -"checksum memchr 2.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e1dd4eaac298c32ce07eb6ed9242eda7d82955b9170b7d6db59b2e02cc63fcb8" +"checksum memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2efc7bc57c883d4a4d6e3246905283d8dae951bb3bd32f49d6ef297f546e1c39" "checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3" "checksum mopa 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a785740271256c230f57462d3b83e52f998433a7062fc18f96d5999474a9f915" -"checksum new_debug_unreachable 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0cdc457076c78ab54d5e0d6fa7c47981757f1e34dc39ff92787f217dede586c4" +"checksum new_debug_unreachable 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f40f005c60db6e03bae699e414c58bf9aa7ea02a2d0b9bfbcf19286cc4c82b30" "checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" "checksum nonzero_signed 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "02783a0482333b0d3f5f5411b8fb60454a596696da041da0470ac9ef3e6e37d8" "checksum num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "e83d528d2677f0518c570baf2b7abdcf0cd2d248860b68507bdcb3e91d4c0cea" "checksum num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31" "checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1" -"checksum num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5a69d464bdc213aaaff628444e99578ede64e9c854025aa43b9796530afa9238" -"checksum opaque-debug 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "51ecbcb821e1bd256d456fe858aaa7f380b63863eab2eb86eee1bd9f33dd6682" -"checksum ordered-float 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2f0015e9e8e28ee20c581cfbfe47c650cedeb9ed0721090e0b7ebb10b9cdbcc2" +"checksum num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1a23f0ed30a54abaa0c7e83b1d2d87ada7c3c23078d1d87815af3e3b6385fbba" +"checksum opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "93f5bb2e8e8dec81642920ccff6b61f1eb94fa3020c5a325c9851ff604152409" +"checksum ordered-float 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "18869315e81473c951eb56ad5558bbc56978562d3ecfb87abb7a1e944cea4518" "checksum ordermap 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a86ed3f5f244b372d6b1a00b72ef7f8876d0bc6a78a4c9985c53614041512063" +"checksum output_vt100 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "53cdc5b785b7a58c5aad8216b3dfa114df64b0b06ae6e1501cef91df2fbdf8f9" "checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37" "checksum owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49a4b8ea2179e6a2e27411d3bca09ca6dd630821cf6894c6c7c8467a8ee7ef13" "checksum parking_lot 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d4d05f1349491390b1730afba60bb20d55761bef489a954546b58b4b34e1e2ac" @@ -1772,70 +1751,71 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum phf_generator 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)" = "09364cc93c159b8b06b1f4dd8a4398984503483891b0c26b867cf431fb132662" "checksum phf_shared 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)" = "234f71a15de2288bcb7e3b6515828d22af7ec8598ee6d24c3b526fa0a80b67a0" "checksum precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" -"checksum pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3a029430f0d744bc3d15dd474d591bed2402b645d024583082b9f63bb936dac6" +"checksum pretty_assertions 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3f81e1644e1b54f5a68959a29aa86cde704219254669da328ecfdf6a1f09d427" "checksum pretty_env_logger 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "df8b3f4e0475def7d9c2e5de8e5a1306949849761e107b360d03e98eafaffd61" -"checksum proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)" = "38fddd23d98b2144d197c0eca5705632d4fe2667d14a6be5df8934f8d74f1978" +"checksum proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)" = "4d317f9caece796be1980837fd5cb3dfec5613ebdb04ad0956deea83ce168915" "checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" "checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" "checksum quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)" = "cdd8e04bd9c52e0342b406469d494fcb033be4bdbe5c606016defbb1681411e1" "checksum rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" "checksum rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9" -"checksum rand 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3906503e80ac6cbcacb2c2973fa8e473f24d7e2747c8c92bb230c2441cad96b5" +"checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" "checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" "checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" "checksum rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d0e7a549d590831370895ab7ba4ea0c1b6b011d106b5ff2da6eee112615e6dc0" "checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" "checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" -"checksum rand_os 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f46fbd5550acf75b0c2730f5dd1873751daf9beb8f11b44027778fae50d7feca" -"checksum rand_pcg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "086bd09a33c7044e56bb44d5bdde5a60e7f119a9e95b0775f545de759a32fe05" +"checksum rand_jitter 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b9ea758282efe12823e0d952ddb269d2e1897227e464919a554f2a03ef1b832" +"checksum rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" +"checksum rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" "checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" "checksum raw-cpuid 6.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "30a9d219c32c9132f7be513c18be77c9881c7107d2ab5569d205a6a0f0e6dc7d" "checksum rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "373814f27745b2686b350dd261bfd24576a6fb0e2c5919b3a2b6005f820b0473" "checksum rayon-core 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b055d1e92aba6877574d8fe604a63c8b5df60f60e5982bf7ccbb1338ea527356" "checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" -"checksum redox_syscall 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)" = "423e376fffca3dfa06c9e9790a9ccd282fafb3cc6e6397d01dbf64f9bacc6b85" +"checksum redox_syscall 0.1.53 (registry+https://github.com/rust-lang/crates.io-index)" = "53848511b7ee6eb9d5c3db48481aaa5779b38fc0131bc133c98cb4f2b2411928" "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" -"checksum regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37e7cbbd370869ce2e8dff25c7018702d10b21a20ef7135316f8daecd6c25b7f" -"checksum regex-syntax 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "8c2f35eedad5295fdf00a63d7d4b238135723f92b434ec06774dad15c7ab0861" +"checksum regex 1.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "559008764a17de49a3146b234641644ed37d118d1ef641a0bb573d146edc6ce0" +"checksum regex-syntax 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)" = "dcfd8681eebe297b81d98498869d4aae052137651ad7b96822f09ceb690d0a96" "checksum region 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ace21a7fc79cffefeb66f2cc3ef22c7687015023bf7f85bec8840f0d46cb51cc" "checksum relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0e7790c7f1cc73d831d28dc5a7deb316a006e7848e6a7f467cdb10a0a9e0fb1c" "checksum rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "adacaae16d02b6ec37fdc7acfcddf365978de76d1983d3ee22afc260e1ca9619" "checksum rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7540fc8b0c49f096ee9c961cda096467dce8084bec6bdca2fc83895fd9b28cb8" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" "checksum ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "eb9e9b8cde282a9fe6a42dd4681319bfb63f121b8a8ee9439c6f4107e58a46f7" -"checksum salsa 0.10.0-alpha5 (registry+https://github.com/rust-lang/crates.io-index)" = "8b5e2535d707dc5ced81106d3b71d806cfeef8a6e8a567472fde7ffd56b770dd" -"checksum salsa-macros 0.10.0-alpha5 (registry+https://github.com/rust-lang/crates.io-index)" = "e7c5da4c649f6d4fc1864fcd9a379b1f7c6d570b278559c84a6e15981c949cc6" +"checksum salsa 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "249290390580a2ccdc1aa8256989733978a7c3e11e508abc529055ae4866e3a3" +"checksum salsa-macros 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9120ba92eda59ebd3a39e8245531df9a3805468bf38fe57fdfc30f14d0fdbea9" "checksum same-file 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8f20c4be53a8a1ff4c1f1b2bd14570d2f634628709752f0702ecdd2b3f9a5267" "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)" = "534b8b91a95e0f71bca3ed5824752d558da048d4248c91af873b63bd60519752" -"checksum serde_derive 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)" = "a915306b0f1ac5607797697148c223bedeaa36bcc2e28a01441cd638cc6567b4" -"checksum serde_json 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)" = "4b90a9fbe1211e57d3e1c15670f1cb00802988fb23a1a4aad7a2b63544f1920e" +"checksum serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)" = "aa5f7c20820475babd2c077c3ab5f8c77a31c15e16ea38687b4c02d3e48680f4" +"checksum serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)" = "58fc82bec244f168b23d1963b45c8bf5726e9a15a9d146a067f9081aeed2de79" +"checksum serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)" = "5a23aa71d4a4d43fdbfaac00eff68ba8a06a51759a89ac3304323e800c4dd40d" "checksum sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b4d8bfd0e469f417657573d8451fb33d16cfe0989359b93baf3a1ffc639543d" "checksum shred 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c75ec29e8d2959ad96a1087fe4cadb926c6fc17cbae9812314fa8efe720aa2a" "checksum shred-derive 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9fcf34e5e5302d3024aba7afc291f6d1ca7573ed035d3c0796976ba3f10691a1" "checksum shrev 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ec60ed6f60a4b3cdc2ceacf57215db3408fbd8990f66a38686a31558cd9da482" "checksum siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0b8de496cf83d4ed58b6be86c3a275b8602f6ffe98d3024a869e124147a9a3ac" -"checksum smallvec 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "88aea073965ab29f6edb5493faf96ad662fb18aa9eeb186a3b7057951605ed15" +"checksum smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c4488ae950c49d403731982257768f48fada354a5203fe81f9bb6f43ca9002be" "checksum specs 0.14.3 (registry+https://github.com/rust-lang/crates.io-index)" = "de65613ada4338aa7ba71eca60eca24c60483433eec0077bc4f33cfc31f4bdf0" -"checksum specs-derive 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a63549fa0d4a6f76e99e6634c328f25d0c9fa8ad6f8498aef74f6c35c0b269e5" "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" "checksum string_cache 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "25d70109977172b127fe834e5449e5ab1740b9ba49fa18a2020f509174f25423" "checksum string_cache_codegen 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1eea1eee654ef80933142157fdad9dd8bc43cf7c74e999e369263496f04ff4da" "checksum string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b1884d1bc09741d466d9b14e6d37ac89d6909cbcac41dd9ae982d4d063bbedfc" -"checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550" -"checksum structopt 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "670ad348dc73012fcf78c71f06f9d942232cdd4c859d4b6975e27836c3efc0c3" -"checksum structopt-derive 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "ef98172b1a00b0bec738508d3726540edcbd186d50dfd326f2b1febbb3559f04" +"checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" +"checksum strsim 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a7be23478587f30ca7b4b423b6bee7baf5b6986c1e511bf1904a984cb6105621" +"checksum structopt 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)" = "3d0760c312538987d363c36c42339b55f5ee176ea8808bbe4543d484a291c8d1" +"checksum structopt-derive 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)" = "528aeb7351d042e6ffbc2a6fb76a86f9b622fdf7c25932798e7a82cb03bc94c6" "checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" -"checksum syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)" = "f92e629aa1d9c827b2bb8297046c1ccffc57c99b947a680d3ccff1f136a3bee9" +"checksum syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)" = "66c8865bf5a7cbb662d8b011950060b3c8743dca141b054bf7195b20d314d8e2" "checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" "checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015" -"checksum target-lexicon 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4af5e2227f0b887d591d3724b796a96eff04226104d872f5b3883fcd427d64b9" +"checksum target-lexicon 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d6923974ce4eb5bd28814756256d8ab71c28dd6e7483313fe7ab6614306bf633" "checksum term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "fa63644f74ce96fbeb9b794f66aff2a52d601cbd5e80f4b97123e3899f4570f1" "checksum termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4096add70612622289f2fdcdbd5086dc81c1e2675e6ae58d6c4f62a16c6d7f2f" "checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" -"checksum textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "307686869c93e71f94da64286f9a9524c0f308a9e1c87a583de8e9c9039ad3f6" +"checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" "checksum tuple_utils 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cbfecd7bb8f0a3e96b3b31c46af2677a55a588767c0091f484601424fcb20e7e" @@ -1845,16 +1825,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" "checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" -"checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" "checksum utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "796f7e48bef87609f7ade7e06495a87d5cd06c7866e6a5cbfceffc558a243737" "checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" -"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" "checksum walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "9d9d7ed3431229a144296213105a390676cc49c9b6a72bd19f3176c98e129fa1" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" -"checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0" +"checksum winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f10e386af2b13e47c89e7236a7a14a086791a2b88ebad6df9bf42040195cf770" "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -"checksum winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "afc5508759c5bf4285e61feb862b6083c8480aec864fa17a81fdec6f69b461ab" +"checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9" "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" "checksum wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "561ed901ae465d6185fa7864d63fbd5720d0ef718366c9a4dc83cf6170d7e9ba" "checksum xdg 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d089681aa106a86fade1b0128fb5daf07d5867a509ab036d99988dec80429a57" diff --git a/Cargo.toml b/Cargo.toml index d3b235f..d5b8f69 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,42 +10,37 @@ edition = "2018" [build-dependencies] lalrpop = "0.16.3" failure = "0.1.5" -regex = "1.1.0" +regex = "1.1.5" walkdir = "2.2.7" [dependencies] -cranelift = "0.28.0" -cranelift-module = "0.28.0" -cranelift-simplejit = "0.28.0" +cranelift = "0.30.0" +cranelift-module = "0.30.0" +cranelift-simplejit = "0.30.0" dot = "0.1.4" -env_logger = "0.6.0" +env_logger = "0.6.1" failure = "0.1.5" lalrpop-util = "0.16.3" log = "0.4.6" -regex = "1.1.0" -specs = { version = "0.14.3", default_features = false } -specs-derive = "0.4.0" -specs-visitor-derive = { version = "0.3.0", path = "specs-visitor-derive" } -specs-visitor = { version = "0.3.0", path = "specs-visitor", default_features = false } +regex = "1.1.5" pretty_env_logger = "0.3.0" -structopt = "0.2.14" -lazy_static = "1.2.0" +structopt = "0.2.15" +lazy_static = "1.3.0" byteorder = "1.3.1" -rayon = { version = "1.0.3", optional = true } itertools = "0.8.0" -codespan = "0.2.0" -codespan-reporting = "0.2.0" +codespan = "0.2.1" +codespan-reporting = "0.2.1" enum-primitive-derive = "0.1.2" num-traits = "0.2.6" -salsa = "0.10.0-alpha5" +salsa = "0.12.0" relative-path = "0.4.0" rustc-hash = "1.0.1" -ordered-float = "1.0.1" +ordered-float = "1.0.2" [features] default = ["parallel"] -nightly = ["specs/nightly"] -parallel = ["rayon", "specs/parallel", "specs-visitor/parallel"] +nightly = [] +parallel = [] test-render-graphs = [] [profile.release] @@ -57,9 +52,8 @@ codegen-units = 1 members = ["specs-visitor", "specs-visitor-derive", "tin-fuzz-target"] [dev-dependencies] -pretty_assertions = "0.5.1" +pretty_assertions = "0.6.1" [dev-dependencies.cargo-husky] -git = "https://github.com/dflemstr/cargo-husky.git" -branch = "run-for-all" +version = "1.3.0" features = ["prepush-hook", "precommit-hook", "run-for-all", "run-cargo-test", "run-cargo-check", "run-cargo-clippy", "run-cargo-fmt"] diff --git a/rust-toolchain b/rust-toolchain index bf867e0..2bf5ad0 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -nightly +stable diff --git a/specs-visitor-derive/Cargo.toml b/specs-visitor-derive/Cargo.toml index d98cce7..66f9c0c 100644 --- a/specs-visitor-derive/Cargo.toml +++ b/specs-visitor-derive/Cargo.toml @@ -13,7 +13,7 @@ proc-macro = true [dependencies] synstructure = "0.10.1" quote = "0.6.11" -proc-macro2 = "0.4.26" +proc-macro2 = "0.4.27" [dev-dependencies] specs = "0.14.3" diff --git a/src/best_iter.rs b/src/best_iter.rs deleted file mode 100644 index 8cc91bb..0000000 --- a/src/best_iter.rs +++ /dev/null @@ -1,184 +0,0 @@ -pub trait BestJoin { - type Iter: BestIterator; - - fn best_join(self) -> Self::Iter - where - Self: Sized; -} - -pub trait BestIterator { - type Item: Send; - - fn best_for_each(self, op: F) - where - F: Fn(Self::Item) + Sync + Send; -} - -pub trait BestIteratorMap: BestIterator -where - F: Fn(Self::Item) -> R + Sync + Send, - R: Send, -{ - type Map; - - fn best_map(self, map_op: F) -> Self::Map; -} - -pub trait BestIteratorFlatMap: BestIterator -where - F: Fn(Self::Item) -> II + Sync + Send, -{ - type FlatMap; - - fn best_flat_map(self, map_op: F) -> Self::FlatMap; -} - -pub trait BestIteratorCollect: BestIterator { - fn best_collect(self) -> C; -} - -#[cfg(feature = "parallel")] -impl BestJoin for J -where - J: specs::Join + specs::ParJoin + Send, - J::Mask: Send + Sync, - J::Type: Send, - J::Value: Send, -{ - type Iter = specs::join::JoinParIter; - - fn best_join(self) -> Self::Iter - where - Self: Sized, - { - specs::join::ParJoin::par_join(self) - } -} - -#[cfg(not(feature = "parallel"))] -impl BestJoin for J -where - J: specs::Join, - J::Type: Send, -{ - type Iter = specs::join::JoinIter; - - fn best_join(self) -> Self::Iter - where - Self: Sized, - { - specs::join::Join::join(self) - } -} - -#[cfg(feature = "parallel")] -impl BestIterator for I -where - I: rayon::iter::ParallelIterator, -{ - type Item = I::Item; - - fn best_for_each(self, op: F) - where - F: Fn(Self::Item) + Sync + Send, - { - rayon::iter::ParallelIterator::for_each(self, op) - } -} - -#[cfg(not(feature = "parallel"))] -impl BestIterator for I -where - I: Iterator, - I::Item: Send, -{ - type Item = I::Item; - - fn best_for_each(self, op: F) - where - F: Fn(Self::Item) + Sync + Send, - { - Iterator::for_each(self, op) - } -} - -#[cfg(feature = "parallel")] -impl BestIteratorMap for I -where - I: rayon::iter::ParallelIterator, - F: Fn(Self::Item) -> R + Sync + Send, - R: Send, -{ - type Map = rayon::iter::Map; - - fn best_map(self, map_op: F) -> Self::Map { - rayon::iter::ParallelIterator::map(self, map_op) - } -} - -#[cfg(not(feature = "parallel"))] -impl BestIteratorMap for I -where - I: Iterator, - I::Item: Send, - F: Fn(Self::Item) -> R + Sync + Send, - R: Send, -{ - type Map = ::std::iter::Map; - - fn best_map(self, map_op: F) -> Self::Map { - Iterator::map(self, map_op) - } -} - -#[cfg(feature = "parallel")] -impl BestIteratorFlatMap for I -where - I: rayon::iter::ParallelIterator, - II: rayon::iter::IntoParallelIterator, - F: Fn(Self::Item) -> II + Sync + Send, -{ - type FlatMap = rayon::iter::FlatMap; - - fn best_flat_map(self, map_op: F) -> Self::FlatMap { - rayon::iter::ParallelIterator::flat_map(self, map_op) - } -} - -#[cfg(not(feature = "parallel"))] -impl BestIteratorFlatMap for I -where - I: Iterator, - I::Item: Send, - II: ::std::iter::IntoIterator, - F: Fn(Self::Item) -> II + Sync + Send, -{ - type FlatMap = std::iter::FlatMap; - - fn best_flat_map(self, map_op: F) -> Self::FlatMap { - Iterator::flat_map(self, map_op) - } -} - -#[cfg(feature = "parallel")] -impl BestIteratorCollect for I -where - I: rayon::iter::ParallelIterator, - C: rayon::iter::FromParallelIterator + Send, -{ - fn best_collect(self) -> C { - rayon::iter::ParallelIterator::collect(self) - } -} - -#[cfg(not(feature = "parallel"))] -impl BestIteratorCollect for I -where - I: Iterator, - I::Item: Send, - C: ::std::iter::FromIterator + Send, -{ - fn best_collect(self) -> C { - Iterator::collect(self) - } -} diff --git a/src/codegen/data.rs b/src/codegen/data.rs index d42f38a..45d4c59 100644 --- a/src/codegen/data.rs +++ b/src/codegen/data.rs @@ -58,11 +58,11 @@ impl<'a> Translator<'a> { .unwrap(), value::Number::F32(v) => self .storage - .write_f32::(v) + .write_f32::(v.into_inner()) .unwrap(), value::Number::F64(v) => self .storage - .write_f64::(v) + .write_f64::(v.into_inner()) .unwrap(), } } diff --git a/src/codegen/function.rs b/src/codegen/function.rs index 8d19a45..7060a55 100644 --- a/src/codegen/function.rs +++ b/src/codegen/function.rs @@ -1,8 +1,6 @@ use std::collections; use std::fmt; -use specs; - use cranelift::prelude::*; use cranelift_module; use cranelift_simplejit; @@ -11,10 +9,10 @@ use crate::codegen::abi_type; use crate::codegen::builtin; use crate::codegen::util; use crate::ir::component::constexpr; -use crate::ir::component::element; +use crate::ir::element; use crate::ir::component::layout; -use crate::ir::component::location; -use crate::ir::component::symbol; +use crate::ir::location; +use crate::ir::symbol; use crate::ir::component::ty; use crate::module; use crate::value; @@ -34,7 +32,7 @@ where ptr_type: Type, error_throw_ebb: Ebb, error_unwind_ebb: Ebb, - variables: &'a collections::HashMap, + variables: &'a collections::HashMap, defined_strings: &'a mut collections::HashMap, codemap: &'a codespan::CodeMap, } @@ -53,7 +51,7 @@ impl<'a, 'f> Translator<'a, 'f> { ptr_type: Type, error_throw_ebb: Ebb, error_unwind_ebb: Ebb, - variables: &'a collections::HashMap, + variables: &'a collections::HashMap, defined_strings: &'a mut collections::HashMap, codemap: &'a codespan::CodeMap, ) -> Self { @@ -75,7 +73,7 @@ impl<'a, 'f> Translator<'a, 'f> { } } - pub fn exec_element(&mut self, entity: specs::Entity, element: &element::Element) { + pub fn exec_element(&mut self, entity: ir::Entity, element: &element::Element) { if let element::Element::Variable(ref v) = element { self.exec_variable(entity, v); } else { @@ -83,13 +81,13 @@ impl<'a, 'f> Translator<'a, 'f> { } } - pub fn exec_variable(&mut self, entity: specs::Entity, variable: &element::Variable) { + pub fn exec_variable(&mut self, entity: ir::Entity, variable: &element::Variable) { let initializer_element = self.elements.get(variable.initializer).unwrap(); let value = self.eval_element(variable.initializer, initializer_element); self.builder.def_var(self.variables[&entity], value); } - pub fn eval_element(&mut self, entity: specs::Entity, element: &element::Element) -> Value { + pub fn eval_element(&mut self, entity: ir::Entity, element: &element::Element) -> Value { if let Some(constexpr) = self.constexprs.get(entity) { self.eval_constexpr(entity, constexpr) } else { @@ -115,7 +113,7 @@ impl<'a, 'f> Translator<'a, 'f> { } } - fn eval_constexpr(&mut self, entity: specs::Entity, constexpr: &constexpr::Constexpr) -> Value { + fn eval_constexpr(&mut self, entity: ir::Entity, constexpr: &constexpr::Constexpr) -> Value { if let value::Case::Number(ref n) = *constexpr.value.case() { match *n { value::Number::U8(ref v) => self.builder.ins().iconst(types::I8, i64::from(*v)), @@ -133,8 +131,14 @@ impl<'a, 'f> Translator<'a, 'f> { value::Number::I16(ref v) => self.builder.ins().iconst(types::I16, i64::from(*v)), value::Number::I32(ref v) => self.builder.ins().iconst(types::I32, i64::from(*v)), value::Number::I64(ref v) => self.builder.ins().iconst(types::I64, *v), - value::Number::F32(ref v) => self.builder.ins().f32const(Ieee32::with_float(*v)), - value::Number::F64(ref v) => self.builder.ins().f64const(Ieee64::with_float(*v)), + value::Number::F32(ref v) => self + .builder + .ins() + .f32const(Ieee32::with_float(v.into_inner())), + value::Number::F64(ref v) => self + .builder + .ins() + .f64const(Ieee64::with_float(v.into_inner())), } } else { let ty = self.types.get(entity).unwrap(); @@ -160,7 +164,7 @@ impl<'a, 'f> Translator<'a, 'f> { #[cfg_attr(feature = "cargo-clippy", allow(clippy::cast_possible_wrap))] pub fn eval_number_value( &mut self, - _entity: specs::Entity, + _entity: ir::Entity, number_value: &element::Number, ) -> Value { match *number_value { @@ -172,12 +176,18 @@ impl<'a, 'f> Translator<'a, 'f> { element::Number::I16(v) => self.builder.ins().iconst(types::I16, i64::from(v)), element::Number::I32(v) => self.builder.ins().iconst(types::I32, i64::from(v)), element::Number::I64(v) => self.builder.ins().iconst(types::I64, v), - element::Number::F32(v) => self.builder.ins().f32const(Ieee32::with_float(v)), - element::Number::F64(v) => self.builder.ins().f64const(Ieee64::with_float(v)), + element::Number::F32(v) => self + .builder + .ins() + .f32const(Ieee32::with_float(v.into_inner())), + element::Number::F64(v) => self + .builder + .ins() + .f64const(Ieee64::with_float(v.into_inner())), } } - pub fn eval_string_value(&mut self, entity: specs::Entity, _string_value: &str) -> Value { + pub fn eval_string_value(&mut self, entity: ir::Entity, _string_value: &str) -> Value { // TODO: create data symbol let symbol = self .module @@ -198,7 +208,7 @@ impl<'a, 'f> Translator<'a, 'f> { feature = "cargo-clippy", allow(clippy::cast_possible_truncation, clippy::cast_possible_wrap) )] - pub fn eval_tuple(&mut self, entity: specs::Entity, tuple: &element::Tuple) -> Value { + pub fn eval_tuple(&mut self, entity: ir::Entity, tuple: &element::Tuple) -> Value { let layout = self.layouts.get(entity).unwrap(); let alloc_size = self.builder.ins().iconst(self.ptr_type, layout.size as i64); let alloc_align = self @@ -221,7 +231,7 @@ impl<'a, 'f> Translator<'a, 'f> { result } - pub fn eval_record(&mut self, entity: specs::Entity, record: &element::Record) -> Value { + pub fn eval_record(&mut self, entity: ir::Entity, record: &element::Record) -> Value { let layout = self.layouts.get(entity).unwrap(); #[cfg_attr( @@ -259,7 +269,7 @@ impl<'a, 'f> Translator<'a, 'f> { result } - pub fn eval_un_op(&mut self, _entity: specs::Entity, un_op: &element::UnOp) -> Value { + pub fn eval_un_op(&mut self, _entity: ir::Entity, un_op: &element::UnOp) -> Value { let element::UnOp { operator, operand } = un_op; let operand = *operand; @@ -289,7 +299,7 @@ impl<'a, 'f> Translator<'a, 'f> { } } - pub fn eval_bi_op(&mut self, entity: specs::Entity, bi_op: &element::BiOp) -> Value { + pub fn eval_bi_op(&mut self, entity: ir::Entity, bi_op: &element::BiOp) -> Value { let element::BiOp { lhs, operator, rhs } = bi_op; let lhs = *lhs; let rhs = *rhs; @@ -377,11 +387,11 @@ impl<'a, 'f> Translator<'a, 'f> { } } - pub fn eval_variable(&mut self, entity: specs::Entity, _variable: &element::Variable) -> Value { + pub fn eval_variable(&mut self, entity: ir::Entity, _variable: &element::Variable) -> Value { self.builder.use_var(self.variables[&entity]) } - pub fn eval_select(&mut self, _entity: specs::Entity, select: &element::Select) -> Value { + pub fn eval_select(&mut self, _entity: ir::Entity, select: &element::Select) -> Value { let record_layout = self.layouts.get(select.record).unwrap(); let record_type = match self.types.get(select.record).unwrap() { ty::Type::Record(r) => r, @@ -418,13 +428,13 @@ impl<'a, 'f> Translator<'a, 'f> { pub fn eval_parameter( &mut self, - entity: specs::Entity, + entity: ir::Entity, _parameter: &element::Parameter, ) -> Value { self.builder.use_var(self.variables[&entity]) } - pub fn eval_apply(&mut self, entity: specs::Entity, apply: &element::Apply) -> Value { + pub fn eval_apply(&mut self, entity: ir::Entity, apply: &element::Apply) -> Value { let mut sig = self.module.make_signature(); for parameter in &apply.parameters { @@ -473,19 +483,19 @@ impl<'a, 'f> Translator<'a, 'f> { result } - pub fn eval_capture(&mut self, entity: specs::Entity, _capture: &element::Capture) -> Value { + pub fn eval_capture(&mut self, entity: ir::Entity, _capture: &element::Capture) -> Value { self.builder.use_var(self.variables[&entity]) } - pub fn eval_closure(&mut self, _entity: specs::Entity, _closure: &element::Closure) -> Value { + pub fn eval_closure(&mut self, _entity: ir::Entity, _closure: &element::Closure) -> Value { unimplemented!() } - pub fn eval_module(&mut self, _entity: specs::Entity, _module: &element::Module) -> Value { + pub fn eval_module(&mut self, _entity: ir::Entity, _module: &element::Module) -> Value { unimplemented!() } - pub fn error_if_zero(&mut self, entity: specs::Entity, value: Value, kind: module::ErrorKind) { + pub fn error_if_zero(&mut self, entity: ir::Entity, value: Value, kind: module::ErrorKind) { use num_traits::cast::ToPrimitive; let kind = self @@ -535,7 +545,7 @@ impl<'a, 'f> Translator<'a, 'f> { (filename, filename_len, line, col) } - fn get_symbol(&self, entity: specs::Entity) -> Option<&symbol::Symbol> { + fn get_symbol(&self, entity: ir::Entity) -> Option<&symbol::Symbol> { if let Some(symbol) = self.symbols.get(entity) { Some(symbol) } else if let Some(element) = self.elements.get(entity) { diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs index e917738..2206be4 100644 --- a/src/codegen/mod.rs +++ b/src/codegen/mod.rs @@ -5,14 +5,13 @@ use std::fmt; use cranelift::codegen; use cranelift_module; use cranelift_simplejit; -use specs; use crate::ir; use crate::ir::component::constexpr; -use crate::ir::component::element; +use crate::ir::element; use crate::ir::component::layout; -use crate::ir::component::location; -use crate::ir::component::symbol; +use crate::ir::location; +use crate::ir::symbol; use crate::ir::component::ty; use crate::module; @@ -63,11 +62,6 @@ impl<'a> Codegen<'a> { /// Compiles the captured IR into a module. pub fn compile(&self) -> module::Module { - use crate::best_iter::BestIteratorCollect; - use crate::best_iter::BestIteratorMap; - use crate::best_iter::BestJoin; - use specs::Join; - let Codegen { ref entities, ref constexprs, @@ -438,10 +432,10 @@ fn declare_variables( types: &specs::ReadStorage, ptr_type: Type, builder: &mut FunctionBuilder, - params: &[specs::Entity], - statements: &[specs::Entity], + params: &[ir::Entity], + statements: &[ir::Entity], entry_ebb: Ebb, -) -> collections::HashMap { +) -> collections::HashMap { let mut next_var = 0; let mut variables = collections::HashMap::new(); @@ -478,9 +472,9 @@ fn declare_variables_in_element( types: &specs::ReadStorage, ptr_type: Type, builder: &mut FunctionBuilder, - variables: &mut collections::HashMap, + variables: &mut collections::HashMap, next_var: &mut usize, - entity: specs::Entity, + entity: ir::Entity, ) { if let element::Element::Variable(_) = *elements.get(entity).unwrap() { declare_variable(types, ptr_type, builder, variables, next_var, entity); @@ -491,9 +485,9 @@ fn declare_variable( types: &specs::ReadStorage, ptr_type: Type, builder: &mut FunctionBuilder, - variables: &mut collections::HashMap, + variables: &mut collections::HashMap, next_var: &mut usize, - entity: specs::Entity, + entity: ir::Entity, ) -> Variable { *variables.entry(entity).or_insert_with(|| { let var = Variable::new(*next_var); diff --git a/src/graph.rs b/src/graph.rs index a4b8be7..676e544 100644 --- a/src/graph.rs +++ b/src/graph.rs @@ -6,13 +6,12 @@ use std::borrow; use std::fmt; use dot; -use specs; use crate::ir; -use crate::ir::component::element; -use crate::ir::component::layout; -use crate::ir::component::symbol; -use crate::ir::component::ty; +use crate::ir::element; +use crate::ir::symbol; +use crate::layout; +use crate::ty; /// A graph representation of IR. pub struct Graph<'a> { @@ -25,7 +24,7 @@ pub struct Graph<'a> { /// A node in the IR graph. #[derive(Clone, Copy, Debug)] -pub struct Node(specs::Entity); +pub struct Node(ir::Entity); /// An edge in the IR graph. #[derive(Clone, Copy, Debug)] @@ -78,8 +77,6 @@ impl<'a> Graph<'a> { impl<'a> dot::GraphWalk<'a, Node, Edge<'a>> for Graph<'a> { fn nodes(&'a self) -> borrow::Cow<'a, [Node]> { - use specs::Join; - borrow::Cow::Owned( self.entities .join() @@ -95,8 +92,6 @@ impl<'a> dot::GraphWalk<'a, Node, Edge<'a>> for Graph<'a> { } fn edges(&'a self) -> borrow::Cow<'a, [Edge<'a>]> { - use specs::Join; - let mut edges = Vec::new(); for entity in self.entities.join() { diff --git a/src/interpreter/error.rs b/src/interpreter/error.rs index f5d88a5..f7cc374 100644 --- a/src/interpreter/error.rs +++ b/src/interpreter/error.rs @@ -1,7 +1,7 @@ use crate::diagnostic; use crate::module; -#[derive(Clone, Debug, Fail, PartialEq)] +#[derive(Clone, Debug, Eq, Fail, PartialEq)] pub enum Error { #[fail(display = "type conflict: {}", _0)] RuntimeTypeConflict(String), diff --git a/src/interpreter/mod.rs b/src/interpreter/mod.rs index 0ce0387..aaccd54 100644 --- a/src/interpreter/mod.rs +++ b/src/interpreter/mod.rs @@ -1,9 +1,8 @@ use std::cmp; use std::collections; -use specs; - -use crate::ir::component::element; +use crate::ir; +use crate::ir::element; use crate::module; use crate::value; @@ -11,12 +10,9 @@ pub mod error; #[macro_use] mod macros; -pub fn eval<'a, F>( - element: &element::Element, - lookup: F, -) -> Result, error::Error> +pub fn eval(element: &element::Element, lookup: F) -> Result, error::Error> where - F: Fn(specs::Entity) -> Option<&'a value::Value>, + F: Fn(ir::Entity) -> Option, { match element { element::Element::Number(v) => Ok(Some(value::Value::number(eval_number(v)))), @@ -26,7 +22,7 @@ where } element::Element::Tuple(element::Tuple { ref fields }) => Ok(fields .iter() - .map(|f| lookup(*f).cloned()) + .map(|f| lookup(*f)) .collect::>>() .map(|fields| value::Value::tuple(value::Tuple { fields }))), element::Element::Record(element::Record { ref fields }) => Ok(fields @@ -41,7 +37,7 @@ where lookup(*lhs).and_then(|lhs| lookup(*rhs).map(|rhs| eval_bi_op(&lhs, *operator, &rhs))), ), element::Element::Variable(element::Variable { initializer, .. }) => { - Ok(lookup(*initializer).cloned()) + Ok(lookup(*initializer)) } element::Element::Select(element::Select { record, field }) => { transpose(lookup(*record).map(|record| match record.case() { @@ -133,25 +129,25 @@ fn eval_bi_op( element::BiOperator::Sub => match_number_value!("-", (lhs, rhs), |l, r| int: Ok( (l.wrapping_sub(*r)).into() ), frac: Ok( - (l - r).into() + (l.into_inner() - r.into_inner()).into() )), element::BiOperator::Mul => match_number_value!("*", (lhs, rhs), |l, r| int: Ok( (l.wrapping_mul(*r)).into() ), frac: Ok( - (l * r).into() + (l.into_inner() * r.into_inner()).into() )), element::BiOperator::Div => match_number_value!("/", (lhs, rhs), |l, r| int: if *r == 0 { Err(error::Error::EvaluationError(module::Error::new(module::ErrorKind::IntegerDivisonByZero))) } else { Ok((l.wrapping_div(*r)).into()) - }, frac: Ok((l / r).into() + }, frac: Ok((l.into_inner() / r.into_inner()).into() )), element::BiOperator::Rem => match_number_value!("%", (lhs, rhs), |l, r| int: if *r == 0 { Err(error::Error::EvaluationError(module::Error::new(module::ErrorKind::IntegerDivisonByZero))) } else { Ok((l.wrapping_rem(*r)).into()) }, frac: Ok( - (l % r).into() + (l.into_inner() % r.into_inner()).into() )), element::BiOperator::And => bool_op("&", lhs, rhs, |l, r| l & r), element::BiOperator::BAnd => { @@ -316,7 +312,7 @@ fn add(lhs: &value::Value, rhs: &value::Value) -> Result { - match_number!("+", (lhs, rhs), |l, r| int: Ok((l.wrapping_add(*r)).into()), frac: Ok((l + r).into())) + match_number!("+", (lhs, rhs), |l, r| int: Ok((l.wrapping_add(*r)).into()), frac: Ok((l.into_inner() + r.into_inner()).into())) } other => Err(error::Error::RuntimeTypeConflict(format!( "operation + not supported on values {:?}", diff --git a/src/ir/builder.rs b/src/ir/builder.rs index 6b11432..e226a4f 100644 --- a/src/ir/builder.rs +++ b/src/ir/builder.rs @@ -1,27 +1,32 @@ use std::collections; use std::mem; -use specs; - -use crate::ir::component::element; -use crate::ir::component::location; -use crate::ir::component::replacement; -use crate::ir::component::symbol; +use crate::ir; +use crate::ir::element; use crate::ir::error; +use crate::ir::location; +use crate::ir::symbol; +use crate::ir::world; use crate::syntax::ast; use crate::syntax::parser; -pub struct Builder<'a> { - world: &'a mut specs::World, +pub struct Builder +where + W: world::World, +{ + world: W, symbol: Vec, - current_scope: collections::HashMap, - scopes: Vec>, - current_captures: collections::HashMap, - captures: Vec>, + current_scope: collections::HashMap, + scopes: Vec>, + current_captures: collections::HashMap, + captures: Vec>, } -impl<'a> Builder<'a> { - pub fn new(world: &'a mut specs::World) -> Builder<'a> { +impl Builder +where + W: world::World, +{ + pub fn new(world: W) -> Builder { let symbol = Vec::new(); let current_scope = collections::HashMap::new(); let scopes = Vec::new(); @@ -40,14 +45,12 @@ impl<'a> Builder<'a> { pub fn add_module( &mut self, - entity: specs::Entity, + entity: ir::Entity, ast: &ast::Module, ) -> Result<(), error::Error> { - use specs::world::Builder; - let mut variables = collections::HashMap::new(); for variable in &ast.variables { - let var_entity = self.world.create_entity().build(); + let var_entity = self.world.create_entity(); self.current_scope .insert(variable.name.value.clone(), var_entity); @@ -60,30 +63,21 @@ impl<'a> Builder<'a> { self.add_variable(variables[name], variable)?; } + self.world.set_element( + entity, + element::Element::Module(element::Module { variables }), + ); self.world - .write_storage() - .insert( - entity, - element::Element::Module(element::Module { variables }), - ) - .unwrap(); - - self.world - .write_storage() - .insert(entity, symbol::Symbol::new(self.symbol.clone())) - .unwrap(); - + .set_symbol(entity, symbol::Symbol::new(self.symbol.clone())); self.world - .write_storage() - .insert(entity, location::Location(ast.context.span)) - .unwrap(); + .set_location(entity, location::Location(ast.context.span)); Ok(()) } fn add_identifier( &mut self, - entity: specs::Entity, + entity: ir::Entity, identifier: &ast::Identifier, ) -> Result<(), error::Error> { let name = &identifier.value; @@ -95,24 +89,17 @@ impl<'a> Builder<'a> { .flat_map(|scope| scope.get(name).cloned().into_iter()) .next() .map(|e| { - use specs::world::Builder; + let capture = self.world.create_entity(); + self.world.set_element( + capture, + element::Element::Capture(element::Capture { + name: name.clone(), + captured: e, + }), + ); - let capture = self.world.create_entity().build(); self.world - .write_storage() - .insert( - capture, - element::Element::Capture(element::Capture { - name: name.clone(), - captured: e, - }), - ) - .unwrap(); - - self.world - .write_storage() - .insert(capture, location::Location(identifier.context.span)) - .unwrap(); + .set_location(capture, location::Location(identifier.context.span)); self.current_captures.insert(name.clone(), capture); @@ -125,22 +112,17 @@ impl<'a> Builder<'a> { location: identifier.context.span, })?; - self.world - .write_storage() - .insert(entity, replacement::Replacement { to: definition }) - .unwrap(); + self.world.replace(entity, definition); self.world - .write_storage() - .insert(entity, location::Location(identifier.context.span)) - .unwrap(); + .set_location(entity, location::Location(identifier.context.span)); Ok(()) } fn add_expression( &mut self, - entity: specs::Entity, + entity: ir::Entity, expression: &ast::Expression, ) -> Result<(), error::Error> { match *expression { @@ -161,213 +143,155 @@ impl<'a> Builder<'a> { fn add_number( &mut self, - entity: specs::Entity, + entity: ir::Entity, number: &ast::NumberLiteral, ) -> Result<(), error::Error> { - self.world - .write_storage() - .insert( - entity, - element::Element::Number(Builder::from_ast_number(number.value)), - ) - .unwrap(); + self.world.set_element( + entity, + element::Element::Number(translate_number(number.value)), + ); self.world - .write_storage() - .insert(entity, location::Location(number.context.span)) - .unwrap(); + .set_location(entity, location::Location(number.context.span)); Ok(()) } - fn from_ast_number(number: ast::NumberValue) -> element::Number { - match number { - ast::NumberValue::U8(n) => element::Number::U8(n), - ast::NumberValue::U16(n) => element::Number::U16(n), - ast::NumberValue::U32(n) => element::Number::U32(n), - ast::NumberValue::U64(n) => element::Number::U64(n), - ast::NumberValue::I8(n) => element::Number::I8(n), - ast::NumberValue::I16(n) => element::Number::I16(n), - ast::NumberValue::I32(n) => element::Number::I32(n), - ast::NumberValue::I64(n) => element::Number::I64(n), - ast::NumberValue::F32(n) => element::Number::F32(n.into_inner()), - ast::NumberValue::F64(n) => element::Number::F64(n.into_inner()), - ast::NumberValue::Invalid => panic!("'invalid' AST nodes should not escape the parser"), - } - } - fn add_string( &mut self, - entity: specs::Entity, + entity: ir::Entity, string: &ast::StringLiteral, ) -> Result<(), error::Error> { - self.world - .write_storage() - .insert( - entity, - element::Element::String(match string.value { - ast::StringValue::String(ref s) => s.clone(), - ast::StringValue::Invalid => { - panic!("'invalid' AST nodes should not escape the parser") - } - }), - ) - .unwrap(); + self.world.set_element( + entity, + element::Element::String(match string.value { + ast::StringValue::String(ref s) => s.clone(), + ast::StringValue::Invalid => { + panic!("'invalid' AST nodes should not escape the parser") + } + }), + ); self.world - .write_storage() - .insert(entity, location::Location(string.context.span)) - .unwrap(); + .set_location(entity, location::Location(string.context.span)); Ok(()) } fn add_tuple( &mut self, - entity: specs::Entity, + entity: ir::Entity, tuple: &ast::Tuple, ) -> Result<(), error::Error> { - use specs::world::Builder; - let fields = tuple .fields .iter() .map(|f| { - let e = self.world.create_entity().build(); + let e = self.world.create_entity(); self.add_expression(e, f)?; Ok(e) }) .collect::>()?; self.world - .write_storage() - .insert(entity, element::Element::Tuple(element::Tuple { fields })) - .unwrap(); + .set_element(entity, element::Element::Tuple(element::Tuple { fields })); self.world - .write_storage() - .insert(entity, location::Location(tuple.context.span)) - .unwrap(); + .set_location(entity, location::Location(tuple.context.span)); Ok(()) } fn add_symbol( &mut self, - entity: specs::Entity, + entity: ir::Entity, symbol: &ast::Symbol, ) -> Result<(), error::Error> { let label = symbol.label.clone(); self.world - .write_storage() - .insert(entity, element::Element::Symbol(element::Symbol { label })) - .unwrap(); + .set_element(entity, element::Element::Symbol(element::Symbol { label })); self.world - .write_storage() - .insert(entity, location::Location(symbol.context.span)) - .unwrap(); + .set_location(entity, location::Location(symbol.context.span)); Ok(()) } fn add_record( &mut self, - entity: specs::Entity, + entity: ir::Entity, record: &ast::Record, ) -> Result<(), error::Error> { - use specs::world::Builder; - let fields = record .fields .iter() .map(|(i, e)| { - let en = self.world.create_entity().build(); + let en = self.world.create_entity(); self.add_expression(en, e)?; Ok((i.value.clone(), en)) }) .collect::>()?; self.world - .write_storage() - .insert(entity, element::Element::Record(element::Record { fields })) - .unwrap(); + .set_element(entity, element::Element::Record(element::Record { fields })); self.world - .write_storage() - .insert(entity, location::Location(record.context.span)) - .unwrap(); + .set_location(entity, location::Location(record.context.span)); Ok(()) } fn add_un_op( &mut self, - entity: specs::Entity, + entity: ir::Entity, un_op: &ast::UnOp, ) -> Result<(), error::Error> { - use specs::world::Builder; + let operator = translate_un_operator(un_op.operator); - let operator = self::Builder::translate_un_operator(un_op.operator); - - let operand = self.world.create_entity().build(); + let operand = self.world.create_entity(); self.add_expression(operand, &*un_op.operand)?; - self.world - .write_storage() - .insert( - entity, - element::Element::UnOp(element::UnOp { operator, operand }), - ) - .unwrap(); + self.world.set_element( + entity, + element::Element::UnOp(element::UnOp { operator, operand }), + ); self.world - .write_storage() - .insert(entity, location::Location(un_op.context.span)) - .unwrap(); + .set_location(entity, location::Location(un_op.context.span)); Ok(()) } fn add_bi_op( &mut self, - entity: specs::Entity, + entity: ir::Entity, bi_op: &ast::BiOp, ) -> Result<(), error::Error> { - use specs::world::Builder; - - let lhs = self.world.create_entity().build(); + let lhs = self.world.create_entity(); self.add_expression(lhs, &*bi_op.lhs)?; - let operator = self::Builder::translate_bi_operator(bi_op.operator); + let operator = translate_bi_operator(bi_op.operator); - let rhs = self.world.create_entity().build(); + let rhs = self.world.create_entity(); self.add_expression(rhs, &*bi_op.rhs)?; - self.world - .write_storage() - .insert( - entity, - element::Element::BiOp(element::BiOp { lhs, operator, rhs }), - ) - .unwrap(); + self.world.set_element( + entity, + element::Element::BiOp(element::BiOp { lhs, operator, rhs }), + ); self.world - .write_storage() - .insert(entity, location::Location(bi_op.context.span)) - .unwrap(); + .set_location(entity, location::Location(bi_op.context.span)); Ok(()) } fn add_lambda( &mut self, - entity: specs::Entity, + entity: ir::Entity, lambda: &ast::Lambda, ) -> Result<(), error::Error> { - use specs::world::Builder; - // TODO generate unique symbol for anonymous lambdas self.push_scope(Some(lambda.parameters.len()), None); @@ -376,7 +300,7 @@ impl<'a> Builder<'a> { .parameters .iter() .map(|p| { - let e = self.world.create_entity().build(); + let e = self.world.create_entity(); self.add_parameter(e, p)?; Ok(e) }) @@ -393,7 +317,7 @@ impl<'a> Builder<'a> { .statements .iter() .map(|s| { - let e = self.world.create_entity().build(); + let e = self.world.create_entity(); match s { ast::Statement::Variable(ref variable) => { @@ -409,40 +333,33 @@ impl<'a> Builder<'a> { }) .collect::, error::Error>>()?; - let signature = self.world.create_entity().build(); + let signature = self.world.create_entity(); self.add_expression(signature, &*lambda.signature)?; let result = if let Some(ref result) = lambda.result { - let e = self.world.create_entity().build(); + let e = self.world.create_entity(); self.add_expression(e, &*result)?; e } else { signature }; - self.world - .write_storage() - .insert( - entity, - element::Element::Closure(element::Closure { - captures: self.current_captures.clone(), - parameters, - statements, - signature, - result, - }), - ) - .unwrap(); + self.world.set_element( + entity, + element::Element::Closure(element::Closure { + captures: self.current_captures.clone(), + parameters, + statements, + signature, + result, + }), + ); self.world - .write_storage() - .insert(entity, symbol::Symbol::new(self.symbol.clone())) - .unwrap(); + .set_symbol(entity, symbol::Symbol::new(self.symbol.clone())); self.world - .write_storage() - .insert(entity, location::Location(lambda.context.span)) - .unwrap(); + .set_location(entity, location::Location(lambda.context.span)); self.pop_scope(); @@ -451,36 +368,27 @@ impl<'a> Builder<'a> { fn add_variable( &mut self, - entity: specs::Entity, + entity: ir::Entity, variable: &ast::Variable, ) -> Result<(), error::Error> { - use specs::world::Builder; - self.symbol .push(symbol::Part::Named(variable.name.value.clone())); let name = variable.name.value.clone(); - let initializer = self.world.create_entity().build(); + let initializer = self.world.create_entity(); self.add_expression(initializer, &variable.initializer)?; - self.world - .write_storage() - .insert( - entity, - element::Element::Variable(element::Variable { name, initializer }), - ) - .unwrap(); + self.world.set_element( + entity, + element::Element::Variable(element::Variable { name, initializer }), + ); self.world - .write_storage() - .insert(entity, symbol::Symbol::new(self.symbol.clone())) - .unwrap(); + .set_symbol(entity, symbol::Symbol::new(self.symbol.clone())); self.world - .write_storage() - .insert(entity, location::Location(variable.context.span)) - .unwrap(); + .set_location(entity, location::Location(variable.context.span)); self.symbol.pop(); @@ -489,94 +397,73 @@ impl<'a> Builder<'a> { fn add_select( &mut self, - entity: specs::Entity, + entity: ir::Entity, select: &ast::Select, ) -> Result<(), error::Error> { - use specs::world::Builder; - - let record = self.world.create_entity().build(); + let record = self.world.create_entity(); self.add_expression(record, &*select.record)?; let field = select.field.value.clone(); - self.world - .write_storage() - .insert( - entity, - element::Element::Select(element::Select { record, field }), - ) - .unwrap(); + self.world.set_element( + entity, + element::Element::Select(element::Select { record, field }), + ); self.world - .write_storage() - .insert(entity, location::Location(select.context.span)) - .unwrap(); + .set_location(entity, location::Location(select.context.span)); Ok(()) } fn add_apply( &mut self, - entity: specs::Entity, + entity: ir::Entity, apply: &ast::Apply, ) -> Result<(), error::Error> { - use specs::world::Builder; - - let function = self.world.create_entity().build(); + let function = self.world.create_entity(); self.add_expression(function, &*apply.function)?; let parameters = apply .parameters .iter() .map(|p| { - let e = self.world.create_entity().build(); + let e = self.world.create_entity(); self.add_expression(e, p)?; Ok(e) }) .collect::>()?; - self.world - .write_storage() - .insert( - entity, - element::Element::Apply(element::Apply { - function, - parameters, - }), - ) - .unwrap(); + self.world.set_element( + entity, + element::Element::Apply(element::Apply { + function, + parameters, + }), + ); self.world - .write_storage() - .insert(entity, location::Location(apply.context.span)) - .unwrap(); + .set_location(entity, location::Location(apply.context.span)); Ok(()) } fn add_parameter( &mut self, - entity: specs::Entity, + entity: ir::Entity, parameter: &ast::Parameter, ) -> Result<(), error::Error> { - use specs::world::Builder; - let name = parameter.name.value.clone(); - let signature = self.world.create_entity().build(); + let signature = self.world.create_entity(); self.add_expression(signature, ¶meter.signature)?; - self.world - .write_storage() - .insert( - entity, - element::Element::Parameter(element::Parameter { name, signature }), - ) - .unwrap(); + self.world.set_element( + entity, + element::Element::Parameter(element::Parameter { name, signature }), + ); self.world - .write_storage() - .insert(entity, location::Location(parameter.context.span)) - .unwrap(); + .set_location(entity, location::Location(parameter.context.span)); Ok(()) } @@ -602,52 +489,68 @@ impl<'a> Builder<'a> { self.current_scope = self.scopes.pop().unwrap(); self.current_captures = self.captures.pop().unwrap(); } +} - fn translate_un_operator(un_operator: ast::UnOperator) -> element::UnOperator { - match un_operator { - ast::UnOperator::Not => element::UnOperator::Not, - ast::UnOperator::BNot => element::UnOperator::BNot, - ast::UnOperator::Cl0 => element::UnOperator::Cl0, - ast::UnOperator::Cl1 => element::UnOperator::Cl1, - ast::UnOperator::Cls => element::UnOperator::Cls, - ast::UnOperator::Ct0 => element::UnOperator::Ct0, - ast::UnOperator::Ct1 => element::UnOperator::Ct1, - ast::UnOperator::C0 => element::UnOperator::C0, - ast::UnOperator::C1 => element::UnOperator::C1, - ast::UnOperator::Sqrt => element::UnOperator::Sqrt, - } +fn translate_number(number: ast::NumberValue) -> element::Number { + match number { + ast::NumberValue::U8(n) => element::Number::U8(n), + ast::NumberValue::U16(n) => element::Number::U16(n), + ast::NumberValue::U32(n) => element::Number::U32(n), + ast::NumberValue::U64(n) => element::Number::U64(n), + ast::NumberValue::I8(n) => element::Number::I8(n), + ast::NumberValue::I16(n) => element::Number::I16(n), + ast::NumberValue::I32(n) => element::Number::I32(n), + ast::NumberValue::I64(n) => element::Number::I64(n), + ast::NumberValue::F32(n) => element::Number::F32(n), + ast::NumberValue::F64(n) => element::Number::F64(n), + ast::NumberValue::Invalid => panic!("'invalid' AST nodes should not escape the parser"), } +} - fn translate_bi_operator(bi_operator: ast::BiOperator) -> element::BiOperator { - match bi_operator { - ast::BiOperator::Eq => element::BiOperator::Eq, - ast::BiOperator::Ne => element::BiOperator::Ne, - ast::BiOperator::Lt => element::BiOperator::Lt, - ast::BiOperator::Ge => element::BiOperator::Ge, - ast::BiOperator::Gt => element::BiOperator::Gt, - ast::BiOperator::Le => element::BiOperator::Le, - ast::BiOperator::Cmp => element::BiOperator::Cmp, - ast::BiOperator::Add => element::BiOperator::Add, - ast::BiOperator::Sub => element::BiOperator::Sub, - ast::BiOperator::Mul => element::BiOperator::Mul, - ast::BiOperator::Div => element::BiOperator::Div, - ast::BiOperator::Rem => element::BiOperator::Rem, - ast::BiOperator::And => element::BiOperator::And, - ast::BiOperator::BAnd => element::BiOperator::BAnd, - ast::BiOperator::Or => element::BiOperator::Or, - ast::BiOperator::BOr => element::BiOperator::BOr, - ast::BiOperator::Xor => element::BiOperator::Xor, - ast::BiOperator::BXor => element::BiOperator::BXor, - ast::BiOperator::AndNot => element::BiOperator::AndNot, - ast::BiOperator::BAndNot => element::BiOperator::BAndNot, - ast::BiOperator::OrNot => element::BiOperator::OrNot, - ast::BiOperator::BOrNot => element::BiOperator::BOrNot, - ast::BiOperator::XorNot => element::BiOperator::XorNot, - ast::BiOperator::BXorNot => element::BiOperator::BXorNot, - ast::BiOperator::RotL => element::BiOperator::RotL, - ast::BiOperator::RotR => element::BiOperator::RotR, - ast::BiOperator::ShL => element::BiOperator::ShL, - ast::BiOperator::ShR => element::BiOperator::ShR, - } +fn translate_un_operator(un_operator: ast::UnOperator) -> element::UnOperator { + match un_operator { + ast::UnOperator::Not => element::UnOperator::Not, + ast::UnOperator::BNot => element::UnOperator::BNot, + ast::UnOperator::Cl0 => element::UnOperator::Cl0, + ast::UnOperator::Cl1 => element::UnOperator::Cl1, + ast::UnOperator::Cls => element::UnOperator::Cls, + ast::UnOperator::Ct0 => element::UnOperator::Ct0, + ast::UnOperator::Ct1 => element::UnOperator::Ct1, + ast::UnOperator::C0 => element::UnOperator::C0, + ast::UnOperator::C1 => element::UnOperator::C1, + ast::UnOperator::Sqrt => element::UnOperator::Sqrt, + } +} + +fn translate_bi_operator(bi_operator: ast::BiOperator) -> element::BiOperator { + match bi_operator { + ast::BiOperator::Eq => element::BiOperator::Eq, + ast::BiOperator::Ne => element::BiOperator::Ne, + ast::BiOperator::Lt => element::BiOperator::Lt, + ast::BiOperator::Ge => element::BiOperator::Ge, + ast::BiOperator::Gt => element::BiOperator::Gt, + ast::BiOperator::Le => element::BiOperator::Le, + ast::BiOperator::Cmp => element::BiOperator::Cmp, + ast::BiOperator::Add => element::BiOperator::Add, + ast::BiOperator::Sub => element::BiOperator::Sub, + ast::BiOperator::Mul => element::BiOperator::Mul, + ast::BiOperator::Div => element::BiOperator::Div, + ast::BiOperator::Rem => element::BiOperator::Rem, + ast::BiOperator::And => element::BiOperator::And, + ast::BiOperator::BAnd => element::BiOperator::BAnd, + ast::BiOperator::Or => element::BiOperator::Or, + ast::BiOperator::BOr => element::BiOperator::BOr, + ast::BiOperator::Xor => element::BiOperator::Xor, + ast::BiOperator::BXor => element::BiOperator::BXor, + ast::BiOperator::AndNot => element::BiOperator::AndNot, + ast::BiOperator::BAndNot => element::BiOperator::BAndNot, + ast::BiOperator::OrNot => element::BiOperator::OrNot, + ast::BiOperator::BOrNot => element::BiOperator::BOrNot, + ast::BiOperator::XorNot => element::BiOperator::XorNot, + ast::BiOperator::BXorNot => element::BiOperator::BXorNot, + ast::BiOperator::RotL => element::BiOperator::RotL, + ast::BiOperator::RotR => element::BiOperator::RotR, + ast::BiOperator::ShL => element::BiOperator::ShL, + ast::BiOperator::ShR => element::BiOperator::ShR, } } diff --git a/src/ir/component/constexpr/error.rs b/src/ir/component/constexpr/error.rs deleted file mode 100644 index 2bfc629..0000000 --- a/src/ir/component/constexpr/error.rs +++ /dev/null @@ -1,11 +0,0 @@ -use specs::Component; -use specs::VecStorage; - -use crate::interpreter; - -#[derive(Component, Clone, Debug, Fail, PartialEq)] -#[storage(VecStorage)] -pub enum Error { - #[fail(display = "evaluation error")] - Evaluation(#[cause] interpreter::error::Error), -} diff --git a/src/ir/component/constexpr/mod.rs b/src/ir/component/constexpr/mod.rs deleted file mode 100644 index 1511850..0000000 --- a/src/ir/component/constexpr/mod.rs +++ /dev/null @@ -1,12 +0,0 @@ -use specs::Component; -use specs::VecStorage; - -use crate::value; - -pub mod error; - -#[derive(Component, Clone, Debug)] -#[storage(VecStorage)] -pub struct Constexpr { - pub value: value::Value, -} diff --git a/src/ir/component/location.rs b/src/ir/component/location.rs deleted file mode 100644 index 4b53e3d..0000000 --- a/src/ir/component/location.rs +++ /dev/null @@ -1,6 +0,0 @@ -use specs::Component; -use specs::VecStorage; - -#[derive(Clone, Component, Debug)] -#[storage(VecStorage)] -pub struct Location(pub codespan::ByteSpan); diff --git a/src/ir/component/mod.rs b/src/ir/component/mod.rs deleted file mode 100644 index 6f44b7d..0000000 --- a/src/ir/component/mod.rs +++ /dev/null @@ -1,34 +0,0 @@ -use specs; - -pub mod constexpr; -pub mod element; -pub mod layout; -pub mod location; -pub mod replacement; -pub mod symbol; -pub mod ty; - -macro_rules! for_each_component { - (|$name:ident| $body:expr) => { - apply_component!(constexpr::Constexpr, $name, $body); - apply_component!(constexpr::error::Error, $name, $body); - apply_component!(element::Element, $name, $body); - apply_component!(layout::Layout, $name, $body); - apply_component!(location::Location, $name, $body); - apply_component!(replacement::Replacement, $name, $body); - apply_component!(symbol::Symbol, $name, $body); - apply_component!(ty::Type, $name, $body); - apply_component!(ty::error::Error, $name, $body); - }; -} - -macro_rules! apply_component { - ($component:ty, $name:ident, $body:expr) => {{ - type $name = $component; - $body - }}; -} - -pub fn register_all(world: &mut specs::World) { - for_each_component!(|C| world.register::()); -} diff --git a/src/ir/component/replacement.rs b/src/ir/component/replacement.rs deleted file mode 100644 index 245d3ff..0000000 --- a/src/ir/component/replacement.rs +++ /dev/null @@ -1,10 +0,0 @@ -use specs; - -use specs::Component; -use specs::HashMapStorage; - -#[derive(Component, Debug, VisitEntities, VisitEntitiesMut)] -#[storage(HashMapStorage)] -pub struct Replacement { - pub to: specs::Entity, -} diff --git a/src/ir/component/ty/error.rs b/src/ir/component/ty/error.rs deleted file mode 100644 index 55f0655..0000000 --- a/src/ir/component/ty/error.rs +++ /dev/null @@ -1,69 +0,0 @@ -use std::fmt; - -use specs::Component; -use specs::VecStorage; - -use crate::ir::component::ty; -use crate::ir::component::ty::class; - -#[derive(Component, Clone, Debug, Eq, Fail, PartialEq, VisitEntities, VisitEntitiesMut)] -#[storage(VecStorage)] -pub struct Error -where - E: fmt::Debug + Send + Sync + 'static, -{ - pub expected: ExpectedType, - pub actual: ty::Type, - pub main_entity: E, - pub aux_entities: Vec>, -} - -#[derive(Clone, Debug, Eq, PartialEq, VisitEntities, VisitEntitiesMut)] -pub struct AuxEntity { - pub entity: E, - pub label: String, -} - -#[derive(Clone, Debug, Eq, PartialEq, VisitEntities, VisitEntitiesMut)] -pub enum ExpectedType { - Specific(ty::Type), - ScalarClass(class::Scalar), - AnyOf(Vec), - Union, -} - -impl fmt::Display for Error -where - E: fmt::Debug + Send + Sync, -{ - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "expected ")?; - self.expected.fmt(f)?; - write!(f, " but got `")?; - self.actual.fmt(f)?; - write!(f, "`")?; - Ok(()) - } -} - -impl fmt::Display for ExpectedType { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match *self { - ExpectedType::Specific(ref ty) => write!(f, "`{}`", ty), - ExpectedType::ScalarClass(ref class) => class.fmt(f), - ExpectedType::AnyOf(ref options) => { - let last = options.len() - 1; - for (i, option) in options.iter().enumerate() { - if i == last { - write!(f, " or ")?; - } else if i > 0 { - write!(f, ", ")?; - } - option.fmt(f)?; - } - Ok(()) - } - ExpectedType::Union => f.write_str("any union type"), - } - } -} diff --git a/src/ir/db.rs b/src/ir/db.rs new file mode 100644 index 0000000..8597b2c --- /dev/null +++ b/src/ir/db.rs @@ -0,0 +1,72 @@ +#![allow(non_camel_case_types)] +use std::sync; + +use crate::interpreter; +use crate::ir; +use crate::ir::element; +use crate::ir::location; +use crate::ir::symbol; +use crate::layout; +use crate::syntax; +use crate::ty; +use crate::value; + +#[salsa::query_group(IrStorage)] +pub trait IrDb: salsa::Database + syntax::db::SyntaxDb { + fn entity_constexpr( + &self, + entity: ir::Entity, + ) -> Result, interpreter::error::Error>; + fn entity_element(&self, entity: ir::Entity) -> sync::Arc; + fn entity_type( + &self, + entity: ir::Entity, + ) -> Result, ty::error::Error>; + fn entity_layout(&self, entity: ir::Entity) -> sync::Arc; + fn entity_location(&self, entity: ir::Entity) -> sync::Arc; + fn entity_symbol(&self, entity: ir::Entity) -> sync::Arc; + + fn entities(&self) -> sync::Arc; +} + +fn entity_constexpr( + ir: &impl IrDb, + entity: ir::Entity, +) -> Result, interpreter::error::Error> { + let element = ir.entity_element(entity); + + Ok(interpreter::eval(&*element, |e| { + ir.entity_constexpr(e) + .as_ref() + .ok() + .and_then(|o| o.as_ref()) + .map(|c| c.value.clone()) + })?) +} + +fn entity_element(_ir: &impl IrDb, _entity: ir::Entity) -> sync::Arc { + unimplemented!() +} + +fn entity_type( + _ir: &impl IrDb, + _entity: ir::Entity, +) -> Result, ty::error::Error> { + unimplemented!() +} + +fn entity_layout(_ir: &impl IrDb, _entity: ir::Entity) -> sync::Arc { + unimplemented!() +} + +fn entity_location(_ir: &impl IrDb, _entity: ir::Entity) -> sync::Arc { + unimplemented!() +} + +fn entity_symbol(_ir: &impl IrDb, _entity: ir::Entity) -> sync::Arc { + unimplemented!() +} + +fn entities(_ir: &impl IrDb) -> sync::Arc { + unimplemented!() +} diff --git a/src/ir/component/element.rs b/src/ir/element.rs similarity index 73% rename from src/ir/component/element.rs rename to src/ir/element.rs index eead12d..6f9fc19 100644 --- a/src/ir/component/element.rs +++ b/src/ir/element.rs @@ -1,13 +1,9 @@ use std::collections; use std::fmt; -use specs; +use crate::ir; -use specs::Component; -use specs::VecStorage; - -#[derive(Component, Debug, VisitEntities, VisitEntitiesMut)] -#[storage(VecStorage)] +#[derive(Clone, Debug, Eq, PartialEq)] pub enum Element { Number(Number), String(String), @@ -25,7 +21,7 @@ pub enum Element { Module(Module), } -#[derive(Clone, Copy, Debug, VisitEntities, VisitEntitiesMut)] +#[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum Number { U8(u8), U16(u16), @@ -35,27 +31,27 @@ pub enum Number { I16(i16), I32(i32), I64(i64), - F32(f32), - F64(f64), + F32(ordered_float::OrderedFloat), + F64(ordered_float::OrderedFloat), } -#[derive(Debug, VisitEntities, VisitEntitiesMut)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Symbol { pub label: String, } -#[derive(Debug, VisitEntities, VisitEntitiesMut)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Tuple { - pub fields: Vec, + pub fields: Vec, } -#[derive(Debug, VisitEntities, VisitEntitiesMut)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Record { - pub fields: collections::HashMap, + pub fields: collections::HashMap, } /// An unary operator. -#[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd, VisitEntities, VisitEntitiesMut)] +#[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)] pub enum UnOperator { /// Logical not. Not, @@ -84,16 +80,16 @@ pub enum UnOperator { } /// An operator application with one operand. -#[derive(Clone, Copy, Debug, PartialEq, VisitEntities, VisitEntitiesMut)] +#[derive(Clone, Copy, Debug, Eq, PartialEq)] pub struct UnOp { /// The unary operator that is being applied. pub operator: UnOperator, /// The operand to the operator. - pub operand: specs::Entity, + pub operand: ir::Entity, } /// A binary operator. -#[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd, VisitEntities, VisitEntitiesMut)] +#[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)] pub enum BiOperator { /// The equal-to operator. Eq, @@ -157,58 +153,58 @@ pub enum BiOperator { } /// An operator application with two operands. -#[derive(Clone, Copy, Debug, PartialEq, VisitEntities, VisitEntitiesMut)] +#[derive(Clone, Copy, Debug, Eq, PartialEq)] pub struct BiOp { /// The left-hand-side operand of the operator. - pub lhs: specs::Entity, + pub lhs: ir::Entity, /// The binary operator that is being applied. pub operator: BiOperator, /// The right-hand-side operand of the operator. - pub rhs: specs::Entity, + pub rhs: ir::Entity, } -#[derive(Debug, VisitEntities, VisitEntitiesMut)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Variable { pub name: String, - pub initializer: specs::Entity, + pub initializer: ir::Entity, } -#[derive(Debug, VisitEntities, VisitEntitiesMut)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Select { - pub record: specs::Entity, + pub record: ir::Entity, pub field: String, } -#[derive(Debug, VisitEntities, VisitEntitiesMut)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Apply { - pub function: specs::Entity, - pub parameters: Vec, + pub function: ir::Entity, + pub parameters: Vec, } -#[derive(Debug, VisitEntities, VisitEntitiesMut)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Parameter { pub name: String, - pub signature: specs::Entity, + pub signature: ir::Entity, } -#[derive(Debug, VisitEntities, VisitEntitiesMut)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Capture { pub name: String, - pub captured: specs::Entity, + pub captured: ir::Entity, } -#[derive(Debug, VisitEntities, VisitEntitiesMut)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Closure { - pub captures: collections::HashMap, - pub parameters: Vec, - pub statements: Vec, - pub signature: specs::Entity, - pub result: specs::Entity, + pub captures: collections::HashMap, + pub parameters: Vec, + pub statements: Vec, + pub signature: ir::Entity, + pub result: ir::Entity, } -#[derive(Debug, VisitEntities, VisitEntitiesMut)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Module { - pub variables: collections::HashMap, + pub variables: collections::HashMap, } impl fmt::Display for UnOperator { diff --git a/src/ir/error.rs b/src/ir/error.rs index 9918472..7621ccc 100644 --- a/src/ir/error.rs +++ b/src/ir/error.rs @@ -1,6 +1,4 @@ use crate::diagnostic; -use crate::ir::component::constexpr; -use crate::ir::component::ty; /// Errors that may occur while building and interacting with an [`Ir`]. #[derive(Clone, Debug, Fail, PartialEq)] @@ -14,17 +12,6 @@ pub enum Error { location: codespan::ByteSpan, }, - /// The IR has a type error. - #[fail(display = "type error")] - Type( - codespan::ByteSpan, - #[cause] ty::error::Error, - ), - - /// The IR has a constexpr that cannot be evaluated. - #[fail(display = "constexpr error")] - Constexpr(codespan::ByteSpan, #[cause] constexpr::error::Error), - /// There were multiple IR errors. #[fail(display = "multiple IR errors")] Multiple { @@ -48,51 +35,6 @@ impl diagnostic::Diagnostics for Error { &self.to_string(), ); } - Error::Type(entity, ref type_error) => match type_error { - ty::error::Error { - ref main_entity, - ref aux_entities, - .. - } => { - builder.add_label(codespan_reporting::Label { - span: entity, - message: None, - style: codespan_reporting::LabelStyle::Primary, - }); - - builder.add_label(codespan_reporting::Label { - span: *main_entity, - message: Some(type_error.to_string()), - style: codespan_reporting::LabelStyle::Primary, - }); - - for aux_entity in aux_entities { - builder.add_label(codespan_reporting::Label { - span: aux_entity.entity, - message: Some(aux_entity.label.clone()), - style: codespan_reporting::LabelStyle::Secondary, - }); - } - - builder.add_diagnostic( - codespan_reporting::Severity::Error, - None, - &self.to_string(), - ); - } - }, - Error::Constexpr(entity, ref constexpr_error) => { - builder.add_label(codespan_reporting::Label { - span: entity, - message: Some("while evaluating this constexpr".to_owned()), - style: codespan_reporting::LabelStyle::Primary, - }); - match constexpr_error { - constexpr::error::Error::Evaluation(ref interpreter_error) => { - interpreter_error.to_diagnostics(builder); - } - } - } Error::Multiple { ref errors } => { for error in errors { error.to_diagnostics(builder); diff --git a/src/ir/location.rs b/src/ir/location.rs new file mode 100644 index 0000000..ba83bee --- /dev/null +++ b/src/ir/location.rs @@ -0,0 +1,2 @@ +#[derive(Clone, Copy, Debug, Eq, PartialEq)] +pub struct Location(pub codespan::ByteSpan); diff --git a/src/ir/mod.rs b/src/ir/mod.rs index 7a20bbf..c4b9261 100644 --- a/src/ir/mod.rs +++ b/src/ir/mod.rs @@ -1,125 +1,49 @@ //! Intermediate representation variables for the compiler and interpreter. +use std::collections; use std::fmt; -use specs; - use crate::syntax::ast; use crate::syntax::parser; pub mod builder; -pub mod component; +pub mod db; +pub mod element; pub mod error; -mod system; -#[cfg(test)] -mod tests; - -/// A separate universe of the Tin intermediate representation. -pub struct Ir { - pub(crate) world: specs::World, +pub mod location; +pub mod symbol; +pub mod world; +//#[cfg(test)] +//mod tests; + +#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] +pub struct Entity(u32); + +#[derive(Clone, Debug, Eq, PartialEq)] +pub struct Entities { + elements: collections::HashMap, + locations: collections::HashMap, + symbols: collections::HashMap, + next_entity: u32, } -impl Ir { - /// Creates a new IR instance. - pub fn new() -> Ir { - let mut world = specs::World::new(); - component::register_all(&mut world); - Ir { world } - } - - /// Adds the specified AST module to the IR world. - pub fn load(&mut self, module: &ast::Module) -> Result<(), error::Error> { - use specs::world::Builder; - - let entity = self.world.create_entity().build(); - builder::Builder::new(&mut self.world).add_module(entity, module)?; - - let mut dispatcher = specs::DispatcherBuilder::new() - .with( - system::apply_replacements::System, - "apply_replacements", - &[], - ) - .build(); - - dispatcher.dispatch(&self.world.res); - - self.maintain()?; - - Ok(()) - } - - /// Checks and infers types for all known variables. - /// - /// `resolve_references` should be called before this; types will not be inferred for unresolved - /// references. - pub fn check_types(&mut self) -> Result<(), error::Error> { - let mut dispatcher = specs::DispatcherBuilder::new() - .with(system::infer_types::System, "infer_types", &[]) - .with(system::infer_constexpr::System, "infer_constexpr", &[]) - .with(system::infer_layouts::System::new(8), "infer_layouts", &[]) - .build(); - - dispatcher.dispatch(&self.world.res); - - self.maintain()?; - - Ok(()) - } - - fn maintain(&mut self) -> Result<(), error::Error> { - use specs::Join; - - self.world.maintain(); - - let mut errors = Vec::new(); - - let entities = self.world.entities(); - let locations = self.world.read_storage::(); - let type_errors = self - .world - .read_storage::>(); - let constexpr_errors = self - .world - .read_storage::(); - - for (entity, type_error) in (&entities, &type_errors).join() { - errors.push(error::Error::Type( - locations.get(entity).unwrap().0, - component::ty::error::Error { - expected: type_error.expected.clone(), - actual: type_error.actual.clone(), - main_entity: locations.get(type_error.main_entity).unwrap().0, - aux_entities: type_error - .aux_entities - .iter() - .map(|aux_entity| component::ty::error::AuxEntity { - entity: locations.get(aux_entity.entity).unwrap().0, - label: aux_entity.label.clone(), - }) - .collect(), - }, - )) - } - - for (entity, constexpr_error, _) in (&entities, &constexpr_errors, !&type_errors).join() { - errors.push(error::Error::Constexpr( - locations.get(entity).unwrap().0, - constexpr_error.clone(), - )); - } - - if errors.is_empty() { - Ok(()) - } else { - Err(errors - .pop() - .unwrap_or_else(|| error::Error::Multiple { errors })) - } +impl Entity { + pub fn new(id: u32) -> Self { + Self(id) } } -impl fmt::Debug for Ir { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_struct("Ir").finish() +impl Entities { + pub fn new() -> Self { + let elements = collections::HashMap::new(); + let locations = collections::HashMap::new(); + let symbols = collections::HashMap::new(); + let next_entity = 0; + + Self { + elements, + locations, + symbols, + next_entity, + } } } diff --git a/src/ir/component/symbol.rs b/src/ir/symbol.rs similarity index 86% rename from src/ir/component/symbol.rs rename to src/ir/symbol.rs index 5ea9869..c2c072a 100644 --- a/src/ir/component/symbol.rs +++ b/src/ir/symbol.rs @@ -1,16 +1,12 @@ use std::fmt; -use specs::Component; -use specs::VecStorage; - -#[derive(Component, Clone, Debug, VisitEntities, VisitEntitiesMut)] -#[storage(VecStorage)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Symbol { public: bool, parts: Vec, } -#[derive(Clone, Debug, VisitEntities, VisitEntitiesMut)] +#[derive(Clone, Debug, Eq, PartialEq)] pub enum Part { Named(String), #[allow(unused)] diff --git a/src/ir/system/apply_replacements.rs b/src/ir/system/apply_replacements.rs deleted file mode 100644 index 5e3933f..0000000 --- a/src/ir/system/apply_replacements.rs +++ /dev/null @@ -1,90 +0,0 @@ -use std::collections; - -use specs; -use specs_visitor; - -use crate::ir::component::element; -use crate::ir::component::layout; -use crate::ir::component::replacement; -use crate::ir::component::symbol; -use crate::ir::component::ty; - -pub struct System; - -struct ReplacementEntityVisitor { - replacements: collections::HashMap, -} - -impl<'a> specs::System<'a> for System { - #[cfg_attr(feature = "cargo-clippy", allow(clippy::type_complexity))] - type SystemData = ( - specs::Entities<'a>, - specs::ReadStorage<'a, replacement::Replacement>, - specs::WriteStorage<'a, element::Element>, - specs::WriteStorage<'a, layout::Layout>, - specs::WriteStorage<'a, symbol::Symbol>, - specs::WriteStorage<'a, ty::Type>, - specs::WriteStorage<'a, ty::error::Error>, - ); - - fn run( - &mut self, - ( - entities, - replacements, - mut elements, - mut layouts, - mut symbols, - mut types, - mut type_errors, - ): Self::SystemData, - ) { - use crate::best_iter::BestIterator; - use crate::best_iter::BestIteratorCollect; - use crate::best_iter::BestIteratorMap; - use crate::best_iter::BestJoin; - use specs_visitor::VisitEntitiesMut; - - (&entities, &replacements) - .best_join() - .best_for_each(|(entity, _)| { - entities.delete(entity).unwrap(); - }); - - let replacements = (&entities, &replacements) - .best_join() - .best_map(|(entity, replacement)| (entity, replacement.to)) - .best_collect(); - - let visitor = ReplacementEntityVisitor { replacements }; - - (&mut elements).best_join().best_for_each(|element| { - element.accept_mut(&visitor); - }); - - (&mut layouts).best_join().best_for_each(|layout| { - layout.accept_mut(&visitor); - }); - - (&mut symbols).best_join().best_for_each(|symbol| { - symbol.accept_mut(&visitor); - }); - - (&mut types).best_join().best_for_each(|ty| { - ty.accept_mut(&visitor); - }); - - (&mut type_errors).best_join().best_for_each(|type_error| { - type_error.accept_mut(&visitor); - }); - } -} - -impl specs_visitor::EntityVisitorMut for ReplacementEntityVisitor { - fn visit_entity_mut(&self, from: &mut specs::Entity) { - if let Some(to) = self.replacements.get(from) { - trace!("applying replacement from {:?} to {:?}", from, to); - *from = *to; - } - } -} diff --git a/src/ir/system/infer_constexpr.rs b/src/ir/system/infer_constexpr.rs deleted file mode 100644 index 5f8a3a3..0000000 --- a/src/ir/system/infer_constexpr.rs +++ /dev/null @@ -1,79 +0,0 @@ -use specs; - -use std::ops; - -use crate::interpreter; -use crate::ir::component::constexpr; -use crate::ir::component::element; - -pub struct System; - -impl<'a> specs::System<'a> for System { - type SystemData = ( - specs::Entities<'a>, - specs::ReadStorage<'a, element::Element>, - specs::WriteStorage<'a, constexpr::Constexpr>, - specs::WriteStorage<'a, constexpr::error::Error>, - ); - - fn run(&mut self, (entities, elements, mut constexprs, mut errors): Self::SystemData) { - use crate::best_iter::BestIteratorCollect; - use crate::best_iter::BestIteratorFlatMap; - use crate::best_iter::BestJoin; - - loop { - let new_constexprs: Vec<_> = (&entities, &elements, !&constexprs, !&errors) - .best_join() - .best_flat_map(|(entity, element, _, _)| { - transpose(System::infer_constexpr(element, &constexprs)).map(|r| (entity, r)) - }) - .best_collect(); - - debug!("inferred new constexprs: {:?}", new_constexprs); - if new_constexprs.is_empty() { - break; - } - - for (entity, constexpr) in new_constexprs { - match constexpr { - Ok(constexpr) => { - constexprs.insert(entity, constexpr).unwrap(); - } - Err(error) => { - errors.insert(entity, error).unwrap(); - } - } - } - } - } -} - -impl System { - fn infer_constexpr( - element: &element::Element, - constexprs: &specs::Storage, - ) -> Result, constexpr::error::Error> - where - D: ops::Deref>, - { - Ok( - interpreter::eval(element, |e| constexprs.get(e).map(|c| &c.value))? - .map(|value| constexpr::Constexpr { value }), - ) - } -} - -impl From for constexpr::error::Error { - fn from(e: interpreter::error::Error) -> Self { - constexpr::error::Error::Evaluation(e) - } -} - -// TODO: awaits https://github.com/rust-lang/rust/issues/47338 -pub fn transpose(result: Result, E>) -> Option> { - match result { - Ok(Some(x)) => Some(Ok(x)), - Ok(None) => None, - Err(e) => Some(Err(e)), - } -} diff --git a/src/ir/system/mod.rs b/src/ir/system/mod.rs deleted file mode 100644 index 87c5ee0..0000000 --- a/src/ir/system/mod.rs +++ /dev/null @@ -1,4 +0,0 @@ -pub mod apply_replacements; -pub mod infer_constexpr; -pub mod infer_layouts; -pub mod infer_types; diff --git a/src/ir/world.rs b/src/ir/world.rs new file mode 100644 index 0000000..2983da3 --- /dev/null +++ b/src/ir/world.rs @@ -0,0 +1,61 @@ +use crate::ir; +use crate::ir::element; +use crate::ir::location; +use crate::ir::symbol; + +pub trait World { + fn create_entity(&mut self) -> ir::Entity; + fn set_element(&mut self, entity: ir::Entity, element: element::Element); + fn set_location(&mut self, entity: ir::Entity, location: location::Location); + fn set_symbol(&mut self, entity: ir::Entity, symbol: symbol::Symbol); + fn replace(&mut self, from: ir::Entity, to: ir::Entity); +} + +impl<'a, W> World for &'a mut W +where + W: World, +{ + fn create_entity(&mut self) -> ir::Entity { + (*self).create_entity() + } + + fn set_element(&mut self, entity: ir::Entity, element: element::Element) { + (*self).set_element(entity, element) + } + + fn set_location(&mut self, entity: ir::Entity, location: location::Location) { + (*self).set_location(entity, location) + } + + fn set_symbol(&mut self, entity: ir::Entity, symbol: symbol::Symbol) { + (*self).set_symbol(entity, symbol) + } + + fn replace(&mut self, from: ir::Entity, to: ir::Entity) { + (*self).replace(from, to) + } +} + +impl World for ir::Entities { + fn create_entity(&mut self) -> ir::Entity { + let entity = ir::Entity::new(self.next_entity); + self.next_entity += 1; + entity + } + + fn set_element(&mut self, entity: ir::Entity, element: element::Element) { + unimplemented!() + } + + fn set_location(&mut self, entity: ir::Entity, location: location::Location) { + unimplemented!() + } + + fn set_symbol(&mut self, entity: ir::Entity, symbol: symbol::Symbol) { + unimplemented!() + } + + fn replace(&mut self, from: ir::Entity, to: ir::Entity) { + unimplemented!() + } +} diff --git a/src/layout/db.rs b/src/layout/db.rs new file mode 100644 index 0000000..f675c49 --- /dev/null +++ b/src/layout/db.rs @@ -0,0 +1,9 @@ +use std::sync; + +use crate::ir; +use crate::layout; + +#[salsa::query_group(IrStorage)] +pub trait LayoutDb: salsa::Database + ir::db::IrDb { + fn entity_layout(&self, entity: ir::Entity) -> sync::Arc; +} diff --git a/src/ir/system/infer_layouts.rs b/src/layout/infer.rs similarity index 74% rename from src/ir/system/infer_layouts.rs rename to src/layout/infer.rs index d164bc2..9175343 100644 --- a/src/ir/system/infer_layouts.rs +++ b/src/layout/infer.rs @@ -1,10 +1,9 @@ use std::collections; use std::usize; -use specs; - -use crate::ir::component::element; -use crate::ir::component::layout; +use crate::ir; +use crate::ir::element; +use crate::layout; use std::ops; pub struct System { @@ -13,53 +12,16 @@ pub struct System { const BOOL_LAYOUT: layout::Layout = layout::Layout::scalar(1); -impl<'a> specs::System<'a> for System { - type SystemData = ( - specs::Entities<'a>, - specs::ReadStorage<'a, element::Element>, - specs::WriteStorage<'a, layout::Layout>, - ); - - fn run(&mut self, (entities, elements, mut layouts): Self::SystemData) { - use crate::best_iter::BestIteratorCollect; - use crate::best_iter::BestIteratorFlatMap; - use crate::best_iter::BestJoin; - - loop { - let new_layouts: Vec<_> = (&entities, &elements, !&layouts) - .best_join() - .best_flat_map(|(entity, element, _)| { - self.infer_layout(element, &elements, &layouts) - .map(|layout| (entity, layout)) - }) - .best_collect(); - debug!("inferred new layouts: {:?}", new_layouts); - if new_layouts.is_empty() { - break; - } - - for (entity, layout) in new_layouts { - layouts.insert(entity, layout).unwrap(); - } - } - } -} - impl System { pub fn new(ptr_size: usize) -> System { System { ptr_size } } - fn infer_layout( + fn infer_layout( &self, element: &element::Element, - elements: &specs::Storage, - layouts: &specs::Storage, - ) -> Option - where - DE: ops::Deref>, - DL: ops::Deref>, - { + db: impl layout::db::LayoutDb, + ) -> Option { match *element { element::Element::Number(ref n) => self.infer_number_layout(n), element::Element::String(_) => Some(layout::Layout::scalar(self.ptr_size)), @@ -114,14 +76,11 @@ impl System { } } - fn infer_tuple_layout( + fn infer_tuple_layout( &self, - fields: &[specs::Entity], - layouts: &specs::Storage, - ) -> Option - where - D: ops::Deref>, - { + fields: &[ir::Entity], + db: impl layout::db::LayoutDb, + ) -> Option { if let Some(mut layouts) = fields .iter() .enumerate() @@ -155,14 +114,11 @@ impl System { } } - fn infer_record_layout( + fn infer_record_layout( &self, - fields: &collections::HashMap, - layouts: &specs::Storage, - ) -> Option - where - D: ops::Deref>, - { + fields: &collections::HashMap, + db: impl layout::db::LayoutDb, + ) -> Option { if let Some(mut layouts) = fields .iter() .map(|(n, f)| layouts.get(*f).map(|l| (n, l))) @@ -198,15 +154,12 @@ impl System { } } - fn infer_un_op_layout( + fn infer_un_op_layout( &self, operator: element::UnOperator, - operand: specs::Entity, - layouts: &specs::Storage, - ) -> Option - where - D: ops::Deref>, - { + operand: ir::Entity, + db: impl layout::db::LayoutDb, + ) -> Option { let operand = layouts.get(operand).cloned(); match operator { @@ -223,16 +176,13 @@ impl System { } } - fn infer_bi_op_layout( + fn infer_bi_op_layout( &self, - lhs: specs::Entity, + lhs: ir::Entity, operator: element::BiOperator, - rhs: specs::Entity, - layouts: &specs::Storage, - ) -> Option - where - D: ops::Deref>, - { + rhs: ir::Entity, + db: impl layout::db::LayoutDb, + ) -> Option { let lhs = layouts.get(lhs).cloned(); let rhs = layouts.get(rhs).cloned(); @@ -277,28 +227,20 @@ impl System { } } - fn infer_variable_layout( + fn infer_variable_layout( &self, - initializer: specs::Entity, - layouts: &specs::Storage, - ) -> Option - where - D: ops::Deref>, - { + initializer: ir::Entity, + db: impl layout::db::LayoutDb, + ) -> Option { layouts.get(initializer).cloned() } - fn infer_select_layout( + fn infer_select_layout( &self, - record: specs::Entity, + record: ir::Entity, field: &str, - elements: &specs::Storage, - layouts: &specs::Storage, - ) -> Option - where - DE: ops::Deref>, - DL: ops::Deref>, - { + db: impl layout::db::LayoutDb, + ) -> Option { match elements.get(record) { None => None, Some(t) => match t { @@ -314,15 +256,12 @@ impl System { } } - fn infer_apply_layout( + fn infer_apply_layout( &self, - _function: specs::Entity, - _parameters: &[specs::Entity], - _layouts: &specs::Storage, - ) -> Option - where - D: ops::Deref>, - { + _function: ir::Entity, + _parameters: &[ir::Entity], + _db: impl layout::db::LayoutDb, + ) -> Option { // TODO None /* @@ -368,36 +307,27 @@ impl System { */ } - fn infer_parameter_layout( + fn infer_parameter_layout( &self, - signature: specs::Entity, - layouts: &specs::Storage, - ) -> Option - where - D: ops::Deref>, - { + signature: ir::Entity, + db: impl layout::db::LayoutDb, + ) -> Option { layouts.get(signature).cloned() } - fn infer_capture_layout( + fn infer_capture_layout( &self, - capture: specs::Entity, - layouts: &specs::Storage, - ) -> Option - where - D: ops::Deref>, - { + capture: ir::Entity, + db: impl layout::db::LayoutDb, + ) -> Option { layouts.get(capture).cloned() } - fn infer_closure_layout( + fn infer_closure_layout( &self, - captures: &collections::HashMap, - layouts: &specs::Storage, - ) -> Option - where - D: ops::Deref>, - { + captures: &collections::HashMap, + db: impl layout::db::LayoutDb, + ) -> Option { if let Some(mut capture_layouts) = captures .iter() .map(|(n, f)| layouts.get(*f).map(|l| (n, l))) @@ -444,14 +374,11 @@ impl System { } } - fn infer_module_layout( + fn infer_module_layout( &self, - _variables: &collections::HashMap, - _layouts: &specs::Storage, - ) -> Option - where - D: ops::Deref>, - { + _variables: &collections::HashMap, + db: impl layout::db::LayoutDb, + ) -> Option { // TODO None /* diff --git a/src/ir/component/layout.rs b/src/layout/mod.rs similarity index 91% rename from src/ir/component/layout.rs rename to src/layout/mod.rs index 690eb2f..4c868ef 100644 --- a/src/ir/component/layout.rs +++ b/src/layout/mod.rs @@ -1,10 +1,9 @@ use std::fmt; -use specs::Component; -use specs::VecStorage; +mod db; +mod infer; -#[derive(Clone, Component, Debug, VisitEntities, VisitEntitiesMut)] -#[storage(VecStorage)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Layout { pub size: usize, pub alignment: usize, @@ -12,13 +11,13 @@ pub struct Layout { pub unnamed_fields: Vec, } -#[derive(Clone, Debug, VisitEntities, VisitEntitiesMut)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct NamedField { pub field: String, pub offset_layout: Offset, } -#[derive(Clone, Debug, VisitEntities, VisitEntitiesMut)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Offset { pub offset: usize, pub layout: Layout, diff --git a/src/lib.rs b/src/lib.rs index 6747a56..36e14d5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -54,22 +54,19 @@ extern crate lalrpop_util; extern crate lazy_static; #[macro_use] extern crate log; -#[macro_use] -extern crate specs_derive; -#[macro_use] -extern crate specs_visitor_derive; #[cfg(test)] #[macro_use] extern crate pretty_assertions; use std::fmt; -mod best_iter; -mod codegen; +// mod codegen; mod interpreter; mod ir; +mod layout; mod source; mod syntax; +mod ty; mod value; #[cfg(test)] diff --git a/src/module.rs b/src/module.rs index 70936c6..0a6d934 100644 --- a/src/module.rs +++ b/src/module.rs @@ -14,7 +14,7 @@ pub struct Module { } /// An error that may happen at runtime. -#[derive(Clone, Debug, Fail, PartialEq)] +#[derive(Clone, Debug, Eq, Fail, PartialEq)] #[fail(display = "{}{}", kind, backtrace)] pub struct Error { kind: ErrorKind, @@ -22,20 +22,20 @@ pub struct Error { } /// A trace, for example a backtrace for an error. -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Trace { frames: Vec, } /// A call stack frame within a [`Trace`]. -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Frame { name: String, location: Point, } /// A specific code point, with a file, line and column. -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Point { path: String, line: u32, @@ -43,7 +43,7 @@ pub struct Point { } /// The various kinds of allowed errors. -#[derive(Clone, Copy, Debug, PartialEq, Primitive)] +#[derive(Clone, Copy, Debug, Eq, PartialEq, Primitive)] pub enum ErrorKind { /// An unknown error has occurred. /// diff --git a/src/source/db.rs b/src/source/db.rs index c447d0c..d603e7f 100644 --- a/src/source/db.rs +++ b/src/source/db.rs @@ -3,10 +3,9 @@ use std::sync; use crate::source; -use crate::syntax; #[salsa::query_group(SourceStorage)] -pub trait Source: salsa::Database { +pub trait SourceDb: salsa::Database { /// Text of the file. #[salsa::input] fn file_text(&self, file_id: source::FileId) -> sync::Arc; @@ -15,12 +14,6 @@ pub trait Source: salsa::Database { #[salsa::input] fn file_span(&self, file_id: source::FileId) -> codespan::ByteSpan; - /// Parses the file into an AST module. - fn parse( - &self, - file_id: source::FileId, - ) -> Result>, syntax::parser::Error>; - /// Path to a file, relative to the root of its source root. #[salsa::input] fn file_relative_path(&self, file_id: source::FileId) -> relative_path::RelativePathBuf; @@ -32,16 +25,8 @@ pub trait Source: salsa::Database { /// Contents of the source root. #[salsa::input] fn source_root(&self, id: source::SourceRootId) -> sync::Arc; -} - -fn parse( - source: &impl Source, - file_id: source::FileId, -) -> Result>, syntax::parser::Error> { - use crate::syntax::parser::Parse; - let text = source.file_text(file_id); - let span = source.file_span(file_id); - - syntax::ast::Module::parse(span, &*text).map(sync::Arc::new) + /// All source roots. + #[salsa::input] + fn all_source_roots(&self) -> sync::Arc>; } diff --git a/src/syntax/db.rs b/src/syntax/db.rs index 8b13789..ed46179 100644 --- a/src/syntax/db.rs +++ b/src/syntax/db.rs @@ -1 +1,26 @@ +#![allow(non_camel_case_types)] +use std::sync; +use crate::source; +use crate::syntax; + +#[salsa::query_group(SyntaxStorage)] +pub trait SyntaxDb: salsa::Database + source::db::SourceDb { + /// Parses the file into an AST module. + fn parse( + &self, + file_id: source::FileId, + ) -> Result>, syntax::parser::Error>; +} + +fn parse( + source: &impl SyntaxDb, + file_id: source::FileId, +) -> Result>, syntax::parser::Error> { + use crate::syntax::parser::Parse; + + let text = source.file_text(file_id); + let span = source.file_span(file_id); + + syntax::ast::Module::parse(span, &*text).map(sync::Arc::new) +} diff --git a/src/ir/component/ty/class.rs b/src/ty/class.rs similarity index 84% rename from src/ir/component/ty/class.rs rename to src/ty/class.rs index 56a08f8..e77369f 100644 --- a/src/ir/component/ty/class.rs +++ b/src/ty/class.rs @@ -1,6 +1,6 @@ use std::fmt; -#[derive(Clone, Copy, Debug, Eq, PartialEq, VisitEntities, VisitEntitiesMut)] +#[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum Scalar { Symbol, Integral(IntegralScalar), @@ -9,7 +9,7 @@ pub enum Scalar { Undefined, } -#[derive(Clone, Copy, Debug, Eq, PartialEq, VisitEntities, VisitEntitiesMut)] +#[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum IntegralScalar { Unsigned, Signed, diff --git a/src/ty/error.rs b/src/ty/error.rs new file mode 100644 index 0000000..fa02004 --- /dev/null +++ b/src/ty/error.rs @@ -0,0 +1,87 @@ +use std::fmt; + +use crate::diagnostic; +use crate::ir; +use crate::ty; +use crate::ty::class; + +#[derive(Clone, Debug, Eq, Fail, PartialEq)] +pub struct Error { + pub expected: ExpectedType, + pub actual: ty::Type, + pub main_entity: ir::Entity, + pub aux_entities: Vec, +} + +#[derive(Clone, Debug, Eq, PartialEq)] +pub struct AuxEntity { + pub entity: ir::Entity, + pub label: String, +} + +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum ExpectedType { + Specific(ty::Type), + ScalarClass(class::Scalar), + AnyOf(Vec), + Union, +} + +impl fmt::Display for Error { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "expected ")?; + self.expected.fmt(f)?; + write!(f, " but got `")?; + self.actual.fmt(f)?; + write!(f, "`")?; + Ok(()) + } +} + +impl fmt::Display for ExpectedType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + ExpectedType::Specific(ref ty) => write!(f, "`{}`", ty), + ExpectedType::ScalarClass(ref class) => class.fmt(f), + ExpectedType::AnyOf(ref options) => { + let last = options.len() - 1; + for (i, option) in options.iter().enumerate() { + if i == last { + write!(f, " or ")?; + } else if i > 0 { + write!(f, ", ")?; + } + option.fmt(f)?; + } + Ok(()) + } + ExpectedType::Union => f.write_str("any union type"), + } + } +} + +impl diagnostic::Diagnostics for Error { + fn to_diagnostics(&self, builder: &mut diagnostic::DiagnosticsBuilder) { + builder.add_label(codespan_reporting::Label { + span: entity, + message: None, + style: codespan_reporting::LabelStyle::Primary, + }); + + builder.add_label(codespan_reporting::Label { + span: *main_entity, + message: Some(type_error.to_string()), + style: codespan_reporting::LabelStyle::Primary, + }); + + for aux_entity in aux_entities { + builder.add_label(codespan_reporting::Label { + span: aux_entity.entity, + message: Some(aux_entity.label.clone()), + style: codespan_reporting::LabelStyle::Secondary, + }); + } + + builder.add_diagnostic(codespan_reporting::Severity::Error, None, &self.to_string()); + } +} diff --git a/src/ir/system/infer_types.rs b/src/ty/infer.rs similarity index 89% rename from src/ir/system/infer_types.rs rename to src/ty/infer.rs index 2009dbb..50df43b 100644 --- a/src/ir/system/infer_types.rs +++ b/src/ty/infer.rs @@ -1,9 +1,7 @@ use std::collections; -use specs; - -use crate::ir::component::element; -use crate::ir::component::ty; +use crate::ir::element; +use crate::ty; use std::ops; lazy_static! { @@ -25,50 +23,11 @@ pub struct System; #[derive(Clone, Debug)] enum Inference { Type(T), - Error(ty::error::Error), + Error(ty::error::Error), } type InferenceResult = Option>; -impl<'a> specs::System<'a> for System { - type SystemData = ( - specs::Entities<'a>, - specs::ReadStorage<'a, element::Element>, - specs::WriteStorage<'a, ty::Type>, - specs::WriteStorage<'a, ty::error::Error>, - ); - - fn run(&mut self, (entities, elements, mut types, mut errors): Self::SystemData) { - use crate::best_iter::BestIteratorCollect; - use crate::best_iter::BestIteratorFlatMap; - use crate::best_iter::BestJoin; - - loop { - let new_types: Vec<_> = (&entities, &elements, !&types, !&errors) - .best_join() - .best_flat_map(|(entity, element, _, _)| { - infer_type(element, &types).map(|ty| (entity, ty)) - }) - .best_collect(); - debug!("inferred new types: {:?}", new_types); - if new_types.is_empty() { - break; - } - - for (entity, inference) in new_types { - match inference { - Inference::Type(ty) => { - types.insert(entity, ty).unwrap(); - } - Inference::Error(error) => { - errors.insert(entity, error).unwrap(); - } - } - } - } - } -} - fn infer_type( element: &element::Element, types: &specs::Storage, @@ -140,7 +99,7 @@ fn infer_number_type(number: &element::Number) -> ty::Number { } fn infer_tuple_type( - fields: &[specs::Entity], + fields: &[ir::Entity], types: &specs::Storage, ) -> InferenceResult where @@ -154,7 +113,7 @@ where } fn infer_record_type( - fields: &collections::HashMap, + fields: &collections::HashMap, types: &specs::Storage, ) -> InferenceResult where @@ -168,7 +127,7 @@ where } fn infer_un_op_type( - operand: specs::Entity, + operand: ir::Entity, operator: element::UnOperator, types: &specs::Storage, ) -> InferenceResult @@ -203,9 +162,9 @@ where } fn infer_bi_op_type( - lhs: specs::Entity, + lhs: ir::Entity, operator: element::BiOperator, - rhs: specs::Entity, + rhs: ir::Entity, types: &specs::Storage, ) -> InferenceResult where @@ -252,7 +211,7 @@ where } fn infer_variable_type( - initializer: specs::Entity, + initializer: ir::Entity, types: &specs::Storage, ) -> InferenceResult where @@ -262,7 +221,7 @@ where } fn infer_select_type( - record: specs::Entity, + record: ir::Entity, field: &str, types: &specs::Storage, ) -> InferenceResult @@ -315,8 +274,8 @@ where } fn infer_apply_type( - function: specs::Entity, - parameters: &[specs::Entity], + function: ir::Entity, + parameters: &[ir::Entity], types: &specs::Storage, ) -> InferenceResult where @@ -377,7 +336,7 @@ where } fn infer_parameter_type( - signature: specs::Entity, + signature: ir::Entity, types: &specs::Storage, ) -> InferenceResult where @@ -387,7 +346,7 @@ where } fn infer_capture_type( - capture: specs::Entity, + capture: ir::Entity, types: &specs::Storage, ) -> InferenceResult where @@ -397,9 +356,9 @@ where } fn infer_closure_type( - parameters: &[specs::Entity], - signature: specs::Entity, - result: specs::Entity, + parameters: &[ir::Entity], + signature: ir::Entity, + result: ir::Entity, types: &specs::Storage, ) -> InferenceResult where @@ -445,7 +404,7 @@ where } fn infer_module_type( - variables: &collections::HashMap, + variables: &collections::HashMap, types: &specs::Storage, ) -> InferenceResult where @@ -459,9 +418,9 @@ where } fn if_eq_then( - lhs_entity: specs::Entity, + lhs_entity: ir::Entity, lhs: &ty::Type, - rhs_entity: specs::Entity, + rhs_entity: ir::Entity, rhs: &ty::Type, result: &ty::Type, ) -> Inference { @@ -481,9 +440,9 @@ fn if_eq_then( } fn bool_op( - lhs_entity: specs::Entity, + lhs_entity: ir::Entity, lhs: &ty::Type, - rhs_entity: specs::Entity, + rhs_entity: ir::Entity, rhs: &ty::Type, ) -> Inference { if *lhs == *BOOL_TYPE { @@ -514,9 +473,9 @@ fn bool_op( } fn or_op( - lhs_entity: specs::Entity, + lhs_entity: ir::Entity, lhs: &ty::Type, - rhs_entity: specs::Entity, + rhs_entity: ir::Entity, rhs: &ty::Type, ) -> Inference { if let ty::Type::Union(u) = lhs { @@ -563,11 +522,7 @@ fn or_op( } } -fn if_integral_then( - entity: specs::Entity, - ty: &ty::Type, - result: &ty::Type, -) -> Inference { +fn if_integral_then(entity: ir::Entity, ty: &ty::Type, result: &ty::Type) -> Inference { match ty.scalar_class() { ty::class::Scalar::Integral(_) => Inference::Type(result.clone()), _ => Inference::Error(ty::error::Error { @@ -582,9 +537,9 @@ fn if_integral_then( } fn if_integral_and_eq_then( - lhs_entity: specs::Entity, + lhs_entity: ir::Entity, lhs: &ty::Type, - rhs_entity: specs::Entity, + rhs_entity: ir::Entity, rhs: &ty::Type, expected: &ty::Type, result: &ty::Type, @@ -619,11 +574,7 @@ fn if_integral_and_eq_then( } } -fn if_fractional_then( - entity: specs::Entity, - ty: &ty::Type, - result: &ty::Type, -) -> Inference { +fn if_fractional_then(entity: ir::Entity, ty: &ty::Type, result: &ty::Type) -> Inference { match ty.scalar_class() { ty::class::Scalar::Fractional => Inference::Type(result.clone()), _ => Inference::Error(ty::error::Error { diff --git a/src/ir/component/ty/mod.rs b/src/ty/mod.rs similarity index 88% rename from src/ir/component/ty/mod.rs rename to src/ty/mod.rs index bc323da..37ffa26 100644 --- a/src/ir/component/ty/mod.rs +++ b/src/ty/mod.rs @@ -1,14 +1,11 @@ use std::collections; use std::fmt; -use specs::Component; -use specs::VecStorage; - pub mod class; pub mod error; +pub mod infer; -#[derive(Component, Clone, Debug, Eq, PartialEq, VisitEntities, VisitEntitiesMut)] -#[storage(VecStorage)] +#[derive(Clone, Debug, Eq, PartialEq)] pub enum Type { Number(Number), String, @@ -19,7 +16,7 @@ pub enum Type { Function(Function), } -#[derive(Clone, Copy, Debug, Eq, PartialEq, VisitEntities, VisitEntitiesMut)] +#[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum Number { U8, U16, @@ -33,27 +30,27 @@ pub enum Number { F64, } -#[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd, VisitEntities, VisitEntitiesMut)] +#[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd)] pub struct Symbol { pub label: String, } -#[derive(Clone, Debug, Eq, PartialEq, VisitEntities, VisitEntitiesMut)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Tuple { pub fields: Vec, } -#[derive(Clone, Debug, Eq, PartialEq, VisitEntities, VisitEntitiesMut)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Union { pub alternatives: Vec, } -#[derive(Clone, Debug, Eq, PartialEq, VisitEntities, VisitEntitiesMut)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Record { pub fields: collections::HashMap, } -#[derive(Clone, Debug, Eq, PartialEq, VisitEntities, VisitEntitiesMut)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Function { pub parameters: Vec, pub result: Box, diff --git a/src/value.rs b/src/value.rs index a9355ab..08ba2bc 100644 --- a/src/value.rs +++ b/src/value.rs @@ -35,10 +35,10 @@ lazy_static! { }; } -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Value(sync::Arc); -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq)] pub enum Case { Number(Number), String(String), @@ -47,7 +47,7 @@ pub enum Case { Record(Record), } -#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)] +#[derive(Clone, Copy, Debug, Eq, PartialEq, PartialOrd)] pub enum Number { U8(u8), U16(u16), @@ -57,8 +57,8 @@ pub enum Number { I16(i16), I32(i32), I64(i64), - F32(f32), - F64(f64), + F32(ordered_float::OrderedFloat), + F64(ordered_float::OrderedFloat), } #[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd)] @@ -66,12 +66,12 @@ pub struct Symbol { pub label: String, } -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Tuple { pub fields: Vec, } -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Record { pub fields: collections::HashMap, } @@ -173,13 +173,13 @@ impl From for Value { impl From for Value { fn from(v: f32) -> Self { - Value::new(Case::Number(Number::F32(v))) + Value::new(Case::Number(Number::F32(ordered_float::OrderedFloat(v)))) } } impl From for Value { fn from(v: f64) -> Self { - Value::new(Case::Number(Number::F64(v))) + Value::new(Case::Number(Number::F64(ordered_float::OrderedFloat(v)))) } } From 6b459cf6bdf3ff80f328c7f16e5cd7be1b44b739 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Flemstr=C3=B6m?= Date: Fri, 12 Apr 2019 15:17:09 +0200 Subject: [PATCH 03/22] More big refactors --- rust-toolchain | 2 +- src/db.rs | 31 +++ src/interpreter/db.rs | 20 ++ src/interpreter/mod.rs | 39 +-- src/ir/db.rs | 41 +-- src/ir/mod.rs | 4 - src/layout/db.rs | 6 +- src/layout/infer.rs | 303 +++++++++++----------- src/layout/mod.rs | 2 +- src/lib.rs | 33 +-- src/source/db.rs | 2 +- src/syntax/db.rs | 2 +- src/ty/db.rs | 16 ++ src/ty/error.rs | 8 +- src/ty/infer.rs | 559 ++++++++++++++++++----------------------- src/ty/mod.rs | 10 +- 16 files changed, 512 insertions(+), 566 deletions(-) create mode 100644 src/db.rs create mode 100644 src/interpreter/db.rs create mode 100644 src/ty/db.rs diff --git a/rust-toolchain b/rust-toolchain index 2bf5ad0..bf867e0 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -stable +nightly diff --git a/src/db.rs b/src/db.rs new file mode 100644 index 0000000..ac4b7c2 --- /dev/null +++ b/src/db.rs @@ -0,0 +1,31 @@ +use crate::interpreter; +use crate::ir; +use crate::layout; +use crate::source; +use crate::syntax; +use crate::ty; + +#[salsa::database( + interpreter::db::Interpreter, + ir::db::Ir, + layout::db::Layout, + source::db::Source, + syntax::db::Syntax, + ty::db::Ty +)] +#[derive(Debug, Default)] +pub struct Db { + runtime: salsa::Runtime, +} + +impl Db { + pub fn new() -> Self { + Self::default() + } +} + +impl salsa::Database for Db { + fn salsa_runtime(&self) -> &salsa::Runtime { + &self.runtime + } +} diff --git a/src/interpreter/db.rs b/src/interpreter/db.rs new file mode 100644 index 0000000..45fb334 --- /dev/null +++ b/src/interpreter/db.rs @@ -0,0 +1,20 @@ +use crate::interpreter; +use crate::ir; +use crate::value; + +#[salsa::query_group(Interpreter)] +pub trait InterpreterDb: salsa::Database + ir::db::IrDb { + fn entity_value( + &self, + entity: ir::Entity, + ) -> Result, interpreter::error::Error>; +} + +fn entity_value( + db: &impl InterpreterDb, + entity: ir::Entity, +) -> Result, interpreter::error::Error> { + let element = db.entity_element(entity); + + Ok(interpreter::eval(&*element, db)?) +} diff --git a/src/interpreter/mod.rs b/src/interpreter/mod.rs index aaccd54..9e38a3b 100644 --- a/src/interpreter/mod.rs +++ b/src/interpreter/mod.rs @@ -1,19 +1,20 @@ use std::cmp; use std::collections; -use crate::ir; +use crate::interpreter; use crate::ir::element; use crate::module; use crate::value; +pub mod db; pub mod error; #[macro_use] mod macros; -pub fn eval(element: &element::Element, lookup: F) -> Result, error::Error> -where - F: Fn(ir::Entity) -> Option, -{ +pub fn eval( + element: &element::Element, + db: &impl interpreter::db::InterpreterDb, +) -> Result, error::Error> { match element { element::Element::Number(v) => Ok(Some(value::Value::number(eval_number(v)))), element::Element::String(ref v) => Ok(Some(value::Value::string(v.as_str()))), @@ -22,25 +23,31 @@ where } element::Element::Tuple(element::Tuple { ref fields }) => Ok(fields .iter() - .map(|f| lookup(*f)) - .collect::>>() + .map(|f| db.entity_value(*f)) + .collect::>, error::Error>>()? .map(|fields| value::Value::tuple(value::Tuple { fields }))), element::Element::Record(element::Record { ref fields }) => Ok(fields .iter() - .map(|(k, f)| lookup(*f).map(|v| (k.clone(), v.clone()))) - .collect::>>() + .map(|(k, f)| Ok(db.entity_value(*f)?.map(|v| (k.clone(), v)))) + .collect::>, error::Error>>()? .map(|fields| value::Value::record(value::Record { fields }))), - element::Element::UnOp(element::UnOp { operator, operand }) => { - transpose(lookup(*operand).map(|operand| eval_un_op(*operator, &operand))) - } - element::Element::BiOp(element::BiOp { lhs, operator, rhs }) => transpose( - lookup(*lhs).and_then(|lhs| lookup(*rhs).map(|rhs| eval_bi_op(&lhs, *operator, &rhs))), + element::Element::UnOp(element::UnOp { operator, operand }) => transpose( + db.entity_value(*operand)? + .map(|operand| eval_un_op(*operator, &operand)), ), + element::Element::BiOp(element::BiOp { lhs, operator, rhs }) => { + let lhs_value = db.entity_value(*lhs)?; + let rhs_value = db.entity_value(*rhs)?; + match (lhs_value, rhs_value) { + (Some(ref lhs), Some(ref rhs)) => eval_bi_op(lhs, *operator, rhs).map(Some), + _ => Ok(None), + } + } element::Element::Variable(element::Variable { initializer, .. }) => { - Ok(lookup(*initializer)) + db.entity_value(*initializer) } element::Element::Select(element::Select { record, field }) => { - transpose(lookup(*record).map(|record| match record.case() { + transpose(db.entity_value(*record)?.map(|record| match record.case() { value::Case::Record(r) => Ok(r.fields[field].clone()), other => Err(error::Error::RuntimeTypeConflict(format!( "not a record: {:?}", diff --git a/src/ir/db.rs b/src/ir/db.rs index 8597b2c..221c9c4 100644 --- a/src/ir/db.rs +++ b/src/ir/db.rs @@ -1,64 +1,25 @@ #![allow(non_camel_case_types)] use std::sync; -use crate::interpreter; use crate::ir; use crate::ir::element; use crate::ir::location; use crate::ir::symbol; -use crate::layout; use crate::syntax; -use crate::ty; -use crate::value; -#[salsa::query_group(IrStorage)] +#[salsa::query_group(Ir)] pub trait IrDb: salsa::Database + syntax::db::SyntaxDb { - fn entity_constexpr( - &self, - entity: ir::Entity, - ) -> Result, interpreter::error::Error>; fn entity_element(&self, entity: ir::Entity) -> sync::Arc; - fn entity_type( - &self, - entity: ir::Entity, - ) -> Result, ty::error::Error>; - fn entity_layout(&self, entity: ir::Entity) -> sync::Arc; fn entity_location(&self, entity: ir::Entity) -> sync::Arc; fn entity_symbol(&self, entity: ir::Entity) -> sync::Arc; fn entities(&self) -> sync::Arc; } -fn entity_constexpr( - ir: &impl IrDb, - entity: ir::Entity, -) -> Result, interpreter::error::Error> { - let element = ir.entity_element(entity); - - Ok(interpreter::eval(&*element, |e| { - ir.entity_constexpr(e) - .as_ref() - .ok() - .and_then(|o| o.as_ref()) - .map(|c| c.value.clone()) - })?) -} - fn entity_element(_ir: &impl IrDb, _entity: ir::Entity) -> sync::Arc { unimplemented!() } -fn entity_type( - _ir: &impl IrDb, - _entity: ir::Entity, -) -> Result, ty::error::Error> { - unimplemented!() -} - -fn entity_layout(_ir: &impl IrDb, _entity: ir::Entity) -> sync::Arc { - unimplemented!() -} - fn entity_location(_ir: &impl IrDb, _entity: ir::Entity) -> sync::Arc { unimplemented!() } diff --git a/src/ir/mod.rs b/src/ir/mod.rs index c4b9261..ff50cbc 100644 --- a/src/ir/mod.rs +++ b/src/ir/mod.rs @@ -1,9 +1,5 @@ //! Intermediate representation variables for the compiler and interpreter. use std::collections; -use std::fmt; - -use crate::syntax::ast; -use crate::syntax::parser; pub mod builder; pub mod db; diff --git a/src/layout/db.rs b/src/layout/db.rs index f675c49..4693ec6 100644 --- a/src/layout/db.rs +++ b/src/layout/db.rs @@ -3,7 +3,11 @@ use std::sync; use crate::ir; use crate::layout; -#[salsa::query_group(IrStorage)] +#[salsa::query_group(Layout)] pub trait LayoutDb: salsa::Database + ir::db::IrDb { fn entity_layout(&self, entity: ir::Entity) -> sync::Arc; } + +fn entity_layout(_ir: &impl LayoutDb, _entity: ir::Entity) -> sync::Arc { + unimplemented!() +} diff --git a/src/layout/infer.rs b/src/layout/infer.rs index 9175343..94f8e75 100644 --- a/src/layout/infer.rs +++ b/src/layout/infer.rs @@ -1,10 +1,10 @@ use std::collections; +use std::sync; use std::usize; use crate::ir; use crate::ir::element; use crate::layout; -use std::ops; pub struct System { ptr_size: usize, @@ -21,57 +21,61 @@ impl System { &self, element: &element::Element, db: impl layout::db::LayoutDb, - ) -> Option { + ) -> sync::Arc { match *element { element::Element::Number(ref n) => self.infer_number_layout(n), - element::Element::String(_) => Some(layout::Layout::scalar(self.ptr_size)), - element::Element::Symbol(_) => Some(layout::Layout::zero()), + element::Element::String(_) => sync::Arc::new(layout::Layout::scalar(self.ptr_size)), + element::Element::Symbol(_) => sync::Arc::new(layout::Layout::zero()), element::Element::Tuple(element::Tuple { ref fields }) => { - self.infer_tuple_layout(fields, layouts) + self.infer_tuple_layout(fields, db) } element::Element::Record(element::Record { ref fields }) => { - self.infer_record_layout(fields, layouts) + self.infer_record_layout(fields, db) } element::Element::UnOp(element::UnOp { operator, operand }) => { - self.infer_un_op_layout(operator, operand, layouts) + self.infer_un_op_layout(operator, operand, db) } element::Element::BiOp(element::BiOp { lhs, operator, rhs }) => { - self.infer_bi_op_layout(lhs, operator, rhs, layouts) + self.infer_bi_op_layout(lhs, operator, rhs, db) } element::Element::Variable(element::Variable { initializer, .. }) => { - self.infer_variable_layout(initializer, layouts) + self.infer_variable_layout(initializer, db) } element::Element::Select(element::Select { record, ref field }) => { - self.infer_select_layout(record, field, elements, layouts) + self.infer_select_layout(record, field, db) } element::Element::Apply(element::Apply { function, ref parameters, - }) => self.infer_apply_layout(function, parameters, layouts), + }) => self.infer_apply_layout(function, parameters, db), element::Element::Parameter(element::Parameter { signature, .. }) => { - self.infer_parameter_layout(signature, layouts) + self.infer_parameter_layout(signature, db) } element::Element::Capture(element::Capture { captured, .. }) => { - self.infer_capture_layout(captured, layouts) + self.infer_capture_layout(captured, db) } element::Element::Closure(element::Closure { ref captures, .. }) => { - self.infer_closure_layout(captures, layouts) + self.infer_closure_layout(captures, db) } element::Element::Module(element::Module { ref variables }) => { - self.infer_module_layout(variables, layouts) + self.infer_module_layout(variables, db) } } } - fn infer_number_layout(&self, number: &element::Number) -> Option { + fn infer_number_layout(&self, number: &element::Number) -> sync::Arc { match *number { - element::Number::U8(_) | element::Number::I8(_) => Some(layout::Layout::scalar(1)), - element::Number::U16(_) | element::Number::I16(_) => Some(layout::Layout::scalar(2)), + element::Number::U8(_) | element::Number::I8(_) => { + sync::Arc::new(layout::Layout::scalar(1)) + } + element::Number::U16(_) | element::Number::I16(_) => { + sync::Arc::new(layout::Layout::scalar(2)) + } element::Number::U32(_) | element::Number::I32(_) | element::Number::F32(_) => { - Some(layout::Layout::scalar(4)) + sync::Arc::new(layout::Layout::scalar(4)) } element::Number::U64(_) | element::Number::I64(_) | element::Number::F64(_) => { - Some(layout::Layout::scalar(8)) + sync::Arc::new(layout::Layout::scalar(8)) } } } @@ -80,37 +84,34 @@ impl System { &self, fields: &[ir::Entity], db: impl layout::db::LayoutDb, - ) -> Option { - if let Some(mut layouts) = fields + ) -> sync::Arc { + let mut layouts = fields .iter() .enumerate() - .map(|(i, f)| layouts.get(*f).map(|l| (i, l))) - .collect::>>() - { - if layouts.is_empty() { - Some(layout::Layout::zero()) - } else { - layouts.sort_unstable_by_key(|(i, l)| (usize::max_value() - l.size, *i)); - let alignment = layouts.iter().map(|(_, l)| l.alignment).max().unwrap(); - let mut size = 0; - - let mut unnamed_fields = vec![layout::Offset::zero(); layouts.len()]; - - for (i, layout) in layouts { - let offset = align_up(size, layout.alignment); - size = offset + layout.size; - let layout = layout.clone(); - unnamed_fields[i] = layout::Offset { offset, layout }; - } + .map(|(i, f)| (i, db.entity_layout(*f))) + .collect::>(); - Some(layout::Layout::unnamed_fields( - size, - alignment, - unnamed_fields, - )) - } + if layouts.is_empty() { + sync::Arc::new(layout::Layout::zero()) } else { - None + layouts.sort_unstable_by_key(|(i, l)| (usize::max_value() - l.size, *i)); + let alignment = layouts.iter().map(|(_, l)| l.alignment).max().unwrap(); + let mut size = 0; + + let mut unnamed_fields = vec![layout::Offset::zero(); layouts.len()]; + + for (i, layout) in layouts { + let offset = align_up(size, layout.alignment); + size = offset + layout.size; + let layout = (*layout).clone(); + unnamed_fields[i] = layout::Offset { offset, layout }; + } + + sync::Arc::new(layout::Layout::unnamed_fields( + size, + alignment, + unnamed_fields, + )) } } @@ -118,39 +119,36 @@ impl System { &self, fields: &collections::HashMap, db: impl layout::db::LayoutDb, - ) -> Option { - if let Some(mut layouts) = fields + ) -> sync::Arc { + let mut layouts = fields .iter() - .map(|(n, f)| layouts.get(*f).map(|l| (n, l))) - .collect::>>() - { - if layouts.is_empty() { - Some(layout::Layout::zero()) - } else { - layouts.sort_unstable_by_key(|(n, l)| (usize::max_value() - l.size, n.as_str())); - let alignment = layouts.iter().map(|(_, l)| l.alignment).max().unwrap(); - let mut size = 0; - - let named_fields = layouts - .into_iter() - .map(|(field, layout)| { - let offset = align_up(size, layout.alignment); - size = offset + layout.size; - let field = field.clone(); - let layout = layout.clone(); - let offset_layout = layout::Offset { offset, layout }; - - layout::NamedField { - field, - offset_layout, - } - }) - .collect::>(); + .map(|(n, f)| (n, db.entity_layout(*f))) + .collect::>(); - Some(layout::Layout::named_fields(size, alignment, named_fields)) - } + if layouts.is_empty() { + sync::Arc::new(layout::Layout::zero()) } else { - None + layouts.sort_unstable_by_key(|(n, l)| (usize::max_value() - l.size, n.as_str())); + let alignment = layouts.iter().map(|(_, l)| l.alignment).max().unwrap(); + let mut size = 0; + + let named_fields = layouts + .into_iter() + .map(|(field, layout)| { + let offset = align_up(size, layout.alignment); + size = offset + layout.size; + let field = field.clone(); + let layout = (*layout).clone(); + let offset_layout = layout::Offset { offset, layout }; + + layout::NamedField { + field, + offset_layout, + } + }) + .collect::>(); + + sync::Arc::new(layout::Layout::named_fields(size, alignment, named_fields)) } } @@ -159,11 +157,9 @@ impl System { operator: element::UnOperator, operand: ir::Entity, db: impl layout::db::LayoutDb, - ) -> Option { - let operand = layouts.get(operand).cloned(); - + ) -> sync::Arc { match operator { - element::UnOperator::Not => Some(BOOL_LAYOUT), + element::UnOperator::Not => sync::Arc::new(BOOL_LAYOUT), element::UnOperator::BNot | element::UnOperator::Cl0 | element::UnOperator::Cl1 @@ -172,7 +168,7 @@ impl System { | element::UnOperator::Ct1 | element::UnOperator::C0 | element::UnOperator::C1 - | element::UnOperator::Sqrt => operand, + | element::UnOperator::Sqrt => db.entity_layout(operand), } } @@ -182,17 +178,16 @@ impl System { operator: element::BiOperator, rhs: ir::Entity, db: impl layout::db::LayoutDb, - ) -> Option { - let lhs = layouts.get(lhs).cloned(); - let rhs = layouts.get(rhs).cloned(); + ) -> sync::Arc { + let lhs = db.entity_layout(lhs); + let rhs = db.entity_layout(rhs); - if let (Some(lhs), Some(rhs)) = (lhs.as_ref(), rhs.as_ref()) { - if lhs.size != rhs.size { - return None; - } - if lhs.alignment != rhs.alignment { - return None; - } + if lhs.size != rhs.size { + unreachable!() + } + + if lhs.alignment != rhs.alignment { + unreachable!() } match operator { @@ -207,7 +202,7 @@ impl System { | element::BiOperator::Xor | element::BiOperator::AndNot | element::BiOperator::OrNot - | element::BiOperator::XorNot => Some(BOOL_LAYOUT), + | element::BiOperator::XorNot => sync::Arc::new(BOOL_LAYOUT), element::BiOperator::Cmp => unimplemented!(), element::BiOperator::Add | element::BiOperator::Sub @@ -231,8 +226,8 @@ impl System { &self, initializer: ir::Entity, db: impl layout::db::LayoutDb, - ) -> Option { - layouts.get(initializer).cloned() + ) -> sync::Arc { + db.entity_layout(initializer) } fn infer_select_layout( @@ -240,19 +235,16 @@ impl System { record: ir::Entity, field: &str, db: impl layout::db::LayoutDb, - ) -> Option { - match elements.get(record) { - None => None, - Some(t) => match t { - element::Element::Record(element::Record { ref fields }) => { - if let Some(f) = fields.get(field) { - layouts.get(*f).cloned() - } else { - None - } + ) -> sync::Arc { + match *db.entity_element(record) { + element::Element::Record(element::Record { ref fields }) => { + if let Some(f) = fields.get(field) { + db.entity_layout(*f) + } else { + panic!("field does not exist") } - _ => None, - }, + } + _ => panic!("entity is not a record"), } } @@ -261,9 +253,9 @@ impl System { _function: ir::Entity, _parameters: &[ir::Entity], _db: impl layout::db::LayoutDb, - ) -> Option { + ) -> sync::Arc { // TODO - None + unimplemented!() /* match types.get(function) { None => { @@ -311,76 +303,71 @@ impl System { &self, signature: ir::Entity, db: impl layout::db::LayoutDb, - ) -> Option { - layouts.get(signature).cloned() + ) -> sync::Arc { + db.entity_layout(signature) } fn infer_capture_layout( &self, capture: ir::Entity, db: impl layout::db::LayoutDb, - ) -> Option { - layouts.get(capture).cloned() + ) -> sync::Arc { + db.entity_layout(capture) } fn infer_closure_layout( &self, captures: &collections::HashMap, db: impl layout::db::LayoutDb, - ) -> Option { - if let Some(mut capture_layouts) = captures + ) -> sync::Arc { + let mut capture_layouts = captures .iter() - .map(|(n, f)| layouts.get(*f).map(|l| (n, l))) - .collect::>>() - { - let unnamed_fields = vec![layout::Offset { - offset: 0, - layout: layout::Layout::scalar(self.ptr_size), - }]; - - capture_layouts - .sort_unstable_by_key(|(n, l)| (usize::max_value() - l.size, n.as_str())); - let alignment = capture_layouts - .iter() - .map(|(_, l)| l.alignment) - .max() - .unwrap_or(self.ptr_size); - let mut size = self.ptr_size; - - let named_fields = capture_layouts - .into_iter() - .map(|(field, layout)| { - let offset = align_up(size, layout.alignment); - size = offset + layout.size; - let field = field.clone(); - let layout = layout.clone(); - let offset_layout = layout::Offset { offset, layout }; - - layout::NamedField { - field, - offset_layout, - } - }) - .collect::>(); - - Some(layout::Layout { - size, - alignment, - named_fields, - unnamed_fields, + .map(|(n, f)| (n, db.entity_layout(*f))) + .collect::>(); + let unnamed_fields = vec![layout::Offset { + offset: 0, + layout: layout::Layout::scalar(self.ptr_size), + }]; + + capture_layouts.sort_unstable_by_key(|(n, l)| (usize::max_value() - l.size, n.as_str())); + let alignment = capture_layouts + .iter() + .map(|(_, l)| l.alignment) + .max() + .unwrap_or(self.ptr_size); + let mut size = self.ptr_size; + + let named_fields = capture_layouts + .into_iter() + .map(|(field, layout)| { + let offset = align_up(size, layout.alignment); + size = offset + layout.size; + let field = field.clone(); + let layout = (*layout).clone(); + let offset_layout = layout::Offset { offset, layout }; + + layout::NamedField { + field, + offset_layout, + } }) - } else { - None - } + .collect::>(); + + sync::Arc::new(layout::Layout { + size, + alignment, + named_fields, + unnamed_fields, + }) } fn infer_module_layout( &self, _variables: &collections::HashMap, db: impl layout::db::LayoutDb, - ) -> Option { + ) -> sync::Arc { // TODO - None + unimplemented!() /* variables .iter() diff --git a/src/layout/mod.rs b/src/layout/mod.rs index 4c868ef..435d24a 100644 --- a/src/layout/mod.rs +++ b/src/layout/mod.rs @@ -1,6 +1,6 @@ use std::fmt; -mod db; +pub mod db; mod infer; #[derive(Clone, Debug, Eq, PartialEq)] diff --git a/src/lib.rs b/src/lib.rs index 36e14d5..7d1626b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -29,7 +29,10 @@ //! # Ok(()) //! # } //! ``` -#![deny(nonstandard_style, warnings, unused)] +#![feature(const_fn, const_vec_new)] + +// #![deny(nonstandard_style, warnings, unused)] +#![deny(nonstandard_style)] #![deny( missing_docs, missing_debug_implementations, @@ -40,7 +43,6 @@ unused_import_braces, unused_qualifications )] -#![feature(const_vec_new)] #![cfg_attr(feature = "cargo-clippy", deny(clippy::all, clippy::pedantic))] #![cfg_attr(feature = "cargo-clippy", allow(clippy::use_self))] @@ -52,8 +54,6 @@ extern crate failure; extern crate lalrpop_util; #[macro_use] extern crate lazy_static; -#[macro_use] -extern crate log; #[cfg(test)] #[macro_use] extern crate pretty_assertions; @@ -61,6 +61,7 @@ extern crate pretty_assertions; use std::fmt; // mod codegen; +mod db; mod interpreter; mod ir; mod layout; @@ -69,12 +70,12 @@ mod syntax; mod ty; mod value; -#[cfg(test)] -mod test_util; +//#[cfg(test)] +//mod test_util; pub mod diagnostic; pub mod error; -pub mod graph; +// pub mod graph; pub mod module; pub use crate::error::Error; @@ -82,27 +83,18 @@ pub use crate::error::Result; /// An instance of the Tin runtime. pub struct Tin { - ir: ir::Ir, - codemap: codespan::CodeMap, - parser: as syntax::parser::Parse>::Parser, + db: db::Db, } impl Tin { /// Creates a new instance of the Tin runtime. pub fn new() -> Tin { - use crate::syntax::parser::Parse; - - let ir = ir::Ir::new(); - let codemap = codespan::CodeMap::new(); - let parser = syntax::ast::Module::new_parser(); + let db = db::Db::new(); - Tin { - ir, - codemap, - parser, - } + Tin { db } } + /* /// Loads the specified source code as a module. /// /// # Errors @@ -197,6 +189,7 @@ impl Tin { pub fn codemap(&self) -> &codespan::CodeMap { &self.codemap } + */ } impl Default for Tin { diff --git a/src/source/db.rs b/src/source/db.rs index d603e7f..2260f15 100644 --- a/src/source/db.rs +++ b/src/source/db.rs @@ -4,7 +4,7 @@ use std::sync; use crate::source; -#[salsa::query_group(SourceStorage)] +#[salsa::query_group(Source)] pub trait SourceDb: salsa::Database { /// Text of the file. #[salsa::input] diff --git a/src/syntax/db.rs b/src/syntax/db.rs index ed46179..22e3e2d 100644 --- a/src/syntax/db.rs +++ b/src/syntax/db.rs @@ -4,7 +4,7 @@ use std::sync; use crate::source; use crate::syntax; -#[salsa::query_group(SyntaxStorage)] +#[salsa::query_group(Syntax)] pub trait SyntaxDb: salsa::Database + source::db::SourceDb { /// Parses the file into an AST module. fn parse( diff --git a/src/ty/db.rs b/src/ty/db.rs new file mode 100644 index 0000000..fd8f41e --- /dev/null +++ b/src/ty/db.rs @@ -0,0 +1,16 @@ +use std::sync; + +use crate::ir; +use crate::ty; + +#[salsa::query_group(Ty)] +pub trait TyDb: salsa::Database + ir::db::IrDb { + fn entity_type(&self, entity: ir::Entity) -> Result, ty::error::Error>; +} + +fn entity_type( + _ir: &impl TyDb, + _entity: ir::Entity, +) -> Result, ty::error::Error> { + unimplemented!() +} diff --git a/src/ty/error.rs b/src/ty/error.rs index fa02004..67a07a6 100644 --- a/src/ty/error.rs +++ b/src/ty/error.rs @@ -1,6 +1,6 @@ use std::fmt; +use std::sync; -use crate::diagnostic; use crate::ir; use crate::ty; use crate::ty::class; @@ -8,7 +8,7 @@ use crate::ty::class; #[derive(Clone, Debug, Eq, Fail, PartialEq)] pub struct Error { pub expected: ExpectedType, - pub actual: ty::Type, + pub actual: sync::Arc, pub main_entity: ir::Entity, pub aux_entities: Vec, } @@ -21,7 +21,7 @@ pub struct AuxEntity { #[derive(Clone, Debug, Eq, PartialEq)] pub enum ExpectedType { - Specific(ty::Type), + Specific(sync::Arc), ScalarClass(class::Scalar), AnyOf(Vec), Union, @@ -60,6 +60,7 @@ impl fmt::Display for ExpectedType { } } +/* impl diagnostic::Diagnostics for Error { fn to_diagnostics(&self, builder: &mut diagnostic::DiagnosticsBuilder) { builder.add_label(codespan_reporting::Label { @@ -85,3 +86,4 @@ impl diagnostic::Diagnostics for Error { builder.add_diagnostic(codespan_reporting::Severity::Error, None, &self.to_string()); } } +*/ diff --git a/src/ty/infer.rs b/src/ty/infer.rs index 50df43b..9f6e40c 100644 --- a/src/ty/infer.rs +++ b/src/ty/infer.rs @@ -1,11 +1,13 @@ use std::collections; +use std::result; +use std::sync; +use crate::ir; use crate::ir::element; use crate::ty; -use std::ops; lazy_static! { - static ref BOOL_TYPE: ty::Type = { + static ref BOOL_TYPE: sync::Arc = { let alternatives = vec![ ty::Symbol { label: "f".to_owned(), @@ -14,71 +16,57 @@ lazy_static! { label: "t".to_owned(), }, ]; - ty::Type::Union(ty::Union { alternatives }) + sync::Arc::new(ty::Type::Union(ty::Union { alternatives })) }; } pub struct System; -#[derive(Clone, Debug)] -enum Inference { - Type(T), - Error(ty::error::Error), -} - -type InferenceResult = Option>; +type Result = result::Result, ty::error::Error>; -fn infer_type( - element: &element::Element, - types: &specs::Storage, -) -> InferenceResult -where - D: ops::Deref>, -{ +fn infer_type(element: &element::Element, db: impl ty::db::TyDb) -> Result { match *element { element::Element::Number(ref n) => { - Some(Inference::Type(ty::Type::Number(infer_number_type(n)))) + Ok(sync::Arc::new(ty::Type::Number(infer_number_type(n)))) } - element::Element::String(_) => Some(Inference::Type(ty::Type::String)), + element::Element::String(_) => Ok(sync::Arc::new(ty::Type::String)), element::Element::Symbol(element::Symbol { ref label }) => { - Some(Inference::Type(ty::Type::Symbol(ty::Symbol { + Ok(sync::Arc::new(ty::Type::Symbol(ty::Symbol { label: label.clone(), }))) } - element::Element::Tuple(element::Tuple { ref fields }) => infer_tuple_type(fields, types), - element::Element::Record(element::Record { ref fields }) => { - infer_record_type(fields, types) - } + element::Element::Tuple(element::Tuple { ref fields }) => infer_tuple_type(fields, db), + element::Element::Record(element::Record { ref fields }) => infer_record_type(fields, db), element::Element::UnOp(element::UnOp { operand, operator }) => { - infer_un_op_type(operand, operator, types) + infer_un_op_type(operand, operator, db) } element::Element::BiOp(element::BiOp { lhs, operator, rhs }) => { - infer_bi_op_type(lhs, operator, rhs, types) + infer_bi_op_type(lhs, operator, rhs, db) } element::Element::Variable(element::Variable { initializer, .. }) => { - infer_variable_type(initializer, types) + infer_variable_type(initializer, db) } element::Element::Select(element::Select { record, ref field }) => { - infer_select_type(record, field, types) + infer_select_type(record, field, db) } element::Element::Apply(element::Apply { function, ref parameters, - }) => infer_apply_type(function, parameters, types), + }) => infer_apply_type(function, parameters, db), element::Element::Parameter(element::Parameter { signature, .. }) => { - infer_parameter_type(signature, types) + infer_parameter_type(signature, db) } element::Element::Capture(element::Capture { captured, .. }) => { - infer_capture_type(captured, types) + infer_capture_type(captured, db) } element::Element::Closure(element::Closure { ref parameters, signature, result, .. - }) => infer_closure_type(parameters, signature, result, types), + }) => infer_closure_type(parameters, signature, result, db), element::Element::Module(element::Module { ref variables }) => { - infer_module_type(variables, types) + infer_module_type(variables, db) } } } @@ -98,56 +86,45 @@ fn infer_number_type(number: &element::Number) -> ty::Number { } } -fn infer_tuple_type( - fields: &[ir::Entity], - types: &specs::Storage, -) -> InferenceResult -where - D: ops::Deref>, -{ - fields +fn infer_tuple_type(fields: &[ir::Entity], db: impl ty::db::TyDb) -> Result { + let fields = fields .iter() - .map(|f| types.get(*f).cloned()) - .collect::>>() - .map(|fields| Inference::Type(ty::Type::Tuple(ty::Tuple { fields }))) + .map(|f| db.entity_type(*f)) + .collect::, ty::error::Error>>()?; + Ok(sync::Arc::new(ty::Type::Tuple(ty::Tuple { fields }))) } -fn infer_record_type( +fn infer_record_type( fields: &collections::HashMap, - types: &specs::Storage, -) -> InferenceResult -where - D: ops::Deref>, -{ - fields + db: impl ty::db::TyDb, +) -> Result { + let fields = fields .iter() - .map(|(k, v)| types.get(*v).map(|t| (k.clone(), t.clone()))) - .collect::>>() - .map(|fields| Inference::Type(ty::Type::Record(ty::Record { fields }))) + .map(|(k, v)| Ok((k.clone(), db.entity_type(*v)?))) + .collect::, ty::error::Error>>()?; + Ok(sync::Arc::new(ty::Type::Record(ty::Record { fields }))) } -fn infer_un_op_type( +fn infer_un_op_type( operand: ir::Entity, operator: element::UnOperator, - types: &specs::Storage, -) -> InferenceResult -where - D: ops::Deref>, -{ - types.get(operand).map(|ty| match operator { + db: impl ty::db::TyDb, +) -> Result { + let ty = db.entity_type(operand)?; + match operator { element::UnOperator::Not => { - if *ty == *BOOL_TYPE { - Inference::Type(BOOL_TYPE.clone()) + if ty == *BOOL_TYPE { + Ok(BOOL_TYPE.clone()) } else { - Inference::Error(ty::error::Error { + Err(ty::error::Error { expected: ty::error::ExpectedType::Specific(BOOL_TYPE.clone()), - actual: ty.clone(), + actual: ty, main_entity: operand, aux_entities: vec![], }) } } - element::UnOperator::BNot => if_integral_then(operand, ty, ty), + element::UnOperator::BNot => if_integral_then(operand, &ty, ty.clone()), element::UnOperator::Cl0 | element::UnOperator::Cl1 | element::UnOperator::Cls @@ -155,279 +132,221 @@ where | element::UnOperator::Ct1 | element::UnOperator::C0 | element::UnOperator::C1 => { - if_integral_then(operand, ty, &ty::Type::Number(ty::Number::U32)) + if_integral_then(operand, &ty, sync::Arc::new(ty::Type::Number(ty::Number::U32))) } - element::UnOperator::Sqrt => if_fractional_then(operand, ty, ty), - }) + element::UnOperator::Sqrt => if_fractional_then(operand, &ty, ty.clone()), + } } -fn infer_bi_op_type( +fn infer_bi_op_type( lhs: ir::Entity, operator: element::BiOperator, rhs: ir::Entity, - types: &specs::Storage, -) -> InferenceResult -where - D: ops::Deref>, -{ + db: impl ty::db::TyDb, +) -> Result { // TODO: check scalar type semantics so e.g. records can't be divided. - match (types.get(lhs), types.get(rhs)) { - (Some(lhs_ty), Some(rhs_ty)) => { - let result = match operator { - element::BiOperator::Eq - | element::BiOperator::Ne - | element::BiOperator::Lt - | element::BiOperator::Ge - | element::BiOperator::Gt - | element::BiOperator::Le => if_eq_then(lhs, lhs_ty, rhs, rhs_ty, &*BOOL_TYPE), - element::BiOperator::Cmp => unimplemented!(), - element::BiOperator::Add - | element::BiOperator::Sub - | element::BiOperator::Mul - | element::BiOperator::Div - | element::BiOperator::Rem - // TODO: don't allow floats - | element::BiOperator::BAnd - | element::BiOperator::BOr - | element::BiOperator::BXor - | element::BiOperator::BAndNot - | element::BiOperator::BOrNot - | element::BiOperator::BXorNot => if_eq_then(lhs, lhs_ty, rhs, rhs_ty, lhs_ty), - element::BiOperator::Or => or_op(lhs, lhs_ty, rhs, rhs_ty), - element::BiOperator::And |element::BiOperator::Xor |element::BiOperator::AndNot |element::BiOperator::OrNot | element::BiOperator::XorNot => bool_op(lhs, lhs_ty, rhs, rhs_ty), - element::BiOperator::RotL | element::BiOperator::RotR |element::BiOperator::ShL |element::BiOperator::ShR => if_integral_and_eq_then( - lhs, - lhs_ty, - rhs, - rhs_ty, - &ty::Type::Number(ty::Number::U32), - lhs_ty, - ), - }; - Some(result) - } - _ => None, + let lhs_ty = db.entity_type(lhs)?; + let rhs_ty = db.entity_type(rhs)?; + match operator { + element::BiOperator::Eq + | element::BiOperator::Ne + | element::BiOperator::Lt + | element::BiOperator::Ge + | element::BiOperator::Gt + | element::BiOperator::Le => if_eq_then(lhs, &lhs_ty, rhs, &rhs_ty, &BOOL_TYPE), + element::BiOperator::Cmp => unimplemented!(), + element::BiOperator::Add + | element::BiOperator::Sub + | element::BiOperator::Mul + | element::BiOperator::Div + | element::BiOperator::Rem + // TODO: don't allow floats + | element::BiOperator::BAnd + | element::BiOperator::BOr + | element::BiOperator::BXor + | element::BiOperator::BAndNot + | element::BiOperator::BOrNot + | element::BiOperator::BXorNot => if_eq_then(lhs, &lhs_ty, rhs, &rhs_ty, &lhs_ty), + element::BiOperator::Or => or_op(lhs, &lhs_ty, rhs, &rhs_ty), + element::BiOperator::And | element::BiOperator::Xor | element::BiOperator::AndNot | element::BiOperator::OrNot | element::BiOperator::XorNot => bool_op(lhs, &lhs_ty, rhs, &rhs_ty), + element::BiOperator::RotL | element::BiOperator::RotR | element::BiOperator::ShL | element::BiOperator::ShR => if_integral_and_eq_then( + lhs, + &lhs_ty, + rhs, + &rhs_ty, + &sync::Arc::new(ty::Type::Number(ty::Number::U32)), + lhs_ty.clone(), + ), } } -fn infer_variable_type( - initializer: ir::Entity, - types: &specs::Storage, -) -> InferenceResult -where - D: ops::Deref>, -{ - types.get(initializer).cloned().map(Inference::Type) +fn infer_variable_type(initializer: ir::Entity, db: impl ty::db::TyDb) -> Result { + db.entity_type(initializer) } -fn infer_select_type( - record: ir::Entity, - field: &str, - types: &specs::Storage, -) -> InferenceResult -where - D: ops::Deref>, -{ - match types.get(record) { - None => None, - Some(t) => match t { - ty::Type::Record(ty::Record { ref fields }) => { - if let Some(t) = fields.get(field) { - Some(Inference::Type(t.clone())) - } else { - let mut expected_fields = collections::HashMap::new(); - expected_fields.insert( - field.to_owned(), - ty::Type::Symbol(ty::Symbol { - label: "something".to_owned(), - }), - ); - Some(Inference::Error(ty::error::Error { - expected: ty::error::ExpectedType::Specific(ty::Type::Record(ty::Record { - fields: expected_fields, - })), - actual: t.clone(), - main_entity: record, - aux_entities: vec![], - })) - } - } - something => { +fn infer_select_type(record: ir::Entity, field: &str, db: impl ty::db::TyDb) -> Result { + let record_ty = db.entity_type(record)?; + match *record_ty { + ty::Type::Record(ty::Record { ref fields }) => { + if let Some(t) = fields.get(field) { + Ok(t.clone()) + } else { let mut expected_fields = collections::HashMap::new(); expected_fields.insert( field.to_owned(), - ty::Type::Symbol(ty::Symbol { + sync::Arc::new(ty::Type::Symbol(ty::Symbol { label: "something".to_owned(), - }), - ); - Some(Inference::Error(ty::error::Error { - expected: ty::error::ExpectedType::Specific(ty::Type::Record(ty::Record { - fields: expected_fields, })), - actual: something.clone(), + ); + Err(ty::error::Error { + expected: ty::error::ExpectedType::Specific(sync::Arc::new(ty::Type::Record( + ty::Record { + fields: expected_fields, + }, + ))), + actual: record_ty.clone(), main_entity: record, aux_entities: vec![], - })) + }) } - }, + } + _ => { + let mut expected_fields = collections::HashMap::new(); + expected_fields.insert( + field.to_owned(), + sync::Arc::new(ty::Type::Symbol(ty::Symbol { + label: "something".to_owned(), + })), + ); + Err(ty::error::Error { + expected: ty::error::ExpectedType::Specific(sync::Arc::new(ty::Type::Record( + ty::Record { + fields: expected_fields, + }, + ))), + actual: record_ty, + main_entity: record, + aux_entities: vec![], + }) + } } } -fn infer_apply_type( +fn infer_apply_type( function: ir::Entity, parameters: &[ir::Entity], - types: &specs::Storage, -) -> InferenceResult -where - D: ops::Deref>, -{ - match types.get(function) { - None => { - trace!("inference failure: missing function type for apply"); - None - } - Some(f) => match f { - ty::Type::Function(ty::Function { - parameters: ref formal_parameters, - result, - }) => { - if let Some(parameters) = parameters - .iter() - .map(|p| types.get(*p).cloned()) - .collect::>>() - { - if parameters == *formal_parameters { - Some(Inference::Type((**result).clone())) - } else { - // TODO: create a diff of expected and actual parameters - Some(Inference::Error(ty::error::Error { - expected: ty::error::ExpectedType::Specific(ty::Type::Function( - ty::Function { - parameters, - result: Box::new(ty::Type::Symbol(ty::Symbol { - label: "something".to_owned(), - })), - }, - )), - actual: f.clone(), - main_entity: function, - aux_entities: vec![], - })) - } - } else { - None - } + db: impl ty::db::TyDb, +) -> Result { + let function_ty = db.entity_type(function)?; + match *function_ty { + ty::Type::Function(ty::Function { + parameters: ref formal_parameters, + ref result, + }) => { + let parameters = parameters + .iter() + .map(|p| db.entity_type(*p)) + .collect::, ty::error::Error>>()?; + + if parameters == *formal_parameters { + Ok(result.clone()) + } else { + // TODO: create a diff of expected and actual parameters + Err(ty::error::Error { + expected: ty::error::ExpectedType::Specific(sync::Arc::new( + ty::Type::Function(ty::Function { + parameters, + result: sync::Arc::new(ty::Type::Symbol(ty::Symbol { + label: "something".to_owned(), + })), + }), + )), + actual: function_ty.clone(), + main_entity: function, + aux_entities: vec![], + }) } - something => Some(Inference::Error(ty::error::Error { - expected: ty::error::ExpectedType::Specific(ty::Type::Function(ty::Function { - parameters: vec![ty::Type::Symbol(ty::Symbol { + } + _ => Err(ty::error::Error { + expected: ty::error::ExpectedType::Specific(sync::Arc::new(ty::Type::Function( + ty::Function { + parameters: vec![sync::Arc::new(ty::Type::Symbol(ty::Symbol { label: "something".to_owned(), - })], - result: Box::new(ty::Type::Symbol(ty::Symbol { + }))], + result: sync::Arc::new(ty::Type::Symbol(ty::Symbol { label: "something".to_owned(), })), - })), - actual: something.clone(), - main_entity: function, - aux_entities: vec![], - })), - }, + }, + ))), + actual: function_ty, + main_entity: function, + aux_entities: vec![], + }), } } -fn infer_parameter_type( - signature: ir::Entity, - types: &specs::Storage, -) -> InferenceResult -where - D: ops::Deref>, -{ - types.get(signature).cloned().map(Inference::Type) +fn infer_parameter_type(signature: ir::Entity, db: impl ty::db::TyDb) -> Result { + db.entity_type(signature) } -fn infer_capture_type( - capture: ir::Entity, - types: &specs::Storage, -) -> InferenceResult -where - D: ops::Deref>, -{ - types.get(capture).cloned().map(Inference::Type) +fn infer_capture_type(capture: ir::Entity, db: impl ty::db::TyDb) -> Result { + db.entity_type(capture) } -fn infer_closure_type( +fn infer_closure_type( parameters: &[ir::Entity], signature: ir::Entity, result: ir::Entity, - types: &specs::Storage, -) -> InferenceResult -where - D: ops::Deref>, -{ - if let Some(parameters) = parameters + db: impl ty::db::TyDb, +) -> Result { + let parameters = parameters .iter() - .map(|p| types.get(*p).cloned()) - .collect::>>() - { - if let Some(result_ty) = types.get(result) { - if let Some(signature_ty) = types.get(signature) { - if signature_ty == result_ty { - let result = Box::new(signature_ty.clone()); - Some(Inference::Type(ty::Type::Function(ty::Function { - parameters, - result, - }))) - } else { - Some(Inference::Error(ty::error::Error { - expected: ty::error::ExpectedType::Specific(signature_ty.clone()), - actual: result_ty.clone(), - main_entity: result, - aux_entities: vec![ty::error::AuxEntity { - entity: signature, - label: format!("declared return type is `{}`", signature_ty), - }], - })) - } - } else { - trace!("inference failure: no signature for closure"); - None - } - } else { - trace!("inference failure: missing signature type for closure, and no inferrable result type"); - None - } + .map(|p| db.entity_type(*p)) + .collect::, ty::error::Error>>()?; + let result_ty = db.entity_type(result)?; + let signature_ty = db.entity_type(signature)?; + + if signature_ty == result_ty { + let result = signature_ty.clone(); + Ok(sync::Arc::new(ty::Type::Function(ty::Function { + parameters, + result, + }))) } else { - trace!("inference failure: missing parameter type(s) for closure"); - // TODO: implement surjective type inference - None + Err(ty::error::Error { + expected: ty::error::ExpectedType::Specific(signature_ty.clone()), + actual: result_ty.clone(), + main_entity: result, + aux_entities: vec![ty::error::AuxEntity { + entity: signature, + label: format!("declared return type is `{}`", signature_ty), + }], + }) } } -fn infer_module_type( +fn infer_module_type( variables: &collections::HashMap, - types: &specs::Storage, -) -> InferenceResult -where - D: ops::Deref>, -{ - variables + db: impl ty::db::TyDb, +) -> Result { + let fields = variables .iter() - .map(|(k, v)| types.get(*v).map(|t| (k.clone(), t.clone()))) - .collect::>>() - .map(|fields| Inference::Type(ty::Type::Record(ty::Record { fields }))) + .map(|(k, v)| Ok((k.clone(), db.entity_type(*v)?))) + .collect::>()?; + Ok(sync::Arc::new(ty::Type::Record(ty::Record { fields }))) } fn if_eq_then( lhs_entity: ir::Entity, - lhs: &ty::Type, + lhs: &sync::Arc, rhs_entity: ir::Entity, - rhs: &ty::Type, - result: &ty::Type, -) -> Inference { + rhs: &sync::Arc, + result: &sync::Arc, +) -> Result { if lhs == rhs { - Inference::Type(result.clone()) + Ok(result.clone()) } else { - Inference::Error(ty::error::Error { + Err(ty::error::Error { expected: ty::error::ExpectedType::Specific(lhs.clone()), actual: rhs.clone(), main_entity: rhs_entity, @@ -441,15 +360,15 @@ fn if_eq_then( fn bool_op( lhs_entity: ir::Entity, - lhs: &ty::Type, + lhs: &sync::Arc, rhs_entity: ir::Entity, - rhs: &ty::Type, -) -> Inference { + rhs: &sync::Arc, +) -> Result { if *lhs == *BOOL_TYPE { if *rhs == *BOOL_TYPE { - Inference::Type(BOOL_TYPE.clone()) + Ok(BOOL_TYPE.clone()) } else { - Inference::Error(ty::error::Error { + Err(ty::error::Error { expected: ty::error::ExpectedType::Specific(BOOL_TYPE.clone()), actual: rhs.clone(), main_entity: rhs_entity, @@ -460,7 +379,7 @@ fn bool_op( }) } } else { - Inference::Error(ty::error::Error { + Err(ty::error::Error { expected: ty::error::ExpectedType::Specific(BOOL_TYPE.clone()), actual: lhs.clone(), main_entity: lhs_entity, @@ -474,15 +393,15 @@ fn bool_op( fn or_op( lhs_entity: ir::Entity, - lhs: &ty::Type, + lhs: &sync::Arc, rhs_entity: ir::Entity, - rhs: &ty::Type, -) -> Inference { - if let ty::Type::Union(u) = lhs { - if let ty::Type::Symbol(ref symbol) = rhs { - Inference::Type(ty::Type::Union(u.clone().with(symbol))) + rhs: &sync::Arc, +) -> Result { + if let ty::Type::Union(ref u) = **lhs { + if let ty::Type::Symbol(ref symbol) = **rhs { + Ok(sync::Arc::new(ty::Type::Union(u.clone().with(symbol)))) } else { - Inference::Error(ty::error::Error { + Err(ty::error::Error { expected: ty::error::ExpectedType::ScalarClass(ty::class::Scalar::Symbol), actual: rhs.clone(), main_entity: rhs_entity, @@ -494,9 +413,9 @@ fn or_op( } } else if *lhs == *BOOL_TYPE { if *rhs == *BOOL_TYPE { - Inference::Type(BOOL_TYPE.clone()) + Ok(BOOL_TYPE.clone()) } else { - Inference::Error(ty::error::Error { + Err(ty::error::Error { expected: ty::error::ExpectedType::Specific(BOOL_TYPE.clone()), actual: rhs.clone(), main_entity: rhs_entity, @@ -507,7 +426,7 @@ fn or_op( }) } } else { - Inference::Error(ty::error::Error { + Err(ty::error::Error { expected: ty::error::ExpectedType::AnyOf(vec![ ty::error::ExpectedType::Specific(BOOL_TYPE.clone()), ty::error::ExpectedType::Union, @@ -522,10 +441,14 @@ fn or_op( } } -fn if_integral_then(entity: ir::Entity, ty: &ty::Type, result: &ty::Type) -> Inference { +fn if_integral_then( + entity: ir::Entity, + ty: &sync::Arc, + result: sync::Arc, +) -> Result { match ty.scalar_class() { - ty::class::Scalar::Integral(_) => Inference::Type(result.clone()), - _ => Inference::Error(ty::error::Error { + ty::class::Scalar::Integral(_) => Ok(result), + _ => Err(ty::error::Error { expected: ty::error::ExpectedType::ScalarClass(ty::class::Scalar::Integral( ty::class::IntegralScalar::Any, )), @@ -538,18 +461,18 @@ fn if_integral_then(entity: ir::Entity, ty: &ty::Type, result: &ty::Type) -> Inf fn if_integral_and_eq_then( lhs_entity: ir::Entity, - lhs: &ty::Type, + lhs: &sync::Arc, rhs_entity: ir::Entity, - rhs: &ty::Type, - expected: &ty::Type, - result: &ty::Type, -) -> Inference { + rhs: &sync::Arc, + expected: &sync::Arc, + result: sync::Arc, +) -> Result { match lhs.scalar_class() { ty::class::Scalar::Integral(_) => { if rhs == expected { - Inference::Type(result.clone()) + Ok(result) } else { - Inference::Error(ty::error::Error { + Err(ty::error::Error { expected: ty::error::ExpectedType::Specific(expected.clone()), actual: rhs.clone(), main_entity: rhs_entity, @@ -560,7 +483,7 @@ fn if_integral_and_eq_then( }) } } - _ => Inference::Error(ty::error::Error { + _ => Err(ty::error::Error { expected: ty::error::ExpectedType::ScalarClass(ty::class::Scalar::Integral( ty::class::IntegralScalar::Any, )), @@ -574,10 +497,14 @@ fn if_integral_and_eq_then( } } -fn if_fractional_then(entity: ir::Entity, ty: &ty::Type, result: &ty::Type) -> Inference { +fn if_fractional_then( + entity: ir::Entity, + ty: &sync::Arc, + result: sync::Arc, +) -> Result { match ty.scalar_class() { - ty::class::Scalar::Fractional => Inference::Type(result.clone()), - _ => Inference::Error(ty::error::Error { + ty::class::Scalar::Fractional => Ok(result), + _ => Err(ty::error::Error { expected: ty::error::ExpectedType::ScalarClass(ty::class::Scalar::Fractional), actual: ty.clone(), main_entity: entity, diff --git a/src/ty/mod.rs b/src/ty/mod.rs index 37ffa26..82890ea 100644 --- a/src/ty/mod.rs +++ b/src/ty/mod.rs @@ -1,7 +1,9 @@ use std::collections; use std::fmt; +use std::sync; pub mod class; +pub mod db; pub mod error; pub mod infer; @@ -37,7 +39,7 @@ pub struct Symbol { #[derive(Clone, Debug, Eq, PartialEq)] pub struct Tuple { - pub fields: Vec, + pub fields: Vec>, } #[derive(Clone, Debug, Eq, PartialEq)] @@ -47,13 +49,13 @@ pub struct Union { #[derive(Clone, Debug, Eq, PartialEq)] pub struct Record { - pub fields: collections::HashMap, + pub fields: collections::HashMap>, } #[derive(Clone, Debug, Eq, PartialEq)] pub struct Function { - pub parameters: Vec, - pub result: Box, + pub parameters: Vec>, + pub result: sync::Arc, } impl Type { From 747ab39aa54b1735ec3680264c86a00f83328cde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Flemstr=C3=B6m?= Date: Thu, 18 Apr 2019 11:56:07 +0200 Subject: [PATCH 04/22] Arc a lot of things --- Cargo.lock | 109 ++++-- src/interpreter/mod.rs | 8 +- src/ir/builder.rs | 68 ++-- src/ir/db.rs | 21 +- src/ir/element.rs | 16 +- src/ir/mod.rs | 28 +- src/ir/world.rs | 11 - src/layout/infer.rs | 22 +- src/layout/mod.rs | 3 +- src/lib.rs | 1 - src/syntax/ast/map_context.rs | 115 +++--- src/syntax/ast/mod.rs | 46 +-- src/syntax/parser/grammar.lalrpop | 32 +- src/syntax/parser/mod.rs | 558 +++++++++++++++--------------- src/ty/db.rs | 14 + src/ty/infer.rs | 108 +++--- src/ty/mod.rs | 14 +- src/value.rs | 22 +- 18 files changed, 661 insertions(+), 535 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 07cf16d..55d1c78 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -72,7 +72,7 @@ dependencies = [ "backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-demangle 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -395,7 +395,7 @@ name = "ctor" version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -405,7 +405,7 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -415,7 +415,7 @@ version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -445,7 +445,7 @@ dependencies = [ "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", - "strsim 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "strsim 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -522,7 +522,7 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)", "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -568,6 +568,15 @@ dependencies = [ "typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "hashbrown" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "heck" version = "0.3.1" @@ -598,6 +607,14 @@ name = "indexmap" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "itertools" +version = "0.7.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "either 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "itertools" version = "0.8.0" @@ -684,6 +701,14 @@ dependencies = [ "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "matrixmultiply" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rawpointer 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "memchr" version = "2.2.0" @@ -699,6 +724,17 @@ name = "mopa" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "ndarray" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "itertools 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)", + "matrixmultiply 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", + "num-complex 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "new_debug_unreachable" version = "1.0.3" @@ -714,6 +750,14 @@ name = "nonzero_signed" version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "num-complex" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "num-integer" version = "0.1.39" @@ -919,7 +963,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "quote" -version = "0.6.11" +version = "0.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1055,6 +1099,11 @@ dependencies = [ "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rawpointer" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "rayon" version = "1.0.3" @@ -1086,7 +1135,7 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.1.53" +version = "0.1.54" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1094,7 +1143,7 @@ name = "redox_termios" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "redox_syscall 0.1.53 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1135,7 +1184,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "rustc-demangle" -version = "0.1.13" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1181,7 +1230,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1225,7 +1274,7 @@ version = "1.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1268,7 +1317,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1323,7 +1372,7 @@ name = "specs-visitor-derive" version = "0.3.0" dependencies = [ "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "specs 0.14.3 (registry+https://github.com/rust-lang/crates.io-index)", "specs-visitor 0.3.0", "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1356,7 +1405,7 @@ dependencies = [ "phf_generator 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", "phf_shared 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1372,8 +1421,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "strsim" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "ndarray 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "structopt" @@ -1391,7 +1444,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1411,7 +1464,7 @@ version = "0.15.30" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1429,7 +1482,7 @@ version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1467,7 +1520,7 @@ version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.53 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1493,7 +1546,7 @@ version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.53 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1711,10 +1764,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" "checksum gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)" = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2" "checksum generic-array 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3c0f28c2f5bfb5960175af447a2da7c18900693738343dc896ffbcabd9839592" +"checksum hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3bae29b6653b3412c2e71e9d486db9f9df5d701941d86683005efb9f2d28e3da" "checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" "checksum hibitset 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6527bc88f32e0d3926c7572874b2bf17a19b36978aacd0aacf75f7d27a5992d0" "checksum humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ca7e5f2e110db35f93b837c81797f3714500b81d517bf20c431b16d3ca4f114" "checksum indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7e81a7c05f79578dbc15793d8b619db9ba32b4577003ef3af1a91c416798c58d" +"checksum itertools 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0d47946d458e94a1b7bcabbf6521ea7c037062c81f534615abcad76e84d4970d" "checksum itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5b8467d9c1cebe26feb08c640139247fac215782d35371ade9a2136ed6085358" "checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" @@ -1725,12 +1780,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c" "checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" "checksum mach 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "86dd2487cdfea56def77b88438a2c915fb45113c5319bfe7e14306ca4cd0b0e1" +"checksum matrixmultiply 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "dcad67dcec2d58ff56f6292582377e6921afdf3bfbd533e26fb8900ae575e002" "checksum memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2efc7bc57c883d4a4d6e3246905283d8dae951bb3bd32f49d6ef297f546e1c39" "checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3" "checksum mopa 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a785740271256c230f57462d3b83e52f998433a7062fc18f96d5999474a9f915" +"checksum ndarray 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7cf380a8af901ad627594013a3bbac903ae0a6f94e176e47e46b5bbc1877b928" "checksum new_debug_unreachable 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f40f005c60db6e03bae699e414c58bf9aa7ea02a2d0b9bfbcf19286cc4c82b30" "checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" "checksum nonzero_signed 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "02783a0482333b0d3f5f5411b8fb60454a596696da041da0470ac9ef3e6e37d8" +"checksum num-complex 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "107b9be86cd2481930688277b675b0114578227f034674726605b8a482d8baf8" "checksum num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "e83d528d2677f0518c570baf2b7abdcf0cd2d248860b68507bdcb3e91d4c0cea" "checksum num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31" "checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1" @@ -1756,7 +1814,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)" = "4d317f9caece796be1980837fd5cb3dfec5613ebdb04ad0956deea83ce168915" "checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" "checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" -"checksum quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)" = "cdd8e04bd9c52e0342b406469d494fcb033be4bdbe5c606016defbb1681411e1" +"checksum quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "faf4799c5d274f3868a4aae320a0a182cbd2baee377b378f080e16a23e9d80db" "checksum rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" "checksum rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9" "checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" @@ -1770,16 +1828,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" "checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" "checksum raw-cpuid 6.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "30a9d219c32c9132f7be513c18be77c9881c7107d2ab5569d205a6a0f0e6dc7d" +"checksum rawpointer 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ebac11a9d2e11f2af219b8b8d833b76b1ea0e054aa0e8d8e9e4cbde353bdf019" "checksum rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "373814f27745b2686b350dd261bfd24576a6fb0e2c5919b3a2b6005f820b0473" "checksum rayon-core 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b055d1e92aba6877574d8fe604a63c8b5df60f60e5982bf7ccbb1338ea527356" "checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" -"checksum redox_syscall 0.1.53 (registry+https://github.com/rust-lang/crates.io-index)" = "53848511b7ee6eb9d5c3db48481aaa5779b38fc0131bc133c98cb4f2b2411928" +"checksum redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)" = "12229c14a0f65c4f1cb046a3b52047cdd9da1f4b30f8a39c5063c8bae515e252" "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" "checksum regex 1.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "559008764a17de49a3146b234641644ed37d118d1ef641a0bb573d146edc6ce0" "checksum regex-syntax 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)" = "dcfd8681eebe297b81d98498869d4aae052137651ad7b96822f09ceb690d0a96" "checksum region 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ace21a7fc79cffefeb66f2cc3ef22c7687015023bf7f85bec8840f0d46cb51cc" "checksum relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0e7790c7f1cc73d831d28dc5a7deb316a006e7848e6a7f467cdb10a0a9e0fb1c" -"checksum rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "adacaae16d02b6ec37fdc7acfcddf365978de76d1983d3ee22afc260e1ca9619" +"checksum rustc-demangle 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "ccc78bfd5acd7bf3e89cffcf899e5cb1a52d6fafa8dec2739ad70c9577a57288" "checksum rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7540fc8b0c49f096ee9c961cda096467dce8084bec6bdca2fc83895fd9b28cb8" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" "checksum ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "eb9e9b8cde282a9fe6a42dd4681319bfb63f121b8a8ee9439c6f4107e58a46f7" @@ -1804,7 +1863,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum string_cache_codegen 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1eea1eee654ef80933142157fdad9dd8bc43cf7c74e999e369263496f04ff4da" "checksum string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b1884d1bc09741d466d9b14e6d37ac89d6909cbcac41dd9ae982d4d063bbedfc" "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" -"checksum strsim 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a7be23478587f30ca7b4b423b6bee7baf5b6986c1e511bf1904a984cb6105621" +"checksum strsim 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "34ac666ab1423aa93bbd4cd47b6e62db5a846df4e28b959d823776eed5b57643" "checksum structopt 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)" = "3d0760c312538987d363c36c42339b55f5ee176ea8808bbe4543d484a291c8d1" "checksum structopt-derive 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)" = "528aeb7351d042e6ffbc2a6fb76a86f9b622fdf7c25932798e7a82cb03bc94c6" "checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" diff --git a/src/interpreter/mod.rs b/src/interpreter/mod.rs index 9e38a3b..2f12d85 100644 --- a/src/interpreter/mod.rs +++ b/src/interpreter/mod.rs @@ -18,8 +18,8 @@ pub fn eval( match element { element::Element::Number(v) => Ok(Some(value::Value::number(eval_number(v)))), element::Element::String(ref v) => Ok(Some(value::Value::string(v.as_str()))), - element::Element::Symbol(element::Symbol { ref label }) => { - Ok(Some(value::Value::symbol(label.as_str()))) + element::Element::Symbol(element::Symbol { label }) => { + Ok(Some(value::Value::symbol(db.lookup_ident(*label)))) } element::Element::Tuple(element::Tuple { ref fields }) => Ok(fields .iter() @@ -28,7 +28,7 @@ pub fn eval( .map(|fields| value::Value::tuple(value::Tuple { fields }))), element::Element::Record(element::Record { ref fields }) => Ok(fields .iter() - .map(|(k, f)| Ok(db.entity_value(*f)?.map(|v| (k.clone(), v)))) + .map(|(k, f)| Ok(db.entity_value(*f)?.map(|v| (db.lookup_ident(*k), v)))) .collect::>, error::Error>>()? .map(|fields| value::Value::record(value::Record { fields }))), element::Element::UnOp(element::UnOp { operator, operand }) => transpose( @@ -48,7 +48,7 @@ pub fn eval( } element::Element::Select(element::Select { record, field }) => { transpose(db.entity_value(*record)?.map(|record| match record.case() { - value::Case::Record(r) => Ok(r.fields[field].clone()), + value::Case::Record(r) => Ok(r.fields[&db.lookup_ident(*field)].clone()), other => Err(error::Error::RuntimeTypeConflict(format!( "not a record: {:?}", other diff --git a/src/ir/builder.rs b/src/ir/builder.rs index e226a4f..01c45b5 100644 --- a/src/ir/builder.rs +++ b/src/ir/builder.rs @@ -16,10 +16,11 @@ where { world: W, symbol: Vec, - current_scope: collections::HashMap, - scopes: Vec>, - current_captures: collections::HashMap, - captures: Vec>, + current_closure: Option, + current_scope: collections::HashMap, + scopes: Vec>, + current_captures: collections::HashMap, + captures: Vec>, } impl Builder @@ -45,22 +46,25 @@ where pub fn add_module( &mut self, + db: impl ir::db::IrDb, entity: ir::Entity, ast: &ast::Module, ) -> Result<(), error::Error> { let mut variables = collections::HashMap::new(); + for variable in &ast.variables { - let var_entity = self.world.create_entity(); + let ident = db.ident(variable.name.value.clone()); + let var_entity = db.entity(Some(entity), ident); self.current_scope - .insert(variable.name.value.clone(), var_entity); + .insert(ident, var_entity); - variables.insert(variable.name.value.clone(), var_entity); + variables.insert(ident, var_entity); } for variable in &ast.variables { - let name = &variable.name.value; - self.add_variable(variables[name], variable)?; + let ident = db.ident(variable.name.value.clone()); + self.add_variable(db, variables[&ident], variable)?; } self.world.set_element( @@ -77,23 +81,24 @@ where fn add_identifier( &mut self, + db: impl ir::db::IrDb, entity: ir::Entity, identifier: &ast::Identifier, ) -> Result<(), error::Error> { - let name = &identifier.value; + let ident = db.ident(identifier.value.clone()); - let definition = self.current_scope.get(name).cloned().or_else(|| { + let definition = self.current_scope.get(&ident).cloned().or_else(|| { self.scopes .iter() .rev() - .flat_map(|scope| scope.get(name).cloned().into_iter()) + .flat_map(|scope| scope.get(&ident).cloned().into_iter()) .next() .map(|e| { - let capture = self.world.create_entity(); + let capture = db.child_entity(entity, ident); self.world.set_element( capture, element::Element::Capture(element::Capture { - name: name.clone(), + name: ident, captured: e, }), ); @@ -122,27 +127,29 @@ where fn add_expression( &mut self, + db: impl ir::db::IrDb, entity: ir::Entity, expression: &ast::Expression, ) -> Result<(), error::Error> { match *expression { - ast::Expression::NumberLiteral(ref v) => self.add_number(entity, v), - ast::Expression::StringLiteral(ref v) => self.add_string(entity, v), - ast::Expression::Symbol(ref v) => self.add_symbol(entity, v), - ast::Expression::Tuple(ref v) => self.add_tuple(entity, v), - ast::Expression::Record(ref v) => self.add_record(entity, v), - ast::Expression::UnOp(ref v) => self.add_un_op(entity, v), - ast::Expression::BiOp(ref v) => self.add_bi_op(entity, v), - ast::Expression::Identifier(ref v) => self.add_identifier(entity, v), - ast::Expression::Lambda(ref v) => self.add_lambda(entity, v), - ast::Expression::Select(ref v) => self.add_select(entity, v), - ast::Expression::Apply(ref v) => self.add_apply(entity, v), + ast::Expression::NumberLiteral(ref v) => self.add_number(db, entity, v), + ast::Expression::StringLiteral(ref v) => self.add_string(db, entity, v), + ast::Expression::Symbol(ref v) => self.add_symbol(db, entity, v), + ast::Expression::Tuple(ref v) => self.add_tuple(db, entity, v), + ast::Expression::Record(ref v) => self.add_record(db, entity, v), + ast::Expression::UnOp(ref v) => self.add_un_op(db, entity, v), + ast::Expression::BiOp(ref v) => self.add_bi_op(db, entity, v), + ast::Expression::Identifier(ref v) => self.add_identifier(db, entity, v), + ast::Expression::Lambda(ref v) => self.add_lambda(db, entity, v), + ast::Expression::Select(ref v) => self.add_select(db, entity, v), + ast::Expression::Apply(ref v) => self.add_apply(db, entity, v), ast::Expression::Unknown => panic!("'unknown' AST nodes should not escape the parser"), } } fn add_number( &mut self, + db: impl ir::db::IrDb, entity: ir::Entity, number: &ast::NumberLiteral, ) -> Result<(), error::Error> { @@ -159,6 +166,7 @@ where fn add_string( &mut self, + db: impl ir::db::IrDb, entity: ir::Entity, string: &ast::StringLiteral, ) -> Result<(), error::Error> { @@ -180,6 +188,7 @@ where fn add_tuple( &mut self, + db: impl ir::db::IrDb, entity: ir::Entity, tuple: &ast::Tuple, ) -> Result<(), error::Error> { @@ -204,6 +213,7 @@ where fn add_symbol( &mut self, + db: impl ir::db::IrDb, entity: ir::Entity, symbol: &ast::Symbol, ) -> Result<(), error::Error> { @@ -220,6 +230,7 @@ where fn add_record( &mut self, + db: impl ir::db::IrDb, entity: ir::Entity, record: &ast::Record, ) -> Result<(), error::Error> { @@ -244,6 +255,7 @@ where fn add_un_op( &mut self, + db: impl ir::db::IrDb, entity: ir::Entity, un_op: &ast::UnOp, ) -> Result<(), error::Error> { @@ -265,6 +277,7 @@ where fn add_bi_op( &mut self, + db: impl ir::db::IrDb, entity: ir::Entity, bi_op: &ast::BiOp, ) -> Result<(), error::Error> { @@ -289,6 +302,7 @@ where fn add_lambda( &mut self, + db: impl ir::db::IrDb, entity: ir::Entity, lambda: &ast::Lambda, ) -> Result<(), error::Error> { @@ -368,6 +382,7 @@ where fn add_variable( &mut self, + db: impl ir::db::IrDb, entity: ir::Entity, variable: &ast::Variable, ) -> Result<(), error::Error> { @@ -397,6 +412,7 @@ where fn add_select( &mut self, + db: impl ir::db::IrDb, entity: ir::Entity, select: &ast::Select, ) -> Result<(), error::Error> { @@ -418,6 +434,7 @@ where fn add_apply( &mut self, + db: impl ir::db::IrDb, entity: ir::Entity, apply: &ast::Apply, ) -> Result<(), error::Error> { @@ -450,6 +467,7 @@ where fn add_parameter( &mut self, + db: impl ir::db::IrDb, entity: ir::Entity, parameter: &ast::Parameter, ) -> Result<(), error::Error> { diff --git a/src/ir/db.rs b/src/ir/db.rs index 221c9c4..0e99a1a 100644 --- a/src/ir/db.rs +++ b/src/ir/db.rs @@ -9,8 +9,16 @@ use crate::syntax; #[salsa::query_group(Ir)] pub trait IrDb: salsa::Database + syntax::db::SyntaxDb { + #[salsa::interned] + fn ident(&self, id: sync::Arc) -> ir::Ident; + + #[salsa::interned] + fn entity(&self, parent: Option, ident: ir::Ident) -> ir::Entity; + fn entity_element(&self, entity: ir::Entity) -> sync::Arc; + fn entity_location(&self, entity: ir::Entity) -> sync::Arc; + fn entity_symbol(&self, entity: ir::Entity) -> sync::Arc; fn entities(&self) -> sync::Arc; @@ -28,6 +36,15 @@ fn entity_symbol(_ir: &impl IrDb, _entity: ir::Entity) -> sync::Arc sync::Arc { - unimplemented!() +fn entities(ir: &impl IrDb) -> sync::Arc { + let mut entities = ir::Entities::new(); + for source_root_id in &*ir.all_source_roots() { + for file in ir.source_root(*source_root_id).files.values() { + let result = ir.parse(*file).unwrap(); + + //let mut builder = ir::builder::Builder::new(&mut entities); + //builder.add_module(&*result).unwrap(); + } + } + sync::Arc::new(entities) } diff --git a/src/ir/element.rs b/src/ir/element.rs index 6f9fc19..7684cd2 100644 --- a/src/ir/element.rs +++ b/src/ir/element.rs @@ -37,7 +37,7 @@ pub enum Number { #[derive(Clone, Debug, Eq, PartialEq)] pub struct Symbol { - pub label: String, + pub label: ir::Ident, } #[derive(Clone, Debug, Eq, PartialEq)] @@ -47,7 +47,7 @@ pub struct Tuple { #[derive(Clone, Debug, Eq, PartialEq)] pub struct Record { - pub fields: collections::HashMap, + pub fields: collections::HashMap, } /// An unary operator. @@ -165,14 +165,14 @@ pub struct BiOp { #[derive(Clone, Debug, Eq, PartialEq)] pub struct Variable { - pub name: String, + pub name: ir::Ident, pub initializer: ir::Entity, } #[derive(Clone, Debug, Eq, PartialEq)] pub struct Select { pub record: ir::Entity, - pub field: String, + pub field: ir::Ident, } #[derive(Clone, Debug, Eq, PartialEq)] @@ -183,19 +183,19 @@ pub struct Apply { #[derive(Clone, Debug, Eq, PartialEq)] pub struct Parameter { - pub name: String, + pub name: ir::Ident, pub signature: ir::Entity, } #[derive(Clone, Debug, Eq, PartialEq)] pub struct Capture { - pub name: String, + pub name: ir::Ident, pub captured: ir::Entity, } #[derive(Clone, Debug, Eq, PartialEq)] pub struct Closure { - pub captures: collections::HashMap, + pub captures: collections::HashMap, pub parameters: Vec, pub statements: Vec, pub signature: ir::Entity, @@ -204,7 +204,7 @@ pub struct Closure { #[derive(Clone, Debug, Eq, PartialEq)] pub struct Module { - pub variables: collections::HashMap, + pub variables: collections::HashMap, } impl fmt::Display for UnOperator { diff --git a/src/ir/mod.rs b/src/ir/mod.rs index ff50cbc..4f47336 100644 --- a/src/ir/mod.rs +++ b/src/ir/mod.rs @@ -1,7 +1,7 @@ //! Intermediate representation variables for the compiler and interpreter. use std::collections; -pub mod builder; +// pub mod builder; pub mod db; pub mod element; pub mod error; @@ -11,6 +11,9 @@ pub mod world; //#[cfg(test)] //mod tests; +#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] +pub struct Ident(u32); + #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] pub struct Entity(u32); @@ -19,12 +22,25 @@ pub struct Entities { elements: collections::HashMap, locations: collections::HashMap, symbols: collections::HashMap, - next_entity: u32, } -impl Entity { - pub fn new(id: u32) -> Self { - Self(id) +impl salsa::InternKey for Ident { + fn from_intern_id(v: salsa::InternId) -> Self { + Ident(v.as_u32()) + } + + fn as_intern_id(&self) -> salsa::InternId { + salsa::InternId::from(self.0) + } +} + +impl salsa::InternKey for Entity { + fn from_intern_id(v: salsa::InternId) -> Self { + Entity(v.as_u32()) + } + + fn as_intern_id(&self) -> salsa::InternId { + salsa::InternId::from(self.0) } } @@ -33,13 +49,11 @@ impl Entities { let elements = collections::HashMap::new(); let locations = collections::HashMap::new(); let symbols = collections::HashMap::new(); - let next_entity = 0; Self { elements, locations, symbols, - next_entity, } } } diff --git a/src/ir/world.rs b/src/ir/world.rs index 2983da3..77e734f 100644 --- a/src/ir/world.rs +++ b/src/ir/world.rs @@ -4,7 +4,6 @@ use crate::ir::location; use crate::ir::symbol; pub trait World { - fn create_entity(&mut self) -> ir::Entity; fn set_element(&mut self, entity: ir::Entity, element: element::Element); fn set_location(&mut self, entity: ir::Entity, location: location::Location); fn set_symbol(&mut self, entity: ir::Entity, symbol: symbol::Symbol); @@ -15,10 +14,6 @@ impl<'a, W> World for &'a mut W where W: World, { - fn create_entity(&mut self) -> ir::Entity { - (*self).create_entity() - } - fn set_element(&mut self, entity: ir::Entity, element: element::Element) { (*self).set_element(entity, element) } @@ -37,12 +32,6 @@ where } impl World for ir::Entities { - fn create_entity(&mut self) -> ir::Entity { - let entity = ir::Entity::new(self.next_entity); - self.next_entity += 1; - entity - } - fn set_element(&mut self, entity: ir::Entity, element: element::Element) { unimplemented!() } diff --git a/src/layout/infer.rs b/src/layout/infer.rs index 94f8e75..4ba00e9 100644 --- a/src/layout/infer.rs +++ b/src/layout/infer.rs @@ -41,7 +41,7 @@ impl System { element::Element::Variable(element::Variable { initializer, .. }) => { self.infer_variable_layout(initializer, db) } - element::Element::Select(element::Select { record, ref field }) => { + element::Element::Select(element::Select { record, field }) => { self.infer_select_layout(record, field, db) } element::Element::Apply(element::Apply { @@ -117,18 +117,19 @@ impl System { fn infer_record_layout( &self, - fields: &collections::HashMap, + fields: &collections::HashMap, db: impl layout::db::LayoutDb, ) -> sync::Arc { let mut layouts = fields .iter() - .map(|(n, f)| (n, db.entity_layout(*f))) + .map(|(n, f)| (*n, db.entity_layout(*f))) .collect::>(); if layouts.is_empty() { sync::Arc::new(layout::Layout::zero()) } else { - layouts.sort_unstable_by_key(|(n, l)| (usize::max_value() - l.size, n.as_str())); + layouts + .sort_unstable_by_key(|(n, l)| (usize::max_value() - l.size, db.lookup_ident(*n))); let alignment = layouts.iter().map(|(_, l)| l.alignment).max().unwrap(); let mut size = 0; @@ -233,12 +234,12 @@ impl System { fn infer_select_layout( &self, record: ir::Entity, - field: &str, + field: ir::Ident, db: impl layout::db::LayoutDb, ) -> sync::Arc { match *db.entity_element(record) { element::Element::Record(element::Record { ref fields }) => { - if let Some(f) = fields.get(field) { + if let Some(f) = fields.get(&field) { db.entity_layout(*f) } else { panic!("field does not exist") @@ -317,19 +318,20 @@ impl System { fn infer_closure_layout( &self, - captures: &collections::HashMap, + captures: &collections::HashMap, db: impl layout::db::LayoutDb, ) -> sync::Arc { let mut capture_layouts = captures .iter() - .map(|(n, f)| (n, db.entity_layout(*f))) + .map(|(n, f)| (*n, db.entity_layout(*f))) .collect::>(); let unnamed_fields = vec![layout::Offset { offset: 0, layout: layout::Layout::scalar(self.ptr_size), }]; - capture_layouts.sort_unstable_by_key(|(n, l)| (usize::max_value() - l.size, n.as_str())); + capture_layouts + .sort_unstable_by_key(|(n, l)| (usize::max_value() - l.size, db.lookup_ident(*n))); let alignment = capture_layouts .iter() .map(|(_, l)| l.alignment) @@ -363,7 +365,7 @@ impl System { fn infer_module_layout( &self, - _variables: &collections::HashMap, + _variables: &collections::HashMap, db: impl layout::db::LayoutDb, ) -> sync::Arc { // TODO diff --git a/src/layout/mod.rs b/src/layout/mod.rs index 435d24a..1a3ab0f 100644 --- a/src/layout/mod.rs +++ b/src/layout/mod.rs @@ -1,3 +1,4 @@ +use crate::ir; use std::fmt; pub mod db; @@ -13,7 +14,7 @@ pub struct Layout { #[derive(Clone, Debug, Eq, PartialEq)] pub struct NamedField { - pub field: String, + pub field: ir::Ident, pub offset_layout: Offset, } diff --git a/src/lib.rs b/src/lib.rs index 7d1626b..c8c9c8c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -30,7 +30,6 @@ //! # } //! ``` #![feature(const_fn, const_vec_new)] - // #![deny(nonstandard_style, warnings, unused)] #![deny(nonstandard_style)] #![deny( diff --git a/src/syntax/ast/map_context.rs b/src/syntax/ast/map_context.rs index fe5820c..69d45c7 100644 --- a/src/syntax/ast/map_context.rs +++ b/src/syntax/ast/map_context.rs @@ -1,5 +1,6 @@ //! AST node context mapping helpers. use std::fmt; +use std::sync; use crate::syntax::ast; use crate::syntax::ast::ast_node; @@ -20,8 +21,8 @@ pub trait MapContext: ast_node::AstNode { impl MapContext for ast::Module where - C1: fmt::Debug, - C2: fmt::Debug, + C1: Clone + fmt::Debug, + C2: Clone + fmt::Debug, { type Output = ast::Module; @@ -33,7 +34,7 @@ where let variables = self .variables .into_iter() - .map(|v| v.map_context(mapping)) + .map(|v| sync::Arc::new(own(v).map_context(mapping))) .collect(); ast::Module { context, variables } @@ -42,8 +43,8 @@ where impl MapContext for ast::Identifier where - C1: fmt::Debug, - C2: fmt::Debug, + C1: Clone + fmt::Debug, + C2: Clone + fmt::Debug, { type Output = ast::Identifier; @@ -60,8 +61,8 @@ where impl MapContext for ast::Expression where - C1: fmt::Debug, - C2: fmt::Debug, + C1: Clone + fmt::Debug, + C2: Clone + fmt::Debug, { type Output = ast::Expression; @@ -92,8 +93,8 @@ where impl MapContext for ast::NumberLiteral where - C1: fmt::Debug, - C2: fmt::Debug, + C1: Clone + fmt::Debug, + C2: Clone + fmt::Debug, { type Output = ast::NumberLiteral; @@ -109,8 +110,8 @@ where impl MapContext for ast::StringLiteral where - C1: fmt::Debug, - C2: fmt::Debug, + C1: Clone + fmt::Debug, + C2: Clone + fmt::Debug, { type Output = ast::StringLiteral; @@ -126,8 +127,8 @@ where impl MapContext for ast::Symbol where - C1: fmt::Debug, - C2: fmt::Debug, + C1: Clone + fmt::Debug, + C2: Clone + fmt::Debug, { type Output = ast::Symbol; @@ -143,8 +144,8 @@ where impl MapContext for ast::Tuple where - C1: fmt::Debug, - C2: fmt::Debug, + C1: Clone + fmt::Debug, + C2: Clone + fmt::Debug, { type Output = ast::Tuple; @@ -156,7 +157,7 @@ where let fields = self .fields .into_iter() - .map(|f| f.map_context(mapping)) + .map(|f| sync::Arc::new(own(f).map_context(mapping))) .collect(); ast::Tuple { context, fields } } @@ -164,8 +165,8 @@ where impl MapContext for ast::Record where - C1: fmt::Debug, - C2: fmt::Debug, + C1: Clone + fmt::Debug, + C2: Clone + fmt::Debug, { type Output = ast::Record; @@ -177,7 +178,12 @@ where let fields = self .fields .into_iter() - .map(|(i, f)| (i.map_context(mapping), f.map_context(mapping))) + .map(|(i, f)| { + ( + sync::Arc::new(own(i).map_context(mapping)), + sync::Arc::new(own(f).map_context(mapping)), + ) + }) .collect(); ast::Record { context, fields } } @@ -185,8 +191,8 @@ where impl MapContext for ast::UnOp where - C1: fmt::Debug, - C2: fmt::Debug, + C1: Clone + fmt::Debug, + C2: Clone + fmt::Debug, { type Output = ast::UnOp; @@ -196,7 +202,7 @@ where { let context = mapping(self.context); let operator = self.operator; - let operand = Box::new(self.operand.map_context(mapping)); + let operand = sync::Arc::new(own(self.operand).map_context(mapping)); ast::UnOp { context, operator, @@ -207,8 +213,8 @@ where impl MapContext for ast::BiOp where - C1: fmt::Debug, - C2: fmt::Debug, + C1: Clone + fmt::Debug, + C2: Clone + fmt::Debug, { type Output = ast::BiOp; @@ -217,9 +223,9 @@ where F: FnMut(C1) -> C2, { let context = mapping(self.context); - let lhs = Box::new(self.lhs.map_context(mapping)); + let lhs = sync::Arc::new(own(self.lhs).map_context(mapping)); let operator = self.operator; - let rhs = Box::new(self.rhs.map_context(mapping)); + let rhs = sync::Arc::new(own(self.rhs).map_context(mapping)); ast::BiOp { context, lhs, @@ -231,8 +237,8 @@ where impl MapContext for ast::Lambda where - C1: fmt::Debug, - C2: fmt::Debug, + C1: Clone + fmt::Debug, + C2: Clone + fmt::Debug, { type Output = ast::Lambda; @@ -244,15 +250,17 @@ where let parameters = self .parameters .into_iter() - .map(|p| p.map_context(mapping)) + .map(|p| sync::Arc::new(own(p).map_context(mapping))) .collect(); - let signature = Box::new(self.signature.map_context(mapping)); + let signature = sync::Arc::new(own(self.signature).map_context(mapping)); let statements = self .statements .into_iter() - .map(|s| s.map_context(mapping)) + .map(|s| sync::Arc::new(own(s).map_context(mapping))) .collect(); - let result = self.result.map(|r| Box::new(r.map_context(mapping))); + let result = self + .result + .map(|r| sync::Arc::new(own(r).map_context(mapping))); ast::Lambda { context, @@ -266,8 +274,8 @@ where impl MapContext for ast::Statement where - C1: fmt::Debug, - C2: fmt::Debug, + C1: Clone + fmt::Debug, + C2: Clone + fmt::Debug, { type Output = ast::Statement; @@ -284,8 +292,8 @@ where impl MapContext for ast::Variable where - C1: fmt::Debug, - C2: fmt::Debug, + C1: Clone + fmt::Debug, + C2: Clone + fmt::Debug, { type Output = ast::Variable; @@ -294,8 +302,8 @@ where F: FnMut(C1) -> C2, { let context = mapping(self.context); - let name = self.name.map_context(mapping); - let initializer = self.initializer.map_context(mapping); + let name = sync::Arc::new(own(self.name).map_context(mapping)); + let initializer = sync::Arc::new(own(self.initializer).map_context(mapping)); ast::Variable { context, @@ -307,8 +315,8 @@ where impl MapContext for ast::Select where - C1: fmt::Debug, - C2: fmt::Debug, + C1: Clone + fmt::Debug, + C2: Clone + fmt::Debug, { type Output = ast::Select; @@ -317,8 +325,8 @@ where F: FnMut(C1) -> C2, { let context = mapping(self.context); - let record = Box::new(self.record.map_context(mapping)); - let field = self.field.map_context(mapping); + let record = sync::Arc::new(own(self.record).map_context(mapping)); + let field = sync::Arc::new(own(self.field).map_context(mapping)); ast::Select { context, record, @@ -329,8 +337,8 @@ where impl MapContext for ast::Apply where - C1: fmt::Debug, - C2: fmt::Debug, + C1: Clone + fmt::Debug, + C2: Clone + fmt::Debug, { type Output = ast::Apply; @@ -339,11 +347,11 @@ where F: FnMut(C1) -> C2, { let context = mapping(self.context); - let function = Box::new(self.function.map_context(mapping)); + let function = sync::Arc::new(own(self.function).map_context(mapping)); let parameters = self .parameters .into_iter() - .map(|e| e.map_context(mapping)) + .map(|e| sync::Arc::new(own(e).map_context(mapping))) .collect(); ast::Apply { context, @@ -355,8 +363,8 @@ where impl MapContext for ast::Parameter where - C1: fmt::Debug, - C2: fmt::Debug, + C1: Clone + fmt::Debug, + C2: Clone + fmt::Debug, { type Output = ast::Parameter; @@ -365,8 +373,8 @@ where F: FnMut(C1) -> C2, { let context = mapping(self.context); - let name = self.name.map_context(mapping); - let signature = self.signature.map_context(mapping); + let name = sync::Arc::new(own(self.name).map_context(mapping)); + let signature = sync::Arc::new(own(self.signature).map_context(mapping)); ast::Parameter { context, name, @@ -374,3 +382,10 @@ where } } } + +fn own(arc: sync::Arc) -> A +where + A: Clone, +{ + sync::Arc::try_unwrap(arc).unwrap_or_else(|arc| (*arc).clone()) +} diff --git a/src/syntax/ast/mod.rs b/src/syntax/ast/mod.rs index 58ce2df..4a0919d 100644 --- a/src/syntax/ast/mod.rs +++ b/src/syntax/ast/mod.rs @@ -6,6 +6,8 @@ //! //! To generically interact with the context of a node, the [`AstNode`] trait can be used. All of //! the contexts of an entire AST can additionally be transformed using the [`MapContext`] trait. +use std::sync; + mod ast_node; mod map_context; @@ -50,8 +52,8 @@ pub enum Kind { pub struct Module { /// This node's AST context. pub context: C, - /// Variable variables that are part of this module, in declaration order. - pub variables: Vec>, + /// Variables that are part of this module, in declaration order. + pub variables: Vec>>, } /// An identifier. @@ -60,7 +62,7 @@ pub struct Identifier { /// This node's AST context. pub context: C, /// The raw string name of the identifier. - pub value: String, + pub value: sync::Arc, } /// Any valid expression. @@ -153,7 +155,7 @@ pub struct Symbol { /// This node's AST context. pub context: C, /// The label of the symbol. - pub label: String, + pub label: sync::Arc, } /// A tuple expression. @@ -162,7 +164,7 @@ pub struct Tuple { /// This node's AST context. pub context: C, /// The fields of the tuple, in declaration order. - pub fields: Vec>, + pub fields: Vec>>, } /// A record expression. @@ -171,7 +173,7 @@ pub struct Record { /// This node's AST context. pub context: C, /// The fields of the record, in declaration order. - pub fields: Vec<(Identifier, Expression)>, + pub fields: Vec<(sync::Arc>, sync::Arc>)>, } /// An unary operator. @@ -211,7 +213,7 @@ pub struct UnOp { /// The unary operator that is being applied. pub operator: UnOperator, /// The operand to the operator. - pub operand: Box>, + pub operand: sync::Arc>, } /// A binary operator. @@ -284,11 +286,11 @@ pub struct BiOp { /// This node's AST context. pub context: C, /// The left-hand-side operand of the operator. - pub lhs: Box>, + pub lhs: sync::Arc>, /// The binary operator that is being applied. pub operator: BiOperator, /// The right-hand-side operand of the operator. - pub rhs: Box>, + pub rhs: sync::Arc>, } /// A lambda expression. @@ -297,13 +299,13 @@ pub struct Lambda { /// This node's AST context. pub context: C, /// The parameters of the lambda. - pub parameters: Vec>, + pub parameters: Vec>>, /// The signature of the result of the lambda. - pub signature: Box>, + pub signature: sync::Arc>, /// The statements that constitute the lambda body. - pub statements: Vec>, + pub statements: Vec>>, /// The result ("return value") of the lambda. - pub result: Option>>, + pub result: Option>>, } /// A valid statement. @@ -321,9 +323,9 @@ pub struct Variable { /// This node's AST context. pub context: C, /// The name of the variable. - pub name: Identifier, + pub name: sync::Arc>, /// The initializer expression of the variable. - pub initializer: Expression, + pub initializer: sync::Arc>, } /// A field selection expression. @@ -332,9 +334,9 @@ pub struct Select { /// This node's AST context. pub context: C, /// The expression to select from; should evaluate to a record. - pub record: Box>, + pub record: sync::Arc>, /// The field to select. - pub field: Identifier, + pub field: sync::Arc>, } /// A function application expression. @@ -343,10 +345,10 @@ pub struct Apply { /// This node's AST context. pub context: C, /// The expression to apply; should evaluate to a function. - pub function: Box>, + pub function: sync::Arc>, /// The parameters to pass in to the function; should match the function's accepted number of /// arguments. - pub parameters: Vec>, + pub parameters: Vec>>, } /// A lambda parameter declaration. @@ -355,7 +357,7 @@ pub struct Parameter { /// This node's AST context. pub context: C, /// The name of the parameter. - pub name: Identifier, - /// The signature of the parameter, if any. - pub signature: Expression, + pub name: sync::Arc>, + /// The signature of the parameter. + pub signature: sync::Arc>, } diff --git a/src/syntax/parser/grammar.lalrpop b/src/syntax/parser/grammar.lalrpop index 9656fe7..d938b40 100644 --- a/src/syntax/parser/grammar.lalrpop +++ b/src/syntax/parser/grammar.lalrpop @@ -1,3 +1,5 @@ +use std::sync; + use lalrpop_util; use crate::syntax::ast; @@ -58,12 +60,12 @@ SemiRequired0: Vec = { pub Module: ast::Module = { )>> => - ast::Module { context: parser::Context::new(ast::Kind::Module, span, lo, hi), variables: ds }, + ast::Module { context: parser::Context::new(ast::Kind::Module, span, lo, hi), variables: ds.into_iter().map(sync::Arc::new).collect() }, } Definition: ast::Variable = { "=" => - ast::Variable { context: parser::Context::new(ast::Kind::Variable, span, lo, hi), name: n, initializer: i }, + ast::Variable { context: parser::Context::new(ast::Kind::Variable, span, lo, hi), name: sync::Arc::new(n), initializer: sync::Arc::new(i) }, } pub Expression = { } @@ -166,13 +168,13 @@ UnOperator: ast::UnOperator = { UnOp: ast::UnOp = { => - ast::UnOp { context: parser::Context::new(ast::Kind::UnOp, span, lo, hi), operator, operand: Box::new(operand) }, + ast::UnOp { context: parser::Context::new(ast::Kind::UnOp, span, lo, hi), operator, operand: sync::Arc::new(operand) }, } #[inline] BiOp: ast::BiOp = { => - ast::BiOp { context: parser::Context::new(ast::Kind::BiOp, span, lo, hi), lhs: Box::new(lhs), operator, rhs: Box::new(rhs) }, + ast::BiOp { context: parser::Context::new(ast::Kind::BiOp, span, lo, hi), lhs: sync::Arc::new(lhs), operator, rhs: sync::Arc::new(rhs) }, } BiOperatorFactor: ast::BiOperator = { @@ -235,19 +237,19 @@ BiOperatorCmp: ast::BiOperator = { Identifier: ast::Identifier = { => - ast::Identifier { context: parser::Context::new(ast::Kind::Identifier, span, lo, hi), value: id.into() }, + ast::Identifier { context: parser::Context::new(ast::Kind::Identifier, span, lo, hi), value: sync::Arc::new(id.to_owned()) }, } Tuple: ast::Tuple = { "(" ")" => ast::Tuple { context: parser::Context::new(ast::Kind::Tuple, span, lo, hi), fields: vec![] }, "(" > ")" => - ast::Tuple { context: parser::Context::new(ast::Kind::Tuple, span, lo, hi), fields: fs }, + ast::Tuple { context: parser::Context::new(ast::Kind::Tuple, span, lo, hi), fields: fs.into_iter().map(sync::Arc::new).collect() }, } Record: ast::Record = { "{" > "}" => - ast::Record { context: parser::Context::new(ast::Kind::Record, span, lo, hi), fields: fs }, + ast::Record { context: parser::Context::new(ast::Kind::Record, span, lo, hi), fields: fs.into_iter().map(|(k, v)| (sync::Arc::new(k), sync::Arc::new(v))).collect() }, } Field: (ast::Identifier, ast::Expression) = { @@ -269,17 +271,17 @@ StringLiteral: ast::StringLiteral = { Symbol: ast::Symbol = { => - ast::Symbol { context: parser::Context::new(ast::Kind::Symbol, span, lo, hi), label: (&label[1..]).to_owned() }, + ast::Symbol { context: parser::Context::new(ast::Kind::Symbol, span, lo, hi), label: sync::Arc::new((&label[1..]).to_owned()) }, } Lambda: ast::Lambda = { "|" )>> "|" "->" => ast::Lambda { context: parser::Context::new(ast::Kind::Lambda, span, lo, hi), - parameters: params, - signature: Box::new(sig), - statements: body.as_ref().map(|b| b.0.clone()).unwrap_or(vec![]), - result: body.as_ref().map(|b| Box::new(b.1.clone())) + parameters: params.into_iter().map(sync::Arc::new).collect(), + signature: sync::Arc::new(sig), + statements: body.as_ref().map(|b| b.0.iter().cloned().map(sync::Arc::new).collect()).unwrap_or(vec![]), + result: body.as_ref().map(|b| sync::Arc::new(b.1.clone())) }, } @@ -294,15 +296,15 @@ Statement: ast::Statement = { Select: ast::Select = { "." => - ast::Select { context: parser::Context::new(ast::Kind::Select, span, lo, hi), record: Box::new(r), field: f }, + ast::Select { context: parser::Context::new(ast::Kind::Select, span, lo, hi), record: sync::Arc::new(r), field: sync::Arc::new(f) }, } Apply: ast::Apply = { "(" > ")" => - ast::Apply { context: parser::Context::new(ast::Kind::Apply, span, lo, hi), function: Box::new(e), parameters: p }, + ast::Apply { context: parser::Context::new(ast::Kind::Apply, span, lo, hi), function: sync::Arc::new(e), parameters: p.into_iter().map(sync::Arc::new).collect() }, } Parameter: ast::Parameter = { ":" => - ast::Parameter { context: parser::Context::new(ast::Kind::Parameter, span, lo, hi), name, signature }, + ast::Parameter { context: parser::Context::new(ast::Kind::Parameter, span, lo, hi), name: sync::Arc::new(name), signature: sync::Arc::new(signature) }, } diff --git a/src/syntax/parser/mod.rs b/src/syntax/parser/mod.rs index 49d2e0b..fdec60b 100644 --- a/src/syntax/parser/mod.rs +++ b/src/syntax/parser/mod.rs @@ -389,7 +389,7 @@ impl diagnostic::Diagnostics for Error { #[cfg(test)] mod tests { - use env_logger; + use std::sync; use crate::syntax::ast; use crate::syntax::ast::MapContext; @@ -454,7 +454,7 @@ help: valid tokens at this point: [Comment, IdentifierName] let expected = Ok(ast::Expression::Identifier(ast::Identifier { context: (), - value: "whatever".to_owned(), + value: sync::Arc::new("whatever".to_owned()), })); let actual = parse_expression("test", r#"whatever"#); assert_eq!(expected, actual); @@ -466,7 +466,7 @@ help: valid tokens at this point: [Comment, IdentifierName] let expected = Ok(ast::Expression::Identifier(ast::Identifier { context: (), - value: "なんでも".to_owned(), + value: sync::Arc::new("なんでも".to_owned()), })); let actual = parse_expression("test", r#"なんでも"#); assert_eq!(expected, actual); @@ -707,14 +707,14 @@ help: valid tokens at this point: [Comment, IdentifierName] let expected = Ok(ast::Expression::Tuple(ast::Tuple { context: (), fields: vec![ - ast::Expression::NumberLiteral(ast::NumberLiteral { + sync::Arc::new(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), value: ast::NumberValue::F64(ordered_float::OrderedFloat::from(1.0)), - }), - ast::Expression::NumberLiteral(ast::NumberLiteral { + })), + sync::Arc::new(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), value: ast::NumberValue::F64(ordered_float::OrderedFloat::from(2.0)), - }), + })), ], })); let actual = parse_expression("test", r#"(1f64, 2f64)"#); @@ -728,14 +728,14 @@ help: valid tokens at this point: [Comment, IdentifierName] let expected = Ok(ast::Expression::Tuple(ast::Tuple { context: (), fields: vec![ - ast::Expression::NumberLiteral(ast::NumberLiteral { + sync::Arc::new(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), value: ast::NumberValue::F64(ordered_float::OrderedFloat::from(1.0)), - }), - ast::Expression::NumberLiteral(ast::NumberLiteral { + })), + sync::Arc::new(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), value: ast::NumberValue::F64(ordered_float::OrderedFloat::from(2.0)), - }), + })), ], })); let actual = parse_expression("test", r#"(1f64, 2f64,)"#); @@ -748,10 +748,12 @@ help: valid tokens at this point: [Comment, IdentifierName] let expected = Ok(ast::Expression::Tuple(ast::Tuple { context: (), - fields: vec![ast::Expression::NumberLiteral(ast::NumberLiteral { - context: (), - value: ast::NumberValue::F64(ordered_float::OrderedFloat::from(1.0)), - })], + fields: vec![sync::Arc::new(ast::Expression::NumberLiteral( + ast::NumberLiteral { + context: (), + value: ast::NumberValue::F64(ordered_float::OrderedFloat::from(1.0)), + }, + ))], })); let actual = parse_expression("test", r#"(1f64,)"#); assert_eq!(expected, actual); @@ -791,28 +793,26 @@ help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", context: (), fields: vec![ ( - ast::Identifier { + sync::Arc::new(ast::Identifier { context: (), - value: "a".to_owned(), - }, - ast::Expression::NumberLiteral(ast::NumberLiteral { + value: sync::Arc::new("a".to_owned()), + }), + sync::Arc::new(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), value: ast::NumberValue::F64(ordered_float::OrderedFloat::from(1.0)), - }), + })), ), ( - ast::Identifier { + sync::Arc::new(ast::Identifier { context: (), - value: "b".to_owned(), - }, - ast::Expression::StringLiteral(ast::StringLiteral { + value: sync::Arc::new("b".to_owned()), + }), + sync::Arc::new(ast::Expression::StringLiteral(ast::StringLiteral { context: (), value: ast::StringValue::String("c".to_owned()), - }), + })), ), - ] - .into_iter() - .collect(), + ], })); let actual = parse_expression("test", r#"{a: 1f64, b: "c"}"#); assert_eq!(expected, actual); @@ -826,28 +826,26 @@ help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", context: (), fields: vec![ ( - ast::Identifier { + sync::Arc::new(ast::Identifier { context: (), - value: "a".to_owned(), - }, - ast::Expression::NumberLiteral(ast::NumberLiteral { + value: sync::Arc::new("a".to_owned()), + }), + sync::Arc::new(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), value: ast::NumberValue::F64(ordered_float::OrderedFloat::from(1.0)), - }), + })), ), ( - ast::Identifier { + sync::Arc::new(ast::Identifier { context: (), - value: "b".to_owned(), - }, - ast::Expression::StringLiteral(ast::StringLiteral { + value: sync::Arc::new("b".to_owned()), + }), + sync::Arc::new(ast::Expression::StringLiteral(ast::StringLiteral { context: (), value: ast::StringValue::String("c".to_owned()), - }), + })), ), - ] - .into_iter() - .collect(), + ], })); let actual = parse_expression("test", r#"{a: 1f64, b: "c",}"#); assert_eq!(expected, actual); @@ -860,17 +858,15 @@ help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", let expected = Ok(ast::Expression::Record(ast::Record { context: (), fields: vec![( - ast::Identifier { + sync::Arc::new(ast::Identifier { context: (), - value: "a".to_owned(), - }, - ast::Expression::NumberLiteral(ast::NumberLiteral { + value: sync::Arc::new("a".to_owned()), + }), + sync::Arc::new(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), value: ast::NumberValue::F64(ordered_float::OrderedFloat::from(1.0)), - }), - )] - .into_iter() - .collect(), + })), + )], })); let actual = parse_expression("test", r#"{a: 1f64}"#); assert_eq!(expected, actual); @@ -883,17 +879,15 @@ help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", let expected = Ok(ast::Expression::Record(ast::Record { context: (), fields: vec![( - ast::Identifier { + sync::Arc::new(ast::Identifier { context: (), - value: "a".to_owned(), - }, - ast::Expression::NumberLiteral(ast::NumberLiteral { + value: sync::Arc::new("a".to_owned()), + }), + sync::Arc::new(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), value: ast::NumberValue::F64(ordered_float::OrderedFloat::from(1.0)), - }), - )] - .into_iter() - .collect(), + })), + )], })); let actual = parse_expression("test", r#"{a: 1f64,}"#); assert_eq!(expected, actual); @@ -926,7 +920,7 @@ help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", let expected = Ok(ast::Expression::UnOp(ast::UnOp { context: (), operator: ast::UnOperator::Not, - operand: Box::new(ast::Expression::NumberLiteral(ast::NumberLiteral { + operand: sync::Arc::new(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), value: ast::NumberValue::U32(0), })), @@ -942,10 +936,10 @@ help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", let expected = Ok(ast::Expression::UnOp(ast::UnOp { context: (), operator: ast::UnOperator::Not, - operand: Box::new(ast::Expression::UnOp(ast::UnOp { + operand: sync::Arc::new(ast::Expression::UnOp(ast::UnOp { context: (), operator: ast::UnOperator::Not, - operand: Box::new(ast::Expression::NumberLiteral(ast::NumberLiteral { + operand: sync::Arc::new(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), value: ast::NumberValue::U32(0), })), @@ -962,7 +956,7 @@ help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", let expected = Ok(ast::Expression::UnOp(ast::UnOp { context: (), operator: ast::UnOperator::BNot, - operand: Box::new(ast::Expression::NumberLiteral(ast::NumberLiteral { + operand: sync::Arc::new(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), value: ast::NumberValue::U32(0), })), @@ -978,10 +972,10 @@ help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", let expected = Ok(ast::Expression::UnOp(ast::UnOp { context: (), operator: ast::UnOperator::BNot, - operand: Box::new(ast::Expression::UnOp(ast::UnOp { + operand: sync::Arc::new(ast::Expression::UnOp(ast::UnOp { context: (), operator: ast::UnOperator::BNot, - operand: Box::new(ast::Expression::NumberLiteral(ast::NumberLiteral { + operand: sync::Arc::new(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), value: ast::NumberValue::U32(0), })), @@ -998,7 +992,7 @@ help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", let expected = Ok(ast::Expression::UnOp(ast::UnOp { context: (), operator: ast::UnOperator::Cl0, - operand: Box::new(ast::Expression::NumberLiteral(ast::NumberLiteral { + operand: sync::Arc::new(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), value: ast::NumberValue::U32(0), })), @@ -1014,10 +1008,10 @@ help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", let expected = Ok(ast::Expression::UnOp(ast::UnOp { context: (), operator: ast::UnOperator::Cl0, - operand: Box::new(ast::Expression::UnOp(ast::UnOp { + operand: sync::Arc::new(ast::Expression::UnOp(ast::UnOp { context: (), operator: ast::UnOperator::Cl0, - operand: Box::new(ast::Expression::NumberLiteral(ast::NumberLiteral { + operand: sync::Arc::new(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), value: ast::NumberValue::U32(0), })), @@ -1034,7 +1028,7 @@ help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", let expected = Ok(ast::Expression::UnOp(ast::UnOp { context: (), operator: ast::UnOperator::Cl1, - operand: Box::new(ast::Expression::NumberLiteral(ast::NumberLiteral { + operand: sync::Arc::new(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), value: ast::NumberValue::U32(0), })), @@ -1050,10 +1044,10 @@ help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", let expected = Ok(ast::Expression::UnOp(ast::UnOp { context: (), operator: ast::UnOperator::Cl1, - operand: Box::new(ast::Expression::UnOp(ast::UnOp { + operand: sync::Arc::new(ast::Expression::UnOp(ast::UnOp { context: (), operator: ast::UnOperator::Cl1, - operand: Box::new(ast::Expression::NumberLiteral(ast::NumberLiteral { + operand: sync::Arc::new(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), value: ast::NumberValue::U32(0), })), @@ -1070,7 +1064,7 @@ help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", let expected = Ok(ast::Expression::UnOp(ast::UnOp { context: (), operator: ast::UnOperator::Cls, - operand: Box::new(ast::Expression::NumberLiteral(ast::NumberLiteral { + operand: sync::Arc::new(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), value: ast::NumberValue::U32(0), })), @@ -1086,10 +1080,10 @@ help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", let expected = Ok(ast::Expression::UnOp(ast::UnOp { context: (), operator: ast::UnOperator::Cls, - operand: Box::new(ast::Expression::UnOp(ast::UnOp { + operand: sync::Arc::new(ast::Expression::UnOp(ast::UnOp { context: (), operator: ast::UnOperator::Cls, - operand: Box::new(ast::Expression::NumberLiteral(ast::NumberLiteral { + operand: sync::Arc::new(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), value: ast::NumberValue::U32(0), })), @@ -1106,7 +1100,7 @@ help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", let expected = Ok(ast::Expression::UnOp(ast::UnOp { context: (), operator: ast::UnOperator::Ct0, - operand: Box::new(ast::Expression::NumberLiteral(ast::NumberLiteral { + operand: sync::Arc::new(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), value: ast::NumberValue::U32(0), })), @@ -1122,10 +1116,10 @@ help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", let expected = Ok(ast::Expression::UnOp(ast::UnOp { context: (), operator: ast::UnOperator::Ct0, - operand: Box::new(ast::Expression::UnOp(ast::UnOp { + operand: sync::Arc::new(ast::Expression::UnOp(ast::UnOp { context: (), operator: ast::UnOperator::Ct0, - operand: Box::new(ast::Expression::NumberLiteral(ast::NumberLiteral { + operand: sync::Arc::new(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), value: ast::NumberValue::U32(0), })), @@ -1142,7 +1136,7 @@ help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", let expected = Ok(ast::Expression::UnOp(ast::UnOp { context: (), operator: ast::UnOperator::Ct1, - operand: Box::new(ast::Expression::NumberLiteral(ast::NumberLiteral { + operand: sync::Arc::new(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), value: ast::NumberValue::U32(0), })), @@ -1158,10 +1152,10 @@ help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", let expected = Ok(ast::Expression::UnOp(ast::UnOp { context: (), operator: ast::UnOperator::Ct1, - operand: Box::new(ast::Expression::UnOp(ast::UnOp { + operand: sync::Arc::new(ast::Expression::UnOp(ast::UnOp { context: (), operator: ast::UnOperator::Ct1, - operand: Box::new(ast::Expression::NumberLiteral(ast::NumberLiteral { + operand: sync::Arc::new(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), value: ast::NumberValue::U32(0), })), @@ -1178,7 +1172,7 @@ help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", let expected = Ok(ast::Expression::UnOp(ast::UnOp { context: (), operator: ast::UnOperator::C0, - operand: Box::new(ast::Expression::NumberLiteral(ast::NumberLiteral { + operand: sync::Arc::new(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), value: ast::NumberValue::U32(0), })), @@ -1194,10 +1188,10 @@ help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", let expected = Ok(ast::Expression::UnOp(ast::UnOp { context: (), operator: ast::UnOperator::C0, - operand: Box::new(ast::Expression::UnOp(ast::UnOp { + operand: sync::Arc::new(ast::Expression::UnOp(ast::UnOp { context: (), operator: ast::UnOperator::C0, - operand: Box::new(ast::Expression::NumberLiteral(ast::NumberLiteral { + operand: sync::Arc::new(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), value: ast::NumberValue::U32(0), })), @@ -1214,7 +1208,7 @@ help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", let expected = Ok(ast::Expression::UnOp(ast::UnOp { context: (), operator: ast::UnOperator::C1, - operand: Box::new(ast::Expression::NumberLiteral(ast::NumberLiteral { + operand: sync::Arc::new(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), value: ast::NumberValue::U32(0), })), @@ -1230,10 +1224,10 @@ help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", let expected = Ok(ast::Expression::UnOp(ast::UnOp { context: (), operator: ast::UnOperator::C1, - operand: Box::new(ast::Expression::UnOp(ast::UnOp { + operand: sync::Arc::new(ast::Expression::UnOp(ast::UnOp { context: (), operator: ast::UnOperator::C1, - operand: Box::new(ast::Expression::NumberLiteral(ast::NumberLiteral { + operand: sync::Arc::new(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), value: ast::NumberValue::U32(0), })), @@ -1250,7 +1244,7 @@ help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", let expected = Ok(ast::Expression::UnOp(ast::UnOp { context: (), operator: ast::UnOperator::Sqrt, - operand: Box::new(ast::Expression::NumberLiteral(ast::NumberLiteral { + operand: sync::Arc::new(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), value: ast::NumberValue::U32(0), })), @@ -1266,10 +1260,10 @@ help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", let expected = Ok(ast::Expression::UnOp(ast::UnOp { context: (), operator: ast::UnOperator::Sqrt, - operand: Box::new(ast::Expression::UnOp(ast::UnOp { + operand: sync::Arc::new(ast::Expression::UnOp(ast::UnOp { context: (), operator: ast::UnOperator::Sqrt, - operand: Box::new(ast::Expression::NumberLiteral(ast::NumberLiteral { + operand: sync::Arc::new(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), value: ast::NumberValue::U32(0), })), @@ -1286,44 +1280,46 @@ help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", let expected = Ok(ast::Expression::Lambda(ast::Lambda { context: (), parameters: vec![ - ast::Parameter { + sync::Arc::new(ast::Parameter { context: (), - name: ast::Identifier { - context: (), - value: "a".to_owned(), - }, - signature: ast::Expression::Identifier(ast::Identifier { + name: sync::Arc::new(ast::Identifier { context: (), - value: "t1".to_owned(), + value: sync::Arc::new("a".to_owned()), }), - }, - ast::Parameter { - context: (), - name: ast::Identifier { + signature: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { context: (), - value: "b".to_owned(), - }, - signature: ast::Expression::Identifier(ast::Identifier { + value: sync::Arc::new("t1".to_owned()), + })), + }), + sync::Arc::new(ast::Parameter { + context: (), + name: sync::Arc::new(ast::Identifier { context: (), - value: "t2".to_owned(), + value: sync::Arc::new("b".to_owned()), }), - }, + signature: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { + context: (), + value: sync::Arc::new("t2".to_owned()), + })), + }), ], - signature: Box::new(ast::Expression::Identifier(ast::Identifier { + signature: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { context: (), - value: "t3".to_owned(), + value: sync::Arc::new("t3".to_owned()), })), statements: vec![], - result: Some(Box::new(ast::Expression::Apply(ast::Apply { + result: Some(sync::Arc::new(ast::Expression::Apply(ast::Apply { context: (), - function: Box::new(ast::Expression::Identifier(ast::Identifier { + function: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { context: (), - value: "a".to_owned(), + value: sync::Arc::new("a".to_owned()), })), - parameters: vec![ast::Expression::Identifier(ast::Identifier { - context: (), - value: "b".to_owned(), - })], + parameters: vec![sync::Arc::new(ast::Expression::Identifier( + ast::Identifier { + context: (), + value: sync::Arc::new("b".to_owned()), + }, + ))], }))), })); let actual = parse_expression("test", r#"|a: t1, b: t2| -> t3 { a(b) }"#); @@ -1337,80 +1333,84 @@ help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", let expected = Ok(ast::Expression::Lambda(ast::Lambda { context: (), parameters: vec![ - ast::Parameter { + sync::Arc::new(ast::Parameter { context: (), - name: ast::Identifier { + name: sync::Arc::new(ast::Identifier { context: (), - value: "a".to_owned(), - }, - signature: ast::Expression::Identifier(ast::Identifier { - context: (), - value: "t1".to_owned(), + value: sync::Arc::new("a".to_owned()), }), - }, - ast::Parameter { - context: (), - name: ast::Identifier { + signature: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { context: (), - value: "b".to_owned(), - }, - signature: ast::Expression::Identifier(ast::Identifier { + value: sync::Arc::new("t1".to_owned()), + })), + }), + sync::Arc::new(ast::Parameter { + context: (), + name: sync::Arc::new(ast::Identifier { context: (), - value: "t2".to_owned(), + value: sync::Arc::new("b".to_owned()), }), - }, + signature: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { + context: (), + value: sync::Arc::new("t2".to_owned()), + })), + }), ], - signature: Box::new(ast::Expression::Identifier(ast::Identifier { + signature: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { context: (), - value: "t3".to_owned(), + value: sync::Arc::new("t3".to_owned()), })), - statements: vec![ast::Statement::Variable(ast::Variable { + statements: vec![sync::Arc::new(ast::Statement::Variable(ast::Variable { context: (), - name: ast::Identifier { + name: sync::Arc::new(ast::Identifier { context: (), - value: "c".to_owned(), - }, - initializer: ast::Expression::Lambda(ast::Lambda { + value: sync::Arc::new("c".to_owned()), + }), + initializer: sync::Arc::new(ast::Expression::Lambda(ast::Lambda { context: (), - parameters: vec![ast::Parameter { + parameters: vec![sync::Arc::new(ast::Parameter { context: (), - name: ast::Identifier { - context: (), - value: "b".to_owned(), - }, - signature: ast::Expression::Identifier(ast::Identifier { + name: sync::Arc::new(ast::Identifier { context: (), - value: "t4".to_owned(), + value: sync::Arc::new("b".to_owned()), }), - }], - signature: Box::new(ast::Expression::Identifier(ast::Identifier { + signature: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { + context: (), + value: sync::Arc::new("t4".to_owned()), + })), + })], + signature: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { context: (), - value: "t5".to_owned(), + value: sync::Arc::new("t5".to_owned()), })), statements: vec![], - result: Some(Box::new(ast::Expression::Apply(ast::Apply { + result: Some(sync::Arc::new(ast::Expression::Apply(ast::Apply { context: (), - function: Box::new(ast::Expression::Identifier(ast::Identifier { + function: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { context: (), - value: "a".to_owned(), + value: sync::Arc::new("a".to_owned()), })), - parameters: vec![ast::Expression::Identifier(ast::Identifier { - context: (), - value: "b".to_owned(), - })], + parameters: vec![sync::Arc::new(ast::Expression::Identifier( + ast::Identifier { + context: (), + value: sync::Arc::new("b".to_owned()), + }, + ))], }))), - }), - })], - result: Some(Box::new(ast::Expression::Apply(ast::Apply { + })), + }))], + result: Some(sync::Arc::new(ast::Expression::Apply(ast::Apply { context: (), - function: Box::new(ast::Expression::Identifier(ast::Identifier { + function: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { context: (), - value: "c".to_owned(), + value: sync::Arc::new("c".to_owned()), })), - parameters: vec![ast::Expression::Identifier(ast::Identifier { - context: (), - value: "b".to_owned(), - })], + parameters: vec![sync::Arc::new(ast::Expression::Identifier( + ast::Identifier { + context: (), + value: sync::Arc::new("b".to_owned()), + }, + ))], }))), })); let actual = parse_expression( @@ -1427,80 +1427,84 @@ help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", let expected = Ok(ast::Expression::Lambda(ast::Lambda { context: (), parameters: vec![ - ast::Parameter { + sync::Arc::new(ast::Parameter { context: (), - name: ast::Identifier { - context: (), - value: "a".to_owned(), - }, - signature: ast::Expression::Identifier(ast::Identifier { + name: sync::Arc::new(ast::Identifier { context: (), - value: "t1".to_owned(), + value: sync::Arc::new("a".to_owned()), }), - }, - ast::Parameter { - context: (), - name: ast::Identifier { + signature: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { context: (), - value: "b".to_owned(), - }, - signature: ast::Expression::Identifier(ast::Identifier { + value: sync::Arc::new("t1".to_owned()), + })), + }), + sync::Arc::new(ast::Parameter { + context: (), + name: sync::Arc::new(ast::Identifier { context: (), - value: "t2".to_owned(), + value: sync::Arc::new("b".to_owned()), }), - }, + signature: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { + context: (), + value: sync::Arc::new("t2".to_owned()), + })), + }), ], - signature: Box::new(ast::Expression::Identifier(ast::Identifier { + signature: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { context: (), - value: "t3".to_owned(), + value: sync::Arc::new("t3".to_owned()), })), - statements: vec![ast::Statement::Variable(ast::Variable { + statements: vec![sync::Arc::new(ast::Statement::Variable(ast::Variable { context: (), - name: ast::Identifier { + name: sync::Arc::new(ast::Identifier { context: (), - value: "c".to_owned(), - }, - initializer: ast::Expression::Lambda(ast::Lambda { + value: sync::Arc::new("c".to_owned()), + }), + initializer: sync::Arc::new(ast::Expression::Lambda(ast::Lambda { context: (), - parameters: vec![ast::Parameter { + parameters: vec![sync::Arc::new(ast::Parameter { context: (), - name: ast::Identifier { - context: (), - value: "b".to_owned(), - }, - signature: ast::Expression::Identifier(ast::Identifier { + name: sync::Arc::new(ast::Identifier { context: (), - value: "t4".to_owned(), + value: sync::Arc::new("b".to_owned()), }), - }], - signature: Box::new(ast::Expression::Identifier(ast::Identifier { + signature: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { + context: (), + value: sync::Arc::new("t4".to_owned()), + })), + })], + signature: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { context: (), - value: "t5".to_owned(), + value: sync::Arc::new("t5".to_owned()), })), statements: vec![], - result: Some(Box::new(ast::Expression::Apply(ast::Apply { + result: Some(sync::Arc::new(ast::Expression::Apply(ast::Apply { context: (), - function: Box::new(ast::Expression::Identifier(ast::Identifier { + function: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { context: (), - value: "a".to_owned(), + value: sync::Arc::new("a".to_owned()), })), - parameters: vec![ast::Expression::Identifier(ast::Identifier { - context: (), - value: "b".to_owned(), - })], + parameters: vec![sync::Arc::new(ast::Expression::Identifier( + ast::Identifier { + context: (), + value: sync::Arc::new("b".to_owned()), + }, + ))], }))), - }), - })], - result: Some(Box::new(ast::Expression::Apply(ast::Apply { + })), + }))], + result: Some(sync::Arc::new(ast::Expression::Apply(ast::Apply { context: (), - function: Box::new(ast::Expression::Identifier(ast::Identifier { + function: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { context: (), - value: "c".to_owned(), + value: sync::Arc::new("c".to_owned()), })), - parameters: vec![ast::Expression::Identifier(ast::Identifier { - context: (), - value: "b".to_owned(), - })], + parameters: vec![sync::Arc::new(ast::Expression::Identifier( + ast::Identifier { + context: (), + value: sync::Arc::new("b".to_owned()), + }, + ))], }))), })); let actual = parse_expression( @@ -1517,44 +1521,46 @@ help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", let expected = Ok(ast::Expression::Lambda(ast::Lambda { context: (), parameters: vec![ - ast::Parameter { + sync::Arc::new(ast::Parameter { context: (), - name: ast::Identifier { + name: sync::Arc::new(ast::Identifier { context: (), - value: "a".to_owned(), - }, - signature: ast::Expression::NumberLiteral(ast::NumberLiteral { + value: sync::Arc::new("a".to_owned()), + }), + signature: sync::Arc::new(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), value: ast::NumberValue::U32(0), - }), - }, - ast::Parameter { + })), + }), + sync::Arc::new(ast::Parameter { context: (), - name: ast::Identifier { + name: sync::Arc::new(ast::Identifier { context: (), - value: "b".to_owned(), - }, - signature: ast::Expression::NumberLiteral(ast::NumberLiteral { + value: sync::Arc::new("b".to_owned()), + }), + signature: sync::Arc::new(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), value: ast::NumberValue::U32(0), - }), - }, + })), + }), ], - signature: Box::new(ast::Expression::Identifier(ast::Identifier { + signature: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { context: (), - value: "t1".to_owned(), + value: sync::Arc::new("t1".to_owned()), })), statements: vec![], - result: Some(Box::new(ast::Expression::Apply(ast::Apply { + result: Some(sync::Arc::new(ast::Expression::Apply(ast::Apply { context: (), - function: Box::new(ast::Expression::Identifier(ast::Identifier { + function: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { context: (), - value: "a".to_owned(), + value: sync::Arc::new("a".to_owned()), })), - parameters: vec![ast::Expression::Identifier(ast::Identifier { - context: (), - value: "b".to_owned(), - })], + parameters: vec![sync::Arc::new(ast::Expression::Identifier( + ast::Identifier { + context: (), + value: sync::Arc::new("b".to_owned()), + }, + ))], }))), })); let actual = parse_expression("test", r#"|a: u32, b: u32| -> t1 { a(b) }"#); @@ -1568,56 +1574,60 @@ help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", let expected = Ok(ast::Expression::Lambda(ast::Lambda { context: (), parameters: vec![ - ast::Parameter { + sync::Arc::new(ast::Parameter { context: (), - name: ast::Identifier { + name: sync::Arc::new(ast::Identifier { context: (), - value: "a".to_owned(), - }, - signature: ast::Expression::Identifier(ast::Identifier { - context: (), - value: "t1".to_owned(), + value: sync::Arc::new("a".to_owned()), }), - }, - ast::Parameter { - context: (), - name: ast::Identifier { + signature: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { context: (), - value: "b".to_owned(), - }, - signature: ast::Expression::Identifier(ast::Identifier { + value: sync::Arc::new("t1".to_owned()), + })), + }), + sync::Arc::new(ast::Parameter { + context: (), + name: sync::Arc::new(ast::Identifier { context: (), - value: "t2".to_owned(), + value: sync::Arc::new("b".to_owned()), }), - }, + signature: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { + context: (), + value: sync::Arc::new("t2".to_owned()), + })), + }), ], - signature: Box::new(ast::Expression::Identifier(ast::Identifier { + signature: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { context: (), - value: "t3".to_owned(), + value: sync::Arc::new("t3".to_owned()), })), - statements: vec![ast::Statement::Expression(ast::Expression::Apply( - ast::Apply { + statements: vec![sync::Arc::new(ast::Statement::Expression( + ast::Expression::Apply(ast::Apply { context: (), - function: Box::new(ast::Expression::Identifier(ast::Identifier { + function: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { context: (), - value: "a".to_owned(), + value: sync::Arc::new("a".to_owned()), })), - parameters: vec![ast::Expression::Identifier(ast::Identifier { - context: (), - value: "b".to_owned(), - })], - }, + parameters: vec![sync::Arc::new(ast::Expression::Identifier( + ast::Identifier { + context: (), + value: sync::Arc::new("b".to_owned()), + }, + ))], + }), ))], - result: Some(Box::new(ast::Expression::Apply(ast::Apply { + result: Some(sync::Arc::new(ast::Expression::Apply(ast::Apply { context: (), - function: Box::new(ast::Expression::Identifier(ast::Identifier { + function: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { context: (), - value: "a".to_owned(), + value: sync::Arc::new("a".to_owned()), })), - parameters: vec![ast::Expression::Identifier(ast::Identifier { - context: (), - value: "b".to_owned(), - })], + parameters: vec![sync::Arc::new(ast::Expression::Identifier( + ast::Identifier { + context: (), + value: sync::Arc::new("b".to_owned()), + }, + ))], }))), })); let actual = parse_expression("test", r#"|a: t1, b: t2| -> t3 { a(b); a(b) }"#); @@ -1630,14 +1640,16 @@ help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", let expected = Ok(ast::Expression::Apply(ast::Apply { context: (), - function: Box::new(ast::Expression::Identifier(ast::Identifier { + function: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { context: (), - value: "a".to_owned(), + value: sync::Arc::new("a".to_owned()), })), - parameters: vec![ast::Expression::Identifier(ast::Identifier { - context: (), - value: "b".to_owned(), - })], + parameters: vec![sync::Arc::new(ast::Expression::Identifier( + ast::Identifier { + context: (), + value: sync::Arc::new("b".to_owned()), + }, + ))], })); let actual = parse_expression("test", r#"a(b)"#); assert_eq!(expected, actual); diff --git a/src/ty/db.rs b/src/ty/db.rs index fd8f41e..585e897 100644 --- a/src/ty/db.rs +++ b/src/ty/db.rs @@ -6,6 +6,8 @@ use crate::ty; #[salsa::query_group(Ty)] pub trait TyDb: salsa::Database + ir::db::IrDb { fn entity_type(&self, entity: ir::Entity) -> Result, ty::error::Error>; + + fn bool_type(&self) -> sync::Arc; } fn entity_type( @@ -14,3 +16,15 @@ fn entity_type( ) -> Result, ty::error::Error> { unimplemented!() } + +fn bool_type(db: &impl TyDb) -> sync::Arc { + let alternatives = vec![ + ty::Symbol { + label: db.ident(sync::Arc::new("f".to_owned())), + }, + ty::Symbol { + label: db.ident(sync::Arc::new("t".to_owned())), + }, + ]; + sync::Arc::new(ty::Type::Union(ty::Union { alternatives })) +} diff --git a/src/ty/infer.rs b/src/ty/infer.rs index 9f6e40c..603e38f 100644 --- a/src/ty/infer.rs +++ b/src/ty/infer.rs @@ -6,20 +6,6 @@ use crate::ir; use crate::ir::element; use crate::ty; -lazy_static! { - static ref BOOL_TYPE: sync::Arc = { - let alternatives = vec![ - ty::Symbol { - label: "f".to_owned(), - }, - ty::Symbol { - label: "t".to_owned(), - }, - ]; - sync::Arc::new(ty::Type::Union(ty::Union { alternatives })) - }; -} - pub struct System; type Result = result::Result, ty::error::Error>; @@ -32,7 +18,7 @@ fn infer_type(element: &element::Element, db: impl ty::db::TyDb) -> Result Ok(sync::Arc::new(ty::Type::String)), element::Element::Symbol(element::Symbol { ref label }) => { Ok(sync::Arc::new(ty::Type::Symbol(ty::Symbol { - label: label.clone(), + label: *label, }))) } element::Element::Tuple(element::Tuple { ref fields }) => infer_tuple_type(fields, db), @@ -46,7 +32,7 @@ fn infer_type(element: &element::Element, db: impl ty::db::TyDb) -> Result { infer_variable_type(initializer, db) } - element::Element::Select(element::Select { record, ref field }) => { + element::Element::Select(element::Select { record, field }) => { infer_select_type(record, field, db) } element::Element::Apply(element::Apply { @@ -95,12 +81,12 @@ fn infer_tuple_type(fields: &[ir::Entity], db: impl ty::db::TyDb) -> Result, + fields: &collections::HashMap, db: impl ty::db::TyDb, ) -> Result { let fields = fields .iter() - .map(|(k, v)| Ok((k.clone(), db.entity_type(*v)?))) + .map(|(k, v)| Ok((*k, db.entity_type(*v)?))) .collect::, ty::error::Error>>()?; Ok(sync::Arc::new(ty::Type::Record(ty::Record { fields }))) } @@ -113,11 +99,12 @@ fn infer_un_op_type( let ty = db.entity_type(operand)?; match operator { element::UnOperator::Not => { - if ty == *BOOL_TYPE { - Ok(BOOL_TYPE.clone()) + let bool_type = db.bool_type(); + if ty == bool_type { + Ok(bool_type) } else { Err(ty::error::Error { - expected: ty::error::ExpectedType::Specific(BOOL_TYPE.clone()), + expected: ty::error::ExpectedType::Specific(bool_type), actual: ty, main_entity: operand, aux_entities: vec![], @@ -131,9 +118,11 @@ fn infer_un_op_type( | element::UnOperator::Ct0 | element::UnOperator::Ct1 | element::UnOperator::C0 - | element::UnOperator::C1 => { - if_integral_then(operand, &ty, sync::Arc::new(ty::Type::Number(ty::Number::U32))) - } + | element::UnOperator::C1 => if_integral_then( + operand, + &ty, + sync::Arc::new(ty::Type::Number(ty::Number::U32)), + ), element::UnOperator::Sqrt => if_fractional_then(operand, &ty, ty.clone()), } } @@ -153,7 +142,7 @@ fn infer_bi_op_type( | element::BiOperator::Lt | element::BiOperator::Ge | element::BiOperator::Gt - | element::BiOperator::Le => if_eq_then(lhs, &lhs_ty, rhs, &rhs_ty, &BOOL_TYPE), + | element::BiOperator::Le => if_eq_then(lhs, &lhs_ty, rhs, &rhs_ty, &db.bool_type(), db), element::BiOperator::Cmp => unimplemented!(), element::BiOperator::Add | element::BiOperator::Sub @@ -166,9 +155,9 @@ fn infer_bi_op_type( | element::BiOperator::BXor | element::BiOperator::BAndNot | element::BiOperator::BOrNot - | element::BiOperator::BXorNot => if_eq_then(lhs, &lhs_ty, rhs, &rhs_ty, &lhs_ty), - element::BiOperator::Or => or_op(lhs, &lhs_ty, rhs, &rhs_ty), - element::BiOperator::And | element::BiOperator::Xor | element::BiOperator::AndNot | element::BiOperator::OrNot | element::BiOperator::XorNot => bool_op(lhs, &lhs_ty, rhs, &rhs_ty), + | element::BiOperator::BXorNot => if_eq_then(lhs, &lhs_ty, rhs, &rhs_ty, &lhs_ty, db), + element::BiOperator::Or => or_op(lhs, &lhs_ty, rhs, &rhs_ty, db), + element::BiOperator::And | element::BiOperator::Xor | element::BiOperator::AndNot | element::BiOperator::OrNot | element::BiOperator::XorNot => bool_op(lhs, &lhs_ty, rhs, &rhs_ty, db), element::BiOperator::RotL | element::BiOperator::RotR | element::BiOperator::ShL | element::BiOperator::ShR => if_integral_and_eq_then( lhs, &lhs_ty, @@ -184,20 +173,19 @@ fn infer_variable_type(initializer: ir::Entity, db: impl ty::db::TyDb) -> Result db.entity_type(initializer) } -fn infer_select_type(record: ir::Entity, field: &str, db: impl ty::db::TyDb) -> Result { +fn infer_select_type( + record: ir::Entity, + field: ir::Ident, + db: impl ty::db::TyDb, +) -> Result { let record_ty = db.entity_type(record)?; match *record_ty { ty::Type::Record(ty::Record { ref fields }) => { - if let Some(t) = fields.get(field) { + if let Some(t) = fields.get(&field) { Ok(t.clone()) } else { let mut expected_fields = collections::HashMap::new(); - expected_fields.insert( - field.to_owned(), - sync::Arc::new(ty::Type::Symbol(ty::Symbol { - label: "something".to_owned(), - })), - ); + expected_fields.insert(field.to_owned(), sync::Arc::new(ty::Type::Placeholder)); Err(ty::error::Error { expected: ty::error::ExpectedType::Specific(sync::Arc::new(ty::Type::Record( ty::Record { @@ -212,12 +200,7 @@ fn infer_select_type(record: ir::Entity, field: &str, db: impl ty::db::TyDb) -> } _ => { let mut expected_fields = collections::HashMap::new(); - expected_fields.insert( - field.to_owned(), - sync::Arc::new(ty::Type::Symbol(ty::Symbol { - label: "something".to_owned(), - })), - ); + expected_fields.insert(field.to_owned(), sync::Arc::new(ty::Type::Placeholder)); Err(ty::error::Error { expected: ty::error::ExpectedType::Specific(sync::Arc::new(ty::Type::Record( ty::Record { @@ -256,9 +239,7 @@ fn infer_apply_type( expected: ty::error::ExpectedType::Specific(sync::Arc::new( ty::Type::Function(ty::Function { parameters, - result: sync::Arc::new(ty::Type::Symbol(ty::Symbol { - label: "something".to_owned(), - })), + result: sync::Arc::new(ty::Type::Placeholder), }), )), actual: function_ty.clone(), @@ -270,12 +251,8 @@ fn infer_apply_type( _ => Err(ty::error::Error { expected: ty::error::ExpectedType::Specific(sync::Arc::new(ty::Type::Function( ty::Function { - parameters: vec![sync::Arc::new(ty::Type::Symbol(ty::Symbol { - label: "something".to_owned(), - }))], - result: sync::Arc::new(ty::Type::Symbol(ty::Symbol { - label: "something".to_owned(), - })), + parameters: vec![sync::Arc::new(ty::Type::Placeholder)], + result: sync::Arc::new(ty::Type::Placeholder), }, ))), actual: function_ty, @@ -326,12 +303,12 @@ fn infer_closure_type( } fn infer_module_type( - variables: &collections::HashMap, + variables: &collections::HashMap, db: impl ty::db::TyDb, ) -> Result { let fields = variables .iter() - .map(|(k, v)| Ok((k.clone(), db.entity_type(*v)?))) + .map(|(k, v)| Ok((*k, db.entity_type(*v)?))) .collect::>()?; Ok(sync::Arc::new(ty::Type::Record(ty::Record { fields }))) } @@ -342,6 +319,7 @@ fn if_eq_then( rhs_entity: ir::Entity, rhs: &sync::Arc, result: &sync::Arc, + db: impl ty::db::TyDb, ) -> Result { if lhs == rhs { Ok(result.clone()) @@ -363,13 +341,15 @@ fn bool_op( lhs: &sync::Arc, rhs_entity: ir::Entity, rhs: &sync::Arc, + db: impl ty::db::TyDb, ) -> Result { - if *lhs == *BOOL_TYPE { - if *rhs == *BOOL_TYPE { - Ok(BOOL_TYPE.clone()) + let bool_type = db.bool_type(); + if *lhs == bool_type { + if *rhs == bool_type { + Ok(bool_type) } else { Err(ty::error::Error { - expected: ty::error::ExpectedType::Specific(BOOL_TYPE.clone()), + expected: ty::error::ExpectedType::Specific(bool_type), actual: rhs.clone(), main_entity: rhs_entity, aux_entities: vec![ty::error::AuxEntity { @@ -380,7 +360,7 @@ fn bool_op( } } else { Err(ty::error::Error { - expected: ty::error::ExpectedType::Specific(BOOL_TYPE.clone()), + expected: ty::error::ExpectedType::Specific(bool_type), actual: lhs.clone(), main_entity: lhs_entity, aux_entities: vec![ty::error::AuxEntity { @@ -396,7 +376,9 @@ fn or_op( lhs: &sync::Arc, rhs_entity: ir::Entity, rhs: &sync::Arc, + db: impl ty::db::TyDb, ) -> Result { + let bool_type = db.bool_type(); if let ty::Type::Union(ref u) = **lhs { if let ty::Type::Symbol(ref symbol) = **rhs { Ok(sync::Arc::new(ty::Type::Union(u.clone().with(symbol)))) @@ -411,12 +393,12 @@ fn or_op( }], }) } - } else if *lhs == *BOOL_TYPE { - if *rhs == *BOOL_TYPE { - Ok(BOOL_TYPE.clone()) + } else if *lhs == bool_type { + if *rhs == bool_type { + Ok(bool_type) } else { Err(ty::error::Error { - expected: ty::error::ExpectedType::Specific(BOOL_TYPE.clone()), + expected: ty::error::ExpectedType::Specific(bool_type), actual: rhs.clone(), main_entity: rhs_entity, aux_entities: vec![ty::error::AuxEntity { @@ -428,7 +410,7 @@ fn or_op( } else { Err(ty::error::Error { expected: ty::error::ExpectedType::AnyOf(vec![ - ty::error::ExpectedType::Specific(BOOL_TYPE.clone()), + ty::error::ExpectedType::Specific(bool_type), ty::error::ExpectedType::Union, ]), actual: lhs.clone(), diff --git a/src/ty/mod.rs b/src/ty/mod.rs index 82890ea..cf0ccea 100644 --- a/src/ty/mod.rs +++ b/src/ty/mod.rs @@ -2,6 +2,8 @@ use std::collections; use std::fmt; use std::sync; +use crate::ir; + pub mod class; pub mod db; pub mod error; @@ -16,6 +18,7 @@ pub enum Type { Union(Union), Record(Record), Function(Function), + Placeholder, } #[derive(Clone, Copy, Debug, Eq, PartialEq)] @@ -34,7 +37,7 @@ pub enum Number { #[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd)] pub struct Symbol { - pub label: String, + pub label: ir::Ident, } #[derive(Clone, Debug, Eq, PartialEq)] @@ -49,7 +52,7 @@ pub struct Union { #[derive(Clone, Debug, Eq, PartialEq)] pub struct Record { - pub fields: collections::HashMap>, + pub fields: collections::HashMap>, } #[derive(Clone, Debug, Eq, PartialEq)] @@ -63,7 +66,7 @@ impl Type { match *self { Type::Number(ref n) => n.scalar_class(), Type::Symbol(_) => class::Scalar::Symbol, - Type::Union(_) | Type::Function(_) => class::Scalar::Undefined, + Type::Union(_) | Type::Function(_) | Type::Placeholder => class::Scalar::Undefined, Type::String | Type::Tuple(_) | Type::Record(_) => class::Scalar::Complex, } } @@ -104,6 +107,7 @@ impl fmt::Display for Type { Type::Union(ref union) => union.fmt(f), Type::Record(ref record) => record.fmt(f), Type::Function(ref function) => function.fmt(f), + Type::Placeholder => write!(f, "???"), } } } @@ -127,7 +131,7 @@ impl fmt::Display for Number { impl fmt::Display for Symbol { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, ":{}", self.label) + write!(f, ":{:?}", self.label) } } @@ -169,7 +173,7 @@ impl fmt::Display for Record { if needs_sep { write!(f, ", ")?; } - write!(f, "{}: ", id)?; + write!(f, "{:?}: ", id)?; ty.fmt(f)?; needs_sep = true; } diff --git a/src/value.rs b/src/value.rs index 08ba2bc..b1e0332 100644 --- a/src/value.rs +++ b/src/value.rs @@ -5,32 +5,32 @@ use std::sync; lazy_static! { pub static ref NIL: Value = { Value::new(Case::Symbol(Symbol { - label: "nil".to_owned(), + label: sync::Arc::new("nil".to_owned()), })) }; pub static ref FALSE: Value = { Value::new(Case::Symbol(Symbol { - label: "f".to_owned(), + label: sync::Arc::new("f".to_owned()), })) }; pub static ref TRUE: Value = { Value::new(Case::Symbol(Symbol { - label: "t".to_owned(), + label: sync::Arc::new("t".to_owned()), })) }; pub static ref LT: Value = { Value::new(Case::Symbol(Symbol { - label: "lt".to_owned(), + label: sync::Arc::new("lt".to_owned()), })) }; pub static ref EQ: Value = { Value::new(Case::Symbol(Symbol { - label: "eq".to_owned(), + label: sync::Arc::new("eq".to_owned()), })) }; pub static ref GT: Value = { Value::new(Case::Symbol(Symbol { - label: "gt".to_owned(), + label: sync::Arc::new("gt".to_owned()), })) }; } @@ -63,7 +63,7 @@ pub enum Number { #[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd)] pub struct Symbol { - pub label: String, + pub label: sync::Arc, } #[derive(Clone, Debug, Eq, PartialEq)] @@ -73,7 +73,7 @@ pub struct Tuple { #[derive(Clone, Debug, Eq, PartialEq)] pub struct Record { - pub fields: collections::HashMap, + pub fields: collections::HashMap, Value>, } impl Value { @@ -92,11 +92,7 @@ impl Value { Value(sync::Arc::new(Case::String(string.into()))) } - pub fn symbol(label: S) -> Self - where - S: Into, - { - let label = label.into(); + pub fn symbol(label: sync::Arc) -> Self { Value::new(Case::Symbol(Symbol { label })) } From 30c7a947ff52a0eb771cad053a244b7b617875ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Flemstr=C3=B6m?= Date: Thu, 18 Apr 2019 17:53:55 +0200 Subject: [PATCH 05/22] Make everything mostly compile --- src/lib.rs | 13 +++++++++++-- src/source/db.rs | 6 +++--- src/source/mod.rs | 4 ++-- src/syntax/db.rs | 6 +++--- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index c8c9c8c..5188d2d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -93,7 +93,6 @@ impl Tin { Tin { db } } - /* /// Loads the specified source code as a module. /// /// # Errors @@ -135,6 +134,8 @@ impl Tin { where F: Into, { + unimplemented!() + /* let span = self .codemap .add_filemap(file_name.into(), source.to_owned()) @@ -143,14 +144,17 @@ impl Tin { self.ir.load(&module)?; Ok(()) + */ } + /* /// Creates a graph representation of the current IR of this Tin instance. /// /// This can be used to for example visualize the code using GraphViz or other tools. pub fn graph(&self) -> graph::Graph { graph::Graph::new(&self.ir) } + */ /// Compiles the code loaded so far into a stand-alone module. /// @@ -178,17 +182,22 @@ impl Tin { /// # } /// ``` pub fn compile(&mut self) -> Result { + unimplemented!() + /* self.ir.check_types()?; let module = codegen::Codegen::new(&self.ir, &self.codemap).compile(); Ok(module) + */ } /// Returns a reference to the current code map, which contains location mapping for all source /// code loaded so far. pub fn codemap(&self) -> &codespan::CodeMap { + unimplemented!() + /* &self.codemap + */ } - */ } impl Default for Tin { diff --git a/src/source/db.rs b/src/source/db.rs index 2260f15..38b1cd3 100644 --- a/src/source/db.rs +++ b/src/source/db.rs @@ -20,13 +20,13 @@ pub trait SourceDb: salsa::Database { /// Source root of the file. #[salsa::input] - fn file_source_root(&self, file_id: source::FileId) -> source::SourceRootId; + fn file_source_root(&self, file_id: source::FileId) -> source::RootId; /// Contents of the source root. #[salsa::input] - fn source_root(&self, id: source::SourceRootId) -> sync::Arc; + fn source_root(&self, id: source::RootId) -> sync::Arc; /// All source roots. #[salsa::input] - fn all_source_roots(&self) -> sync::Arc>; + fn all_source_roots(&self) -> sync::Arc>; } diff --git a/src/source/mod.rs b/src/source/mod.rs index 39b1a79..7a4a032 100644 --- a/src/source/mod.rs +++ b/src/source/mod.rs @@ -25,9 +25,9 @@ pub struct FileId(u32); /// source root at all. So, a file from one source root can't refer to a file in another source root /// by path. #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)] -pub struct SourceRootId(u32); +pub struct RootId(u32); #[derive(Default, Clone, Debug, PartialEq, Eq)] -pub struct SourceRoot { +pub struct Root { pub files: rustc_hash::FxHashMap, } diff --git a/src/syntax/db.rs b/src/syntax/db.rs index 22e3e2d..8e1526b 100644 --- a/src/syntax/db.rs +++ b/src/syntax/db.rs @@ -14,13 +14,13 @@ pub trait SyntaxDb: salsa::Database + source::db::SourceDb { } fn parse( - source: &impl SyntaxDb, + db: &impl SyntaxDb, file_id: source::FileId, ) -> Result>, syntax::parser::Error> { use crate::syntax::parser::Parse; - let text = source.file_text(file_id); - let span = source.file_span(file_id); + let text = db.file_text(file_id); + let span = db.file_span(file_id); syntax::ast::Module::parse(span, &*text).map(sync::Arc::new) } From a760375db2b97fe601f07ef116dc93d2b32e7a18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Flemstr=C3=B6m?= Date: Thu, 18 Apr 2019 19:29:14 +0200 Subject: [PATCH 06/22] Start breaking out a syntax crate --- specs-visitor-derive/Cargo.toml | 20 --- specs-visitor-derive/release.toml | 1 - specs-visitor-derive/src/lib.rs | 78 -------- specs-visitor-derive/src/tests.rs | 130 -------------- specs-visitor/Cargo.toml | 17 -- specs-visitor/release.toml | 1 - specs-visitor/src/lib.rs | 284 ------------------------------ syntax/src/ast.rs | 0 syntax/src/error.rs | 0 syntax/src/parser.rs | 0 10 files changed, 531 deletions(-) delete mode 100644 specs-visitor-derive/Cargo.toml delete mode 100644 specs-visitor-derive/release.toml delete mode 100644 specs-visitor-derive/src/lib.rs delete mode 100644 specs-visitor-derive/src/tests.rs delete mode 100644 specs-visitor/Cargo.toml delete mode 100644 specs-visitor/release.toml delete mode 100644 specs-visitor/src/lib.rs create mode 100644 syntax/src/ast.rs create mode 100644 syntax/src/error.rs create mode 100644 syntax/src/parser.rs diff --git a/specs-visitor-derive/Cargo.toml b/specs-visitor-derive/Cargo.toml deleted file mode 100644 index 66f9c0c..0000000 --- a/specs-visitor-derive/Cargo.toml +++ /dev/null @@ -1,20 +0,0 @@ -[package] -name = "specs-visitor-derive" -description = "A procedural macro for deriving traits in specs-derive." -license = "MIT" -version = "0.3.0" -authors = ["David Flemström "] -repository = "https://github.com/dflemstr/tin" -edition = "2018" - -[lib] -proc-macro = true - -[dependencies] -synstructure = "0.10.1" -quote = "0.6.11" -proc-macro2 = "0.4.27" - -[dev-dependencies] -specs = "0.14.3" -specs-visitor = { version = "0.3.0", path = "../specs-visitor" } diff --git a/specs-visitor-derive/release.toml b/specs-visitor-derive/release.toml deleted file mode 100644 index 0533e2d..0000000 --- a/specs-visitor-derive/release.toml +++ /dev/null @@ -1 +0,0 @@ -no-dev-version = true diff --git a/specs-visitor-derive/src/lib.rs b/specs-visitor-derive/src/lib.rs deleted file mode 100644 index 2e3832e..0000000 --- a/specs-visitor-derive/src/lib.rs +++ /dev/null @@ -1,78 +0,0 @@ -//! Procedural macros for deriving specs entity visitors. -//! -//! These visitors can be used to implement generic transformations of ECS graphs that compile down -//! to very effective code. -//! -//! See the [`specs-visitor`](https://crates.io/crates/specs-visitor) crate for API documentation -//! for the actual types derived by this crate. -#![deny(nonstandard_style, warnings, unused)] -#![deny( - missing_debug_implementations, - missing_copy_implementations, - trivial_casts, - trivial_numeric_casts, - unstable_features, - unused_import_braces, - unused_qualifications -)] -#![cfg_attr(feature = "cargo-clippy", deny(clippy::all, clippy::pedantic))] -#![recursion_limit = "128"] - -#[macro_use] -extern crate synstructure; -#[macro_use] -extern crate quote; - -#[cfg(test)] -mod tests; - -fn visit_entities_derive(mut s: synstructure::Structure) -> proc_macro2::TokenStream { - let accept_body = s.each(|bi| { - quote! { - ::specs_visitor::VisitEntities::accept(#bi, visitor); - } - }); - - s.add_bounds(synstructure::AddBounds::Generics); - - s.gen_impl(quote! { - gen impl ::specs_visitor::VisitEntities for @Self { - fn accept(&self, visitor: &V) - where - V: ::specs_visitor::EntityVisitor, - { - match *self { - #accept_body - } - } - } - }) -} - -fn visit_entities_mut_derive(mut s: synstructure::Structure) -> proc_macro2::TokenStream { - s.bind_with(|_| synstructure::BindStyle::RefMut); - - let accept_mut_body = s.each(|bi| { - quote! { - ::specs_visitor::VisitEntitiesMut::accept_mut(#bi, visitor); - } - }); - - s.add_bounds(synstructure::AddBounds::Generics); - - s.gen_impl(quote! { - gen impl ::specs_visitor::VisitEntitiesMut for @Self { - fn accept_mut(&mut self, visitor: &V) - where - V: ::specs_visitor::EntityVisitorMut, - { - match *self { - #accept_mut_body - } - } - } - }) -} - -decl_derive!([VisitEntities] => visit_entities_derive); -decl_derive!([VisitEntitiesMut] => visit_entities_mut_derive); diff --git a/specs-visitor-derive/src/tests.rs b/specs-visitor-derive/src/tests.rs deleted file mode 100644 index 992bf54..0000000 --- a/specs-visitor-derive/src/tests.rs +++ /dev/null @@ -1,130 +0,0 @@ -use specs; - -use super::visit_entities_derive; -use super::visit_entities_mut_derive; - -#[test] -fn simple() { - test_derive! { - visit_entities_derive { - struct Foo { - entity: specs::Entity, - } - } - expands to { - #[allow(non_upper_case_globals)] - const _DERIVE_specs_visitor_VisitEntities_FOR_Foo: () = { - impl ::specs_visitor::VisitEntities for Foo { - fn accept(&self, visitor: &V) - where - V: ::specs_visitor::EntityVisitor, - { - match *self { - Foo { - entity: ref __binding_0, - } => {{ - ::specs_visitor::VisitEntities::accept(__binding_0, visitor); - }} - } - } - } - }; - } - } -} - -#[test] -fn simple_mut() { - test_derive! { - visit_entities_mut_derive { - struct Foo { - entity: specs::Entity, - } - } - expands to { - #[allow(non_upper_case_globals)] - const _DERIVE_specs_visitor_VisitEntitiesMut_FOR_Foo: () = { - impl ::specs_visitor::VisitEntitiesMut for Foo { - fn accept_mut(&mut self, visitor: &V) - where - V: ::specs_visitor::EntityVisitorMut, - { - match *self { - Foo { - entity: ref mut __binding_0, - } => {{ - ::specs_visitor::VisitEntitiesMut::accept_mut(__binding_0, visitor); - }} - } - } - } - }; - } - } -} - -#[test] -fn generic() { - test_derive! { - visit_entities_derive { - struct Foo { - entity_stuff: T, - } - } - expands to { - #[allow(non_upper_case_globals)] - const _DERIVE_specs_visitor_VisitEntities_FOR_Foo: () = { - impl ::specs_visitor::VisitEntities for Foo - where - T: ::specs_visitor::VisitEntities - { - fn accept(&self, visitor: &V) - where - V: ::specs_visitor::EntityVisitor, - { - match *self { - Foo { - entity_stuff: ref __binding_0, - } => {{ - ::specs_visitor::VisitEntities::accept(__binding_0, visitor); - }} - } - } - } - }; - } - } -} - -#[test] -fn generic_mut() { - test_derive! { - visit_entities_mut_derive { - struct Foo { - entity_stuff: T, - } - } - expands to { - #[allow(non_upper_case_globals)] - const _DERIVE_specs_visitor_VisitEntitiesMut_FOR_Foo: () = { - impl ::specs_visitor::VisitEntitiesMut for Foo - where - T: ::specs_visitor::VisitEntitiesMut - { - fn accept_mut(&mut self, visitor: &V) - where - V: ::specs_visitor::EntityVisitorMut, - { - match *self { - Foo { - entity_stuff: ref mut __binding_0, - } => {{ - ::specs_visitor::VisitEntitiesMut::accept_mut(__binding_0, visitor); - }} - } - } - } - }; - } - } -} diff --git a/specs-visitor/Cargo.toml b/specs-visitor/Cargo.toml deleted file mode 100644 index 3c45fac..0000000 --- a/specs-visitor/Cargo.toml +++ /dev/null @@ -1,17 +0,0 @@ -[package] -name = "specs-visitor" -description = "Utilities for visiting entities in an ECS that is using the specs library." -license = "MIT" -version = "0.3.0" -authors = ["David Flemström "] -repository = "https://github.com/dflemstr/tin" -edition = "2018" - -[dependencies] -specs = { version = "0.14.3", default_features = false } -rayon = { version = "1.0.3", optional = true } - -[features] -default = ["parallel"] -parallel = ["rayon", "specs/parallel"] -test-render-graphs = [] diff --git a/specs-visitor/release.toml b/specs-visitor/release.toml deleted file mode 100644 index 0533e2d..0000000 --- a/specs-visitor/release.toml +++ /dev/null @@ -1 +0,0 @@ -no-dev-version = true diff --git a/specs-visitor/src/lib.rs b/specs-visitor/src/lib.rs deleted file mode 100644 index 51cc093..0000000 --- a/specs-visitor/src/lib.rs +++ /dev/null @@ -1,284 +0,0 @@ -//! Utilities for visiting specs components and resources very efficiently. -//! -//! This can be used to implement generic transformations of ECS graphs that compile down to very -//! effective code. -//! -//! Use the [`specs-visitor-derive`](https://crates.io/crates/specs-visitor-derive) crate to -//! automatically derive the traits in this crate. -#![deny(nonstandard_style, warnings, unused)] -#![deny( - missing_docs, - missing_debug_implementations, - missing_copy_implementations, - trivial_casts, - trivial_numeric_casts, - unstable_features, - unused_import_braces, - unused_qualifications -)] -#![cfg_attr(feature = "cargo-clippy", deny(clippy::all, clippy::pedantic))] - -use std::collections; -use std::hash; -use std::sync; - -/// Support for generically visiting all `specs` entities of a type with a -/// visitor. -/// -/// This trait can be derived automatically with `#[derive(VisitEntities)]` using the -/// [`specs-visitor-derive`](https://crates.io/crates/specs-visitor-derive) crate. -pub trait VisitEntities { - /// Accepts the given visitor. - /// - /// The visitor's `visit_entity` method will be called for every entity contained within this - /// type. The visitor could potentially be called in parallel. - fn accept(&self, visitor: &V) - where - V: EntityVisitor; -} - -/// Support for generically mutably visiting all `specs` entities of a type with a -/// visitor. -/// -/// This trait can be derived automatically with `#[derive(VisitEntitiesMut)]` using the -/// [`specs-visitor-derive`](https://crates.io/crates/specs-visitor-derive) crate. -pub trait VisitEntitiesMut { - /// Accepts the given visitor. - /// - /// The visitor's `visit_entity_mut` method will be called for every entity contained within - /// this type. This gives the visitor mutable references to each entity, allowing them to be - /// changed. Note that the visitor itself has a shared borrow instead of a mutable borrow, - /// because it might potentially be called in parallel. - fn accept_mut(&mut self, visitor: &V) - where - V: EntityVisitorMut; -} - -/// A visitor for visiting entities in a read-only fashion. -/// -/// Types implementing this trait are compatible with the `accept` method on the `VisitEntities` -/// trait. -pub trait EntityVisitor: Send + Sync { - /// Allows the visitor to visit the specified entity. - /// - /// This method could potentially be called in parallel. - fn visit_entity(&self, entity: specs::Entity); -} - -/// A visitor for visiting entities mutably. -/// -/// Types implementing this trait are compatible with the `accept_mut` method on the -/// `VisitEntitiesMut` trait. -pub trait EntityVisitorMut: Send + Sync { - /// Allows the visitor to visit the specified entity mutably. - /// - /// This method could potentially be called in parallel. - fn visit_entity_mut(&self, entity: &mut specs::Entity); -} - -#[cfg(feature = "parallel")] -fn for_each<'a, A, I, F>(iter: &'a I, action: F) -where - A: 'a + Send + Sync, - I: rayon::iter::IntoParallelRefIterator<'a, Item = A>, - F: Fn(A) + Send + Sync, -{ - use rayon::iter::ParallelIterator; - iter.par_iter().for_each(action) -} - -#[cfg(feature = "parallel")] -fn for_each_mut<'a, A, I, F>(iter: &'a mut I, action: F) -where - A: 'a + Send + Sync, - I: rayon::iter::IntoParallelRefMutIterator<'a, Item = A>, - F: Fn(A) + Send + Sync, -{ - use rayon::iter::ParallelIterator; - iter.par_iter_mut().for_each(action) -} - -#[cfg(not(feature = "parallel"))] -fn for_each(iter: I, action: F) -where - I: IntoIterator, - F: FnMut(A), -{ - iter.into_iter().for_each(action) -} - -#[cfg(not(feature = "parallel"))] -fn for_each_mut(iter: I, action: F) -where - I: IntoIterator, - F: FnMut(A), -{ - iter.into_iter().for_each(action) -} - -impl VisitEntities for specs::Entity { - fn accept(&self, visitor: &V) - where - V: EntityVisitor, - { - visitor.visit_entity(*self) - } -} - -impl VisitEntitiesMut for specs::Entity { - fn accept_mut(&mut self, visitor: &V) - where - V: EntityVisitorMut, - { - visitor.visit_entity_mut(self) - } -} - -impl VisitEntities for Option -where - A: VisitEntities + Send + Sync, -{ - fn accept(&self, visitor: &V) - where - V: EntityVisitor, - { - for_each(self, |element| element.accept(visitor)) - } -} - -impl VisitEntitiesMut for Option -where - A: VisitEntitiesMut + Send + Sync, -{ - fn accept_mut(&mut self, visitor: &V) - where - V: EntityVisitorMut, - { - for_each_mut(self, |element| element.accept_mut(visitor)) - } -} - -impl VisitEntities for Vec -where - A: VisitEntities + Send + Sync, -{ - fn accept(&self, visitor: &V) - where - V: EntityVisitor, - { - for_each(self, |element| element.accept(visitor)) - } -} - -impl VisitEntitiesMut for Vec -where - A: VisitEntitiesMut + Send + Sync, -{ - fn accept_mut(&mut self, visitor: &V) - where - V: EntityVisitorMut, - { - for_each_mut(self, |element| element.accept_mut(visitor)) - } -} - -impl VisitEntities for Box -where - A: VisitEntities + Send + Sync, -{ - fn accept(&self, visitor: &V) - where - V: EntityVisitor, - { - (**self).accept(visitor) - } -} - -impl VisitEntitiesMut for Box -where - A: VisitEntitiesMut + Send + Sync, -{ - fn accept_mut(&mut self, visitor: &V) - where - V: EntityVisitorMut, - { - (**self).accept_mut(visitor) - } -} - -impl VisitEntities for collections::HashMap -where - A: Eq + hash::Hash + Send + Sync, - B: VisitEntities + Send + Sync, -{ - fn accept(&self, visitor: &V) - where - V: EntityVisitor, - { - for_each(self, |(_, element)| element.accept(visitor)) - } -} - -impl VisitEntitiesMut for collections::HashMap -where - A: Eq + hash::Hash + Send + Sync, - B: VisitEntitiesMut + Send + Sync, -{ - fn accept_mut(&mut self, visitor: &V) - where - V: EntityVisitorMut, - { - for_each_mut(self, |(_, element)| element.accept_mut(visitor)) - } -} - -impl VisitEntities for sync::Arc -where - A: VisitEntities, -{ - fn accept(&self, visitor: &V) - where - V: EntityVisitor, - { - (**self).accept(visitor) - } -} - -macro_rules! impl_visit_entities_empty { - ($t:ty) => { - impl VisitEntities for $t { - #[inline(always)] - fn accept(&self, _visitor: &V) - where - V: EntityVisitor, - { - } - } - - impl VisitEntitiesMut for $t { - #[inline(always)] - fn accept_mut(&mut self, _visitor: &V) - where - V: EntityVisitorMut, - { - } - } - }; -} - -impl_visit_entities_empty!(i8); -impl_visit_entities_empty!(i16); -impl_visit_entities_empty!(i32); -impl_visit_entities_empty!(i64); -impl_visit_entities_empty!(isize); -impl_visit_entities_empty!(u8); -impl_visit_entities_empty!(u16); -impl_visit_entities_empty!(u32); -impl_visit_entities_empty!(u64); -impl_visit_entities_empty!(usize); -impl_visit_entities_empty!(f32); -impl_visit_entities_empty!(f64); -impl_visit_entities_empty!(bool); -impl_visit_entities_empty!(char); - -impl_visit_entities_empty!(String); diff --git a/syntax/src/ast.rs b/syntax/src/ast.rs new file mode 100644 index 0000000..e69de29 diff --git a/syntax/src/error.rs b/syntax/src/error.rs new file mode 100644 index 0000000..e69de29 diff --git a/syntax/src/parser.rs b/syntax/src/parser.rs new file mode 100644 index 0000000..e69de29 From 91b13aefa29383ac7fe8e2e1337105d3bd00dcab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Flemstr=C3=B6m?= Date: Mon, 22 Apr 2019 21:51:01 +0200 Subject: [PATCH 07/22] More syntax crate stuff --- Cargo.lock | 428 +++-------------------------------------- Cargo.toml | 2 +- src/interpreter/mod.rs | 2 +- src/lib.rs | 2 - syntax/Cargo.toml | 10 + syntax/src/ast.rs | 57 ++++++ syntax/src/error.rs | 1 + syntax/src/kind.rs | 71 +++++++ syntax/src/lib.rs | 8 + syntax/src/parser.rs | 32 +++ 10 files changed, 212 insertions(+), 401 deletions(-) create mode 100644 syntax/Cargo.toml create mode 100644 syntax/src/kind.rs create mode 100644 syntax/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 55d1c78..03ae8ba 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,16 +1,5 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -[[package]] -name = "afl" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "xdg 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "aho-corasick" version = "0.7.3" @@ -27,14 +16,6 @@ dependencies = [ "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "arrayvec" -version = "0.4.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "ascii-canvas" version = "1.0.0" @@ -43,11 +24,6 @@ dependencies = [ "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "atom" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "atty" version = "0.2.11" @@ -197,6 +173,11 @@ dependencies = [ "termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "colosseum" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "cranelift" version = "0.30.0" @@ -287,109 +268,6 @@ dependencies = [ "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "crossbeam" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "crossbeam-channel 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-deque 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-epoch 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "crossbeam-channel" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "crossbeam-epoch 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "crossbeam-deque" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "crossbeam-epoch 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "crossbeam-deque" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "crossbeam-epoch 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", - "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "crossbeam-utils" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "crossbeam-utils" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "crossbeam-utils" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "ctor" version = "0.1.8" @@ -399,16 +277,6 @@ dependencies = [ "syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "derivative" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "derive-new" version = "0.5.6" @@ -537,24 +405,11 @@ name = "fixedbitset" version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "fnv" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "fuchsia-cprng" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "fxhash" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "gcc" version = "0.3.55" @@ -585,15 +440,6 @@ dependencies = [ "unicode-segmentation 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "hibitset" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "atom 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", - "rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "humantime" version = "1.2.0" @@ -714,16 +560,6 @@ name = "memchr" version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "memoffset" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "mopa" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "ndarray" version = "0.12.1" @@ -740,16 +576,6 @@ name = "new_debug_unreachable" version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "nodrop" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "nonzero_signed" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "num-complex" version = "0.2.1" @@ -779,14 +605,6 @@ name = "num-traits" version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "num_cpus" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "opaque-debug" version = "0.2.2" @@ -813,14 +631,6 @@ dependencies = [ "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "owning_ref" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "owning_ref" version = "0.4.0" @@ -829,24 +639,6 @@ dependencies = [ "stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "parking_lot" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot_core 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "parking_lot" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "parking_lot" version = "0.7.1" @@ -856,29 +648,6 @@ dependencies = [ "parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "parking_lot_core" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "parking_lot_core" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "parking_lot_core" version = "0.4.0" @@ -969,30 +738,6 @@ dependencies = [ "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "rand" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rand" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "rand" version = "0.6.5" @@ -1104,27 +849,6 @@ name = "rawpointer" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "rayon" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "either 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rayon-core 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rayon-core" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "rdrand" version = "0.4.0" @@ -1182,6 +906,17 @@ name = "relative-path" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "rowan" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "colosseum 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "smol_str 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "text_unit 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rustc-demangle" version = "0.1.14" @@ -1299,37 +1034,6 @@ dependencies = [ "opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "shred" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", - "fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "mopa 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "shred-derive" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "shrev" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "derivative 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "siphasher" version = "0.2.3" @@ -1341,42 +1045,9 @@ version = "0.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "specs" -version = "0.14.3" +name = "smol_str" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "crossbeam 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "derivative 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "hibitset 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "mopa 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "nonzero_signed 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "shred 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "shred-derive 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "shrev 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tuple_utils 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "specs-visitor" -version = "0.3.0" -dependencies = [ - "rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "specs 0.14.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "specs-visitor-derive" -version = "0.3.0" -dependencies = [ - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "specs 0.14.3 (registry+https://github.com/rust-lang/crates.io-index)", - "specs-visitor 0.3.0", - "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] name = "stable_deref_trait" @@ -1524,6 +1195,11 @@ dependencies = [ "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "text_unit" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "textwrap" version = "0.11.0" @@ -1583,18 +1259,14 @@ dependencies = [ ] [[package]] -name = "tin-fuzz-target" +name = "tin-syntax" version = "0.1.0" dependencies = [ - "afl 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "tin 0.3.0", + "enum-primitive-derive 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rowan 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "tuple_utils" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "typenum" version = "1.10.0" @@ -1691,18 +1363,10 @@ dependencies = [ "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "xdg" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - [metadata] -"checksum afl 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf91d62aed05ac9b289ba6c5412e7ac61404254c20ed040ecf8448902834c3c" "checksum aho-corasick 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e6f484ae0c99fec2e858eb6134949117399f222608d84cadb3f58c1f97c2364c" "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" -"checksum arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "92c7fb76bc8826a8b33b4ee5bb07a247a81e76764ab4d55e8f73e3a4d8808c71" "checksum ascii-canvas 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b385d69402821a1c254533a011a312531cbcc0e3e24f19bbb4747a5a2daf37e2" -"checksum atom 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3c86699c3f02778ec07158376991c8f783dd1f2f95c579ffaf0738dc984b2fe2" "checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" "checksum autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a6d640bee2da49f60a4068a7fae53acde8982514ab7bae8b8cea9e88cbcfd799" "checksum backtrace 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "f106c02a3604afcdc0df5d36cc47b44b55917dbaf3d808f71c163a0ddba64637" @@ -1722,6 +1386,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" "checksum codespan 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "004def512a9848b23a68ed110927d102b0e6d9f3dc732e28570879afde051f8c" "checksum codespan-reporting 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab081a14ab8f9598ce826890fe896d0addee68c7a58ab49008369ccbb51510a8" +"checksum colosseum 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "370c83b49aedf022ee27942e8ae1d9de1cf40dc9653ee6550e4455d08f6406f9" "checksum cranelift 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)" = "135f36eed3a578925d4b8dd506e4df596c55615d2603c47e8638b8f6acc5bf22" "checksum cranelift-bforest 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e5a357d20666bf4a8c2d626a19f1b59dbca66cd844fb1e66c5612254fd0f7505" "checksum cranelift-codegen 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ab00cb149a5bb0f7e6dd391357356a5d71c335a431e8eece94f32da2d5a043f7" @@ -1731,18 +1396,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum cranelift-module 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)" = "83558a9230d46c75091fb6a1fe357ac693a669a85396da3c37a4ccd7d9f4acc3" "checksum cranelift-native 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d0239f34836621a127c2132980b2f5c32a1be1c40e2d1a9a1a9bd5af33c12aee" "checksum cranelift-simplejit 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)" = "caa00fb269e166f786a2c8e10e5866e365c7620c3686a7b592292f6d9cb0e2ff" -"checksum crossbeam 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d7408247b1b87f480890f28b670c5f8d9a8a4274833433fe74dc0dfd46d33650" -"checksum crossbeam-channel 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7b85741761b7f160bc5e7e0c14986ef685b7f8bf9b7ad081c60c604bb4649827" -"checksum crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f739f8c5363aca78cfb059edf753d8f0d36908c348f3d8d1503f03d8b75d9cf3" -"checksum crossbeam-deque 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7792c4a9b5a4222f654e3728a3dd945aacc24d2c3a1a096ed265d80e4929cb9a" -"checksum crossbeam-epoch 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "927121f5407de9956180ff5e936fe3cf4324279280001cd56b669d28ee7e9150" -"checksum crossbeam-epoch 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "30fecfcac6abfef8771151f8be4abc9e4edc112c2bcb233314cafde2680536e9" -"checksum crossbeam-epoch 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2449aaa4ec7ef96e5fb24db16024b935df718e9ae1cec0a1e68feeca2efca7b8" -"checksum crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2760899e32a1d58d5abb31129f8fae5de75220bc2176e77ff7c627ae45c918d9" -"checksum crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "677d453a17e8bd2b913fa38e8b9cf04bcdbb5be790aa294f2389661d72036015" -"checksum crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f8306fcef4a7b563b76b7dd949ca48f52bc1141aa067d2ea09565f3e2652aa5c" "checksum ctor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "e5cc1c7c759bf979c651ce1da82d06065375e2223b65c070190b8000787da58b" -"checksum derivative 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6073e9676dbebdddeabaeb63e3b7cefd23c86f5c41d381ee1237cc77b1079898" "checksum derive-new 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "6ca414e896ae072546f4d789f452daaecf60ddee4c9df5dc6d5936d769e3d87c" "checksum diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "3c2b69f912779fbb121ceb775d74d51e915af17aaebc38d28a592843a2dd0a3a" "checksum difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198" @@ -1759,14 +1413,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" "checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" "checksum fixedbitset 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "86d4de0081402f5e88cdac65c8dcdcc73118c1a7a465e2a05f0da05843a8ea33" -"checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" "checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" -"checksum fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" "checksum gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)" = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2" "checksum generic-array 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3c0f28c2f5bfb5960175af447a2da7c18900693738343dc896ffbcabd9839592" "checksum hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3bae29b6653b3412c2e71e9d486db9f9df5d701941d86683005efb9f2d28e3da" "checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" -"checksum hibitset 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6527bc88f32e0d3926c7572874b2bf17a19b36978aacd0aacf75f7d27a5992d0" "checksum humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ca7e5f2e110db35f93b837c81797f3714500b81d517bf20c431b16d3ca4f114" "checksum indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7e81a7c05f79578dbc15793d8b619db9ba32b4577003ef3af1a91c416798c58d" "checksum itertools 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0d47946d458e94a1b7bcabbf6521ea7c037062c81f534615abcad76e84d4970d" @@ -1782,28 +1433,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum mach 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "86dd2487cdfea56def77b88438a2c915fb45113c5319bfe7e14306ca4cd0b0e1" "checksum matrixmultiply 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "dcad67dcec2d58ff56f6292582377e6921afdf3bfbd533e26fb8900ae575e002" "checksum memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2efc7bc57c883d4a4d6e3246905283d8dae951bb3bd32f49d6ef297f546e1c39" -"checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3" -"checksum mopa 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a785740271256c230f57462d3b83e52f998433a7062fc18f96d5999474a9f915" "checksum ndarray 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7cf380a8af901ad627594013a3bbac903ae0a6f94e176e47e46b5bbc1877b928" "checksum new_debug_unreachable 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f40f005c60db6e03bae699e414c58bf9aa7ea02a2d0b9bfbcf19286cc4c82b30" -"checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" -"checksum nonzero_signed 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "02783a0482333b0d3f5f5411b8fb60454a596696da041da0470ac9ef3e6e37d8" "checksum num-complex 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "107b9be86cd2481930688277b675b0114578227f034674726605b8a482d8baf8" "checksum num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "e83d528d2677f0518c570baf2b7abdcf0cd2d248860b68507bdcb3e91d4c0cea" "checksum num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31" "checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1" -"checksum num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1a23f0ed30a54abaa0c7e83b1d2d87ada7c3c23078d1d87815af3e3b6385fbba" "checksum opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "93f5bb2e8e8dec81642920ccff6b61f1eb94fa3020c5a325c9851ff604152409" "checksum ordered-float 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "18869315e81473c951eb56ad5558bbc56978562d3ecfb87abb7a1e944cea4518" "checksum ordermap 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a86ed3f5f244b372d6b1a00b72ef7f8876d0bc6a78a4c9985c53614041512063" "checksum output_vt100 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "53cdc5b785b7a58c5aad8216b3dfa114df64b0b06ae6e1501cef91df2fbdf8f9" -"checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37" "checksum owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49a4b8ea2179e6a2e27411d3bca09ca6dd630821cf6894c6c7c8467a8ee7ef13" -"checksum parking_lot 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d4d05f1349491390b1730afba60bb20d55761bef489a954546b58b4b34e1e2ac" -"checksum parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f0802bff09003b291ba756dc7e79313e51cc31667e94afbe847def490424cde5" "checksum parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab41b4aed082705d1056416ae4468b6ea99d52599ecf3169b00088d43113e337" -"checksum parking_lot_core 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "4db1a8ccf734a7bce794cc19b3df06ed87ab2f3907036b693c68f56b4d4537fa" -"checksum parking_lot_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad7f7e6ebdc79edff6fdcb87a55b620174f7a989e3eb31b65231f4af57f00b8c" "checksum parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94c8c7923936b28d546dfd14d4472eaf34c99b14e1c973a32b3e6d4eb04298c9" "checksum petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)" = "9c3659d1ee90221741f65dd128d9998311b0e40c5d3c23a62445938214abce4f" "checksum phf_generator 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)" = "09364cc93c159b8b06b1f4dd8a4398984503483891b0c26b867cf431fb132662" @@ -1815,8 +1456,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" "checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" "checksum quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "faf4799c5d274f3868a4aae320a0a182cbd2baee377b378f080e16a23e9d80db" -"checksum rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" -"checksum rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9" "checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" "checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" "checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" @@ -1829,8 +1468,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" "checksum raw-cpuid 6.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "30a9d219c32c9132f7be513c18be77c9881c7107d2ab5569d205a6a0f0e6dc7d" "checksum rawpointer 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ebac11a9d2e11f2af219b8b8d833b76b1ea0e054aa0e8d8e9e4cbde353bdf019" -"checksum rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "373814f27745b2686b350dd261bfd24576a6fb0e2c5919b3a2b6005f820b0473" -"checksum rayon-core 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b055d1e92aba6877574d8fe604a63c8b5df60f60e5982bf7ccbb1338ea527356" "checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" "checksum redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)" = "12229c14a0f65c4f1cb046a3b52047cdd9da1f4b30f8a39c5063c8bae515e252" "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" @@ -1838,6 +1475,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum regex-syntax 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)" = "dcfd8681eebe297b81d98498869d4aae052137651ad7b96822f09ceb690d0a96" "checksum region 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ace21a7fc79cffefeb66f2cc3ef22c7687015023bf7f85bec8840f0d46cb51cc" "checksum relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0e7790c7f1cc73d831d28dc5a7deb316a006e7848e6a7f467cdb10a0a9e0fb1c" +"checksum rowan 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "91237e0f16ac1073139acd696d9d386c3225ba1d6eafc09b105984905994068d" "checksum rustc-demangle 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "ccc78bfd5acd7bf3e89cffcf899e5cb1a52d6fafa8dec2739ad70c9577a57288" "checksum rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7540fc8b0c49f096ee9c961cda096467dce8084bec6bdca2fc83895fd9b28cb8" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" @@ -1852,12 +1490,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)" = "58fc82bec244f168b23d1963b45c8bf5726e9a15a9d146a067f9081aeed2de79" "checksum serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)" = "5a23aa71d4a4d43fdbfaac00eff68ba8a06a51759a89ac3304323e800c4dd40d" "checksum sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b4d8bfd0e469f417657573d8451fb33d16cfe0989359b93baf3a1ffc639543d" -"checksum shred 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c75ec29e8d2959ad96a1087fe4cadb926c6fc17cbae9812314fa8efe720aa2a" -"checksum shred-derive 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9fcf34e5e5302d3024aba7afc291f6d1ca7573ed035d3c0796976ba3f10691a1" -"checksum shrev 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ec60ed6f60a4b3cdc2ceacf57215db3408fbd8990f66a38686a31558cd9da482" "checksum siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0b8de496cf83d4ed58b6be86c3a275b8602f6ffe98d3024a869e124147a9a3ac" "checksum smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c4488ae950c49d403731982257768f48fada354a5203fe81f9bb6f43ca9002be" -"checksum specs 0.14.3 (registry+https://github.com/rust-lang/crates.io-index)" = "de65613ada4338aa7ba71eca60eca24c60483433eec0077bc4f33cfc31f4bdf0" +"checksum smol_str 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "d077b3367211e9c6e2e012fb804c444e0d80ab5a51ae4137739b58e6446dcaef" "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" "checksum string_cache 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "25d70109977172b127fe834e5449e5ab1740b9ba49fa18a2020f509174f25423" "checksum string_cache_codegen 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1eea1eee654ef80933142157fdad9dd8bc43cf7c74e999e369263496f04ff4da" @@ -1874,10 +1509,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "fa63644f74ce96fbeb9b794f66aff2a52d601cbd5e80f4b97123e3899f4570f1" "checksum termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4096add70612622289f2fdcdbd5086dc81c1e2675e6ae58d6c4f62a16c6d7f2f" "checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" +"checksum text_unit 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "158bb1c22b638b1da3c95a8ad9f061ea40d4d39fd0301be3a520f92efeeb189e" "checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" -"checksum tuple_utils 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cbfecd7bb8f0a3e96b3b31c46af2677a55a588767c0091f484601424fcb20e7e" "checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169" "checksum ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86" "checksum unicode-segmentation 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "aa6024fc12ddfd1c6dbc14a80fa2324d4568849869b779f6bd37e5e4c03344d1" @@ -1894,4 +1529,3 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9" "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" "checksum wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "561ed901ae465d6185fa7864d63fbd5720d0ef718366c9a4dc83cf6170d7e9ba" -"checksum xdg 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d089681aa106a86fade1b0128fb5daf07d5867a509ab036d99988dec80429a57" diff --git a/Cargo.toml b/Cargo.toml index d5b8f69..2b3908a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -49,7 +49,7 @@ lto = true codegen-units = 1 [workspace] -members = ["specs-visitor", "specs-visitor-derive", "tin-fuzz-target"] +members = ["syntax"] [dev-dependencies] pretty_assertions = "0.6.1" diff --git a/src/interpreter/mod.rs b/src/interpreter/mod.rs index 2f12d85..9d4b5b5 100644 --- a/src/interpreter/mod.rs +++ b/src/interpreter/mod.rs @@ -106,7 +106,7 @@ fn eval_un_op( } } -#[cfg_attr(feature = "cargo-clippy", allow(clippy::cyclomatic_complexity))] +#[allow(clippy::cyclomatic_complexity)] fn eval_bi_op( lhs: &value::Value, operator: element::BiOperator, diff --git a/src/lib.rs b/src/lib.rs index 5188d2d..e5494fa 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -42,8 +42,6 @@ unused_import_braces, unused_qualifications )] -#![cfg_attr(feature = "cargo-clippy", deny(clippy::all, clippy::pedantic))] -#![cfg_attr(feature = "cargo-clippy", allow(clippy::use_self))] #[macro_use] extern crate enum_primitive_derive; diff --git a/syntax/Cargo.toml b/syntax/Cargo.toml new file mode 100644 index 0000000..798fc32 --- /dev/null +++ b/syntax/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "tin-syntax" +version = "0.1.0" +authors = ["David Flemström "] +edition = "2018" + +[dependencies] +enum-primitive-derive = "0.1.2" +rowan = "0.5.0" +num-traits = "0.2.6" diff --git a/syntax/src/ast.rs b/syntax/src/ast.rs index e69de29..d1e471e 100644 --- a/syntax/src/ast.rs +++ b/syntax/src/ast.rs @@ -0,0 +1,57 @@ +use crate::kind; + +pub trait Node: rowan::TransparentNewType { + fn from_rowan(node: &rowan::SyntaxNode) -> Option<&Self>; + + fn to_owned(&self) -> rowan::TreeArc; +} + +macro_rules! ast_node { + ($ast:ident) => { ast_node!($ast, $ast); }; + ($ast:ident, $kind:ident) => { + #[derive(Debug, Eq, Hash, PartialEq)] + #[repr(transparent)] + pub struct $ast(rowan::SyntaxNode); + + unsafe impl rowan::TransparentNewType for $ast { + type Repr = rowan::SyntaxNode; + } + + impl Node for $ast { + fn from_rowan(node: &rowan::SyntaxNode) -> Option<&Self> { + use rowan::TransparentNewType; + + if node.kind() == kind::Kind::$kind.to_rowan_kind() { + Some(Self::from_repr(node)) + } else { + None + } + } + + fn to_owned(&self) -> rowan::TreeArc { + rowan::TreeArc::cast(self.0.to_owned()) + } + } + + impl kind::HasKind for $ast { + fn kind(&self) -> kind::Kind { + kind::Kind::$kind + } + } + }; +} + +ast_node!(Reference); +ast_node!(Module); +ast_node!(Expression); +ast_node!(Statement); +ast_node!(Number); +ast_node!(String); +ast_node!(Symbol); +ast_node!(Tuple); +ast_node!(Record); +ast_node!(UnOp); +ast_node!(BiOp); +ast_node!(Lambda); +ast_node!(Parameter); +ast_node!(Apply); diff --git a/syntax/src/error.rs b/syntax/src/error.rs index e69de29..12fcaf2 100644 --- a/syntax/src/error.rs +++ b/syntax/src/error.rs @@ -0,0 +1 @@ +pub enum Error {} diff --git a/syntax/src/kind.rs b/syntax/src/kind.rs new file mode 100644 index 0000000..17f0fd7 --- /dev/null +++ b/syntax/src/kind.rs @@ -0,0 +1,71 @@ +use enum_primitive_derive::Primitive; + +#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Primitive)] +pub enum Kind { + // The discriminants in this enum are not stable and can change between releases without notice + + // Simple tokens + Semi = 1, + Comma = 2, + ParenOpen = 3, + ParenClose = 4, + CurlyOpen = 5, + CurlyClose = 6, + BracketOpen = 7, + BracketClose = 8, + AngleOpen = 9, + AngleClose = 10, + Arrow = 11, + Dot = 12, + Colon = 13, + Is = 14, + + // Operator tokens + Add = 15, + Sub = 16, + Mul = 17, + Div = 18, + + // Complex tokens + Comment = 19, + Identifier = 20, + SymbolLiteral = 21, + StringLiteral = 22, + UnsignedIntLiteral = 23, + SignedIntLiteral = 24, + FloatLiteral = 25, + + // Nodes + Reference = 26, + Module = 27, + Expression = 28, + Statement = 29, + Number = 30, + String = 31, + Symbol = 32, + Tuple = 33, + Record = 34, + UnOp = 35, + BiOp = 36, + Lambda = 37, + Parameter = 38, + Apply = 39, +} + +pub trait HasKind { + fn kind(&self) -> Kind; +} + +impl Kind { + pub fn to_rowan_kind(self) -> rowan::SyntaxKind { + use num_traits::cast::ToPrimitive; + + rowan::SyntaxKind(self.to_u16().unwrap()) + } + + pub fn from_rowan_kind(syntax_kind: rowan::SyntaxKind) -> Option { + use num_traits::cast::FromPrimitive; + + Self::from_u16(syntax_kind.0) + } +} diff --git a/syntax/src/lib.rs b/syntax/src/lib.rs new file mode 100644 index 0000000..3f1a8ec --- /dev/null +++ b/syntax/src/lib.rs @@ -0,0 +1,8 @@ +mod ast; +mod error; +mod kind; +mod parser; + +fn parse_module(text: &str) -> rowan::TreeArc { + unimplemented!() +} diff --git a/syntax/src/parser.rs b/syntax/src/parser.rs index e69de29..59cd56b 100644 --- a/syntax/src/parser.rs +++ b/syntax/src/parser.rs @@ -0,0 +1,32 @@ +use crate::ast; +use crate::error; +use crate::kind; + +pub struct Parser { + tokens: I, + builder: rowan::GreenNodeBuilder, + errors: Vec, +} + +impl Parser where I: Iterator { + fn parse(mut self) -> rowan::TreeArc { + use crate::ast::Node; + + self.builder.start_node(kind::Kind::Module.to_rowan_kind()); + + loop { + + } + + self.skip_ws(); + self.builder.finish_node(); + + let green = self.builder.finish(); + let node = rowan::SyntaxNode::new(green, None); + ast::Module::from_rowan(&node).unwrap().to_owned() + } + + fn skip_ws(&mut self) { + + } +} From 67fd7d49c0c4a0afc24e16733bf58ce8bc5f8a7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Flemstr=C3=B6m?= Date: Sun, 12 May 2019 18:04:27 +0200 Subject: [PATCH 08/22] Allow IR builder to use IR salsa db --- Cargo.lock | 39 --- Cargo.toml | 4 +- src/ir/builder.rs | 531 +++++++++++++++--------------- src/ir/db.rs | 35 +- src/ir/element.rs | 4 +- src/ir/mod.rs | 36 +- src/ir/symbol.rs | 68 ---- src/ir/world.rs | 50 --- src/layout/infer.rs | 1 + src/syntax/ast/ast_node.rs | 6 +- src/syntax/ast/map_context.rs | 18 +- src/syntax/ast/mod.rs | 14 +- src/syntax/parser/grammar.lalrpop | 93 ++---- src/syntax/parser/mod.rs | 246 +++++--------- src/syntax/parser/util.rs | 5 +- src/ty/infer.rs | 1 + syntax/src/kind.rs | 82 ++--- syntax/src/lib.rs | 1 + syntax/src/parser.rs | 74 ++++- syntax/src/token.rs | 6 + 20 files changed, 571 insertions(+), 743 deletions(-) delete mode 100644 src/ir/symbol.rs delete mode 100644 src/ir/world.rs create mode 100644 syntax/src/token.rs diff --git a/Cargo.lock b/Cargo.lock index 03ae8ba..78f4830 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -173,11 +173,6 @@ dependencies = [ "termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "colosseum" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "cranelift" version = "0.30.0" @@ -906,17 +901,6 @@ name = "relative-path" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "rowan" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "colosseum 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "smol_str 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "text_unit 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "rustc-demangle" version = "0.1.14" @@ -1044,11 +1028,6 @@ name = "smallvec" version = "0.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "smol_str" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "stable_deref_trait" version = "1.1.1" @@ -1195,11 +1174,6 @@ dependencies = [ "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "text_unit" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "textwrap" version = "0.11.0" @@ -1258,15 +1232,6 @@ dependencies = [ "walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "tin-syntax" -version = "0.1.0" -dependencies = [ - "enum-primitive-derive 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "rowan 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "typenum" version = "1.10.0" @@ -1386,7 +1351,6 @@ dependencies = [ "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" "checksum codespan 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "004def512a9848b23a68ed110927d102b0e6d9f3dc732e28570879afde051f8c" "checksum codespan-reporting 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab081a14ab8f9598ce826890fe896d0addee68c7a58ab49008369ccbb51510a8" -"checksum colosseum 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "370c83b49aedf022ee27942e8ae1d9de1cf40dc9653ee6550e4455d08f6406f9" "checksum cranelift 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)" = "135f36eed3a578925d4b8dd506e4df596c55615d2603c47e8638b8f6acc5bf22" "checksum cranelift-bforest 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e5a357d20666bf4a8c2d626a19f1b59dbca66cd844fb1e66c5612254fd0f7505" "checksum cranelift-codegen 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ab00cb149a5bb0f7e6dd391357356a5d71c335a431e8eece94f32da2d5a043f7" @@ -1475,7 +1439,6 @@ dependencies = [ "checksum regex-syntax 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)" = "dcfd8681eebe297b81d98498869d4aae052137651ad7b96822f09ceb690d0a96" "checksum region 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ace21a7fc79cffefeb66f2cc3ef22c7687015023bf7f85bec8840f0d46cb51cc" "checksum relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0e7790c7f1cc73d831d28dc5a7deb316a006e7848e6a7f467cdb10a0a9e0fb1c" -"checksum rowan 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "91237e0f16ac1073139acd696d9d386c3225ba1d6eafc09b105984905994068d" "checksum rustc-demangle 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "ccc78bfd5acd7bf3e89cffcf899e5cb1a52d6fafa8dec2739ad70c9577a57288" "checksum rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7540fc8b0c49f096ee9c961cda096467dce8084bec6bdca2fc83895fd9b28cb8" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" @@ -1492,7 +1455,6 @@ dependencies = [ "checksum sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b4d8bfd0e469f417657573d8451fb33d16cfe0989359b93baf3a1ffc639543d" "checksum siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0b8de496cf83d4ed58b6be86c3a275b8602f6ffe98d3024a869e124147a9a3ac" "checksum smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c4488ae950c49d403731982257768f48fada354a5203fe81f9bb6f43ca9002be" -"checksum smol_str 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "d077b3367211e9c6e2e012fb804c444e0d80ab5a51ae4137739b58e6446dcaef" "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" "checksum string_cache 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "25d70109977172b127fe834e5449e5ab1740b9ba49fa18a2020f509174f25423" "checksum string_cache_codegen 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1eea1eee654ef80933142157fdad9dd8bc43cf7c74e999e369263496f04ff4da" @@ -1509,7 +1471,6 @@ dependencies = [ "checksum term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "fa63644f74ce96fbeb9b794f66aff2a52d601cbd5e80f4b97123e3899f4570f1" "checksum termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4096add70612622289f2fdcdbd5086dc81c1e2675e6ae58d6c4f62a16c6d7f2f" "checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" -"checksum text_unit 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "158bb1c22b638b1da3c95a8ad9f061ea40d4d39fd0301be3a520f92efeeb189e" "checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" diff --git a/Cargo.toml b/Cargo.toml index 2b3908a..02edd63 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -48,8 +48,8 @@ debug = true lto = true codegen-units = 1 -[workspace] -members = ["syntax"] +#[workspace] +#members = ["syntax"] [dev-dependencies] pretty_assertions = "0.6.1" diff --git a/src/ir/builder.rs b/src/ir/builder.rs index 01c45b5..e1e88bb 100644 --- a/src/ir/builder.rs +++ b/src/ir/builder.rs @@ -1,511 +1,522 @@ use std::collections; use std::mem; +use std::sync; use crate::ir; use crate::ir::element; use crate::ir::error; use crate::ir::location; -use crate::ir::symbol; -use crate::ir::world; use crate::syntax::ast; use crate::syntax::parser; -pub struct Builder -where - W: world::World, -{ - world: W, - symbol: Vec, - current_closure: Option, - current_scope: collections::HashMap, - scopes: Vec>, - current_captures: collections::HashMap, - captures: Vec>, +pub struct Builder<'a, Db> { + db: &'a mut Db, + scope: Scope, + infos: collections::HashMap, +} + +#[derive(Debug)] +struct Scope { + parent: Option>, + entity: ir::Entity, + locals: collections::HashMap, + captures: collections::HashMap, } -impl Builder +impl<'a, Db> Builder<'a, Db> where - W: world::World, + Db: ir::db::IrDb, { - pub fn new(world: W) -> Builder { - let symbol = Vec::new(); - let current_scope = collections::HashMap::new(); - let scopes = Vec::new(); - let current_captures = collections::HashMap::new(); - let captures = Vec::new(); - - Builder { - world, - symbol, - current_scope, - scopes, - current_captures, - captures, - } + pub fn new(db: &'a mut Db, root: ir::Entity) -> Self { + let scope = Scope::new(root); + let infos = collections::HashMap::new(); + + Builder { db, scope, infos } } - pub fn add_module( + pub fn build_module( + mut self, + name: sync::Arc, + ast: &ast::Module, + ) -> Result { + let module_ident = self.db.ident(name.clone()); + let module_entity = self + .db + .entity(None, ir::db::EntityKind::Module(module_ident)); + + self.add_module(module_entity, ast)?; + + Ok(module_entity) + } + + fn add_module( &mut self, - db: impl ir::db::IrDb, entity: ir::Entity, ast: &ast::Module, ) -> Result<(), error::Error> { let mut variables = collections::HashMap::new(); for variable in &ast.variables { - let ident = db.ident(variable.name.value.clone()); - let var_entity = db.entity(Some(entity), ident); + let ident = self.db.ident(variable.name.clone()); + let var_entity = self + .db + .entity(Some(entity), ir::db::EntityKind::Named(ident)); - self.current_scope - .insert(ident, var_entity); + self.scope.locals.insert(ident, var_entity); variables.insert(ident, var_entity); } for variable in &ast.variables { - let ident = db.ident(variable.name.value.clone()); - self.add_variable(db, variables[&ident], variable)?; + let ident = self.db.ident(variable.name.clone()); + self.add_variable(variables[&ident], variable)?; } - self.world.set_element( - entity, - element::Element::Module(element::Module { variables }), - ); - self.world - .set_symbol(entity, symbol::Symbol::new(self.symbol.clone())); - self.world - .set_location(entity, location::Location(ast.context.span)); + let element = element::Element::Module(element::Module { variables }); + let location = location::Location(ast.context.span); + + self.infos + .insert(entity, ir::EntityInfo::new(element, location)); Ok(()) } - fn add_identifier( + fn add_reference( &mut self, - db: impl ir::db::IrDb, entity: ir::Entity, - identifier: &ast::Identifier, + ast: &ast::Reference, ) -> Result<(), error::Error> { - let ident = db.ident(identifier.value.clone()); - - let definition = self.current_scope.get(&ident).cloned().or_else(|| { - self.scopes - .iter() - .rev() - .flat_map(|scope| scope.get(&ident).cloned().into_iter()) - .next() - .map(|e| { - let capture = db.child_entity(entity, ident); - self.world.set_element( - capture, - element::Element::Capture(element::Capture { - name: ident, - captured: e, - }), - ); - - self.world - .set_location(capture, location::Location(identifier.context.span)); - - self.current_captures.insert(name.clone(), capture); - - capture - }) - }); - - let definition = definition.ok_or_else(|| error::Error::UndefinedReference { - reference: name.clone(), - location: identifier.context.span, - })?; + let ident = self.db.ident(ast.value.clone()); + let target = self + .scope + .resolve_capture(self.db, ident, ast.context.span)?; - self.world.replace(entity, definition); + let element = element::Element::Reference(target); + let location = location::Location(ast.context.span); - self.world - .set_location(entity, location::Location(identifier.context.span)); + self.infos + .insert(entity, ir::EntityInfo::new(element, location)); Ok(()) } fn add_expression( &mut self, - db: impl ir::db::IrDb, entity: ir::Entity, - expression: &ast::Expression, + ast: &ast::Expression, ) -> Result<(), error::Error> { - match *expression { - ast::Expression::NumberLiteral(ref v) => self.add_number(db, entity, v), - ast::Expression::StringLiteral(ref v) => self.add_string(db, entity, v), - ast::Expression::Symbol(ref v) => self.add_symbol(db, entity, v), - ast::Expression::Tuple(ref v) => self.add_tuple(db, entity, v), - ast::Expression::Record(ref v) => self.add_record(db, entity, v), - ast::Expression::UnOp(ref v) => self.add_un_op(db, entity, v), - ast::Expression::BiOp(ref v) => self.add_bi_op(db, entity, v), - ast::Expression::Identifier(ref v) => self.add_identifier(db, entity, v), - ast::Expression::Lambda(ref v) => self.add_lambda(db, entity, v), - ast::Expression::Select(ref v) => self.add_select(db, entity, v), - ast::Expression::Apply(ref v) => self.add_apply(db, entity, v), + match *ast { + ast::Expression::NumberLiteral(ref v) => self.add_number(entity, v), + ast::Expression::StringLiteral(ref v) => self.add_string(entity, v), + ast::Expression::Symbol(ref v) => self.add_symbol(entity, v), + ast::Expression::Tuple(ref v) => self.add_tuple(entity, v), + ast::Expression::Record(ref v) => self.add_record(entity, v), + ast::Expression::UnOp(ref v) => self.add_un_op(entity, v), + ast::Expression::BiOp(ref v) => self.add_bi_op(entity, v), + ast::Expression::Reference(ref v) => self.add_reference(entity, v), + ast::Expression::Lambda(ref v) => self.add_lambda(entity, v), + ast::Expression::Select(ref v) => self.add_select(entity, v), + ast::Expression::Apply(ref v) => self.add_apply(entity, v), ast::Expression::Unknown => panic!("'unknown' AST nodes should not escape the parser"), } } fn add_number( &mut self, - db: impl ir::db::IrDb, entity: ir::Entity, - number: &ast::NumberLiteral, + ast: &ast::NumberLiteral, ) -> Result<(), error::Error> { - self.world.set_element( - entity, - element::Element::Number(translate_number(number.value)), - ); + let element = element::Element::Number(translate_number(ast.value)); + let location = location::Location(ast.context.span); - self.world - .set_location(entity, location::Location(number.context.span)); + self.infos + .insert(entity, ir::EntityInfo::new(element, location)); Ok(()) } fn add_string( &mut self, - db: impl ir::db::IrDb, entity: ir::Entity, - string: &ast::StringLiteral, + ast: &ast::StringLiteral, ) -> Result<(), error::Error> { - self.world.set_element( - entity, - element::Element::String(match string.value { - ast::StringValue::String(ref s) => s.clone(), - ast::StringValue::Invalid => { - panic!("'invalid' AST nodes should not escape the parser") - } - }), - ); + let element = element::Element::String(match &ast.value { + ast::StringValue::String(str) => str.clone(), + ast::StringValue::Invalid => { + panic!("'invalid' string values should not escape the parser") + } + }); + let location = location::Location(ast.context.span); - self.world - .set_location(entity, location::Location(string.context.span)); + self.infos + .insert(entity, ir::EntityInfo::new(element, location)); Ok(()) } fn add_tuple( &mut self, - db: impl ir::db::IrDb, entity: ir::Entity, tuple: &ast::Tuple, ) -> Result<(), error::Error> { let fields = tuple .fields .iter() - .map(|f| { - let e = self.world.create_entity(); - self.add_expression(e, f)?; - Ok(e) + .enumerate() + .map(|(index, ast)| { + let entity = self + .db + .entity(Some(entity), ir::db::EntityKind::Indexed(index)); + self.add_expression(entity, &*ast)?; + Ok(entity) }) .collect::>()?; - self.world - .set_element(entity, element::Element::Tuple(element::Tuple { fields })); + let element = element::Element::Tuple(element::Tuple { fields }); + let location = location::Location(tuple.context.span); - self.world - .set_location(entity, location::Location(tuple.context.span)); + self.infos + .insert(entity, ir::EntityInfo::new(element, location)); Ok(()) } fn add_symbol( &mut self, - db: impl ir::db::IrDb, entity: ir::Entity, symbol: &ast::Symbol, ) -> Result<(), error::Error> { - let label = symbol.label.clone(); + let label = self.db.ident(symbol.label.clone()); - self.world - .set_element(entity, element::Element::Symbol(element::Symbol { label })); + let element = element::Element::Symbol(element::Symbol { label }); + let location = location::Location(symbol.context.span); - self.world - .set_location(entity, location::Location(symbol.context.span)); + self.infos + .insert(entity, ir::EntityInfo::new(element, location)); Ok(()) } fn add_record( &mut self, - db: impl ir::db::IrDb, entity: ir::Entity, record: &ast::Record, ) -> Result<(), error::Error> { let fields = record .fields .iter() - .map(|(i, e)| { - let en = self.world.create_entity(); - self.add_expression(en, e)?; - Ok((i.value.clone(), en)) + .map(|(field, value)| { + let ident = self.db.ident(field.clone()); + let entity = self + .db + .entity(Some(entity), ir::db::EntityKind::Named(ident)); + self.add_expression(entity, value)?; + Ok((ident, entity)) }) .collect::>()?; - self.world - .set_element(entity, element::Element::Record(element::Record { fields })); + let element = element::Element::Record(element::Record { fields }); + let location = location::Location(record.context.span); - self.world - .set_location(entity, location::Location(record.context.span)); + self.infos + .insert(entity, ir::EntityInfo::new(element, location)); Ok(()) } fn add_un_op( &mut self, - db: impl ir::db::IrDb, entity: ir::Entity, un_op: &ast::UnOp, ) -> Result<(), error::Error> { let operator = translate_un_operator(un_op.operator); - let operand = self.world.create_entity(); + let operand = self.db.entity(Some(entity), ir::db::EntityKind::UnOperand); self.add_expression(operand, &*un_op.operand)?; - self.world.set_element( - entity, - element::Element::UnOp(element::UnOp { operator, operand }), - ); + let element = element::Element::UnOp(element::UnOp { operator, operand }); + let location = location::Location(un_op.context.span); - self.world - .set_location(entity, location::Location(un_op.context.span)); + self.infos + .insert(entity, ir::EntityInfo::new(element, location)); Ok(()) } fn add_bi_op( &mut self, - db: impl ir::db::IrDb, entity: ir::Entity, bi_op: &ast::BiOp, ) -> Result<(), error::Error> { - let lhs = self.world.create_entity(); + let lhs = self.db.entity(Some(entity), ir::db::EntityKind::BiLhs); self.add_expression(lhs, &*bi_op.lhs)?; let operator = translate_bi_operator(bi_op.operator); - let rhs = self.world.create_entity(); + let rhs = self.db.entity(Some(entity), ir::db::EntityKind::BiRhs); self.add_expression(rhs, &*bi_op.rhs)?; - self.world.set_element( - entity, - element::Element::BiOp(element::BiOp { lhs, operator, rhs }), - ); + let element = element::Element::BiOp(element::BiOp { lhs, operator, rhs }); + let location = location::Location(bi_op.context.span); - self.world - .set_location(entity, location::Location(bi_op.context.span)); + self.infos + .insert(entity, ir::EntityInfo::new(element, location)); Ok(()) } fn add_lambda( &mut self, - db: impl ir::db::IrDb, entity: ir::Entity, lambda: &ast::Lambda, ) -> Result<(), error::Error> { // TODO generate unique symbol for anonymous lambdas - self.push_scope(Some(lambda.parameters.len()), None); + self.push_scope(entity); let parameters = lambda .parameters .iter() - .map(|p| { - let e = self.world.create_entity(); - self.add_parameter(e, p)?; - Ok(e) + .map(|parameter| { + let ident = self.db.ident(parameter.name.clone()); + let entity = self + .db + .entity(Some(entity), ir::db::EntityKind::Named(ident)); + self.add_parameter(entity, &*parameter)?; + Ok(entity) }) .collect::, error::Error>>()?; // Defer inserting parameters as variables until here to ensure that one parameter can't // depend on another one. for (entity, parameter) in parameters.iter().zip(lambda.parameters.iter()) { - self.current_scope - .insert(parameter.name.value.clone(), *entity); + let ident = self.db.ident(parameter.name.clone()); + self.scope.locals.insert(ident, *entity); } let statements = lambda .statements .iter() - .map(|s| { - let e = self.world.create_entity(); + .enumerate() + .map(|(index, statement)| { + let entity = self + .db + .entity(Some(entity), ir::db::EntityKind::Indexed(index)); - match s { + match &**statement { ast::Statement::Variable(ref variable) => { - self.current_scope.insert(variable.name.value.clone(), e); - self.add_variable(e, variable)?; + let ident = self.db.ident(variable.name.clone()); + self.scope.locals.insert(ident, entity); + self.add_variable(entity, variable)?; } ast::Statement::Expression(ref expression) => { - self.add_expression(e, expression)?; + self.add_expression(entity, expression)?; } } - Ok(e) + Ok(entity) }) .collect::, error::Error>>()?; - let signature = self.world.create_entity(); + let signature = self.db.entity(Some(entity), ir::db::EntityKind::Signature); self.add_expression(signature, &*lambda.signature)?; let result = if let Some(ref result) = lambda.result { - let e = self.world.create_entity(); + let e = self + .db + .entity(Some(entity), ir::db::EntityKind::LambdaResult); self.add_expression(e, &*result)?; e } else { signature }; - self.world.set_element( - entity, - element::Element::Closure(element::Closure { - captures: self.current_captures.clone(), - parameters, - statements, - signature, - result, - }), - ); - - self.world - .set_symbol(entity, symbol::Symbol::new(self.symbol.clone())); + let location = location::Location(lambda.context.span); + + let scope = self.pop_scope(); + let captures = scope + .captures + .into_iter() + .map(|(entity, capture)| { + let ident = capture.name; + self.infos.insert( + entity, + ir::EntityInfo::new(element::Element::Capture(capture), location), + ); + (ident, entity) + }) + .collect(); - self.world - .set_location(entity, location::Location(lambda.context.span)); + let element = element::Element::Closure(element::Closure { + captures, + parameters, + statements, + signature, + result, + }); - self.pop_scope(); + self.infos + .insert(entity, ir::EntityInfo::new(element, location)); Ok(()) } fn add_variable( &mut self, - db: impl ir::db::IrDb, entity: ir::Entity, variable: &ast::Variable, ) -> Result<(), error::Error> { - self.symbol - .push(symbol::Part::Named(variable.name.value.clone())); + let name = self.db.ident(variable.name.clone()); - let name = variable.name.value.clone(); - let initializer = self.world.create_entity(); + let initializer = self + .db + .entity(Some(entity), ir::db::EntityKind::Initializer); self.add_expression(initializer, &variable.initializer)?; - self.world.set_element( - entity, - element::Element::Variable(element::Variable { name, initializer }), - ); - - self.world - .set_symbol(entity, symbol::Symbol::new(self.symbol.clone())); + let element = element::Element::Variable(element::Variable { name, initializer }); + let location = location::Location(variable.context.span); - self.world - .set_location(entity, location::Location(variable.context.span)); - - self.symbol.pop(); + self.infos + .insert(entity, ir::EntityInfo::new(element, location)); Ok(()) } fn add_select( &mut self, - db: impl ir::db::IrDb, entity: ir::Entity, select: &ast::Select, ) -> Result<(), error::Error> { - let record = self.world.create_entity(); + let field = self.db.ident(select.field.clone()); + let record = self + .db + .entity(Some(entity), ir::db::EntityKind::Named(field)); self.add_expression(record, &*select.record)?; - let field = select.field.value.clone(); - - self.world.set_element( - entity, - element::Element::Select(element::Select { record, field }), - ); + let element = element::Element::Select(element::Select { record, field }); + let location = location::Location(select.context.span); - self.world - .set_location(entity, location::Location(select.context.span)); + self.infos + .insert(entity, ir::EntityInfo::new(element, location)); Ok(()) } fn add_apply( &mut self, - db: impl ir::db::IrDb, entity: ir::Entity, apply: &ast::Apply, ) -> Result<(), error::Error> { - let function = self.world.create_entity(); + let function = self + .db + .entity(Some(entity), ir::db::EntityKind::CalledFunction); self.add_expression(function, &*apply.function)?; let parameters = apply .parameters .iter() - .map(|p| { - let e = self.world.create_entity(); - self.add_expression(e, p)?; - Ok(e) + .enumerate() + .map(|(index, parameter)| { + let entity = self + .db + .entity(Some(entity), ir::db::EntityKind::Indexed(index)); + self.add_expression(entity, &*parameter)?; + Ok(entity) }) .collect::>()?; - self.world.set_element( - entity, - element::Element::Apply(element::Apply { - function, - parameters, - }), - ); + let element = element::Element::Apply(element::Apply { + function, + parameters, + }); + let location = location::Location(apply.context.span); - self.world - .set_location(entity, location::Location(apply.context.span)); + self.infos + .insert(entity, ir::EntityInfo::new(element, location)); Ok(()) } fn add_parameter( &mut self, - db: impl ir::db::IrDb, entity: ir::Entity, parameter: &ast::Parameter, ) -> Result<(), error::Error> { - let name = parameter.name.value.clone(); - let signature = self.world.create_entity(); + let name = self.db.ident(parameter.name.clone()); + let signature = self.db.entity(Some(entity), ir::db::EntityKind::Signature); self.add_expression(signature, ¶meter.signature)?; - self.world.set_element( - entity, - element::Element::Parameter(element::Parameter { name, signature }), - ); + let element = element::Element::Parameter(element::Parameter { name, signature }); + let location = location::Location(parameter.context.span); - self.world - .set_location(entity, location::Location(parameter.context.span)); + self.infos + .insert(entity, ir::EntityInfo::new(element, location)); Ok(()) } - fn push_scope(&mut self, scope_size_hint: Option, captures_size_hint: Option) { - self.scopes.push(mem::replace( - &mut self.current_scope, - scope_size_hint.map_or_else( - collections::HashMap::new, - collections::HashMap::with_capacity, - ), - )); - self.captures.push(mem::replace( - &mut self.current_captures, - captures_size_hint.map_or_else( - collections::HashMap::new, - collections::HashMap::with_capacity, - ), - )); + fn push_scope(&mut self, entity: ir::Entity) { + let scope = Scope::new(entity); + let parent_scope = mem::replace(&mut self.scope, scope); + self.scope.parent = Some(Box::new(parent_scope)); } - fn pop_scope(&mut self) { - self.current_scope = self.scopes.pop().unwrap(); - self.current_captures = self.captures.pop().unwrap(); + fn pop_scope(&mut self) -> Scope { + let parent = self + .scope + .parent + .take() + .expect("unbalanced push_scope/pop_scope calls"); + mem::replace(&mut self.scope, *parent) + } +} + +impl Scope { + fn new(entity: ir::Entity) -> Self { + let parent = None; + let locals = collections::HashMap::new(); + let captures = collections::HashMap::new(); + + Self { + parent, + entity, + locals, + captures, + } + } + + fn resolve_capture( + &mut self, + db: &mut impl ir::db::IrDb, + ident: ir::Ident, + location: codespan::ByteSpan, + ) -> Result { + match self.locals.entry(ident) { + collections::hash_map::Entry::Occupied(entry) => Ok(*entry.get()), + collections::hash_map::Entry::Vacant(entry) => { + if let Some(parent) = &mut self.parent { + let capture_entity = + db.entity(Some(self.entity), ir::db::EntityKind::Named(ident)); + let parent_entity = parent.resolve_capture(db, ident, location)?; + self.captures.insert( + capture_entity, + element::Capture { + name: ident, + captured: parent_entity, + }, + ); + self.locals.insert(ident, capture_entity); + Ok(capture_entity) + } else { + let reference = (*db.lookup_ident(ident)).clone(); + Err(error::Error::UndefinedReference { + reference, + location, + }) + } + } + } } } diff --git a/src/ir/db.rs b/src/ir/db.rs index 0e99a1a..1e57a4c 100644 --- a/src/ir/db.rs +++ b/src/ir/db.rs @@ -4,7 +4,6 @@ use std::sync; use crate::ir; use crate::ir::element; use crate::ir::location; -use crate::ir::symbol; use crate::syntax; #[salsa::query_group(Ir)] @@ -13,34 +12,42 @@ pub trait IrDb: salsa::Database + syntax::db::SyntaxDb { fn ident(&self, id: sync::Arc) -> ir::Ident; #[salsa::interned] - fn entity(&self, parent: Option, ident: ir::Ident) -> ir::Entity; + fn entity(&self, parent: Option, kind: EntityKind) -> ir::Entity; fn entity_element(&self, entity: ir::Entity) -> sync::Arc; fn entity_location(&self, entity: ir::Entity) -> sync::Arc; - fn entity_symbol(&self, entity: ir::Entity) -> sync::Arc; - fn entities(&self) -> sync::Arc; } -fn entity_element(_ir: &impl IrDb, _entity: ir::Entity) -> sync::Arc { - unimplemented!() +#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] +pub enum EntityKind { + Module(ir::Ident), + Named(ir::Ident), + Indexed(usize), + Initializer, + UnOperand, + BiLhs, + BiRhs, + Signature, + LambdaResult, + CalledFunction, } -fn entity_location(_ir: &impl IrDb, _entity: ir::Entity) -> sync::Arc { - unimplemented!() +fn entity_element(db: &impl IrDb, entity: ir::Entity) -> sync::Arc { + db.entities().infos.get(&entity).unwrap().element.clone() } -fn entity_symbol(_ir: &impl IrDb, _entity: ir::Entity) -> sync::Arc { - unimplemented!() +fn entity_location(db: &impl IrDb, entity: ir::Entity) -> sync::Arc { + db.entities().infos.get(&entity).unwrap().location.clone() } -fn entities(ir: &impl IrDb) -> sync::Arc { +fn entities(db: &impl IrDb) -> sync::Arc { let mut entities = ir::Entities::new(); - for source_root_id in &*ir.all_source_roots() { - for file in ir.source_root(*source_root_id).files.values() { - let result = ir.parse(*file).unwrap(); + for source_root_id in &*db.all_source_roots() { + for file in db.source_root(*source_root_id).files.values() { + let result = db.parse(*file).unwrap(); //let mut builder = ir::builder::Builder::new(&mut entities); //builder.add_module(&*result).unwrap(); diff --git a/src/ir/element.rs b/src/ir/element.rs index 7684cd2..d35894f 100644 --- a/src/ir/element.rs +++ b/src/ir/element.rs @@ -1,12 +1,14 @@ use std::collections; use std::fmt; +use std::sync; use crate::ir; #[derive(Clone, Debug, Eq, PartialEq)] pub enum Element { + Reference(ir::Entity), Number(Number), - String(String), + String(sync::Arc), Symbol(Symbol), Tuple(Tuple), Record(Record), diff --git a/src/ir/mod.rs b/src/ir/mod.rs index 4f47336..f9f366e 100644 --- a/src/ir/mod.rs +++ b/src/ir/mod.rs @@ -1,13 +1,12 @@ //! Intermediate representation variables for the compiler and interpreter. use std::collections; +use std::sync; -// pub mod builder; +pub mod builder; pub mod db; pub mod element; pub mod error; pub mod location; -pub mod symbol; -pub mod world; //#[cfg(test)] //mod tests; @@ -19,9 +18,13 @@ pub struct Entity(u32); #[derive(Clone, Debug, Eq, PartialEq)] pub struct Entities { - elements: collections::HashMap, - locations: collections::HashMap, - symbols: collections::HashMap, + infos: collections::HashMap, +} + +#[derive(Clone, Debug, Eq, PartialEq)] +pub struct EntityInfo { + pub element: sync::Arc, + pub location: sync::Arc, } impl salsa::InternKey for Ident { @@ -44,16 +47,19 @@ impl salsa::InternKey for Entity { } } +impl EntityInfo { + fn new(element: element::Element, location: location::Location) -> Self { + let element = sync::Arc::new(element); + let location = sync::Arc::new(location); + + Self { element, location } + } +} + impl Entities { pub fn new() -> Self { - let elements = collections::HashMap::new(); - let locations = collections::HashMap::new(); - let symbols = collections::HashMap::new(); - - Self { - elements, - locations, - symbols, - } + let infos = collections::HashMap::new(); + + Self { infos } } } diff --git a/src/ir/symbol.rs b/src/ir/symbol.rs deleted file mode 100644 index c2c072a..0000000 --- a/src/ir/symbol.rs +++ /dev/null @@ -1,68 +0,0 @@ -use std::fmt; - -#[derive(Clone, Debug, Eq, PartialEq)] -pub struct Symbol { - public: bool, - parts: Vec, -} - -#[derive(Clone, Debug, Eq, PartialEq)] -pub enum Part { - Named(String), - #[allow(unused)] - Unnamed(u64), -} - -impl Symbol { - pub fn new(parts: Vec) -> Self { - let public = false; - Symbol { public, parts } - } - - pub fn into_public(self) -> Self { - let public = true; - let parts = self.parts; - Symbol { public, parts } - } - - pub fn is_empty(&self) -> bool { - self.parts.is_empty() - } - - pub fn is_public(&self) -> bool { - self.public - } - - pub fn is_top_level(&self) -> bool { - self.parts.len() == 1 - } -} - -impl fmt::Display for Symbol { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - if self.public { - f.write_str("public:")?; - } - - let mut needs_sep = false; - - for part in &self.parts { - if needs_sep { - f.write_str(".")?; - } - part.fmt(f)?; - needs_sep = true; - } - - Ok(()) - } -} - -impl fmt::Display for Part { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match *self { - Part::Named(ref name) => name.fmt(f), - Part::Unnamed(ref id) => id.fmt(f), - } - } -} diff --git a/src/ir/world.rs b/src/ir/world.rs deleted file mode 100644 index 77e734f..0000000 --- a/src/ir/world.rs +++ /dev/null @@ -1,50 +0,0 @@ -use crate::ir; -use crate::ir::element; -use crate::ir::location; -use crate::ir::symbol; - -pub trait World { - fn set_element(&mut self, entity: ir::Entity, element: element::Element); - fn set_location(&mut self, entity: ir::Entity, location: location::Location); - fn set_symbol(&mut self, entity: ir::Entity, symbol: symbol::Symbol); - fn replace(&mut self, from: ir::Entity, to: ir::Entity); -} - -impl<'a, W> World for &'a mut W -where - W: World, -{ - fn set_element(&mut self, entity: ir::Entity, element: element::Element) { - (*self).set_element(entity, element) - } - - fn set_location(&mut self, entity: ir::Entity, location: location::Location) { - (*self).set_location(entity, location) - } - - fn set_symbol(&mut self, entity: ir::Entity, symbol: symbol::Symbol) { - (*self).set_symbol(entity, symbol) - } - - fn replace(&mut self, from: ir::Entity, to: ir::Entity) { - (*self).replace(from, to) - } -} - -impl World for ir::Entities { - fn set_element(&mut self, entity: ir::Entity, element: element::Element) { - unimplemented!() - } - - fn set_location(&mut self, entity: ir::Entity, location: location::Location) { - unimplemented!() - } - - fn set_symbol(&mut self, entity: ir::Entity, symbol: symbol::Symbol) { - unimplemented!() - } - - fn replace(&mut self, from: ir::Entity, to: ir::Entity) { - unimplemented!() - } -} diff --git a/src/layout/infer.rs b/src/layout/infer.rs index 4ba00e9..42da6d2 100644 --- a/src/layout/infer.rs +++ b/src/layout/infer.rs @@ -23,6 +23,7 @@ impl System { db: impl layout::db::LayoutDb, ) -> sync::Arc { match *element { + element::Element::Reference(_) => unimplemented!(), element::Element::Number(ref n) => self.infer_number_layout(n), element::Element::String(_) => sync::Arc::new(layout::Layout::scalar(self.ptr_size)), element::Element::Symbol(_) => sync::Arc::new(layout::Layout::zero()), diff --git a/src/syntax/ast/ast_node.rs b/src/syntax/ast/ast_node.rs index ebecdb4..6656233 100644 --- a/src/syntax/ast/ast_node.rs +++ b/src/syntax/ast/ast_node.rs @@ -25,7 +25,7 @@ where } } -impl AstNode for ast::Identifier +impl AstNode for ast::Reference where C: fmt::Debug, { @@ -51,7 +51,7 @@ where ast::Expression::Record(ref v) => v.context(), ast::Expression::UnOp(ref v) => v.context(), ast::Expression::BiOp(ref v) => v.context(), - ast::Expression::Identifier(ref v) => v.context(), + ast::Expression::Reference(ref v) => v.context(), ast::Expression::Lambda(ref v) => v.context(), ast::Expression::Select(ref v) => v.context(), ast::Expression::Apply(ref v) => v.context(), @@ -68,7 +68,7 @@ where ast::Expression::Record(ref mut v) => v.context_mut(), ast::Expression::UnOp(ref mut v) => v.context_mut(), ast::Expression::BiOp(ref mut v) => v.context_mut(), - ast::Expression::Identifier(ref mut v) => v.context_mut(), + ast::Expression::Reference(ref mut v) => v.context_mut(), ast::Expression::Lambda(ref mut v) => v.context_mut(), ast::Expression::Select(ref mut v) => v.context_mut(), ast::Expression::Apply(ref mut v) => v.context_mut(), diff --git a/src/syntax/ast/map_context.rs b/src/syntax/ast/map_context.rs index 69d45c7..0a2e53f 100644 --- a/src/syntax/ast/map_context.rs +++ b/src/syntax/ast/map_context.rs @@ -41,12 +41,12 @@ where } } -impl MapContext for ast::Identifier +impl MapContext for ast::Reference where C1: Clone + fmt::Debug, C2: Clone + fmt::Debug, { - type Output = ast::Identifier; + type Output = ast::Reference; fn map_context(self, mapping: &mut F) -> Self::Output where @@ -55,7 +55,7 @@ where let context = mapping(self.context); let value = self.value; - ast::Identifier { context, value } + ast::Reference { context, value } } } @@ -82,7 +82,7 @@ where ast::Expression::Record(e) => ast::Expression::Record(e.map_context(mapping)), ast::Expression::UnOp(e) => ast::Expression::UnOp(e.map_context(mapping)), ast::Expression::BiOp(e) => ast::Expression::BiOp(e.map_context(mapping)), - ast::Expression::Identifier(e) => ast::Expression::Identifier(e.map_context(mapping)), + ast::Expression::Reference(e) => ast::Expression::Reference(e.map_context(mapping)), ast::Expression::Lambda(e) => ast::Expression::Lambda(e.map_context(mapping)), ast::Expression::Select(e) => ast::Expression::Select(e.map_context(mapping)), ast::Expression::Apply(e) => ast::Expression::Apply(e.map_context(mapping)), @@ -178,9 +178,9 @@ where let fields = self .fields .into_iter() - .map(|(i, f)| { + .map(|(n, f)| { ( - sync::Arc::new(own(i).map_context(mapping)), + sync::Arc::new(own(n)), sync::Arc::new(own(f).map_context(mapping)), ) }) @@ -302,7 +302,7 @@ where F: FnMut(C1) -> C2, { let context = mapping(self.context); - let name = sync::Arc::new(own(self.name).map_context(mapping)); + let name = sync::Arc::new(own(self.name)); let initializer = sync::Arc::new(own(self.initializer).map_context(mapping)); ast::Variable { @@ -326,7 +326,7 @@ where { let context = mapping(self.context); let record = sync::Arc::new(own(self.record).map_context(mapping)); - let field = sync::Arc::new(own(self.field).map_context(mapping)); + let field = sync::Arc::new(own(self.field)); ast::Select { context, record, @@ -373,7 +373,7 @@ where F: FnMut(C1) -> C2, { let context = mapping(self.context); - let name = sync::Arc::new(own(self.name).map_context(mapping)); + let name = sync::Arc::new(own(self.name)); let signature = sync::Arc::new(own(self.signature).map_context(mapping)); ast::Parameter { context, diff --git a/src/syntax/ast/mod.rs b/src/syntax/ast/mod.rs index 4a0919d..f2f8653 100644 --- a/src/syntax/ast/mod.rs +++ b/src/syntax/ast/mod.rs @@ -58,7 +58,7 @@ pub struct Module { /// An identifier. #[derive(Clone, Debug, Eq, PartialEq)] -pub struct Identifier { +pub struct Reference { /// This node's AST context. pub context: C, /// The raw string name of the identifier. @@ -79,7 +79,7 @@ pub enum Expression { /// A record literal. Record(Record), /// A reference to an identifier. - Identifier(Identifier), + Reference(Reference), /// A unary operator application. UnOp(UnOp), /// A binary operator application. @@ -144,7 +144,7 @@ pub struct StringLiteral { #[derive(Clone, Debug, Eq, PartialEq)] pub enum StringValue { /// A plain string. - String(String), + String(sync::Arc), /// The string value is invalid (e.g. has an illegal character). Invalid, } @@ -173,7 +173,7 @@ pub struct Record { /// This node's AST context. pub context: C, /// The fields of the record, in declaration order. - pub fields: Vec<(sync::Arc>, sync::Arc>)>, + pub fields: Vec<(sync::Arc, sync::Arc>)>, } /// An unary operator. @@ -323,7 +323,7 @@ pub struct Variable { /// This node's AST context. pub context: C, /// The name of the variable. - pub name: sync::Arc>, + pub name: sync::Arc, /// The initializer expression of the variable. pub initializer: sync::Arc>, } @@ -336,7 +336,7 @@ pub struct Select { /// The expression to select from; should evaluate to a record. pub record: sync::Arc>, /// The field to select. - pub field: sync::Arc>, + pub field: sync::Arc, } /// A function application expression. @@ -357,7 +357,7 @@ pub struct Parameter { /// This node's AST context. pub context: C, /// The name of the parameter. - pub name: sync::Arc>, + pub name: sync::Arc, /// The signature of the parameter. pub signature: sync::Arc>, } diff --git a/src/syntax/parser/grammar.lalrpop b/src/syntax/parser/grammar.lalrpop index d938b40..4661024 100644 --- a/src/syntax/parser/grammar.lalrpop +++ b/src/syntax/parser/grammar.lalrpop @@ -20,7 +20,7 @@ match { )" => NumberValue, } else { r"/\*(\*[^/]|[^*])*\*/" => Comment, - r"\p{XID_Start}\p{XID_Continue}*" => IdentifierName, + r"\p{XID_Start}\p{XID_Continue}*" => Identifier, r":\p{XID_Start}\p{XID_Continue}*" => SymbolLabel, r#""(?:[^"\\]|\\.)*""# => StringValue, _ @@ -65,70 +65,33 @@ pub Module: ast::Module = { Definition: ast::Variable = { "=" => - ast::Variable { context: parser::Context::new(ast::Kind::Variable, span, lo, hi), name: sync::Arc::new(n), initializer: sync::Arc::new(i) }, + ast::Variable { context: parser::Context::new(ast::Kind::Variable, span, lo, hi), name: sync::Arc::new(n.to_owned()), initializer: sync::Arc::new(i) }, } pub Expression = { } // Left-to-right evaluation -ExpressionBiOpOr: ast::Expression = { - BiOp => ast::Expression::BiOp(<>), - ExpressionBiOpXor => <>, -} - -// Left-to-right evaluation -ExpressionBiOpXor: ast::Expression = { - BiOp => ast::Expression::BiOp(<>), - ExpressionBiOpAnd => <>, -} - -// Left-to-right evaluation -ExpressionBiOpAnd: ast::Expression = { - BiOp => ast::Expression::BiOp(<>), - ExpressionBiOpCmp => <>, +LeftOp: ast::Expression = { + BiOp, Op, NextTier> => ast::Expression::BiOp(<>), + NextTier => <>, } // No associativity; require parenthesis -ExpressionBiOpCmp: ast::Expression = { - BiOp => ast::Expression::BiOp(<>), - ExpressionBiOpBOr => <>, -} - -// Left-to-right evaluation -ExpressionBiOpBOr: ast::Expression = { - BiOp => ast::Expression::BiOp(<>), - ExpressionBiOpBXor => <>, -} - -// Left-to-right evaluation -ExpressionBiOpBXor: ast::Expression = { - BiOp => ast::Expression::BiOp(<>), - ExpressionBiOpBAnd => <>, -} - -// Left-to-right evaluation -ExpressionBiOpBAnd: ast::Expression = { - BiOp => ast::Expression::BiOp(<>), - ExpressionBiOpShift => <>, -} - -// Left-to-right evaluation -ExpressionBiOpShift: ast::Expression = { - BiOp => ast::Expression::BiOp(<>), - ExpressionBiOpSum => <>, -} - -// Left-to-right evaluation -ExpressionBiOpSum: ast::Expression = { - BiOp => ast::Expression::BiOp(<>), - ExpressionBiOpFactor => <>, -} - -// Left-to-right evaluation -ExpressionBiOpFactor: ast::Expression = { - BiOp => ast::Expression::BiOp(<>), - ExpressionUnOp => <>, -} +InfixOp: ast::Expression = { + BiOp => ast::Expression::BiOp(<>), + NextTier => <>, +} + +ExpressionBiOpOr = LeftOp; +ExpressionBiOpXor = LeftOp; +ExpressionBiOpAnd = LeftOp; +ExpressionBiOpCmp = InfixOp; +ExpressionBiOpBOr = LeftOp; +ExpressionBiOpBXor = LeftOp; +ExpressionBiOpBAnd = LeftOp; +ExpressionBiOpShift = LeftOp; +ExpressionBiOpSum = LeftOp; +ExpressionBiOpFactor = LeftOp; ExpressionUnOp: ast::Expression = { UnOp => ast::Expression::UnOp(<>), @@ -143,7 +106,7 @@ ExpressionProjection: ast::Expression = { } ExpressionAtom: ast::Expression = { - Identifier => ast::Expression::Identifier(<>), + Reference => ast::Expression::Reference(<>), NumberLiteral => ast::Expression::NumberLiteral(<>), StringLiteral => ast::Expression::StringLiteral(<>), Symbol => ast::Expression::Symbol(<>), @@ -235,9 +198,9 @@ BiOperatorCmp: ast::BiOperator = { "<=>" => ast::BiOperator::Cmp, } -Identifier: ast::Identifier = { - => - ast::Identifier { context: parser::Context::new(ast::Kind::Identifier, span, lo, hi), value: sync::Arc::new(id.to_owned()) }, +Reference: ast::Reference = { + => + ast::Reference { context: parser::Context::new(ast::Kind::Identifier, span, lo, hi), value: sync::Arc::new(id.to_owned()) }, } Tuple: ast::Tuple = { @@ -252,8 +215,8 @@ Record: ast::Record = { ast::Record { context: parser::Context::new(ast::Kind::Record, span, lo, hi), fields: fs.into_iter().map(|(k, v)| (sync::Arc::new(k), sync::Arc::new(v))).collect() }, } -Field: (ast::Identifier, ast::Expression) = { - ":" => (<>), +Field: (String, ast::Expression) = { + ":" => (i.to_owned(), e), } NumberLiteral: ast::NumberLiteral = { @@ -296,7 +259,7 @@ Statement: ast::Statement = { Select: ast::Select = { "." => - ast::Select { context: parser::Context::new(ast::Kind::Select, span, lo, hi), record: sync::Arc::new(r), field: sync::Arc::new(f) }, + ast::Select { context: parser::Context::new(ast::Kind::Select, span, lo, hi), record: sync::Arc::new(r), field: sync::Arc::new(f.to_owned()) }, } Apply: ast::Apply = { @@ -306,5 +269,5 @@ Apply: ast::Apply = { Parameter: ast::Parameter = { ":" => - ast::Parameter { context: parser::Context::new(ast::Kind::Parameter, span, lo, hi), name: sync::Arc::new(name), signature: sync::Arc::new(signature) }, + ast::Parameter { context: parser::Context::new(ast::Kind::Parameter, span, lo, hi), name: sync::Arc::new(name.to_owned()), signature: sync::Arc::new(signature) }, } diff --git a/src/syntax/parser/mod.rs b/src/syntax/parser/mod.rs index fdec60b..af46dc1 100644 --- a/src/syntax/parser/mod.rs +++ b/src/syntax/parser/mod.rs @@ -452,7 +452,7 @@ help: valid tokens at this point: [Comment, IdentifierName] fn identifier() { let _ = env_logger::try_init(); - let expected = Ok(ast::Expression::Identifier(ast::Identifier { + let expected = Ok(ast::Expression::Reference(ast::Reference { context: (), value: sync::Arc::new("whatever".to_owned()), })); @@ -464,7 +464,7 @@ help: valid tokens at this point: [Comment, IdentifierName] fn identifier_unicode() { let _ = env_logger::try_init(); - let expected = Ok(ast::Expression::Identifier(ast::Identifier { + let expected = Ok(ast::Expression::Reference(ast::Reference { context: (), value: sync::Arc::new("なんでも".to_owned()), })); @@ -670,7 +670,7 @@ help: valid tokens at this point: [Comment, IdentifierName] let expected = Ok(ast::Expression::StringLiteral(ast::StringLiteral { context: (), - value: ast::StringValue::String("abc".to_owned()), + value: ast::StringValue::String(sync::Arc::new("abc".to_owned())), })); let actual = parse_expression("test", r#""abc""#); assert_eq!(expected, actual); @@ -682,7 +682,7 @@ help: valid tokens at this point: [Comment, IdentifierName] let expected = Ok(ast::Expression::StringLiteral(ast::StringLiteral { context: (), - value: ast::StringValue::String("なんでも".to_owned()), + value: ast::StringValue::String(sync::Arc::new("なんでも".to_owned())), })); let actual = parse_expression("test", r#""なんでも""#); assert_eq!(expected, actual); @@ -694,7 +694,9 @@ help: valid tokens at this point: [Comment, IdentifierName] let expected = Ok(ast::Expression::StringLiteral(ast::StringLiteral { context: (), - value: ast::StringValue::String("\"\\/\u{0008}\u{000C}\n\r\t\u{1234}".to_owned()), + value: ast::StringValue::String(sync::Arc::new( + "\"\\/\u{0008}\u{000C}\n\r\t\u{1234}".to_owned(), + )), })); let actual = parse_expression("test", r#""\"\\/\b\f\n\r\t\u{1234}""#); assert_eq!(expected, actual); @@ -793,23 +795,17 @@ help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", context: (), fields: vec![ ( - sync::Arc::new(ast::Identifier { - context: (), - value: sync::Arc::new("a".to_owned()), - }), + sync::Arc::new("a".to_owned()), sync::Arc::new(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), value: ast::NumberValue::F64(ordered_float::OrderedFloat::from(1.0)), })), ), ( - sync::Arc::new(ast::Identifier { - context: (), - value: sync::Arc::new("b".to_owned()), - }), + sync::Arc::new("b".to_owned()), sync::Arc::new(ast::Expression::StringLiteral(ast::StringLiteral { context: (), - value: ast::StringValue::String("c".to_owned()), + value: ast::StringValue::String(sync::Arc::new("c".to_owned())), })), ), ], @@ -826,23 +822,17 @@ help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", context: (), fields: vec![ ( - sync::Arc::new(ast::Identifier { - context: (), - value: sync::Arc::new("a".to_owned()), - }), + sync::Arc::new("a".to_owned()), sync::Arc::new(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), value: ast::NumberValue::F64(ordered_float::OrderedFloat::from(1.0)), })), ), ( - sync::Arc::new(ast::Identifier { - context: (), - value: sync::Arc::new("b".to_owned()), - }), + sync::Arc::new("b".to_owned()), sync::Arc::new(ast::Expression::StringLiteral(ast::StringLiteral { context: (), - value: ast::StringValue::String("c".to_owned()), + value: ast::StringValue::String(sync::Arc::new("c".to_owned())), })), ), ], @@ -858,10 +848,7 @@ help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", let expected = Ok(ast::Expression::Record(ast::Record { context: (), fields: vec![( - sync::Arc::new(ast::Identifier { - context: (), - value: sync::Arc::new("a".to_owned()), - }), + sync::Arc::new("a".to_owned()), sync::Arc::new(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), value: ast::NumberValue::F64(ordered_float::OrderedFloat::from(1.0)), @@ -879,10 +866,7 @@ help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", let expected = Ok(ast::Expression::Record(ast::Record { context: (), fields: vec![( - sync::Arc::new(ast::Identifier { - context: (), - value: sync::Arc::new("a".to_owned()), - }), + sync::Arc::new("a".to_owned()), sync::Arc::new(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), value: ast::NumberValue::F64(ordered_float::OrderedFloat::from(1.0)), @@ -1282,44 +1266,36 @@ help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", parameters: vec![ sync::Arc::new(ast::Parameter { context: (), - name: sync::Arc::new(ast::Identifier { - context: (), - value: sync::Arc::new("a".to_owned()), - }), - signature: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { + name: sync::Arc::new("a".to_owned()), + signature: sync::Arc::new(ast::Expression::Reference(ast::Reference { context: (), value: sync::Arc::new("t1".to_owned()), })), }), sync::Arc::new(ast::Parameter { context: (), - name: sync::Arc::new(ast::Identifier { - context: (), - value: sync::Arc::new("b".to_owned()), - }), - signature: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { + name: sync::Arc::new("b".to_owned()), + signature: sync::Arc::new(ast::Expression::Reference(ast::Reference { context: (), value: sync::Arc::new("t2".to_owned()), })), }), ], - signature: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { + signature: sync::Arc::new(ast::Expression::Reference(ast::Reference { context: (), value: sync::Arc::new("t3".to_owned()), })), statements: vec![], result: Some(sync::Arc::new(ast::Expression::Apply(ast::Apply { context: (), - function: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { + function: sync::Arc::new(ast::Expression::Reference(ast::Reference { context: (), value: sync::Arc::new("a".to_owned()), })), - parameters: vec![sync::Arc::new(ast::Expression::Identifier( - ast::Identifier { - context: (), - value: sync::Arc::new("b".to_owned()), - }, - ))], + parameters: vec![sync::Arc::new(ast::Expression::Reference(ast::Reference { + context: (), + value: sync::Arc::new("b".to_owned()), + }))], }))), })); let actual = parse_expression("test", r#"|a: t1, b: t2| -> t3 { a(b) }"#); @@ -1335,63 +1311,51 @@ help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", parameters: vec![ sync::Arc::new(ast::Parameter { context: (), - name: sync::Arc::new(ast::Identifier { - context: (), - value: sync::Arc::new("a".to_owned()), - }), - signature: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { + name: sync::Arc::new("a".to_owned()), + signature: sync::Arc::new(ast::Expression::Reference(ast::Reference { context: (), value: sync::Arc::new("t1".to_owned()), })), }), sync::Arc::new(ast::Parameter { context: (), - name: sync::Arc::new(ast::Identifier { - context: (), - value: sync::Arc::new("b".to_owned()), - }), - signature: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { + name: sync::Arc::new("b".to_owned()), + signature: sync::Arc::new(ast::Expression::Reference(ast::Reference { context: (), value: sync::Arc::new("t2".to_owned()), })), }), ], - signature: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { + signature: sync::Arc::new(ast::Expression::Reference(ast::Reference { context: (), value: sync::Arc::new("t3".to_owned()), })), statements: vec![sync::Arc::new(ast::Statement::Variable(ast::Variable { context: (), - name: sync::Arc::new(ast::Identifier { - context: (), - value: sync::Arc::new("c".to_owned()), - }), + name: sync::Arc::new("c".to_owned()), initializer: sync::Arc::new(ast::Expression::Lambda(ast::Lambda { context: (), parameters: vec![sync::Arc::new(ast::Parameter { context: (), - name: sync::Arc::new(ast::Identifier { - context: (), - value: sync::Arc::new("b".to_owned()), - }), - signature: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { + name: sync::Arc::new("b".to_owned()), + signature: sync::Arc::new(ast::Expression::Reference(ast::Reference { context: (), value: sync::Arc::new("t4".to_owned()), })), })], - signature: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { + signature: sync::Arc::new(ast::Expression::Reference(ast::Reference { context: (), value: sync::Arc::new("t5".to_owned()), })), statements: vec![], result: Some(sync::Arc::new(ast::Expression::Apply(ast::Apply { context: (), - function: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { + function: sync::Arc::new(ast::Expression::Reference(ast::Reference { context: (), value: sync::Arc::new("a".to_owned()), })), - parameters: vec![sync::Arc::new(ast::Expression::Identifier( - ast::Identifier { + parameters: vec![sync::Arc::new(ast::Expression::Reference( + ast::Reference { context: (), value: sync::Arc::new("b".to_owned()), }, @@ -1401,16 +1365,14 @@ help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", }))], result: Some(sync::Arc::new(ast::Expression::Apply(ast::Apply { context: (), - function: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { + function: sync::Arc::new(ast::Expression::Reference(ast::Reference { context: (), value: sync::Arc::new("c".to_owned()), })), - parameters: vec![sync::Arc::new(ast::Expression::Identifier( - ast::Identifier { - context: (), - value: sync::Arc::new("b".to_owned()), - }, - ))], + parameters: vec![sync::Arc::new(ast::Expression::Reference(ast::Reference { + context: (), + value: sync::Arc::new("b".to_owned()), + }))], }))), })); let actual = parse_expression( @@ -1429,63 +1391,51 @@ help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", parameters: vec![ sync::Arc::new(ast::Parameter { context: (), - name: sync::Arc::new(ast::Identifier { - context: (), - value: sync::Arc::new("a".to_owned()), - }), - signature: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { + name: sync::Arc::new("a".to_owned()), + signature: sync::Arc::new(ast::Expression::Reference(ast::Reference { context: (), value: sync::Arc::new("t1".to_owned()), })), }), sync::Arc::new(ast::Parameter { context: (), - name: sync::Arc::new(ast::Identifier { - context: (), - value: sync::Arc::new("b".to_owned()), - }), - signature: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { + name: sync::Arc::new("b".to_owned()), + signature: sync::Arc::new(ast::Expression::Reference(ast::Reference { context: (), value: sync::Arc::new("t2".to_owned()), })), }), ], - signature: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { + signature: sync::Arc::new(ast::Expression::Reference(ast::Reference { context: (), value: sync::Arc::new("t3".to_owned()), })), statements: vec![sync::Arc::new(ast::Statement::Variable(ast::Variable { context: (), - name: sync::Arc::new(ast::Identifier { - context: (), - value: sync::Arc::new("c".to_owned()), - }), + name: sync::Arc::new("c".to_owned()), initializer: sync::Arc::new(ast::Expression::Lambda(ast::Lambda { context: (), parameters: vec![sync::Arc::new(ast::Parameter { context: (), - name: sync::Arc::new(ast::Identifier { - context: (), - value: sync::Arc::new("b".to_owned()), - }), - signature: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { + name: sync::Arc::new("b".to_owned()), + signature: sync::Arc::new(ast::Expression::Reference(ast::Reference { context: (), value: sync::Arc::new("t4".to_owned()), })), })], - signature: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { + signature: sync::Arc::new(ast::Expression::Reference(ast::Reference { context: (), value: sync::Arc::new("t5".to_owned()), })), statements: vec![], result: Some(sync::Arc::new(ast::Expression::Apply(ast::Apply { context: (), - function: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { + function: sync::Arc::new(ast::Expression::Reference(ast::Reference { context: (), value: sync::Arc::new("a".to_owned()), })), - parameters: vec![sync::Arc::new(ast::Expression::Identifier( - ast::Identifier { + parameters: vec![sync::Arc::new(ast::Expression::Reference( + ast::Reference { context: (), value: sync::Arc::new("b".to_owned()), }, @@ -1495,16 +1445,14 @@ help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", }))], result: Some(sync::Arc::new(ast::Expression::Apply(ast::Apply { context: (), - function: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { + function: sync::Arc::new(ast::Expression::Reference(ast::Reference { context: (), value: sync::Arc::new("c".to_owned()), })), - parameters: vec![sync::Arc::new(ast::Expression::Identifier( - ast::Identifier { - context: (), - value: sync::Arc::new("b".to_owned()), - }, - ))], + parameters: vec![sync::Arc::new(ast::Expression::Reference(ast::Reference { + context: (), + value: sync::Arc::new("b".to_owned()), + }))], }))), })); let actual = parse_expression( @@ -1523,10 +1471,7 @@ help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", parameters: vec![ sync::Arc::new(ast::Parameter { context: (), - name: sync::Arc::new(ast::Identifier { - context: (), - value: sync::Arc::new("a".to_owned()), - }), + name: sync::Arc::new("a".to_owned()), signature: sync::Arc::new(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), value: ast::NumberValue::U32(0), @@ -1534,33 +1479,28 @@ help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", }), sync::Arc::new(ast::Parameter { context: (), - name: sync::Arc::new(ast::Identifier { - context: (), - value: sync::Arc::new("b".to_owned()), - }), + name: sync::Arc::new("b".to_owned()), signature: sync::Arc::new(ast::Expression::NumberLiteral(ast::NumberLiteral { context: (), value: ast::NumberValue::U32(0), })), }), ], - signature: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { + signature: sync::Arc::new(ast::Expression::Reference(ast::Reference { context: (), value: sync::Arc::new("t1".to_owned()), })), statements: vec![], result: Some(sync::Arc::new(ast::Expression::Apply(ast::Apply { context: (), - function: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { + function: sync::Arc::new(ast::Expression::Reference(ast::Reference { context: (), value: sync::Arc::new("a".to_owned()), })), - parameters: vec![sync::Arc::new(ast::Expression::Identifier( - ast::Identifier { - context: (), - value: sync::Arc::new("b".to_owned()), - }, - ))], + parameters: vec![sync::Arc::new(ast::Expression::Reference(ast::Reference { + context: (), + value: sync::Arc::new("b".to_owned()), + }))], }))), })); let actual = parse_expression("test", r#"|a: u32, b: u32| -> t1 { a(b) }"#); @@ -1576,58 +1516,48 @@ help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", parameters: vec![ sync::Arc::new(ast::Parameter { context: (), - name: sync::Arc::new(ast::Identifier { - context: (), - value: sync::Arc::new("a".to_owned()), - }), - signature: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { + name: sync::Arc::new("a".to_owned()), + signature: sync::Arc::new(ast::Expression::Reference(ast::Reference { context: (), value: sync::Arc::new("t1".to_owned()), })), }), sync::Arc::new(ast::Parameter { context: (), - name: sync::Arc::new(ast::Identifier { - context: (), - value: sync::Arc::new("b".to_owned()), - }), - signature: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { + name: sync::Arc::new("b".to_owned()), + signature: sync::Arc::new(ast::Expression::Reference(ast::Reference { context: (), value: sync::Arc::new("t2".to_owned()), })), }), ], - signature: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { + signature: sync::Arc::new(ast::Expression::Reference(ast::Reference { context: (), value: sync::Arc::new("t3".to_owned()), })), statements: vec![sync::Arc::new(ast::Statement::Expression( ast::Expression::Apply(ast::Apply { context: (), - function: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { + function: sync::Arc::new(ast::Expression::Reference(ast::Reference { context: (), value: sync::Arc::new("a".to_owned()), })), - parameters: vec![sync::Arc::new(ast::Expression::Identifier( - ast::Identifier { - context: (), - value: sync::Arc::new("b".to_owned()), - }, - ))], + parameters: vec![sync::Arc::new(ast::Expression::Reference(ast::Reference { + context: (), + value: sync::Arc::new("b".to_owned()), + }))], }), ))], result: Some(sync::Arc::new(ast::Expression::Apply(ast::Apply { context: (), - function: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { + function: sync::Arc::new(ast::Expression::Reference(ast::Reference { context: (), value: sync::Arc::new("a".to_owned()), })), - parameters: vec![sync::Arc::new(ast::Expression::Identifier( - ast::Identifier { - context: (), - value: sync::Arc::new("b".to_owned()), - }, - ))], + parameters: vec![sync::Arc::new(ast::Expression::Reference(ast::Reference { + context: (), + value: sync::Arc::new("b".to_owned()), + }))], }))), })); let actual = parse_expression("test", r#"|a: t1, b: t2| -> t3 { a(b); a(b) }"#); @@ -1640,16 +1570,14 @@ help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", let expected = Ok(ast::Expression::Apply(ast::Apply { context: (), - function: sync::Arc::new(ast::Expression::Identifier(ast::Identifier { + function: sync::Arc::new(ast::Expression::Reference(ast::Reference { context: (), value: sync::Arc::new("a".to_owned()), })), - parameters: vec![sync::Arc::new(ast::Expression::Identifier( - ast::Identifier { - context: (), - value: sync::Arc::new("b".to_owned()), - }, - ))], + parameters: vec![sync::Arc::new(ast::Expression::Reference(ast::Reference { + context: (), + value: sync::Arc::new("b".to_owned()), + }))], })); let actual = parse_expression("test", r#"a(b)"#); assert_eq!(expected, actual); diff --git a/src/syntax/parser/util.rs b/src/syntax/parser/util.rs index 4004785..51d67f5 100644 --- a/src/syntax/parser/util.rs +++ b/src/syntax/parser/util.rs @@ -1,5 +1,6 @@ use std::char; use std::num; +use std::sync; use crate::syntax::ast; use crate::syntax::parser; @@ -356,9 +357,9 @@ pub fn parse_escaped_string( if is_invalid { ast::StringValue::Invalid } else { - ast::StringValue::String(result.to_owned()) + ast::StringValue::String(sync::Arc::new(result)) } } else { - ast::StringValue::String(input.to_owned()) + ast::StringValue::String(sync::Arc::new(input.to_owned())) } } diff --git a/src/ty/infer.rs b/src/ty/infer.rs index 603e38f..ff6968e 100644 --- a/src/ty/infer.rs +++ b/src/ty/infer.rs @@ -12,6 +12,7 @@ type Result = result::Result, ty::error::Error>; fn infer_type(element: &element::Element, db: impl ty::db::TyDb) -> Result { match *element { + element::Element::Reference(_) => unimplemented!(), element::Element::Number(ref n) => { Ok(sync::Arc::new(ty::Type::Number(infer_number_type(n)))) } diff --git a/syntax/src/kind.rs b/syntax/src/kind.rs index 17f0fd7..6d5d927 100644 --- a/syntax/src/kind.rs +++ b/syntax/src/kind.rs @@ -4,52 +4,56 @@ use enum_primitive_derive::Primitive; pub enum Kind { // The discriminants in this enum are not stable and can change between releases without notice + Error = 0, + Whitespace = 1, + // Simple tokens - Semi = 1, - Comma = 2, - ParenOpen = 3, - ParenClose = 4, - CurlyOpen = 5, - CurlyClose = 6, - BracketOpen = 7, - BracketClose = 8, - AngleOpen = 9, - AngleClose = 10, - Arrow = 11, - Dot = 12, - Colon = 13, - Is = 14, + Semi = 2, + Comma = 3, + ParenOpen = 4, + ParenClose = 5, + CurlyOpen = 6, + CurlyClose = 7, + BracketOpen = 8, + BracketClose = 9, + AngleOpen = 10, + AngleClose = 11, + Arrow = 12, + Dot = 13, + Colon = 14, + Is = 15, // Operator tokens - Add = 15, - Sub = 16, - Mul = 17, - Div = 18, + Add = 16, + Sub = 17, + Mul = 18, + Div = 19, // Complex tokens - Comment = 19, - Identifier = 20, - SymbolLiteral = 21, - StringLiteral = 22, - UnsignedIntLiteral = 23, - SignedIntLiteral = 24, - FloatLiteral = 25, + Comment = 20, + Identifier = 21, + SymbolLiteral = 22, + StringLiteral = 23, + UnsignedIntLiteral = 24, + SignedIntLiteral = 25, + FloatLiteral = 26, // Nodes - Reference = 26, - Module = 27, - Expression = 28, - Statement = 29, - Number = 30, - String = 31, - Symbol = 32, - Tuple = 33, - Record = 34, - UnOp = 35, - BiOp = 36, - Lambda = 37, - Parameter = 38, - Apply = 39, + Reference = 27, + Module = 28, + Variable = 29, + Expression = 30, + Statement = 31, + Number = 32, + String = 33, + Symbol = 34, + Tuple = 35, + Record = 36, + UnOp = 37, + BiOp = 38, + Lambda = 39, + Parameter = 40, + Apply = 41, } pub trait HasKind { diff --git a/syntax/src/lib.rs b/syntax/src/lib.rs index 3f1a8ec..9a9f9ca 100644 --- a/syntax/src/lib.rs +++ b/syntax/src/lib.rs @@ -2,6 +2,7 @@ mod ast; mod error; mod kind; mod parser; +mod token; fn parse_module(text: &str) -> rowan::TreeArc { unimplemented!() diff --git a/syntax/src/parser.rs b/syntax/src/parser.rs index 59cd56b..4a6ef82 100644 --- a/syntax/src/parser.rs +++ b/syntax/src/parser.rs @@ -1,32 +1,86 @@ +use std::iter; +use std::result; use crate::ast; use crate::error; use crate::kind; +use crate::token; -pub struct Parser { - tokens: I, +pub struct Parser where I: Iterator { + tokens: iter::Peekable, builder: rowan::GreenNodeBuilder, errors: Vec, } -impl Parser where I: Iterator { - fn parse(mut self) -> rowan::TreeArc { +pub enum Error { + Expected(kind::Kind), +} + +impl Parser where I: Iterator { + fn into_module(mut self) -> rowan::TreeArc { use crate::ast::Node; - self.builder.start_node(kind::Kind::Module.to_rowan_kind()); + self.module(); - loop { + let green = self.builder.finish(); + let node = rowan::SyntaxNode::new(green, None); + ast::Module::from_rowan(&node).unwrap().to_owned() + } + fn module(&mut self) { + self.builder.start_node(kind::Kind::Module.to_rowan_kind()); + + while self.tokens.peek().is_some() { + self.variable(); } + self.builder.finish_node(); + } + + fn variable(&mut self) { + self.builder.start_node(kind::Kind::Variable.to_rowan_kind()); + self.identifier(); + self.expect_kind(kind::Kind::Is); self.skip_ws(); + self.builder.finish_node(); + } - let green = self.builder.finish(); - let node = rowan::SyntaxNode::new(green, None); - ast::Module::from_rowan(&node).unwrap().to_owned() + fn identifier(&mut self) { + if self.expect_kind(kind::Kind::Identifier) { + self.builder.start_node(kind::Kind::Identifier.to_rowan_kind()); + self.bump(); + self.builder.finish_node(); + } } - fn skip_ws(&mut self) { + fn expect_kind(&mut self, kind: kind::Kind) -> bool { + if self.peek_kind() == Some(kind::Kind::Identifier) { + true + } else { + self.error(Error::Expected(kind::Kind::Identifier)); + self.bump(); + false + } + } + fn error(&mut self, error: Error) {} + + fn bump(&mut self) { + let token = self.tokens.next().unwrap(); + self.builder.token(token.kind.to_rowan_kind(), token.contents); + } + + fn peek(&mut self) -> Option<&token::Token> { + self.tokens.peek() + } + + fn peek_kind(&mut self) -> Option { + self.peek().map(|t| t.kind) + } + + fn skip_ws(&mut self) { + while self.peek_kind() == Some(kind::Kind::Whitespace) { + self.bump(); + } } } diff --git a/syntax/src/token.rs b/syntax/src/token.rs new file mode 100644 index 0000000..1f43736 --- /dev/null +++ b/syntax/src/token.rs @@ -0,0 +1,6 @@ +use crate::kind; + +pub struct Token { + pub kind: kind::Kind, + pub contents: rowan::SmolStr +} From 0df9ceb2458244fc2041798bb6472b9dd7b8a9ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Flemstr=C3=B6m?= Date: Sun, 12 May 2019 18:06:13 +0200 Subject: [PATCH 09/22] Fix some tests --- src/syntax/parser/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/syntax/parser/mod.rs b/src/syntax/parser/mod.rs index af46dc1..f0d5186 100644 --- a/src/syntax/parser/mod.rs +++ b/src/syntax/parser/mod.rs @@ -441,7 +441,7 @@ main = || -> i32 { - :1:28 1 | main = || -> u32 { 0u32 }; <-< | ^^^ -help: valid tokens at this point: [Comment, IdentifierName] +help: valid tokens at this point: [Comment, Identifier] "# .to_owned()); let actual = parse_module("test", r#"main = || -> u32 { 0u32 }; <-<"#); @@ -781,7 +781,7 @@ help: valid tokens at this point: [Comment, IdentifierName] - :1:2 1 | (,) | ^ -help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", "#^1", "(", ")", "^/", "{", "|", "~!", IdentifierName, NumberValue, StringValue, SymbolLabel] +help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", "#^1", "(", ")", "^/", "{", "|", "~!", Identifier, NumberValue, StringValue, SymbolLabel] "##.to_owned()); let actual = parse_expression("test", r#"(,)"#); assert_eq!(expected, actual); From 7c0888ca2cb44c7c80fcc56cb06e1fa57a6b2265 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Flemstr=C3=B6m?= Date: Sun, 12 May 2019 20:08:13 +0200 Subject: [PATCH 10/22] Partially restore graph drawing again --- Cargo.lock | 1 - Cargo.toml | 1 - src/graph.rs | 355 ++++++++++----------------------------- src/interpreter/db.rs | 2 +- src/interpreter/error.rs | 10 ++ src/ir/builder.rs | 63 ++++--- src/ir/db.rs | 57 ++++--- src/ir/error.rs | 2 +- src/ir/mod.rs | 47 +++++- src/ir/tests.rs | 34 ++-- src/layout/db.rs | 10 +- src/layout/error.rs | 18 ++ src/layout/infer.rs | 87 +++++----- src/layout/mod.rs | 1 + src/lib.rs | 12 +- src/source/mod.rs | 8 +- src/test_util.rs | 6 +- src/ty/db.rs | 7 +- src/ty/infer.rs | 2 +- 19 files changed, 330 insertions(+), 393 deletions(-) create mode 100644 src/layout/error.rs diff --git a/Cargo.lock b/Cargo.lock index 78f4830..98ef178 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1226,7 +1226,6 @@ dependencies = [ "pretty_env_logger 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "salsa 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "structopt 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", "walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index 02edd63..2ef1e31 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,7 +34,6 @@ enum-primitive-derive = "0.1.2" num-traits = "0.2.6" salsa = "0.12.0" relative-path = "0.4.0" -rustc-hash = "1.0.1" ordered-float = "1.0.2" [features] diff --git a/src/graph.rs b/src/graph.rs index 676e544..4e68fdc 100644 --- a/src/graph.rs +++ b/src/graph.rs @@ -7,19 +7,13 @@ use std::fmt; use dot; +use crate::db; use crate::ir; use crate::ir::element; -use crate::ir::symbol; -use crate::layout; -use crate::ty; /// A graph representation of IR. pub struct Graph<'a> { - entities: specs::Entities<'a>, - elements: specs::ReadStorage<'a, element::Element>, - layouts: specs::ReadStorage<'a, layout::Layout>, - symbols: specs::ReadStorage<'a, symbol::Symbol>, - types: specs::ReadStorage<'a, ty::Type>, + db: &'a db::Db, } /// A node in the IR graph. @@ -28,207 +22,43 @@ pub struct Node(ir::Entity); /// An edge in the IR graph. #[derive(Clone, Copy, Debug)] -pub struct Edge<'a> { +pub struct Edge { source: Node, target: Node, - label: Label<'a>, -} - -#[derive(Clone, Copy, Debug)] -enum Label<'a> { - RecordField(&'a str), - TupleField(usize), - VariableInitializer, - SelectField(&'a str), - AppliedFunction, - AppliedParameter(usize), - ParameterSignature, - ClosureCaptureDefinition(&'a str), - ClosureCaptureUsage(&'a str), - ClosureParameter(usize), - ClosureStatement(usize), - ClosureSignature, - ClosureResult, - ModuleDefinition(&'a str), - UnOperand, - BiLhs, - BiRhs, + role: ir::EntityRole, } impl<'a> Graph<'a> { /// Creates a new IR graph based on the supplied intermediate representation. - pub(crate) fn new(ir: &'a ir::Ir) -> Graph<'a> { - let world = &ir.world; - let entities = world.entities(); - let elements = world.read_storage(); - let layouts = world.read_storage(); - let symbols = world.read_storage(); - let types = world.read_storage(); - - Graph { - entities, - elements, - layouts, - symbols, - types, - } + pub(crate) fn new(db: &'a db::Db) -> Graph<'a> { + Graph { db } } } -impl<'a> dot::GraphWalk<'a, Node, Edge<'a>> for Graph<'a> { +impl<'a> dot::GraphWalk<'a, Node, Edge> for Graph<'a> { fn nodes(&'a self) -> borrow::Cow<'a, [Node]> { - borrow::Cow::Owned( - self.entities - .join() - .filter_map(|e| { - if self.elements.contains(e) { - Some(Node(e)) - } else { - None - } - }) - .collect::>(), - ) + use crate::ir::db::IrDb; + + let entities = self.db.entities().unwrap(); + borrow::Cow::Owned(entities.infos.keys().cloned().map(Node).collect()) } - fn edges(&'a self) -> borrow::Cow<'a, [Edge<'a>]> { + fn edges(&'a self) -> borrow::Cow<'a, [Edge]> { + use crate::ir::db::IrDb; + let mut edges = Vec::new(); - for entity in self.entities.join() { - if let Some(element) = self.elements.get(entity) { - match element { - element::Element::Number(_) - | element::Element::String(_) - | element::Element::Symbol(_) => {} - element::Element::Tuple(element::Tuple { fields }) => { - for (idx, field) in fields.iter().enumerate() { - edges.push(Edge { - source: Node(entity), - target: Node(*field), - label: Label::TupleField(idx), - }); - } - } - element::Element::Record(element::Record { fields }) => { - for (name, field) in fields { - edges.push(Edge { - source: Node(entity), - target: Node(*field), - label: Label::RecordField(name), - }); - } - } - element::Element::UnOp(element::UnOp { operand, .. }) => { - edges.push(Edge { - source: Node(entity), - target: Node(*operand), - label: Label::UnOperand, - }); - } - element::Element::BiOp(element::BiOp { lhs, rhs, .. }) => { - edges.push(Edge { - source: Node(entity), - target: Node(*lhs), - label: Label::BiLhs, - }); - edges.push(Edge { - source: Node(entity), - target: Node(*rhs), - label: Label::BiRhs, - }); - } - element::Element::Variable(element::Variable { initializer, .. }) => edges - .push(Edge { - source: Node(entity), - target: Node(*initializer), - label: Label::VariableInitializer, - }), - element::Element::Select(element::Select { record, field }) => { - edges.push(Edge { - source: Node(entity), - target: Node(*record), - label: Label::SelectField(field), - }); - } - element::Element::Apply(element::Apply { - function, - parameters, - }) => { - edges.push(Edge { - source: Node(entity), - target: Node(*function), - label: Label::AppliedFunction, - }); - for (idx, parameter) in parameters.iter().enumerate() { - edges.push(Edge { - source: Node(entity), - target: Node(*parameter), - label: Label::AppliedParameter(idx), - }); - } - } - element::Element::Parameter(element::Parameter { signature, .. }) => { - edges.push(Edge { - source: Node(entity), - target: Node(*signature), - label: Label::ParameterSignature, - }); - } - element::Element::Capture(element::Capture { ref name, captured }) => edges - .push(Edge { - source: Node(entity), - target: Node(*captured), - label: Label::ClosureCaptureDefinition(name), - }), - element::Element::Closure(element::Closure { - captures, - parameters, - statements, - signature, - result, - }) => { - for (name, capture) in captures { - edges.push(Edge { - source: Node(entity), - target: Node(*capture), - label: Label::ClosureCaptureUsage(name), - }); - } - for (idx, parameter) in parameters.iter().enumerate() { - edges.push(Edge { - source: Node(entity), - target: Node(*parameter), - label: Label::ClosureParameter(idx), - }); - } - for (idx, statement) in statements.iter().enumerate() { - edges.push(Edge { - source: Node(entity), - target: Node(*statement), - label: Label::ClosureStatement(idx), - }); - } - edges.push(Edge { - source: Node(entity), - target: Node(*signature), - label: Label::ClosureSignature, - }); - edges.push(Edge { - source: Node(entity), - target: Node(*result), - label: Label::ClosureResult, - }); - } - element::Element::Module(element::Module { variables }) => { - for (name, variable) in variables { - edges.push(Edge { - source: Node(entity), - target: Node(*variable), - label: Label::ModuleDefinition(name), - }); - } - } - } + let entities = self.db.entities().unwrap(); + for entity in entities.infos.keys() { + let (parent, role) = self.db.lookup_entity(*entity); + if let Some(parent) = parent { + let source = Node(parent); + let target = Node(*entity); + edges.push(Edge { + source, + target, + role, + }); } } @@ -244,7 +74,7 @@ impl<'a> dot::GraphWalk<'a, Node, Edge<'a>> for Graph<'a> { } } -impl<'a> dot::Labeller<'a, Node, Edge<'a>> for Graph<'a> { +impl<'a> dot::Labeller<'a, Node, Edge> for Graph<'a> { fn graph_id(&'a self) -> dot::Id<'a> { dot::Id::new("ir").unwrap() } @@ -258,16 +88,20 @@ impl<'a> dot::Labeller<'a, Node, Edge<'a>> for Graph<'a> { } fn node_label(&'a self, n: &Node) -> dot::LabelText<'a> { + use crate::ir::db::IrDb; + use crate::layout::db::LayoutDb; + use crate::ty::db::TyDb; use std::fmt::Write; let mut result = format!("({}) ", n.0.id()); - if let Some(element) = self.elements.get(n.0) { - match element { + if let Ok(element) = self.db.entity_element(n.0) { + match &*element { + element::Element::Reference(e) => write!(result, "ref {:?}", e).unwrap(), element::Element::Number(n) => write!(result, "num {:?}", n).unwrap(), element::Element::String(s) => write!(result, "str {:?}", s).unwrap(), - element::Element::Symbol(element::Symbol { ref label }) => { - write!(result, "sym {:?}", label).unwrap() + element::Element::Symbol(element::Symbol { label }) => { + write!(result, "sym {:?}", self.db.lookup_ident(*label)).unwrap() } element::Element::Tuple(element::Tuple { fields }) => { write!(result, "tuple
{:?} fields", fields.len()).unwrap() @@ -282,7 +116,7 @@ impl<'a> dot::Labeller<'a, Node, Edge<'a>> for Graph<'a> { write!(result, "bi op {}", operator).unwrap() } element::Element::Variable(element::Variable { name, .. }) => { - write!(result, "variable {:?}", name).unwrap() + write!(result, "variable {:?}", self.db.lookup_ident(*name)).unwrap() } element::Element::Select(element::Select { .. }) => { write!(result, "select").unwrap() @@ -291,10 +125,10 @@ impl<'a> dot::Labeller<'a, Node, Edge<'a>> for Graph<'a> { write!(result, "apply
{:?} params", parameters.len()).unwrap() } element::Element::Parameter(element::Parameter { name, .. }) => { - write!(result, "param {:?}", name).unwrap() + write!(result, "param {:?}", self.db.lookup_ident(*name)).unwrap() } element::Element::Capture(element::Capture { name, .. }) => { - write!(result, "capture {:?}", name).unwrap() + write!(result, "capture {:?}", self.db.lookup_ident(*name)).unwrap() } element::Element::Closure(element::Closure { captures, @@ -319,82 +153,75 @@ impl<'a> dot::Labeller<'a, Node, Edge<'a>> for Graph<'a> { write!(result, "(unknown)").unwrap(); }; - if let Some(ty) = self.types.get(n.0) { + if let Ok(ty) = self.db.entity_type(n.0) { write!(result, "
{}", ty).unwrap(); } - if let Some(layout) = self.layouts.get(n.0) { + if let Ok(layout) = self.db.entity_layout(n.0) { write!(result, "
{}", layout).unwrap(); } - if let Some(symbol) = self.symbols.get(n.0) { - if symbol.is_empty() { - write!(result, "
(root)").unwrap(); - } else { - write!(result, "
{}", symbol).unwrap(); - } - } - dot::LabelText::HtmlStr(result.into()) } - fn edge_label(&'a self, e: &Edge<'a>) -> dot::LabelText<'a> { - match e.label { - Label::RecordField(ref name) => { - dot::LabelText::HtmlStr(format!("field {}", name).into()) - } - Label::TupleField(idx) => { - dot::LabelText::HtmlStr(format!("field {}", idx).into()) - } - Label::VariableInitializer => dot::LabelText::LabelStr("initializer".into()), - Label::SelectField(ref name) => { - dot::LabelText::HtmlStr(format!("select {}", name).into()) - } - Label::AppliedFunction => dot::LabelText::LabelStr("func".into()), - Label::AppliedParameter(idx) => { - dot::LabelText::HtmlStr(format!("apply param {}", idx).into()) - } - Label::ParameterSignature => dot::LabelText::LabelStr("param sig".into()), - Label::ClosureCaptureDefinition(ref name) => { - dot::LabelText::HtmlStr(format!("capture definition {}", name).into()) + fn edge_label(&'a self, e: &Edge) -> dot::LabelText<'a> { + use crate::ir::db::IrDb; + use crate::source::db::SourceDb; + + match e.role { + ir::EntityRole::File(file_id) => dot::LabelText::HtmlStr( + format!("file {:?}", self.db.file_relative_path(file_id)).into(), + ), + ir::EntityRole::Reference(ident) => dot::LabelText::HtmlStr( + format!("ref {:?}", self.db.lookup_ident(ident)).into(), + ), + ir::EntityRole::RecordField(ident) => dot::LabelText::HtmlStr( + format!("field {:?}", self.db.lookup_ident(ident)).into(), + ), + ir::EntityRole::TupleField(idx) => { + dot::LabelText::HtmlStr(format!("field {:?}", idx).into()) } - Label::ClosureCaptureUsage(idx) => { - dot::LabelText::HtmlStr(format!("capture usage {}", idx).into()) + ir::EntityRole::VariableDefinition(ident) => dot::LabelText::HtmlStr( + format!("def {:?}", self.db.lookup_ident(ident)).into(), + ), + ir::EntityRole::VariableInitializer => dot::LabelText::HtmlStr("init".into()), + ir::EntityRole::SelectField(ident) => dot::LabelText::HtmlStr( + format!("select {:?}", self.db.lookup_ident(ident)).into(), + ), + ir::EntityRole::AppliedFunction => dot::LabelText::HtmlStr("fun".into()), + ir::EntityRole::AppliedParameter(idx) => { + dot::LabelText::HtmlStr(format!("param {:?}", idx).into()) } - Label::ClosureParameter(idx) => { - dot::LabelText::HtmlStr(format!("closure param {}", idx).into()) + ir::EntityRole::ParameterSignature => dot::LabelText::HtmlStr("sig".into()), + ir::EntityRole::ClosureCaptureDefinition(ident) => dot::LabelText::HtmlStr( + format!("capture {:?}", self.db.lookup_ident(ident)).into(), + ), + ir::EntityRole::ClosureParameter(ident) => dot::LabelText::HtmlStr( + format!("param {:?}", self.db.lookup_ident(ident)).into(), + ), + ir::EntityRole::ClosureStatement(idx) => { + dot::LabelText::HtmlStr(format!("stmt {:?}", idx).into()) } - Label::ClosureStatement(idx) => { - dot::LabelText::HtmlStr(format!("closure stmt {}", idx).into()) - } - Label::ClosureResult => dot::LabelText::HtmlStr("closure result".into()), - Label::ClosureSignature => dot::LabelText::LabelStr("closure sig".into()), - Label::ModuleDefinition(ref name) => { - dot::LabelText::HtmlStr(format!("def {}", name).into()) - } - Label::UnOperand => dot::LabelText::LabelStr("operand".into()), - Label::BiLhs => dot::LabelText::LabelStr("lhs".into()), - Label::BiRhs => dot::LabelText::LabelStr("rhs".into()), + ir::EntityRole::ClosureSignature => dot::LabelText::HtmlStr("sig".into()), + ir::EntityRole::ClosureResult => dot::LabelText::HtmlStr("result".into()), + ir::EntityRole::ModuleDefinition(ident) => dot::LabelText::HtmlStr( + format!("mod {:?}", self.db.lookup_ident(ident)).into(), + ), + ir::EntityRole::UnOperand => dot::LabelText::HtmlStr("op".into()), + ir::EntityRole::BiLhs => dot::LabelText::HtmlStr("lhs".into()), + ir::EntityRole::BiRhs => dot::LabelText::HtmlStr("rhs".into()), } } - fn edge_style(&'a self, e: &Edge<'a>) -> dot::Style { - match e.label { - Label::RecordField(_) - | Label::TupleField(_) - | Label::VariableInitializer - | Label::SelectField(_) - | Label::AppliedFunction - | Label::AppliedParameter(_) - | Label::ClosureCaptureUsage(_) - | Label::ClosureParameter(_) - | Label::ClosureResult - | Label::ModuleDefinition(_) - | Label::UnOperand - | Label::BiLhs - | Label::BiRhs => dot::Style::None, - Label::ParameterSignature | Label::ClosureSignature => dot::Style::Dotted, - Label::ClosureCaptureDefinition(_) | Label::ClosureStatement(_) => dot::Style::Dashed, + fn edge_style(&'a self, e: &Edge) -> dot::Style { + match e.role { + ir::EntityRole::ParameterSignature | ir::EntityRole::ClosureSignature => { + dot::Style::Dotted + } + ir::EntityRole::ClosureCaptureDefinition(_) | ir::EntityRole::ClosureStatement(_) => { + dot::Style::Dashed + } + _ => dot::Style::None, } } } diff --git a/src/interpreter/db.rs b/src/interpreter/db.rs index 45fb334..5d78c32 100644 --- a/src/interpreter/db.rs +++ b/src/interpreter/db.rs @@ -14,7 +14,7 @@ fn entity_value( db: &impl InterpreterDb, entity: ir::Entity, ) -> Result, interpreter::error::Error> { - let element = db.entity_element(entity); + let element = db.entity_element(entity)?; Ok(interpreter::eval(&*element, db)?) } diff --git a/src/interpreter/error.rs b/src/interpreter/error.rs index f7cc374..dff463d 100644 --- a/src/interpreter/error.rs +++ b/src/interpreter/error.rs @@ -1,8 +1,11 @@ use crate::diagnostic; +use crate::ir; use crate::module; #[derive(Clone, Debug, Eq, Fail, PartialEq)] pub enum Error { + #[fail(display = "semantic error: {}", _0)] + Ir(#[cause] ir::error::Error), #[fail(display = "type conflict: {}", _0)] RuntimeTypeConflict(String), #[fail(display = "evaluation error: {}", _0)] @@ -12,6 +15,7 @@ pub enum Error { impl diagnostic::Diagnostics for Error { fn to_diagnostics(&self, builder: &mut diagnostic::DiagnosticsBuilder) { match *self { + Error::Ir(_) => {} Error::RuntimeTypeConflict(ref cause) => { builder.add_diagnostic(codespan_reporting::Severity::Bug, None, cause); } @@ -25,3 +29,9 @@ impl diagnostic::Diagnostics for Error { } } } + +impl From for Error { + fn from(error: ir::error::Error) -> Self { + Error::Ir(error) + } +} diff --git a/src/ir/builder.rs b/src/ir/builder.rs index e1e88bb..5cd58cd 100644 --- a/src/ir/builder.rs +++ b/src/ir/builder.rs @@ -10,9 +10,9 @@ use crate::syntax::ast; use crate::syntax::parser; pub struct Builder<'a, Db> { - db: &'a mut Db, + db: &'a Db, scope: Scope, - infos: collections::HashMap, + infos: &'a mut collections::HashMap, } #[derive(Debug)] @@ -27,9 +27,8 @@ impl<'a, Db> Builder<'a, Db> where Db: ir::db::IrDb, { - pub fn new(db: &'a mut Db, root: ir::Entity) -> Self { + pub fn new(db: &'a Db, root: ir::Entity, infos: &'a mut collections::HashMap) -> Self { let scope = Scope::new(root); - let infos = collections::HashMap::new(); Builder { db, scope, infos } } @@ -40,9 +39,10 @@ where ast: &ast::Module, ) -> Result { let module_ident = self.db.ident(name.clone()); - let module_entity = self - .db - .entity(None, ir::db::EntityKind::Module(module_ident)); + let module_entity = self.db.entity( + Some(self.scope.entity), + ir::EntityRole::ModuleDefinition(module_ident), + ); self.add_module(module_entity, ast)?; @@ -60,7 +60,7 @@ where let ident = self.db.ident(variable.name.clone()); let var_entity = self .db - .entity(Some(entity), ir::db::EntityKind::Named(ident)); + .entity(Some(entity), ir::EntityRole::VariableDefinition(ident)); self.scope.locals.insert(ident, var_entity); @@ -87,6 +87,9 @@ where ast: &ast::Reference, ) -> Result<(), error::Error> { let ident = self.db.ident(ast.value.clone()); + let entity = self + .db + .entity(Some(entity), ir::EntityRole::Reference(ident)); let target = self .scope .resolve_capture(self.db, ident, ast.context.span)?; @@ -166,7 +169,7 @@ where .map(|(index, ast)| { let entity = self .db - .entity(Some(entity), ir::db::EntityKind::Indexed(index)); + .entity(Some(entity), ir::EntityRole::TupleField(index)); self.add_expression(entity, &*ast)?; Ok(entity) }) @@ -209,7 +212,7 @@ where let ident = self.db.ident(field.clone()); let entity = self .db - .entity(Some(entity), ir::db::EntityKind::Named(ident)); + .entity(Some(entity), ir::EntityRole::RecordField(ident)); self.add_expression(entity, value)?; Ok((ident, entity)) }) @@ -231,7 +234,7 @@ where ) -> Result<(), error::Error> { let operator = translate_un_operator(un_op.operator); - let operand = self.db.entity(Some(entity), ir::db::EntityKind::UnOperand); + let operand = self.db.entity(Some(entity), ir::EntityRole::UnOperand); self.add_expression(operand, &*un_op.operand)?; let element = element::Element::UnOp(element::UnOp { operator, operand }); @@ -248,12 +251,12 @@ where entity: ir::Entity, bi_op: &ast::BiOp, ) -> Result<(), error::Error> { - let lhs = self.db.entity(Some(entity), ir::db::EntityKind::BiLhs); + let lhs = self.db.entity(Some(entity), ir::EntityRole::BiLhs); self.add_expression(lhs, &*bi_op.lhs)?; let operator = translate_bi_operator(bi_op.operator); - let rhs = self.db.entity(Some(entity), ir::db::EntityKind::BiRhs); + let rhs = self.db.entity(Some(entity), ir::EntityRole::BiRhs); self.add_expression(rhs, &*bi_op.rhs)?; let element = element::Element::BiOp(element::BiOp { lhs, operator, rhs }); @@ -281,7 +284,7 @@ where let ident = self.db.ident(parameter.name.clone()); let entity = self .db - .entity(Some(entity), ir::db::EntityKind::Named(ident)); + .entity(Some(entity), ir::EntityRole::ClosureParameter(ident)); self.add_parameter(entity, &*parameter)?; Ok(entity) }) @@ -301,7 +304,7 @@ where .map(|(index, statement)| { let entity = self .db - .entity(Some(entity), ir::db::EntityKind::Indexed(index)); + .entity(Some(entity), ir::EntityRole::ClosureStatement(index)); match &**statement { ast::Statement::Variable(ref variable) => { @@ -318,13 +321,13 @@ where }) .collect::, error::Error>>()?; - let signature = self.db.entity(Some(entity), ir::db::EntityKind::Signature); + let signature = self + .db + .entity(Some(entity), ir::EntityRole::ClosureSignature); self.add_expression(signature, &*lambda.signature)?; let result = if let Some(ref result) = lambda.result { - let e = self - .db - .entity(Some(entity), ir::db::EntityKind::LambdaResult); + let e = self.db.entity(Some(entity), ir::EntityRole::ClosureResult); self.add_expression(e, &*result)?; e } else { @@ -370,7 +373,7 @@ where let initializer = self .db - .entity(Some(entity), ir::db::EntityKind::Initializer); + .entity(Some(entity), ir::EntityRole::VariableInitializer); self.add_expression(initializer, &variable.initializer)?; @@ -391,7 +394,7 @@ where let field = self.db.ident(select.field.clone()); let record = self .db - .entity(Some(entity), ir::db::EntityKind::Named(field)); + .entity(Some(entity), ir::EntityRole::SelectField(field)); self.add_expression(record, &*select.record)?; let element = element::Element::Select(element::Select { record, field }); @@ -410,7 +413,7 @@ where ) -> Result<(), error::Error> { let function = self .db - .entity(Some(entity), ir::db::EntityKind::CalledFunction); + .entity(Some(entity), ir::EntityRole::AppliedFunction); self.add_expression(function, &*apply.function)?; let parameters = apply @@ -420,7 +423,7 @@ where .map(|(index, parameter)| { let entity = self .db - .entity(Some(entity), ir::db::EntityKind::Indexed(index)); + .entity(Some(entity), ir::EntityRole::AppliedParameter(index)); self.add_expression(entity, &*parameter)?; Ok(entity) }) @@ -444,7 +447,9 @@ where parameter: &ast::Parameter, ) -> Result<(), error::Error> { let name = self.db.ident(parameter.name.clone()); - let signature = self.db.entity(Some(entity), ir::db::EntityKind::Signature); + let signature = self + .db + .entity(Some(entity), ir::EntityRole::ParameterSignature); self.add_expression(signature, ¶meter.signature)?; let element = element::Element::Parameter(element::Parameter { name, signature }); @@ -488,7 +493,7 @@ impl Scope { fn resolve_capture( &mut self, - db: &mut impl ir::db::IrDb, + db: &impl ir::db::IrDb, ident: ir::Ident, location: codespan::ByteSpan, ) -> Result { @@ -496,8 +501,10 @@ impl Scope { collections::hash_map::Entry::Occupied(entry) => Ok(*entry.get()), collections::hash_map::Entry::Vacant(entry) => { if let Some(parent) = &mut self.parent { - let capture_entity = - db.entity(Some(self.entity), ir::db::EntityKind::Named(ident)); + let capture_entity = db.entity( + Some(self.entity), + ir::EntityRole::ClosureCaptureDefinition(ident), + ); let parent_entity = parent.resolve_capture(db, ident, location)?; self.captures.insert( capture_entity, @@ -506,7 +513,7 @@ impl Scope { captured: parent_entity, }, ); - self.locals.insert(ident, capture_entity); + entry.insert(capture_entity); Ok(capture_entity) } else { let reference = (*db.lookup_ident(ident)).clone(); diff --git a/src/ir/db.rs b/src/ir/db.rs index 1e57a4c..2be6149 100644 --- a/src/ir/db.rs +++ b/src/ir/db.rs @@ -2,8 +2,8 @@ use std::sync; use crate::ir; -use crate::ir::element; use crate::ir::location; +use crate::ir::{element, EntityRole}; use crate::syntax; #[salsa::query_group(Ir)] @@ -12,46 +12,49 @@ pub trait IrDb: salsa::Database + syntax::db::SyntaxDb { fn ident(&self, id: sync::Arc) -> ir::Ident; #[salsa::interned] - fn entity(&self, parent: Option, kind: EntityKind) -> ir::Entity; + fn entity(&self, parent: Option, role: EntityRole) -> ir::Entity; - fn entity_element(&self, entity: ir::Entity) -> sync::Arc; + fn entity_element( + &self, + entity: ir::Entity, + ) -> Result, ir::error::Error>; - fn entity_location(&self, entity: ir::Entity) -> sync::Arc; + fn entity_location( + &self, + entity: ir::Entity, + ) -> Result, ir::error::Error>; - fn entities(&self) -> sync::Arc; + fn entities(&self) -> Result, ir::error::Error>; } -#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] -pub enum EntityKind { - Module(ir::Ident), - Named(ir::Ident), - Indexed(usize), - Initializer, - UnOperand, - BiLhs, - BiRhs, - Signature, - LambdaResult, - CalledFunction, +fn entity_element( + db: &impl IrDb, + entity: ir::Entity, +) -> Result, ir::error::Error> { + Ok(db.entities()?.infos.get(&entity).unwrap().element.clone()) } -fn entity_element(db: &impl IrDb, entity: ir::Entity) -> sync::Arc { - db.entities().infos.get(&entity).unwrap().element.clone() +fn entity_location( + db: &impl IrDb, + entity: ir::Entity, +) -> Result, ir::error::Error> { + Ok(db.entities()?.infos.get(&entity).unwrap().location.clone()) } -fn entity_location(db: &impl IrDb, entity: ir::Entity) -> sync::Arc { - db.entities().infos.get(&entity).unwrap().location.clone() -} - -fn entities(db: &impl IrDb) -> sync::Arc { +fn entities(db: &impl IrDb) -> Result, ir::error::Error> { let mut entities = ir::Entities::new(); for source_root_id in &*db.all_source_roots() { for file in db.source_root(*source_root_id).files.values() { let result = db.parse(*file).unwrap(); - //let mut builder = ir::builder::Builder::new(&mut entities); - //builder.add_module(&*result).unwrap(); + let entity = db.entity(None, ir::EntityRole::File(*file)); + let builder = ir::builder::Builder::new(db, entity, &mut entities.infos); + let module_id = builder.build_module( + sync::Arc::new(db.file_relative_path(*file).as_str().to_owned()), + &*result, + )?; + entities.modules.push(module_id); } } - sync::Arc::new(entities) + Ok(sync::Arc::new(entities)) } diff --git a/src/ir/error.rs b/src/ir/error.rs index 7621ccc..85f3ff5 100644 --- a/src/ir/error.rs +++ b/src/ir/error.rs @@ -1,7 +1,7 @@ use crate::diagnostic; /// Errors that may occur while building and interacting with an [`Ir`]. -#[derive(Clone, Debug, Fail, PartialEq)] +#[derive(Clone, Debug, Eq, Fail, PartialEq)] pub enum Error { /// The IR cannot be built because something refers to an identifier that is not defined. #[fail(display = "undefined reference to `{}`", reference)] diff --git a/src/ir/mod.rs b/src/ir/mod.rs index f9f366e..29d73c0 100644 --- a/src/ir/mod.rs +++ b/src/ir/mod.rs @@ -2,13 +2,15 @@ use std::collections; use std::sync; +use crate::source; + pub mod builder; pub mod db; pub mod element; pub mod error; pub mod location; -//#[cfg(test)] -//mod tests; +#[cfg(test)] +mod tests; #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] pub struct Ident(u32); @@ -18,7 +20,31 @@ pub struct Entity(u32); #[derive(Clone, Debug, Eq, PartialEq)] pub struct Entities { - infos: collections::HashMap, + pub infos: collections::HashMap, + pub modules: Vec, +} + +#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] +pub enum EntityRole { + File(source::FileId), + Reference(Ident), + RecordField(Ident), + TupleField(usize), + VariableDefinition(Ident), + VariableInitializer, + SelectField(Ident), + AppliedFunction, + AppliedParameter(usize), + ParameterSignature, + ClosureCaptureDefinition(Ident), + ClosureParameter(Ident), + ClosureStatement(usize), + ClosureSignature, + ClosureResult, + ModuleDefinition(Ident), + UnOperand, + BiLhs, + BiRhs, } #[derive(Clone, Debug, Eq, PartialEq)] @@ -27,6 +53,18 @@ pub struct EntityInfo { pub location: sync::Arc, } +impl Ident { + pub fn id(self) -> u32 { + self.0 + } +} + +impl Entity { + pub fn id(self) -> u32 { + self.0 + } +} + impl salsa::InternKey for Ident { fn from_intern_id(v: salsa::InternId) -> Self { Ident(v.as_u32()) @@ -59,7 +97,8 @@ impl EntityInfo { impl Entities { pub fn new() -> Self { let infos = collections::HashMap::new(); + let modules = Vec::new(); - Self { infos } + Self { infos, modules } } } diff --git a/src/ir/tests.rs b/src/ir/tests.rs index 93e1563..cdb8e32 100644 --- a/src/ir/tests.rs +++ b/src/ir/tests.rs @@ -1,8 +1,10 @@ use env_logger; use failure; +use std::collections; +use std::sync; -use super::*; -use crate::syntax::ast; +use crate::db; +use crate::source; use crate::test_util; #[test] @@ -123,22 +125,34 @@ a = || -> u32 { } fn check_module(name: &'static str, source: &str) -> Result<(), String> { - use crate::syntax::parser::Parse; + use crate::ir::db::IrDb; + use crate::source::db::SourceDb; let mut codemap = codespan::CodeMap::new(); let span = codemap .add_filemap(codespan::FileName::Virtual(name.into()), source.to_owned()) .span(); - let ast_module = - ast::Module::parse(span, source).map_err(|e| crate::diagnostic::to_string(&codemap, &e))?; - let mut ir = Ir::new(); - ir.load(&ast_module) - .map_err(|e| crate::diagnostic::to_string(&codemap, &e))?; - ir.check_types() + let root_id = source::RootId(1); + let file_id = source::FileId(1); + let path = relative_path::RelativePath::new(name).to_owned(); + let mut files = collections::HashMap::new(); + files.insert(path.clone(), file_id); + let root = source::Root { files }; + + let mut db = db::Db::new(); + + db.set_file_text(file_id, sync::Arc::new(source.to_owned())); + db.set_file_span(file_id, span); + db.set_file_relative_path(file_id, path); + db.set_file_source_root(file_id, root_id); + db.set_source_root(root_id, sync::Arc::new(root)); + db.set_all_source_roots(sync::Arc::new(vec![root_id])); + + db.entities() .map_err(|e| crate::diagnostic::to_string(&codemap, &e))?; - test_util::render_graph(&format!(concat!(module_path!(), "::{}"), name), &ir).unwrap(); + test_util::render_graph(&format!(concat!(module_path!(), "::{}"), name), &db).unwrap(); Ok(()) } diff --git a/src/layout/db.rs b/src/layout/db.rs index 4693ec6..96b5980 100644 --- a/src/layout/db.rs +++ b/src/layout/db.rs @@ -5,9 +5,13 @@ use crate::layout; #[salsa::query_group(Layout)] pub trait LayoutDb: salsa::Database + ir::db::IrDb { - fn entity_layout(&self, entity: ir::Entity) -> sync::Arc; + fn entity_layout(&self, entity: ir::Entity) + -> layout::error::Result>; } -fn entity_layout(_ir: &impl LayoutDb, _entity: ir::Entity) -> sync::Arc { - unimplemented!() +fn entity_layout( + _ir: &impl LayoutDb, + _entity: ir::Entity, +) -> layout::error::Result> { + Err(layout::error::Error::NotImplemented) } diff --git a/src/layout/error.rs b/src/layout/error.rs new file mode 100644 index 0000000..0cfe195 --- /dev/null +++ b/src/layout/error.rs @@ -0,0 +1,18 @@ +use crate::ir; +use std::result; + +#[derive(Clone, Debug, Eq, Fail, PartialEq)] +pub enum Error { + #[fail(display = "semantic error: {}", _0)] + Ir(#[cause] ir::error::Error), + #[fail(display = "not implemented")] + NotImplemented +} + +pub type Result
= result::Result; + +impl From for Error { + fn from(error: ir::error::Error) -> Self { + Error::Ir(error) + } +} diff --git a/src/layout/infer.rs b/src/layout/infer.rs index 42da6d2..61395aa 100644 --- a/src/layout/infer.rs +++ b/src/layout/infer.rs @@ -21,12 +21,14 @@ impl System { &self, element: &element::Element, db: impl layout::db::LayoutDb, - ) -> sync::Arc { + ) -> layout::error::Result> { match *element { element::Element::Reference(_) => unimplemented!(), element::Element::Number(ref n) => self.infer_number_layout(n), - element::Element::String(_) => sync::Arc::new(layout::Layout::scalar(self.ptr_size)), - element::Element::Symbol(_) => sync::Arc::new(layout::Layout::zero()), + element::Element::String(_) => { + Ok(sync::Arc::new(layout::Layout::scalar(self.ptr_size))) + } + element::Element::Symbol(_) => Ok(sync::Arc::new(layout::Layout::zero())), element::Element::Tuple(element::Tuple { ref fields }) => { self.infer_tuple_layout(fields, db) } @@ -64,19 +66,22 @@ impl System { } } - fn infer_number_layout(&self, number: &element::Number) -> sync::Arc { + fn infer_number_layout( + &self, + number: &element::Number, + ) -> layout::error::Result> { match *number { element::Number::U8(_) | element::Number::I8(_) => { - sync::Arc::new(layout::Layout::scalar(1)) + Ok(sync::Arc::new(layout::Layout::scalar(1))) } element::Number::U16(_) | element::Number::I16(_) => { - sync::Arc::new(layout::Layout::scalar(2)) + Ok(sync::Arc::new(layout::Layout::scalar(2))) } element::Number::U32(_) | element::Number::I32(_) | element::Number::F32(_) => { - sync::Arc::new(layout::Layout::scalar(4)) + Ok(sync::Arc::new(layout::Layout::scalar(4))) } element::Number::U64(_) | element::Number::I64(_) | element::Number::F64(_) => { - sync::Arc::new(layout::Layout::scalar(8)) + Ok(sync::Arc::new(layout::Layout::scalar(8))) } } } @@ -85,15 +90,15 @@ impl System { &self, fields: &[ir::Entity], db: impl layout::db::LayoutDb, - ) -> sync::Arc { + ) -> layout::error::Result> { let mut layouts = fields .iter() .enumerate() - .map(|(i, f)| (i, db.entity_layout(*f))) - .collect::>(); + .map(|(i, f)| Ok((i, db.entity_layout(*f)?))) + .collect::>>()?; if layouts.is_empty() { - sync::Arc::new(layout::Layout::zero()) + Ok(sync::Arc::new(layout::Layout::zero())) } else { layouts.sort_unstable_by_key(|(i, l)| (usize::max_value() - l.size, *i)); let alignment = layouts.iter().map(|(_, l)| l.alignment).max().unwrap(); @@ -108,11 +113,11 @@ impl System { unnamed_fields[i] = layout::Offset { offset, layout }; } - sync::Arc::new(layout::Layout::unnamed_fields( + Ok(sync::Arc::new(layout::Layout::unnamed_fields( size, alignment, unnamed_fields, - )) + ))) } } @@ -120,14 +125,14 @@ impl System { &self, fields: &collections::HashMap, db: impl layout::db::LayoutDb, - ) -> sync::Arc { + ) -> layout::error::Result> { let mut layouts = fields .iter() - .map(|(n, f)| (*n, db.entity_layout(*f))) - .collect::>(); + .map(|(n, f)| Ok((*n, db.entity_layout(*f)?))) + .collect::>>()?; if layouts.is_empty() { - sync::Arc::new(layout::Layout::zero()) + Ok(sync::Arc::new(layout::Layout::zero())) } else { layouts .sort_unstable_by_key(|(n, l)| (usize::max_value() - l.size, db.lookup_ident(*n))); @@ -150,7 +155,11 @@ impl System { }) .collect::>(); - sync::Arc::new(layout::Layout::named_fields(size, alignment, named_fields)) + Ok(sync::Arc::new(layout::Layout::named_fields( + size, + alignment, + named_fields, + ))) } } @@ -159,9 +168,9 @@ impl System { operator: element::UnOperator, operand: ir::Entity, db: impl layout::db::LayoutDb, - ) -> sync::Arc { + ) -> layout::error::Result> { match operator { - element::UnOperator::Not => sync::Arc::new(BOOL_LAYOUT), + element::UnOperator::Not => Ok(sync::Arc::new(BOOL_LAYOUT)), element::UnOperator::BNot | element::UnOperator::Cl0 | element::UnOperator::Cl1 @@ -180,9 +189,9 @@ impl System { operator: element::BiOperator, rhs: ir::Entity, db: impl layout::db::LayoutDb, - ) -> sync::Arc { - let lhs = db.entity_layout(lhs); - let rhs = db.entity_layout(rhs); + ) -> layout::error::Result> { + let lhs = db.entity_layout(lhs)?; + let rhs = db.entity_layout(rhs)?; if lhs.size != rhs.size { unreachable!() @@ -204,7 +213,7 @@ impl System { | element::BiOperator::Xor | element::BiOperator::AndNot | element::BiOperator::OrNot - | element::BiOperator::XorNot => sync::Arc::new(BOOL_LAYOUT), + | element::BiOperator::XorNot => Ok(sync::Arc::new(BOOL_LAYOUT)), element::BiOperator::Cmp => unimplemented!(), element::BiOperator::Add | element::BiOperator::Sub @@ -220,7 +229,7 @@ impl System { | element::BiOperator::RotL | element::BiOperator::RotR | element::BiOperator::ShL - | element::BiOperator::ShR => lhs, + | element::BiOperator::ShR => Ok(lhs), } } @@ -228,7 +237,7 @@ impl System { &self, initializer: ir::Entity, db: impl layout::db::LayoutDb, - ) -> sync::Arc { + ) -> layout::error::Result> { db.entity_layout(initializer) } @@ -237,8 +246,8 @@ impl System { record: ir::Entity, field: ir::Ident, db: impl layout::db::LayoutDb, - ) -> sync::Arc { - match *db.entity_element(record) { + ) -> layout::error::Result> { + match *db.entity_element(record)? { element::Element::Record(element::Record { ref fields }) => { if let Some(f) = fields.get(&field) { db.entity_layout(*f) @@ -255,7 +264,7 @@ impl System { _function: ir::Entity, _parameters: &[ir::Entity], _db: impl layout::db::LayoutDb, - ) -> sync::Arc { + ) -> layout::error::Result> { // TODO unimplemented!() /* @@ -305,7 +314,7 @@ impl System { &self, signature: ir::Entity, db: impl layout::db::LayoutDb, - ) -> sync::Arc { + ) -> layout::error::Result> { db.entity_layout(signature) } @@ -313,7 +322,7 @@ impl System { &self, capture: ir::Entity, db: impl layout::db::LayoutDb, - ) -> sync::Arc { + ) -> layout::error::Result> { db.entity_layout(capture) } @@ -321,11 +330,11 @@ impl System { &self, captures: &collections::HashMap, db: impl layout::db::LayoutDb, - ) -> sync::Arc { + ) -> layout::error::Result> { let mut capture_layouts = captures .iter() - .map(|(n, f)| (*n, db.entity_layout(*f))) - .collect::>(); + .map(|(n, f)| Ok((*n, db.entity_layout(*f)?))) + .collect::>>()?; let unnamed_fields = vec![layout::Offset { offset: 0, layout: layout::Layout::scalar(self.ptr_size), @@ -356,19 +365,19 @@ impl System { }) .collect::>(); - sync::Arc::new(layout::Layout { + Ok(sync::Arc::new(layout::Layout { size, alignment, named_fields, unnamed_fields, - }) + })) } fn infer_module_layout( &self, _variables: &collections::HashMap, - db: impl layout::db::LayoutDb, - ) -> sync::Arc { + _db: impl layout::db::LayoutDb, + ) -> layout::error::Result> { // TODO unimplemented!() /* diff --git a/src/layout/mod.rs b/src/layout/mod.rs index 1a3ab0f..897c367 100644 --- a/src/layout/mod.rs +++ b/src/layout/mod.rs @@ -2,6 +2,7 @@ use crate::ir; use std::fmt; pub mod db; +pub mod error; mod infer; #[derive(Clone, Debug, Eq, PartialEq)] diff --git a/src/lib.rs b/src/lib.rs index e5494fa..b92940e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -30,8 +30,8 @@ //! # } //! ``` #![feature(const_fn, const_vec_new)] -// #![deny(nonstandard_style, warnings, unused)] -#![deny(nonstandard_style)] +#![deny(nonstandard_style, warnings)] +#![allow(unused)] #![deny( missing_docs, missing_debug_implementations, @@ -67,12 +67,12 @@ mod syntax; mod ty; mod value; -//#[cfg(test)] -//mod test_util; +#[cfg(test)] +mod test_util; pub mod diagnostic; pub mod error; -// pub mod graph; +pub mod graph; pub mod module; pub use crate::error::Error; @@ -128,7 +128,7 @@ impl Tin { /// # Ok(()) /// # } /// ``` - pub fn load(&mut self, file_name: F, source: &str) -> Result<()> + pub fn load(&mut self, _file_name: F, _source: &str) -> Result<()> where F: Into, { diff --git a/src/source/mod.rs b/src/source/mod.rs index 7a4a032..641862f 100644 --- a/src/source/mod.rs +++ b/src/source/mod.rs @@ -9,13 +9,15 @@ //! pub mod db; +use std::collections; + /// `FileId` is an integer which uniquely identifies a file. /// /// File paths are messy and system-dependent, so most of the code should work directly with /// `FileId`, without inspecting the path. The mapping between `FileId` and path and `SourceRoot` /// is constant. A file rename is represented as a pair of deletion/creation. #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] -pub struct FileId(u32); +pub struct FileId(pub u32); /// Files are grouped into source roots. /// @@ -25,9 +27,9 @@ pub struct FileId(u32); /// source root at all. So, a file from one source root can't refer to a file in another source root /// by path. #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)] -pub struct RootId(u32); +pub struct RootId(pub u32); #[derive(Default, Clone, Debug, PartialEq, Eq)] pub struct Root { - pub files: rustc_hash::FxHashMap, + pub files: collections::HashMap, } diff --git a/src/test_util.rs b/src/test_util.rs index bbd1b3e..c2a6333 100644 --- a/src/test_util.rs +++ b/src/test_util.rs @@ -1,11 +1,11 @@ use failure; +use crate::db; use crate::graph; -use crate::ir; -pub fn render_graph(name: &str, ir: &ir::Ir) -> Result<(), failure::Error> { +pub fn render_graph(name: &str, db: &db::Db) -> Result<(), failure::Error> { if cfg!(feature = "test-render-graphs") { - let graph = graph::Graph::new(ir); + let graph = graph::Graph::new(db); let dot_path = format!("/tmp/{}.dot", name); let img_path = format!("/tmp/{}.svg", name); diff --git a/src/ty/db.rs b/src/ty/db.rs index 585e897..e1ad25b 100644 --- a/src/ty/db.rs +++ b/src/ty/db.rs @@ -14,7 +14,12 @@ fn entity_type( _ir: &impl TyDb, _entity: ir::Entity, ) -> Result, ty::error::Error> { - unimplemented!() + Err(ty::error::Error { + expected: ty::error::ExpectedType::AnyOf(vec![]), + actual: sync::Arc::new(ty::Type::Placeholder), + main_entity: _entity, + aux_entities: vec![] + }) } fn bool_type(db: &impl TyDb) -> sync::Arc { diff --git a/src/ty/infer.rs b/src/ty/infer.rs index ff6968e..3a8e657 100644 --- a/src/ty/infer.rs +++ b/src/ty/infer.rs @@ -320,7 +320,7 @@ fn if_eq_then( rhs_entity: ir::Entity, rhs: &sync::Arc, result: &sync::Arc, - db: impl ty::db::TyDb, + _db: impl ty::db::TyDb, ) -> Result { if lhs == rhs { Ok(result.clone()) From 64e7730bceb5dd7f86d94711a4033ff20d17bcfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Flemstr=C3=B6m?= Date: Sun, 12 May 2019 20:19:54 +0200 Subject: [PATCH 11/22] Start refactoring away separate "db" modules --- src/db.rs | 2 +- src/interpreter/db.rs | 20 --------------- src/interpreter/error.rs | 7 ++++-- src/interpreter/mod.rs | 54 ++++++++++++++++++++++------------------ src/ir/builder.rs | 6 ++++- src/layout/error.rs | 2 +- src/layout/infer.rs | 2 -- src/ty/db.rs | 2 +- 8 files changed, 43 insertions(+), 52 deletions(-) delete mode 100644 src/interpreter/db.rs diff --git a/src/db.rs b/src/db.rs index ac4b7c2..ad27f1c 100644 --- a/src/db.rs +++ b/src/db.rs @@ -6,7 +6,7 @@ use crate::syntax; use crate::ty; #[salsa::database( - interpreter::db::Interpreter, + interpreter::Interpreter, ir::db::Ir, layout::db::Layout, source::db::Source, diff --git a/src/interpreter/db.rs b/src/interpreter/db.rs deleted file mode 100644 index 5d78c32..0000000 --- a/src/interpreter/db.rs +++ /dev/null @@ -1,20 +0,0 @@ -use crate::interpreter; -use crate::ir; -use crate::value; - -#[salsa::query_group(Interpreter)] -pub trait InterpreterDb: salsa::Database + ir::db::IrDb { - fn entity_value( - &self, - entity: ir::Entity, - ) -> Result, interpreter::error::Error>; -} - -fn entity_value( - db: &impl InterpreterDb, - entity: ir::Entity, -) -> Result, interpreter::error::Error> { - let element = db.entity_element(entity)?; - - Ok(interpreter::eval(&*element, db)?) -} diff --git a/src/interpreter/error.rs b/src/interpreter/error.rs index dff463d..114b057 100644 --- a/src/interpreter/error.rs +++ b/src/interpreter/error.rs @@ -1,6 +1,7 @@ use crate::diagnostic; use crate::ir; use crate::module; +use std::result; #[derive(Clone, Debug, Eq, Fail, PartialEq)] pub enum Error { @@ -9,9 +10,11 @@ pub enum Error { #[fail(display = "type conflict: {}", _0)] RuntimeTypeConflict(String), #[fail(display = "evaluation error: {}", _0)] - EvaluationError(#[cause] module::Error), + Evaluation(#[cause] module::Error), } +pub type Result = result::Result; + impl diagnostic::Diagnostics for Error { fn to_diagnostics(&self, builder: &mut diagnostic::DiagnosticsBuilder) { match *self { @@ -19,7 +22,7 @@ impl diagnostic::Diagnostics for Error { Error::RuntimeTypeConflict(ref cause) => { builder.add_diagnostic(codespan_reporting::Severity::Bug, None, cause); } - Error::EvaluationError(ref cause) => { + Error::Evaluation(ref cause) => { builder.add_diagnostic( codespan_reporting::Severity::Error, None, diff --git a/src/interpreter/mod.rs b/src/interpreter/mod.rs index 9d4b5b5..ef37bed 100644 --- a/src/interpreter/mod.rs +++ b/src/interpreter/mod.rs @@ -2,19 +2,33 @@ use std::cmp; use std::collections; use crate::interpreter; +use crate::ir; use crate::ir::element; use crate::module; use crate::value; -pub mod db; pub mod error; #[macro_use] mod macros; -pub fn eval( +#[salsa::query_group(Interpreter)] +pub trait InterpreterDb: salsa::Database + ir::db::IrDb { + fn entity_value(&self, entity: ir::Entity) -> error::Result>; +} + +fn entity_value( + db: &impl InterpreterDb, + entity: ir::Entity, +) -> error::Result> { + let element = db.entity_element(entity)?; + let value = eval(db, &*element)?; + Ok(value) +} + +fn eval( + db: &impl InterpreterDb, element: &element::Element, - db: &impl interpreter::db::InterpreterDb, -) -> Result, error::Error> { +) -> error::Result> { match element { element::Element::Number(v) => Ok(Some(value::Value::number(eval_number(v)))), element::Element::String(ref v) => Ok(Some(value::Value::string(v.as_str()))), @@ -31,10 +45,10 @@ pub fn eval( .map(|(k, f)| Ok(db.entity_value(*f)?.map(|v| (db.lookup_ident(*k), v)))) .collect::>, error::Error>>()? .map(|fields| value::Value::record(value::Record { fields }))), - element::Element::UnOp(element::UnOp { operator, operand }) => transpose( - db.entity_value(*operand)? - .map(|operand| eval_un_op(*operator, &operand)), - ), + element::Element::UnOp(element::UnOp { operator, operand }) => db + .entity_value(*operand)? + .map(|operand| eval_un_op(*operator, &operand)) + .transpose(), element::Element::BiOp(element::BiOp { lhs, operator, rhs }) => { let lhs_value = db.entity_value(*lhs)?; let rhs_value = db.entity_value(*rhs)?; @@ -46,15 +60,16 @@ pub fn eval( element::Element::Variable(element::Variable { initializer, .. }) => { db.entity_value(*initializer) } - element::Element::Select(element::Select { record, field }) => { - transpose(db.entity_value(*record)?.map(|record| match record.case() { + element::Element::Select(element::Select { record, field }) => db + .entity_value(*record)? + .map(|record| match record.case() { value::Case::Record(r) => Ok(r.fields[&db.lookup_ident(*field)].clone()), other => Err(error::Error::RuntimeTypeConflict(format!( "not a record: {:?}", other ))), - })) - } + }) + .transpose(), _ => Ok(None), // TODO } } @@ -106,7 +121,7 @@ fn eval_un_op( } } -#[allow(clippy::cyclomatic_complexity)] +#[allow(clippy::cognitive_complexity)] fn eval_bi_op( lhs: &value::Value, operator: element::BiOperator, @@ -144,13 +159,13 @@ fn eval_bi_op( (l.into_inner() * r.into_inner()).into() )), element::BiOperator::Div => match_number_value!("/", (lhs, rhs), |l, r| int: if *r == 0 { - Err(error::Error::EvaluationError(module::Error::new(module::ErrorKind::IntegerDivisonByZero))) + Err(error::Error::Evaluation(module::Error::new(module::ErrorKind::IntegerDivisonByZero))) } else { Ok((l.wrapping_div(*r)).into()) }, frac: Ok((l.into_inner() / r.into_inner()).into() )), element::BiOperator::Rem => match_number_value!("%", (lhs, rhs), |l, r| int: if *r == 0 { - Err(error::Error::EvaluationError(module::Error::new(module::ErrorKind::IntegerDivisonByZero))) + Err(error::Error::Evaluation(module::Error::new(module::ErrorKind::IntegerDivisonByZero))) } else { Ok((l.wrapping_rem(*r)).into()) }, frac: Ok( @@ -342,12 +357,3 @@ where Ok(op(lhs, rhs).into()) } - -// TODO: awaits https://github.com/rust-lang/rust/issues/47338 -fn transpose(option: Option>) -> Result, E> { - match option { - Some(Ok(x)) => Ok(Some(x)), - Some(Err(e)) => Err(e), - None => Ok(None), - } -} diff --git a/src/ir/builder.rs b/src/ir/builder.rs index 5cd58cd..ae170ba 100644 --- a/src/ir/builder.rs +++ b/src/ir/builder.rs @@ -27,7 +27,11 @@ impl<'a, Db> Builder<'a, Db> where Db: ir::db::IrDb, { - pub fn new(db: &'a Db, root: ir::Entity, infos: &'a mut collections::HashMap) -> Self { + pub fn new( + db: &'a Db, + root: ir::Entity, + infos: &'a mut collections::HashMap, + ) -> Self { let scope = Scope::new(root); Builder { db, scope, infos } diff --git a/src/layout/error.rs b/src/layout/error.rs index 0cfe195..2bc4ee9 100644 --- a/src/layout/error.rs +++ b/src/layout/error.rs @@ -6,7 +6,7 @@ pub enum Error { #[fail(display = "semantic error: {}", _0)] Ir(#[cause] ir::error::Error), #[fail(display = "not implemented")] - NotImplemented + NotImplemented, } pub type Result = result::Result; diff --git a/src/layout/infer.rs b/src/layout/infer.rs index 61395aa..b67d20a 100644 --- a/src/layout/infer.rs +++ b/src/layout/infer.rs @@ -144,7 +144,6 @@ impl System { .map(|(field, layout)| { let offset = align_up(size, layout.alignment); size = offset + layout.size; - let field = field.clone(); let layout = (*layout).clone(); let offset_layout = layout::Offset { offset, layout }; @@ -354,7 +353,6 @@ impl System { .map(|(field, layout)| { let offset = align_up(size, layout.alignment); size = offset + layout.size; - let field = field.clone(); let layout = (*layout).clone(); let offset_layout = layout::Offset { offset, layout }; diff --git a/src/ty/db.rs b/src/ty/db.rs index e1ad25b..eca93d2 100644 --- a/src/ty/db.rs +++ b/src/ty/db.rs @@ -18,7 +18,7 @@ fn entity_type( expected: ty::error::ExpectedType::AnyOf(vec![]), actual: sync::Arc::new(ty::Type::Placeholder), main_entity: _entity, - aux_entities: vec![] + aux_entities: vec![], }) } From 02bed64637fa6ba3c6c5b8f4b756fffb1c54657a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Flemstr=C3=B6m?= Date: Sun, 12 May 2019 20:22:35 +0200 Subject: [PATCH 12/22] Rename trait --- src/interpreter/mod.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/interpreter/mod.rs b/src/interpreter/mod.rs index ef37bed..0dba386 100644 --- a/src/interpreter/mod.rs +++ b/src/interpreter/mod.rs @@ -12,12 +12,12 @@ pub mod error; mod macros; #[salsa::query_group(Interpreter)] -pub trait InterpreterDb: salsa::Database + ir::db::IrDb { +pub trait Db: salsa::Database + ir::db::IrDb { fn entity_value(&self, entity: ir::Entity) -> error::Result>; } fn entity_value( - db: &impl InterpreterDb, + db: &impl Db, entity: ir::Entity, ) -> error::Result> { let element = db.entity_element(entity)?; @@ -26,7 +26,7 @@ fn entity_value( } fn eval( - db: &impl InterpreterDb, + db: &impl Db, element: &element::Element, ) -> error::Result> { match element { From adb9285abf1d3f5e09f76dfb0fa3035fb05c1e6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Flemstr=C3=B6m?= Date: Sun, 12 May 2019 20:37:10 +0200 Subject: [PATCH 13/22] Remove ir::db similarly --- src/db.rs | 2 +- src/graph.rs | 8 ++--- src/interpreter/mod.rs | 2 +- src/ir/builder.rs | 4 +-- src/ir/db.rs | 60 ------------------------------------ src/ir/error.rs | 3 ++ src/ir/mod.rs | 69 +++++++++++++++++++++++++++++++++++++++--- src/ir/tests.rs | 2 +- src/layout/db.rs | 2 +- src/ty/db.rs | 2 +- 10 files changed, 79 insertions(+), 75 deletions(-) delete mode 100644 src/ir/db.rs diff --git a/src/db.rs b/src/db.rs index ad27f1c..23e54c2 100644 --- a/src/db.rs +++ b/src/db.rs @@ -7,7 +7,7 @@ use crate::ty; #[salsa::database( interpreter::Interpreter, - ir::db::Ir, + ir::Ir, layout::db::Layout, source::db::Source, syntax::db::Syntax, diff --git a/src/graph.rs b/src/graph.rs index 4e68fdc..79fb65d 100644 --- a/src/graph.rs +++ b/src/graph.rs @@ -37,14 +37,14 @@ impl<'a> Graph<'a> { impl<'a> dot::GraphWalk<'a, Node, Edge> for Graph<'a> { fn nodes(&'a self) -> borrow::Cow<'a, [Node]> { - use crate::ir::db::IrDb; + use crate::ir::Db; let entities = self.db.entities().unwrap(); borrow::Cow::Owned(entities.infos.keys().cloned().map(Node).collect()) } fn edges(&'a self) -> borrow::Cow<'a, [Edge]> { - use crate::ir::db::IrDb; + use crate::ir::Db; let mut edges = Vec::new(); @@ -88,7 +88,7 @@ impl<'a> dot::Labeller<'a, Node, Edge> for Graph<'a> { } fn node_label(&'a self, n: &Node) -> dot::LabelText<'a> { - use crate::ir::db::IrDb; + use crate::ir::Db; use crate::layout::db::LayoutDb; use crate::ty::db::TyDb; use std::fmt::Write; @@ -165,7 +165,7 @@ impl<'a> dot::Labeller<'a, Node, Edge> for Graph<'a> { } fn edge_label(&'a self, e: &Edge) -> dot::LabelText<'a> { - use crate::ir::db::IrDb; + use crate::ir::Db; use crate::source::db::SourceDb; match e.role { diff --git a/src/interpreter/mod.rs b/src/interpreter/mod.rs index 0dba386..aa5c753 100644 --- a/src/interpreter/mod.rs +++ b/src/interpreter/mod.rs @@ -12,7 +12,7 @@ pub mod error; mod macros; #[salsa::query_group(Interpreter)] -pub trait Db: salsa::Database + ir::db::IrDb { +pub trait Db: salsa::Database + ir::Db { fn entity_value(&self, entity: ir::Entity) -> error::Result>; } diff --git a/src/ir/builder.rs b/src/ir/builder.rs index ae170ba..a14f11c 100644 --- a/src/ir/builder.rs +++ b/src/ir/builder.rs @@ -25,7 +25,7 @@ struct Scope { impl<'a, Db> Builder<'a, Db> where - Db: ir::db::IrDb, + Db: ir::Db, { pub fn new( db: &'a Db, @@ -497,7 +497,7 @@ impl Scope { fn resolve_capture( &mut self, - db: &impl ir::db::IrDb, + db: &impl ir::Db, ident: ir::Ident, location: codespan::ByteSpan, ) -> Result { diff --git a/src/ir/db.rs b/src/ir/db.rs deleted file mode 100644 index 2be6149..0000000 --- a/src/ir/db.rs +++ /dev/null @@ -1,60 +0,0 @@ -#![allow(non_camel_case_types)] -use std::sync; - -use crate::ir; -use crate::ir::location; -use crate::ir::{element, EntityRole}; -use crate::syntax; - -#[salsa::query_group(Ir)] -pub trait IrDb: salsa::Database + syntax::db::SyntaxDb { - #[salsa::interned] - fn ident(&self, id: sync::Arc) -> ir::Ident; - - #[salsa::interned] - fn entity(&self, parent: Option, role: EntityRole) -> ir::Entity; - - fn entity_element( - &self, - entity: ir::Entity, - ) -> Result, ir::error::Error>; - - fn entity_location( - &self, - entity: ir::Entity, - ) -> Result, ir::error::Error>; - - fn entities(&self) -> Result, ir::error::Error>; -} - -fn entity_element( - db: &impl IrDb, - entity: ir::Entity, -) -> Result, ir::error::Error> { - Ok(db.entities()?.infos.get(&entity).unwrap().element.clone()) -} - -fn entity_location( - db: &impl IrDb, - entity: ir::Entity, -) -> Result, ir::error::Error> { - Ok(db.entities()?.infos.get(&entity).unwrap().location.clone()) -} - -fn entities(db: &impl IrDb) -> Result, ir::error::Error> { - let mut entities = ir::Entities::new(); - for source_root_id in &*db.all_source_roots() { - for file in db.source_root(*source_root_id).files.values() { - let result = db.parse(*file).unwrap(); - - let entity = db.entity(None, ir::EntityRole::File(*file)); - let builder = ir::builder::Builder::new(db, entity, &mut entities.infos); - let module_id = builder.build_module( - sync::Arc::new(db.file_relative_path(*file).as_str().to_owned()), - &*result, - )?; - entities.modules.push(module_id); - } - } - Ok(sync::Arc::new(entities)) -} diff --git a/src/ir/error.rs b/src/ir/error.rs index 85f3ff5..3b83efd 100644 --- a/src/ir/error.rs +++ b/src/ir/error.rs @@ -1,4 +1,5 @@ use crate::diagnostic; +use std::result; /// Errors that may occur while building and interacting with an [`Ir`]. #[derive(Clone, Debug, Eq, Fail, PartialEq)] @@ -20,6 +21,8 @@ pub enum Error { }, } +pub type Result = result::Result; + impl diagnostic::Diagnostics for Error { fn to_diagnostics(&self, builder: &mut diagnostic::DiagnosticsBuilder) { match *self { diff --git a/src/ir/mod.rs b/src/ir/mod.rs index 29d73c0..cb0a0ce 100644 --- a/src/ir/mod.rs +++ b/src/ir/mod.rs @@ -3,15 +3,36 @@ use std::collections; use std::sync; use crate::source; +use crate::syntax; pub mod builder; -pub mod db; pub mod element; pub mod error; pub mod location; #[cfg(test)] mod tests; +#[salsa::query_group(Ir)] +pub trait Db: salsa::Database + syntax::db::SyntaxDb { + #[salsa::interned] + fn ident(&self, id: sync::Arc) -> Ident; + + #[salsa::interned] + fn entity(&self, parent: Option, role: EntityRole) -> Entity; + + fn entity_element( + &self, + entity: Entity, + ) -> error::Result>; + + fn entity_location( + &self, + entity: Entity, + ) -> error::Result; + + fn entities(&self) -> error::Result>; +} + #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] pub struct Ident(u32); @@ -49,8 +70,8 @@ pub enum EntityRole { #[derive(Clone, Debug, Eq, PartialEq)] pub struct EntityInfo { - pub element: sync::Arc, - pub location: sync::Arc, + element: sync::Arc, + location: location::Location, } impl Ident { @@ -88,7 +109,6 @@ impl salsa::InternKey for Entity { impl EntityInfo { fn new(element: element::Element, location: location::Location) -> Self { let element = sync::Arc::new(element); - let location = sync::Arc::new(location); Self { element, location } } @@ -102,3 +122,44 @@ impl Entities { Self { infos, modules } } } + +impl EntityInfo { + pub fn element(&self) -> &element::Element { + &self.element + } + + pub fn location(&self) -> location::Location { + self.location + } +} +fn entity_element( + db: &impl Db, + entity: Entity, +) -> error::Result> { + Ok(db.entities()?.infos.get(&entity).unwrap().element.clone()) +} + +fn entity_location( + db: &impl Db, + entity: Entity, +) -> error::Result { + Ok(db.entities()?.infos.get(&entity).unwrap().location) +} + +fn entities(db: &impl Db) -> error::Result> { + let mut entities = Entities::new(); + for source_root_id in &*db.all_source_roots() { + for file in db.source_root(*source_root_id).files.values() { + let result = db.parse(*file).unwrap(); + + let entity = db.entity(None, EntityRole::File(*file)); + let builder = builder::Builder::new(db, entity, &mut entities.infos); + let module_id = builder.build_module( + sync::Arc::new(db.file_relative_path(*file).as_str().to_owned()), + &*result, + )?; + entities.modules.push(module_id); + } + } + Ok(sync::Arc::new(entities)) +} diff --git a/src/ir/tests.rs b/src/ir/tests.rs index cdb8e32..55f8f02 100644 --- a/src/ir/tests.rs +++ b/src/ir/tests.rs @@ -125,7 +125,7 @@ a = || -> u32 { } fn check_module(name: &'static str, source: &str) -> Result<(), String> { - use crate::ir::db::IrDb; + use crate::ir::Db; use crate::source::db::SourceDb; let mut codemap = codespan::CodeMap::new(); diff --git a/src/layout/db.rs b/src/layout/db.rs index 96b5980..7237811 100644 --- a/src/layout/db.rs +++ b/src/layout/db.rs @@ -4,7 +4,7 @@ use crate::ir; use crate::layout; #[salsa::query_group(Layout)] -pub trait LayoutDb: salsa::Database + ir::db::IrDb { +pub trait LayoutDb: salsa::Database + ir::Db { fn entity_layout(&self, entity: ir::Entity) -> layout::error::Result>; } diff --git a/src/ty/db.rs b/src/ty/db.rs index eca93d2..d87ab06 100644 --- a/src/ty/db.rs +++ b/src/ty/db.rs @@ -4,7 +4,7 @@ use crate::ir; use crate::ty; #[salsa::query_group(Ty)] -pub trait TyDb: salsa::Database + ir::db::IrDb { +pub trait TyDb: salsa::Database + ir::Db { fn entity_type(&self, entity: ir::Entity) -> Result, ty::error::Error>; fn bool_type(&self) -> sync::Arc; From a2b35feb63d187c26b1e432b7f23ec3366e9408e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Flemstr=C3=B6m?= Date: Sun, 12 May 2019 20:55:02 +0200 Subject: [PATCH 14/22] Use shorter names for some common methods --- src/graph.rs | 2 +- src/interpreter/mod.rs | 20 ++++++++++---------- src/ir/mod.rs | 8 ++++---- src/layout/infer.rs | 2 +- src/syntax/ast/mod.rs | 4 ++-- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/graph.rs b/src/graph.rs index 79fb65d..7e955d6 100644 --- a/src/graph.rs +++ b/src/graph.rs @@ -95,7 +95,7 @@ impl<'a> dot::Labeller<'a, Node, Edge> for Graph<'a> { let mut result = format!("({}) ", n.0.id()); - if let Ok(element) = self.db.entity_element(n.0) { + if let Ok(element) = self.db.element(n.0) { match &*element { element::Element::Reference(e) => write!(result, "ref {:?}", e).unwrap(), element::Element::Number(n) => write!(result, "num {:?}", n).unwrap(), diff --git a/src/interpreter/mod.rs b/src/interpreter/mod.rs index aa5c753..b241340 100644 --- a/src/interpreter/mod.rs +++ b/src/interpreter/mod.rs @@ -13,14 +13,14 @@ mod macros; #[salsa::query_group(Interpreter)] pub trait Db: salsa::Database + ir::Db { - fn entity_value(&self, entity: ir::Entity) -> error::Result>; + fn value(&self, entity: ir::Entity) -> error::Result>; } -fn entity_value( +fn value( db: &impl Db, entity: ir::Entity, ) -> error::Result> { - let element = db.entity_element(entity)?; + let element = db.element(entity)?; let value = eval(db, &*element)?; Ok(value) } @@ -37,31 +37,31 @@ fn eval( } element::Element::Tuple(element::Tuple { ref fields }) => Ok(fields .iter() - .map(|f| db.entity_value(*f)) + .map(|f| db.value(*f)) .collect::>, error::Error>>()? .map(|fields| value::Value::tuple(value::Tuple { fields }))), element::Element::Record(element::Record { ref fields }) => Ok(fields .iter() - .map(|(k, f)| Ok(db.entity_value(*f)?.map(|v| (db.lookup_ident(*k), v)))) + .map(|(k, f)| Ok(db.value(*f)?.map(|v| (db.lookup_ident(*k), v)))) .collect::>, error::Error>>()? .map(|fields| value::Value::record(value::Record { fields }))), element::Element::UnOp(element::UnOp { operator, operand }) => db - .entity_value(*operand)? + .value(*operand)? .map(|operand| eval_un_op(*operator, &operand)) .transpose(), element::Element::BiOp(element::BiOp { lhs, operator, rhs }) => { - let lhs_value = db.entity_value(*lhs)?; - let rhs_value = db.entity_value(*rhs)?; + let lhs_value = db.value(*lhs)?; + let rhs_value = db.value(*rhs)?; match (lhs_value, rhs_value) { (Some(ref lhs), Some(ref rhs)) => eval_bi_op(lhs, *operator, rhs).map(Some), _ => Ok(None), } } element::Element::Variable(element::Variable { initializer, .. }) => { - db.entity_value(*initializer) + db.value(*initializer) } element::Element::Select(element::Select { record, field }) => db - .entity_value(*record)? + .value(*record)? .map(|record| match record.case() { value::Case::Record(r) => Ok(r.fields[&db.lookup_ident(*field)].clone()), other => Err(error::Error::RuntimeTypeConflict(format!( diff --git a/src/ir/mod.rs b/src/ir/mod.rs index cb0a0ce..e063f4d 100644 --- a/src/ir/mod.rs +++ b/src/ir/mod.rs @@ -20,12 +20,12 @@ pub trait Db: salsa::Database + syntax::db::SyntaxDb { #[salsa::interned] fn entity(&self, parent: Option, role: EntityRole) -> Entity; - fn entity_element( + fn element( &self, entity: Entity, ) -> error::Result>; - fn entity_location( + fn location( &self, entity: Entity, ) -> error::Result; @@ -132,14 +132,14 @@ impl EntityInfo { self.location } } -fn entity_element( +fn element( db: &impl Db, entity: Entity, ) -> error::Result> { Ok(db.entities()?.infos.get(&entity).unwrap().element.clone()) } -fn entity_location( +fn location( db: &impl Db, entity: Entity, ) -> error::Result { diff --git a/src/layout/infer.rs b/src/layout/infer.rs index b67d20a..c049c45 100644 --- a/src/layout/infer.rs +++ b/src/layout/infer.rs @@ -246,7 +246,7 @@ impl System { field: ir::Ident, db: impl layout::db::LayoutDb, ) -> layout::error::Result> { - match *db.entity_element(record)? { + match *db.element(record)? { element::Element::Record(element::Record { ref fields }) => { if let Some(f) = fields.get(&field) { db.entity_layout(*f) diff --git a/src/syntax/ast/mod.rs b/src/syntax/ast/mod.rs index f2f8653..39f6a15 100644 --- a/src/syntax/ast/mod.rs +++ b/src/syntax/ast/mod.rs @@ -4,8 +4,8 @@ //! arbitrary metadata to every node; a common use is to store the source location for each node as //! parsed by a parser (see [`parser::Context`] for an example). //! -//! To generically interact with the context of a node, the [`AstNode`] trait can be used. All of -//! the contexts of an entire AST can additionally be transformed using the [`MapContext`] trait. +//! To generically interact with the context of a node, the `AstNode` trait can be used. All of +//! the contexts of an entire AST can additionally be transformed using the `MapContext` trait. use std::sync; mod ast_node; From a864848ae651cf0d0ffb7c3fb63c7270db4be311 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Flemstr=C3=B6m?= Date: Sun, 12 May 2019 20:59:52 +0200 Subject: [PATCH 15/22] Update some deps --- Cargo.lock | 365 +++++++++++++++++++-------------------- Cargo.toml | 12 +- src/interpreter/mod.rs | 14 +- src/ir/mod.rs | 20 +-- src/syntax/parser/mod.rs | 26 +-- 5 files changed, 208 insertions(+), 229 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 98ef178..780390d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -16,12 +16,29 @@ dependencies = [ "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "argon2rs" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", + "scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "arrayvec" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "ascii-canvas" -version = "1.0.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "term 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -29,8 +46,8 @@ name = "atty" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", - "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "termion 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -47,7 +64,7 @@ dependencies = [ "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-demangle 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -57,8 +74,8 @@ name = "backtrace-sys" version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -79,12 +96,21 @@ name = "bitflags" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "blake2-rfc" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "block-buffer" -version = "0.7.0" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "block-padding 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "block-padding 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "generic-array 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -92,7 +118,7 @@ dependencies = [ [[package]] name = "block-padding" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -115,7 +141,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "cc" -version = "1.0.35" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -157,7 +183,7 @@ dependencies = [ [[package]] name = "codespan" -version = "0.2.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -166,13 +192,18 @@ dependencies = [ [[package]] name = "codespan-reporting" -version = "0.2.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "codespan 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "codespan 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "constant_time_eq" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "cranelift" version = "0.30.0" @@ -257,7 +288,7 @@ dependencies = [ "cranelift-module 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", "cranelift-native 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", "errno 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", "region 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "target-lexicon 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -265,11 +296,11 @@ dependencies = [ [[package]] name = "ctor" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -277,9 +308,9 @@ name = "derive-new" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -300,15 +331,25 @@ dependencies = [ "generic-array 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "dirs" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_users 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "docopt" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", - "strsim 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", + "strsim 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -323,7 +364,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "ena" -version = "0.11.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -347,7 +388,7 @@ dependencies = [ "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -357,7 +398,7 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "errno-dragonfly 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -367,7 +408,7 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -384,9 +425,9 @@ name = "failure_derive" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -418,15 +459,6 @@ dependencies = [ "typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "hashbrown" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "heck" version = "0.3.1" @@ -448,14 +480,6 @@ name = "indexmap" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "itertools" -version = "0.7.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "either 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "itertools" version = "0.8.0" @@ -466,45 +490,36 @@ dependencies = [ [[package]] name = "itoa" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "kernel32-sys" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "lalrpop" -version = "0.16.3" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "ascii-canvas 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ascii-canvas 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "bit-set 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "docopt 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "ena 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ena 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lalrpop-util 0.16.3 (registry+https://github.com/rust-lang/crates.io-index)", + "lalrpop-util 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)", "petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "term 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "lalrpop-util" -version = "0.16.3" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -514,7 +529,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libc" -version = "0.2.51" +version = "0.2.54" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -539,15 +554,7 @@ name = "mach" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "matrixmultiply" -version = "0.1.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rawpointer 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -555,29 +562,15 @@ name = "memchr" version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "ndarray" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "itertools 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)", - "matrixmultiply 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", - "num-complex 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "new_debug_unreachable" version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "num-complex" -version = "0.2.1" +name = "nodrop" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] name = "num-integer" @@ -600,6 +593,11 @@ name = "num-traits" version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "numtoa" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "opaque-debug" version = "0.2.2" @@ -648,7 +646,7 @@ name = "parking_lot_core" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -692,7 +690,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "ctor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "ctor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "output_vt100 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -709,7 +707,7 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "0.4.27" +version = "0.4.30" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -730,7 +728,7 @@ name = "quote" version = "0.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -739,12 +737,12 @@ version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_jitter 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -791,10 +789,10 @@ dependencies = [ [[package]] name = "rand_jitter" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -806,7 +804,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -835,15 +833,10 @@ version = "6.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "rawpointer" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "rdrand" version = "0.4.0" @@ -865,9 +858,20 @@ dependencies = [ "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "redox_users" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "argon2rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "regex" -version = "1.1.5" +version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "aho-corasick 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -891,7 +895,7 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", "mach 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -924,7 +928,7 @@ dependencies = [ [[package]] name = "ryu" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -948,9 +952,9 @@ version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -961,6 +965,11 @@ dependencies = [ "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "scoped_threadpool" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "scopeguard" version = "0.3.3" @@ -981,20 +990,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde" -version = "1.0.90" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_derive" -version = "1.0.90" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1002,9 +1011,9 @@ name = "serde_json" version = "1.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "ryu 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1012,7 +1021,7 @@ name = "sha2" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "block-buffer 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "digest 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1042,7 +1051,7 @@ dependencies = [ "new_debug_unreachable 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "phf_shared 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", "precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache_codegen 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1054,7 +1063,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "phf_generator 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", "phf_shared 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1071,12 +1080,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "strsim" -version = "0.9.1" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "ndarray 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] name = "structopt" @@ -1093,9 +1098,9 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1110,10 +1115,10 @@ dependencies = [ [[package]] name = "syn" -version = "0.15.30" +version = "0.15.34" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1131,9 +1136,9 @@ name = "synstructure" version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1149,11 +1154,12 @@ dependencies = [ [[package]] name = "term" -version = "0.4.6" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "dirs 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1166,10 +1172,11 @@ dependencies = [ [[package]] name = "termion" -version = "1.5.1" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1195,7 +1202,7 @@ name = "time" version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1206,8 +1213,8 @@ version = "0.3.0" dependencies = [ "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "cargo-husky 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "codespan 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "codespan-reporting 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "codespan 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "codespan-reporting 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "cranelift 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", "cranelift-module 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", "cranelift-simplejit 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1216,15 +1223,15 @@ dependencies = [ "env_logger 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lalrpop 0.16.3 (registry+https://github.com/rust-lang/crates.io-index)", - "lalrpop-util 0.16.3 (registry+https://github.com/rust-lang/crates.io-index)", + "lalrpop 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lalrpop-util 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", "ordered-float 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "pretty_assertions 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "pretty_env_logger 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "salsa 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "structopt 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1281,11 +1288,6 @@ dependencies = [ "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "winapi" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "winapi" version = "0.3.7" @@ -1295,11 +1297,6 @@ dependencies = [ "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "winapi-build" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" @@ -1330,7 +1327,9 @@ dependencies = [ [metadata] "checksum aho-corasick 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e6f484ae0c99fec2e858eb6134949117399f222608d84cadb3f58c1f97c2364c" "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" -"checksum ascii-canvas 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b385d69402821a1c254533a011a312531cbcc0e3e24f19bbb4747a5a2daf37e2" +"checksum argon2rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3f67b0b6a86dae6e67ff4ca2b6201396074996379fba2b92ff649126f37cb392" +"checksum arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "92c7fb76bc8826a8b33b4ee5bb07a247a81e76764ab4d55e8f73e3a4d8808c71" +"checksum ascii-canvas 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff8eb72df928aafb99fe5d37b383f2fe25bd2a765e3e5f7c365916b6f2463a29" "checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" "checksum autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a6d640bee2da49f60a4068a7fae53acde8982514ab7bae8b8cea9e88cbcfd799" "checksum backtrace 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "f106c02a3604afcdc0df5d36cc47b44b55917dbaf3d808f71c163a0ddba64637" @@ -1338,18 +1337,20 @@ dependencies = [ "checksum bit-set 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e84c238982c4b1e1ee668d136c510c67a13465279c0cb367ea6baf6310620a80" "checksum bit-vec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f59bbe95d4e52a6398ec21238d31577f2b28a9d86807f06ca59d191d8440d0bb" "checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" -"checksum block-buffer 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49665c62e0e700857531fa5d3763e91b539ff1abeebd56808d378b495870d60d" -"checksum block-padding 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d75255892aeb580d3c566f213a2b6fdc1c66667839f45719ee1d30ebf2aea591" +"checksum blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" +"checksum block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" +"checksum block-padding 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6d4dc3af3ee2e12f3e5d224e5e1e3d73668abbeb69e566d361f7d5563a4fdf09" "checksum byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" "checksum byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a019b10a2a7cdeb292db131fc8113e57ea2a908f6e7894b0c3c671893b65dbeb" "checksum cargo-husky 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "22f6d8b2af30e25d3ee4d72cdb7a127033ee6ee0ec50b47cdb6737e282797652" -"checksum cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)" = "5e5f3fee5eeb60324c2781f1e41286bdee933850fff9b3c672587fed5ec58c83" +"checksum cc 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)" = "a0c56216487bb80eec9c4516337b2588a4f2a2290d72a1416d930e4dcdb0c90d" "checksum cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "11d43355396e872eefb45ce6342e4374ed7bc2b3a502d1b28e36d6e23c05d1f4" "checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878" "checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" -"checksum codespan 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "004def512a9848b23a68ed110927d102b0e6d9f3dc732e28570879afde051f8c" -"checksum codespan-reporting 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab081a14ab8f9598ce826890fe896d0addee68c7a58ab49008369ccbb51510a8" +"checksum codespan 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "03ed0fdf823b4a01c3b6a3e086b4d0a2def8d3cb75b110ec5c988fe2790860a9" +"checksum codespan-reporting 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2ae73f6c4b3803dc2a0fe08ed1ce40e8f3f94ecc8394a82e0696bbc86d4e4fc3" +"checksum constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8ff012e225ce166d4422e0e78419d901719760f62ae2b7969ca6b564d1b54a9e" "checksum cranelift 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)" = "135f36eed3a578925d4b8dd506e4df596c55615d2603c47e8638b8f6acc5bf22" "checksum cranelift-bforest 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e5a357d20666bf4a8c2d626a19f1b59dbca66cd844fb1e66c5612254fd0f7505" "checksum cranelift-codegen 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ab00cb149a5bb0f7e6dd391357356a5d71c335a431e8eece94f32da2d5a043f7" @@ -1359,15 +1360,16 @@ dependencies = [ "checksum cranelift-module 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)" = "83558a9230d46c75091fb6a1fe357ac693a669a85396da3c37a4ccd7d9f4acc3" "checksum cranelift-native 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d0239f34836621a127c2132980b2f5c32a1be1c40e2d1a9a1a9bd5af33c12aee" "checksum cranelift-simplejit 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)" = "caa00fb269e166f786a2c8e10e5866e365c7620c3686a7b592292f6d9cb0e2ff" -"checksum ctor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "e5cc1c7c759bf979c651ce1da82d06065375e2223b65c070190b8000787da58b" +"checksum ctor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "3b4c17619643c1252b5f690084b82639dd7fac141c57c8e77a00e0148132092c" "checksum derive-new 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "6ca414e896ae072546f4d789f452daaecf60ddee4c9df5dc6d5936d769e3d87c" "checksum diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "3c2b69f912779fbb121ceb775d74d51e915af17aaebc38d28a592843a2dd0a3a" "checksum difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198" "checksum digest 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05f47366984d3ad862010e22c7ce81a7dbcaebbdfb37241a620f8b6596ee135c" +"checksum dirs 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3fd78930633bd1c6e35c4b42b1df7b0cbc6bc191146e512bb3bedf243fcc3901" "checksum docopt 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7f525a586d310c87df72ebcd98009e57f1cc030c8c268305287a476beb653969" "checksum dot 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a74b6c4d4a1cff5f454164363c16b72fa12463ca6b31f4b5f2035a65fa3d5906" "checksum either 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5527cfe0d098f36e3f8839852688e63c8fff1c90b2b405aef730615f9a7bcf7b" -"checksum ena 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f56c93cc076508c549d9bb747f79aa9b4eb098be7b8cad8830c3137ef52d1e00" +"checksum ena 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3dc01d68e08ca384955a3aeba9217102ca1aa85b6e168639bf27739f1d749d87" "checksum enum-primitive-derive 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2b90e520ec62c1864c8c78d637acbfe8baf5f63240f2fb8165b8325c07812dd" "checksum env_logger 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b61fa891024a945da30a9581546e8cfaf5602c7b3f4c137a2805cf388f92075a" "checksum errno 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c2a071601ed01b988f896ab14b95e67335d1eeb50190932a1320f7fe3cadc84e" @@ -1379,29 +1381,25 @@ dependencies = [ "checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" "checksum gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)" = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2" "checksum generic-array 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3c0f28c2f5bfb5960175af447a2da7c18900693738343dc896ffbcabd9839592" -"checksum hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3bae29b6653b3412c2e71e9d486db9f9df5d701941d86683005efb9f2d28e3da" "checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" "checksum humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ca7e5f2e110db35f93b837c81797f3714500b81d517bf20c431b16d3ca4f114" "checksum indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7e81a7c05f79578dbc15793d8b619db9ba32b4577003ef3af1a91c416798c58d" -"checksum itertools 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0d47946d458e94a1b7bcabbf6521ea7c037062c81f534615abcad76e84d4970d" "checksum itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5b8467d9c1cebe26feb08c640139247fac215782d35371ade9a2136ed6085358" -"checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b" -"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -"checksum lalrpop 0.16.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4e2e80bee40b22bca46665b4ef1f3cd88ed0fb043c971407eac17a0712c02572" -"checksum lalrpop-util 0.16.3 (registry+https://github.com/rust-lang/crates.io-index)" = "33b27d8490dbe1f9704b0088d61e8d46edc10d5673a8829836c6ded26a9912c7" +"checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f" +"checksum lalrpop 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5b7f2d14eb07d819e961e5169f61d67de76a7cdbc6778b62192bcfe27c5af019" +"checksum lalrpop-util 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9768f55211206d3c17181108d8facb80bdffc1f1e674a67b1dddb2743529ca19" "checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" -"checksum libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)" = "bedcc7a809076656486ffe045abeeac163da1b558e963a31e29fbfbeba916917" +"checksum libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)" = "c6785aa7dd976f5fbf3b71cfd9cd49d7f783c1ff565a858d71031c6c313aa5c6" "checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c" "checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" "checksum mach 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "86dd2487cdfea56def77b88438a2c915fb45113c5319bfe7e14306ca4cd0b0e1" -"checksum matrixmultiply 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "dcad67dcec2d58ff56f6292582377e6921afdf3bfbd533e26fb8900ae575e002" "checksum memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2efc7bc57c883d4a4d6e3246905283d8dae951bb3bd32f49d6ef297f546e1c39" -"checksum ndarray 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7cf380a8af901ad627594013a3bbac903ae0a6f94e176e47e46b5bbc1877b928" "checksum new_debug_unreachable 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f40f005c60db6e03bae699e414c58bf9aa7ea02a2d0b9bfbcf19286cc4c82b30" -"checksum num-complex 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "107b9be86cd2481930688277b675b0114578227f034674726605b8a482d8baf8" +"checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" "checksum num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "e83d528d2677f0518c570baf2b7abdcf0cd2d248860b68507bdcb3e91d4c0cea" "checksum num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31" "checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1" +"checksum numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" "checksum opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "93f5bb2e8e8dec81642920ccff6b61f1eb94fa3020c5a325c9851ff604152409" "checksum ordered-float 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "18869315e81473c951eb56ad5558bbc56978562d3ecfb87abb7a1e944cea4518" "checksum ordermap 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a86ed3f5f244b372d6b1a00b72ef7f8876d0bc6a78a4c9985c53614041512063" @@ -1415,7 +1413,7 @@ dependencies = [ "checksum precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" "checksum pretty_assertions 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3f81e1644e1b54f5a68959a29aa86cde704219254669da328ecfdf6a1f09d427" "checksum pretty_env_logger 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "df8b3f4e0475def7d9c2e5de8e5a1306949849761e107b360d03e98eafaffd61" -"checksum proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)" = "4d317f9caece796be1980837fd5cb3dfec5613ebdb04ad0956deea83ce168915" +"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" "checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" "checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" "checksum quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "faf4799c5d274f3868a4aae320a0a182cbd2baee377b378f080e16a23e9d80db" @@ -1425,31 +1423,32 @@ dependencies = [ "checksum rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d0e7a549d590831370895ab7ba4ea0c1b6b011d106b5ff2da6eee112615e6dc0" "checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" "checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" -"checksum rand_jitter 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b9ea758282efe12823e0d952ddb269d2e1897227e464919a554f2a03ef1b832" +"checksum rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b" "checksum rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" "checksum rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" "checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" "checksum raw-cpuid 6.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "30a9d219c32c9132f7be513c18be77c9881c7107d2ab5569d205a6a0f0e6dc7d" -"checksum rawpointer 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ebac11a9d2e11f2af219b8b8d833b76b1ea0e054aa0e8d8e9e4cbde353bdf019" "checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" "checksum redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)" = "12229c14a0f65c4f1cb046a3b52047cdd9da1f4b30f8a39c5063c8bae515e252" "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" -"checksum regex 1.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "559008764a17de49a3146b234641644ed37d118d1ef641a0bb573d146edc6ce0" +"checksum redox_users 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3fe5204c3a17e97dde73f285d49be585df59ed84b50a872baf416e73b62c3828" +"checksum regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "8f0a0bcab2fd7d1d7c54fa9eae6f43eddeb9ce2e7352f8518a814a4f65d60c58" "checksum regex-syntax 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)" = "dcfd8681eebe297b81d98498869d4aae052137651ad7b96822f09ceb690d0a96" "checksum region 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ace21a7fc79cffefeb66f2cc3ef22c7687015023bf7f85bec8840f0d46cb51cc" "checksum relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0e7790c7f1cc73d831d28dc5a7deb316a006e7848e6a7f467cdb10a0a9e0fb1c" "checksum rustc-demangle 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "ccc78bfd5acd7bf3e89cffcf899e5cb1a52d6fafa8dec2739ad70c9577a57288" "checksum rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7540fc8b0c49f096ee9c961cda096467dce8084bec6bdca2fc83895fd9b28cb8" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -"checksum ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "eb9e9b8cde282a9fe6a42dd4681319bfb63f121b8a8ee9439c6f4107e58a46f7" +"checksum ryu 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "b96a9549dc8d48f2c283938303c4b5a77aa29bfbc5b54b084fb1630408899a8f" "checksum salsa 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "249290390580a2ccdc1aa8256989733978a7c3e11e508abc529055ae4866e3a3" "checksum salsa-macros 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9120ba92eda59ebd3a39e8245531df9a3805468bf38fe57fdfc30f14d0fdbea9" "checksum same-file 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8f20c4be53a8a1ff4c1f1b2bd14570d2f634628709752f0702ecdd2b3f9a5267" +"checksum scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1d51f5df5af43ab3f1360b429fa5e0152ac5ce8c0bd6485cae490332e96846a8" "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)" = "aa5f7c20820475babd2c077c3ab5f8c77a31c15e16ea38687b4c02d3e48680f4" -"checksum serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)" = "58fc82bec244f168b23d1963b45c8bf5726e9a15a9d146a067f9081aeed2de79" +"checksum serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)" = "a72e9b96fa45ce22a4bc23da3858dfccfd60acd28a25bcd328a98fdd6bea43fd" +"checksum serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)" = "101b495b109a3e3ca8c4cbe44cf62391527cdfb6ba15821c5ce80bcd5ea23f9f" "checksum serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)" = "5a23aa71d4a4d43fdbfaac00eff68ba8a06a51759a89ac3304323e800c4dd40d" "checksum sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b4d8bfd0e469f417657573d8451fb33d16cfe0989359b93baf3a1ffc639543d" "checksum siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0b8de496cf83d4ed58b6be86c3a275b8602f6ffe98d3024a869e124147a9a3ac" @@ -1459,17 +1458,17 @@ dependencies = [ "checksum string_cache_codegen 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1eea1eee654ef80933142157fdad9dd8bc43cf7c74e999e369263496f04ff4da" "checksum string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b1884d1bc09741d466d9b14e6d37ac89d6909cbcac41dd9ae982d4d063bbedfc" "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" -"checksum strsim 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "34ac666ab1423aa93bbd4cd47b6e62db5a846df4e28b959d823776eed5b57643" +"checksum strsim 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "032c03039aae92b350aad2e3779c352e104d919cb192ba2fabbd7b831ce4f0f6" "checksum structopt 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)" = "3d0760c312538987d363c36c42339b55f5ee176ea8808bbe4543d484a291c8d1" "checksum structopt-derive 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)" = "528aeb7351d042e6ffbc2a6fb76a86f9b622fdf7c25932798e7a82cb03bc94c6" "checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" -"checksum syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)" = "66c8865bf5a7cbb662d8b011950060b3c8743dca141b054bf7195b20d314d8e2" +"checksum syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)" = "a1393e4a97a19c01e900df2aec855a29f71cf02c402e2f443b8d2747c25c5dbe" "checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" "checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015" "checksum target-lexicon 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d6923974ce4eb5bd28814756256d8ab71c28dd6e7483313fe7ab6614306bf633" -"checksum term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "fa63644f74ce96fbeb9b794f66aff2a52d601cbd5e80f4b97123e3899f4570f1" +"checksum term 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "edd106a334b7657c10b7c540a0106114feadeb4dc314513e97df481d5d966f42" "checksum termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4096add70612622289f2fdcdbd5086dc81c1e2675e6ae58d6c4f62a16c6d7f2f" -"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" +"checksum termion 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dde0593aeb8d47accea5392b39350015b5eccb12c0d98044d856983d89548dea" "checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" @@ -1482,9 +1481,7 @@ dependencies = [ "checksum utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "796f7e48bef87609f7ade7e06495a87d5cd06c7866e6a5cbfceffc558a243737" "checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" "checksum walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "9d9d7ed3431229a144296213105a390676cc49c9b6a72bd19f3176c98e129fa1" -"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" "checksum winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f10e386af2b13e47c89e7236a7a14a086791a2b88ebad6df9bf42040195cf770" -"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" "checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9" "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/Cargo.toml b/Cargo.toml index 2ef1e31..d2ae079 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,9 +8,9 @@ repository = "https://github.com/dflemstr/tin" edition = "2018" [build-dependencies] -lalrpop = "0.16.3" +lalrpop = "0.17.0" failure = "0.1.5" -regex = "1.1.5" +regex = "1.1.6" walkdir = "2.2.7" [dependencies] @@ -20,16 +20,16 @@ cranelift-simplejit = "0.30.0" dot = "0.1.4" env_logger = "0.6.1" failure = "0.1.5" -lalrpop-util = "0.16.3" +lalrpop-util = "0.17.0" log = "0.4.6" -regex = "1.1.5" +regex = "1.1.6" pretty_env_logger = "0.3.0" structopt = "0.2.15" lazy_static = "1.3.0" byteorder = "1.3.1" itertools = "0.8.0" -codespan = "0.2.1" -codespan-reporting = "0.2.1" +codespan = "0.3.0" +codespan-reporting = "0.3.0" enum-primitive-derive = "0.1.2" num-traits = "0.2.6" salsa = "0.12.0" diff --git a/src/interpreter/mod.rs b/src/interpreter/mod.rs index b241340..ed869f1 100644 --- a/src/interpreter/mod.rs +++ b/src/interpreter/mod.rs @@ -16,19 +16,13 @@ pub trait Db: salsa::Database + ir::Db { fn value(&self, entity: ir::Entity) -> error::Result>; } -fn value( - db: &impl Db, - entity: ir::Entity, -) -> error::Result> { +fn value(db: &impl Db, entity: ir::Entity) -> error::Result> { let element = db.element(entity)?; let value = eval(db, &*element)?; Ok(value) } -fn eval( - db: &impl Db, - element: &element::Element, -) -> error::Result> { +fn eval(db: &impl Db, element: &element::Element) -> error::Result> { match element { element::Element::Number(v) => Ok(Some(value::Value::number(eval_number(v)))), element::Element::String(ref v) => Ok(Some(value::Value::string(v.as_str()))), @@ -57,9 +51,7 @@ fn eval( _ => Ok(None), } } - element::Element::Variable(element::Variable { initializer, .. }) => { - db.value(*initializer) - } + element::Element::Variable(element::Variable { initializer, .. }) => db.value(*initializer), element::Element::Select(element::Select { record, field }) => db .value(*record)? .map(|record| match record.case() { diff --git a/src/ir/mod.rs b/src/ir/mod.rs index e063f4d..3f7f357 100644 --- a/src/ir/mod.rs +++ b/src/ir/mod.rs @@ -20,15 +20,9 @@ pub trait Db: salsa::Database + syntax::db::SyntaxDb { #[salsa::interned] fn entity(&self, parent: Option, role: EntityRole) -> Entity; - fn element( - &self, - entity: Entity, - ) -> error::Result>; + fn element(&self, entity: Entity) -> error::Result>; - fn location( - &self, - entity: Entity, - ) -> error::Result; + fn location(&self, entity: Entity) -> error::Result; fn entities(&self) -> error::Result>; } @@ -132,17 +126,11 @@ impl EntityInfo { self.location } } -fn element( - db: &impl Db, - entity: Entity, -) -> error::Result> { +fn element(db: &impl Db, entity: Entity) -> error::Result> { Ok(db.entities()?.infos.get(&entity).unwrap().element.clone()) } -fn location( - db: &impl Db, - entity: Entity, -) -> error::Result { +fn location(db: &impl Db, entity: Entity) -> error::Result { Ok(db.entities()?.infos.get(&entity).unwrap().location) } diff --git a/src/syntax/parser/mod.rs b/src/syntax/parser/mod.rs index f0d5186..1862084 100644 --- a/src/syntax/parser/mod.rs +++ b/src/syntax/parser/mod.rs @@ -221,18 +221,13 @@ impl Error { ), } } - lalrpop_util::ParseError::UnrecognizedToken { token, expected } => { - let token = token.map_or( - codespan::Span::new( - span.end() - codespan::ByteOffset(1), - span.end() - codespan::ByteOffset(1), - ), - |(s, _, e)| { - span.subspan( - codespan::ByteOffset(s as codespan::RawOffset), - codespan::ByteOffset(e as codespan::RawOffset), - ) - }, + lalrpop_util::ParseError::UnrecognizedToken { + token: (s, _, e), + expected, + } => { + let token = span.subspan( + codespan::ByteOffset(s as codespan::RawOffset), + codespan::ByteOffset(e as codespan::RawOffset), ); Error::Unexpected { token, expected } } @@ -243,6 +238,13 @@ impl Error { ); Error::Extra { token } } + lalrpop_util::ParseError::UnrecognizedEOF { location, expected } => { + let token = span.subspan( + codespan::ByteOffset(location as codespan::RawOffset), + codespan::ByteOffset((location + 1) as codespan::RawOffset), + ); + Error::Unexpected { token, expected } + } lalrpop_util::ParseError::User { error } => error, } } From 03e9eb9ece97e55c63f86fc7a1f6c10ca5cb892f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Flemstr=C3=B6m?= Date: Sun, 12 May 2019 21:25:14 +0200 Subject: [PATCH 16/22] Refactor layout code --- src/db.rs | 6 +- src/graph.rs | 6 +- src/interpreter/mod.rs | 2 +- src/ir/mod.rs | 2 +- src/ir/tests.rs | 5 +- src/layout/db.rs | 17 -- src/layout/error.rs | 5 +- src/layout/infer.rs | 428 ----------------------------------------- src/layout/mod.rs | 372 ++++++++++++++++++++++++++++++++++- 9 files changed, 385 insertions(+), 458 deletions(-) delete mode 100644 src/layout/db.rs delete mode 100644 src/layout/infer.rs diff --git a/src/db.rs b/src/db.rs index 23e54c2..614e3b7 100644 --- a/src/db.rs +++ b/src/db.rs @@ -6,9 +6,9 @@ use crate::syntax; use crate::ty; #[salsa::database( - interpreter::Interpreter, - ir::Ir, - layout::db::Layout, + interpreter::InterpreterStorage, + ir::IrStorage, + layout::LayoutStorage, source::db::Source, syntax::db::Syntax, ty::db::Ty diff --git a/src/graph.rs b/src/graph.rs index 7e955d6..8c1b6e5 100644 --- a/src/graph.rs +++ b/src/graph.rs @@ -88,9 +88,9 @@ impl<'a> dot::Labeller<'a, Node, Edge> for Graph<'a> { } fn node_label(&'a self, n: &Node) -> dot::LabelText<'a> { - use crate::ir::Db; - use crate::layout::db::LayoutDb; - use crate::ty::db::TyDb; + use crate::ir::Db as _; + use crate::layout::Db as _; + use crate::ty::db::TyDb as _; use std::fmt::Write; let mut result = format!("({}) ", n.0.id()); diff --git a/src/interpreter/mod.rs b/src/interpreter/mod.rs index ed869f1..f0b2eaf 100644 --- a/src/interpreter/mod.rs +++ b/src/interpreter/mod.rs @@ -11,7 +11,7 @@ pub mod error; #[macro_use] mod macros; -#[salsa::query_group(Interpreter)] +#[salsa::query_group(InterpreterStorage)] pub trait Db: salsa::Database + ir::Db { fn value(&self, entity: ir::Entity) -> error::Result>; } diff --git a/src/ir/mod.rs b/src/ir/mod.rs index 3f7f357..7f8440f 100644 --- a/src/ir/mod.rs +++ b/src/ir/mod.rs @@ -12,7 +12,7 @@ pub mod location; #[cfg(test)] mod tests; -#[salsa::query_group(Ir)] +#[salsa::query_group(IrStorage)] pub trait Db: salsa::Database + syntax::db::SyntaxDb { #[salsa::interned] fn ident(&self, id: sync::Arc) -> Ident; diff --git a/src/ir/tests.rs b/src/ir/tests.rs index 55f8f02..11ba663 100644 --- a/src/ir/tests.rs +++ b/src/ir/tests.rs @@ -4,6 +4,7 @@ use std::collections; use std::sync; use crate::db; +use crate::layout; use crate::source; use crate::test_util; @@ -125,7 +126,8 @@ a = || -> u32 { } fn check_module(name: &'static str, source: &str) -> Result<(), String> { - use crate::ir::Db; + use crate::ir::Db as _; + use crate::layout::Db as _; use crate::source::db::SourceDb; let mut codemap = codespan::CodeMap::new(); @@ -148,6 +150,7 @@ fn check_module(name: &'static str, source: &str) -> Result<(), String> { db.set_file_source_root(file_id, root_id); db.set_source_root(root_id, sync::Arc::new(root)); db.set_all_source_roots(sync::Arc::new(vec![root_id])); + db.set_ptr_size(layout::PtrSize::Size64); db.entities() .map_err(|e| crate::diagnostic::to_string(&codemap, &e))?; diff --git a/src/layout/db.rs b/src/layout/db.rs deleted file mode 100644 index 7237811..0000000 --- a/src/layout/db.rs +++ /dev/null @@ -1,17 +0,0 @@ -use std::sync; - -use crate::ir; -use crate::layout; - -#[salsa::query_group(Layout)] -pub trait LayoutDb: salsa::Database + ir::Db { - fn entity_layout(&self, entity: ir::Entity) - -> layout::error::Result>; -} - -fn entity_layout( - _ir: &impl LayoutDb, - _entity: ir::Entity, -) -> layout::error::Result> { - Err(layout::error::Error::NotImplemented) -} diff --git a/src/layout/error.rs b/src/layout/error.rs index 2bc4ee9..3aa88c1 100644 --- a/src/layout/error.rs +++ b/src/layout/error.rs @@ -1,12 +1,13 @@ use crate::ir; +use crate::ty; use std::result; #[derive(Clone, Debug, Eq, Fail, PartialEq)] pub enum Error { #[fail(display = "semantic error: {}", _0)] Ir(#[cause] ir::error::Error), - #[fail(display = "not implemented")] - NotImplemented, + #[fail(display = "unknown size")] + UnknownSize, } pub type Result = result::Result; diff --git a/src/layout/infer.rs b/src/layout/infer.rs deleted file mode 100644 index c049c45..0000000 --- a/src/layout/infer.rs +++ /dev/null @@ -1,428 +0,0 @@ -use std::collections; -use std::sync; -use std::usize; - -use crate::ir; -use crate::ir::element; -use crate::layout; - -pub struct System { - ptr_size: usize, -} - -const BOOL_LAYOUT: layout::Layout = layout::Layout::scalar(1); - -impl System { - pub fn new(ptr_size: usize) -> System { - System { ptr_size } - } - - fn infer_layout( - &self, - element: &element::Element, - db: impl layout::db::LayoutDb, - ) -> layout::error::Result> { - match *element { - element::Element::Reference(_) => unimplemented!(), - element::Element::Number(ref n) => self.infer_number_layout(n), - element::Element::String(_) => { - Ok(sync::Arc::new(layout::Layout::scalar(self.ptr_size))) - } - element::Element::Symbol(_) => Ok(sync::Arc::new(layout::Layout::zero())), - element::Element::Tuple(element::Tuple { ref fields }) => { - self.infer_tuple_layout(fields, db) - } - element::Element::Record(element::Record { ref fields }) => { - self.infer_record_layout(fields, db) - } - element::Element::UnOp(element::UnOp { operator, operand }) => { - self.infer_un_op_layout(operator, operand, db) - } - element::Element::BiOp(element::BiOp { lhs, operator, rhs }) => { - self.infer_bi_op_layout(lhs, operator, rhs, db) - } - element::Element::Variable(element::Variable { initializer, .. }) => { - self.infer_variable_layout(initializer, db) - } - element::Element::Select(element::Select { record, field }) => { - self.infer_select_layout(record, field, db) - } - element::Element::Apply(element::Apply { - function, - ref parameters, - }) => self.infer_apply_layout(function, parameters, db), - element::Element::Parameter(element::Parameter { signature, .. }) => { - self.infer_parameter_layout(signature, db) - } - element::Element::Capture(element::Capture { captured, .. }) => { - self.infer_capture_layout(captured, db) - } - element::Element::Closure(element::Closure { ref captures, .. }) => { - self.infer_closure_layout(captures, db) - } - element::Element::Module(element::Module { ref variables }) => { - self.infer_module_layout(variables, db) - } - } - } - - fn infer_number_layout( - &self, - number: &element::Number, - ) -> layout::error::Result> { - match *number { - element::Number::U8(_) | element::Number::I8(_) => { - Ok(sync::Arc::new(layout::Layout::scalar(1))) - } - element::Number::U16(_) | element::Number::I16(_) => { - Ok(sync::Arc::new(layout::Layout::scalar(2))) - } - element::Number::U32(_) | element::Number::I32(_) | element::Number::F32(_) => { - Ok(sync::Arc::new(layout::Layout::scalar(4))) - } - element::Number::U64(_) | element::Number::I64(_) | element::Number::F64(_) => { - Ok(sync::Arc::new(layout::Layout::scalar(8))) - } - } - } - - fn infer_tuple_layout( - &self, - fields: &[ir::Entity], - db: impl layout::db::LayoutDb, - ) -> layout::error::Result> { - let mut layouts = fields - .iter() - .enumerate() - .map(|(i, f)| Ok((i, db.entity_layout(*f)?))) - .collect::>>()?; - - if layouts.is_empty() { - Ok(sync::Arc::new(layout::Layout::zero())) - } else { - layouts.sort_unstable_by_key(|(i, l)| (usize::max_value() - l.size, *i)); - let alignment = layouts.iter().map(|(_, l)| l.alignment).max().unwrap(); - let mut size = 0; - - let mut unnamed_fields = vec![layout::Offset::zero(); layouts.len()]; - - for (i, layout) in layouts { - let offset = align_up(size, layout.alignment); - size = offset + layout.size; - let layout = (*layout).clone(); - unnamed_fields[i] = layout::Offset { offset, layout }; - } - - Ok(sync::Arc::new(layout::Layout::unnamed_fields( - size, - alignment, - unnamed_fields, - ))) - } - } - - fn infer_record_layout( - &self, - fields: &collections::HashMap, - db: impl layout::db::LayoutDb, - ) -> layout::error::Result> { - let mut layouts = fields - .iter() - .map(|(n, f)| Ok((*n, db.entity_layout(*f)?))) - .collect::>>()?; - - if layouts.is_empty() { - Ok(sync::Arc::new(layout::Layout::zero())) - } else { - layouts - .sort_unstable_by_key(|(n, l)| (usize::max_value() - l.size, db.lookup_ident(*n))); - let alignment = layouts.iter().map(|(_, l)| l.alignment).max().unwrap(); - let mut size = 0; - - let named_fields = layouts - .into_iter() - .map(|(field, layout)| { - let offset = align_up(size, layout.alignment); - size = offset + layout.size; - let layout = (*layout).clone(); - let offset_layout = layout::Offset { offset, layout }; - - layout::NamedField { - field, - offset_layout, - } - }) - .collect::>(); - - Ok(sync::Arc::new(layout::Layout::named_fields( - size, - alignment, - named_fields, - ))) - } - } - - fn infer_un_op_layout( - &self, - operator: element::UnOperator, - operand: ir::Entity, - db: impl layout::db::LayoutDb, - ) -> layout::error::Result> { - match operator { - element::UnOperator::Not => Ok(sync::Arc::new(BOOL_LAYOUT)), - element::UnOperator::BNot - | element::UnOperator::Cl0 - | element::UnOperator::Cl1 - | element::UnOperator::Cls - | element::UnOperator::Ct0 - | element::UnOperator::Ct1 - | element::UnOperator::C0 - | element::UnOperator::C1 - | element::UnOperator::Sqrt => db.entity_layout(operand), - } - } - - fn infer_bi_op_layout( - &self, - lhs: ir::Entity, - operator: element::BiOperator, - rhs: ir::Entity, - db: impl layout::db::LayoutDb, - ) -> layout::error::Result> { - let lhs = db.entity_layout(lhs)?; - let rhs = db.entity_layout(rhs)?; - - if lhs.size != rhs.size { - unreachable!() - } - - if lhs.alignment != rhs.alignment { - unreachable!() - } - - match operator { - element::BiOperator::Eq - | element::BiOperator::Ne - | element::BiOperator::Lt - | element::BiOperator::Ge - | element::BiOperator::Gt - | element::BiOperator::Le - | element::BiOperator::And - | element::BiOperator::Or - | element::BiOperator::Xor - | element::BiOperator::AndNot - | element::BiOperator::OrNot - | element::BiOperator::XorNot => Ok(sync::Arc::new(BOOL_LAYOUT)), - element::BiOperator::Cmp => unimplemented!(), - element::BiOperator::Add - | element::BiOperator::Sub - | element::BiOperator::Mul - | element::BiOperator::Div - | element::BiOperator::Rem - | element::BiOperator::BAnd - | element::BiOperator::BOr - | element::BiOperator::BXor - | element::BiOperator::BAndNot - | element::BiOperator::BOrNot - | element::BiOperator::BXorNot - | element::BiOperator::RotL - | element::BiOperator::RotR - | element::BiOperator::ShL - | element::BiOperator::ShR => Ok(lhs), - } - } - - fn infer_variable_layout( - &self, - initializer: ir::Entity, - db: impl layout::db::LayoutDb, - ) -> layout::error::Result> { - db.entity_layout(initializer) - } - - fn infer_select_layout( - &self, - record: ir::Entity, - field: ir::Ident, - db: impl layout::db::LayoutDb, - ) -> layout::error::Result> { - match *db.element(record)? { - element::Element::Record(element::Record { ref fields }) => { - if let Some(f) = fields.get(&field) { - db.entity_layout(*f) - } else { - panic!("field does not exist") - } - } - _ => panic!("entity is not a record"), - } - } - - fn infer_apply_layout( - &self, - _function: ir::Entity, - _parameters: &[ir::Entity], - _db: impl layout::db::LayoutDb, - ) -> layout::error::Result> { - // TODO - unimplemented!() - /* - match types.get(function) { - None => { - trace!("inference failure: missing function type for apply"); - None - } - Some(f) => match f { - ty::Type::Function(ty::Function { - parameters: ref formal_parameters, - result, - }) => { - if let Some(parameters) = parameters - .iter() - .map(|p| types.get(*p).cloned()) - .collect::>>() - { - if parameters == *formal_parameters { - Some((**result).clone()) - } else { - Some(ty::Type::Conflict(ty::Conflict { - expected: Box::new(ty::Type::Function(ty::Function { - parameters, - result: Box::new(ty::Type::Any), - })), - actual: Box::new(f.clone()), - })) - } - } else { - None - } - } - something => Some(ty::Type::Conflict(ty::Conflict { - expected: Box::new(ty::Type::Function(ty::Function { - parameters: vec![ty::Type::Any], - result: Box::new(ty::Type::Any), - })), - actual: Box::new(something.clone()), - })), - }, - } - */ - } - - fn infer_parameter_layout( - &self, - signature: ir::Entity, - db: impl layout::db::LayoutDb, - ) -> layout::error::Result> { - db.entity_layout(signature) - } - - fn infer_capture_layout( - &self, - capture: ir::Entity, - db: impl layout::db::LayoutDb, - ) -> layout::error::Result> { - db.entity_layout(capture) - } - - fn infer_closure_layout( - &self, - captures: &collections::HashMap, - db: impl layout::db::LayoutDb, - ) -> layout::error::Result> { - let mut capture_layouts = captures - .iter() - .map(|(n, f)| Ok((*n, db.entity_layout(*f)?))) - .collect::>>()?; - let unnamed_fields = vec![layout::Offset { - offset: 0, - layout: layout::Layout::scalar(self.ptr_size), - }]; - - capture_layouts - .sort_unstable_by_key(|(n, l)| (usize::max_value() - l.size, db.lookup_ident(*n))); - let alignment = capture_layouts - .iter() - .map(|(_, l)| l.alignment) - .max() - .unwrap_or(self.ptr_size); - let mut size = self.ptr_size; - - let named_fields = capture_layouts - .into_iter() - .map(|(field, layout)| { - let offset = align_up(size, layout.alignment); - size = offset + layout.size; - let layout = (*layout).clone(); - let offset_layout = layout::Offset { offset, layout }; - - layout::NamedField { - field, - offset_layout, - } - }) - .collect::>(); - - Ok(sync::Arc::new(layout::Layout { - size, - alignment, - named_fields, - unnamed_fields, - })) - } - - fn infer_module_layout( - &self, - _variables: &collections::HashMap, - _db: impl layout::db::LayoutDb, - ) -> layout::error::Result> { - // TODO - unimplemented!() - /* - variables - .iter() - .map(|(k, v)| types.get(*v).map(|t| (k.clone(), t.clone()))) - .collect::>>() - .map(|fields| ty::Type::Record(ty::Record { fields })) - */ - } -} - -#[allow(clippy::cast_sign_loss, clippy::cast_possible_wrap)] -fn align_up(offset: usize, alignment: usize) -> usize { - debug_assert!(alignment.is_power_of_two()); - offset + ((-(offset as isize)) & (alignment as isize - 1)) as usize -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn align_up_4() { - assert_eq!(0, align_up(0, 4)); - assert_eq!(4, align_up(1, 4)); - assert_eq!(4, align_up(2, 4)); - assert_eq!(4, align_up(3, 4)); - assert_eq!(4, align_up(4, 4)); - assert_eq!(8, align_up(5, 4)); - assert_eq!(8, align_up(6, 4)); - assert_eq!(8, align_up(7, 4)); - assert_eq!(8, align_up(8, 4)); - assert_eq!(12, align_up(9, 4)); - } - - #[test] - fn align_up_8() { - assert_eq!(0, align_up(0, 8)); - assert_eq!(8, align_up(1, 8)); - assert_eq!(8, align_up(2, 8)); - assert_eq!(8, align_up(3, 8)); - assert_eq!(8, align_up(4, 8)); - assert_eq!(8, align_up(5, 8)); - assert_eq!(8, align_up(6, 8)); - assert_eq!(8, align_up(7, 8)); - assert_eq!(8, align_up(8, 8)); - assert_eq!(16, align_up(9, 8)); - } -} diff --git a/src/layout/mod.rs b/src/layout/mod.rs index 897c367..ae6d733 100644 --- a/src/layout/mod.rs +++ b/src/layout/mod.rs @@ -1,9 +1,20 @@ use crate::ir; +use crate::ir::element; +use crate::ty; +use std::collections; use std::fmt; +use std::sync; +use std::usize; -pub mod db; pub mod error; -mod infer; + +#[salsa::query_group(LayoutStorage)] +pub trait Db: salsa::Database + ir::Db { + #[salsa::input] + fn ptr_size(&self) -> PtrSize; + + fn entity_layout(&self, entity: ir::Entity) -> error::Result>; +} #[derive(Clone, Debug, Eq, PartialEq)] pub struct Layout { @@ -25,6 +36,16 @@ pub struct Offset { pub layout: Layout, } +#[derive(Clone, Copy, Debug, Eq, PartialEq)] +pub enum PtrSize { + Size8 = 8, + Size16 = 16, + Size32 = 32, + Size64 = 64, +} + +const BOOL_LAYOUT: Layout = Layout::scalar(1); + impl Layout { pub const fn zero() -> Layout { Layout { @@ -35,6 +56,16 @@ impl Layout { } } + pub const fn pointer(size: PtrSize) -> Layout { + let size = size as usize; + Layout { + size, + alignment: size, + named_fields: Vec::new(), + unnamed_fields: Vec::new(), + } + } + pub const fn scalar(size: usize) -> Layout { Layout { size, @@ -119,3 +150,340 @@ impl fmt::Display for Offset { write!(f, "{}({})", self.offset, self.layout) } } + +fn entity_layout(db: &impl Db, entity: ir::Entity) -> error::Result> { + let element = db.element(entity)?; + let layout = element_layout(db, &*element)?; + Ok(layout) +} + +fn element_layout(db: &impl Db, element: &element::Element) -> error::Result> { + match *element { + element::Element::Reference(entity) => element_layout(db, &*db.element(entity)?), + element::Element::Number(ref n) => number_layout(db, n), + element::Element::String(_) => Ok(sync::Arc::new(Layout::pointer(db.ptr_size()))), + element::Element::Symbol(_) => Ok(sync::Arc::new(Layout::zero())), + element::Element::Tuple(element::Tuple { ref fields }) => tuple_layout(db, fields), + element::Element::Record(element::Record { ref fields }) => record_layout(db, fields), + element::Element::UnOp(element::UnOp { operator, operand }) => { + un_op_layout(db, operator, operand) + } + element::Element::BiOp(element::BiOp { lhs, operator, rhs }) => { + bi_op_layout(db, lhs, operator, rhs) + } + element::Element::Variable(element::Variable { initializer, .. }) => { + variable_layout(db, initializer) + } + element::Element::Select(element::Select { record, field }) => { + select_layout(db, record, field) + } + element::Element::Apply(element::Apply { + function, + ref parameters, + }) => apply_layout(db, function, parameters), + element::Element::Parameter(element::Parameter { signature, .. }) => { + parameter_layout(db, signature) + } + element::Element::Capture(element::Capture { captured, .. }) => { + capture_layout(db, captured) + } + element::Element::Closure(element::Closure { ref captures, .. }) => { + closure_layout(db, captures) + } + element::Element::Module(element::Module { ref variables }) => module_layout(db, variables), + } +} + +fn number_layout(db: &impl Db, number: &element::Number) -> error::Result> { + match *number { + element::Number::U8(_) | element::Number::I8(_) => Ok(sync::Arc::new(Layout::scalar(1))), + element::Number::U16(_) | element::Number::I16(_) => Ok(sync::Arc::new(Layout::scalar(2))), + element::Number::U32(_) | element::Number::I32(_) | element::Number::F32(_) => { + Ok(sync::Arc::new(Layout::scalar(4))) + } + element::Number::U64(_) | element::Number::I64(_) | element::Number::F64(_) => { + Ok(sync::Arc::new(Layout::scalar(8))) + } + } +} + +fn tuple_layout(db: &impl Db, fields: &[ir::Entity]) -> error::Result> { + let mut layouts = fields + .iter() + .enumerate() + .map(|(i, f)| Ok((i, db.entity_layout(*f)?))) + .collect::>>()?; + + if layouts.is_empty() { + Ok(sync::Arc::new(Layout::zero())) + } else { + layouts.sort_unstable_by_key(|(i, l)| (usize::max_value() - l.size, *i)); + let alignment = layouts.iter().map(|(_, l)| l.alignment).max().unwrap(); + let mut size = 0; + + let mut unnamed_fields = vec![Offset::zero(); layouts.len()]; + + for (i, layout) in layouts { + let offset = align_up(size, layout.alignment); + size = offset + layout.size; + let layout = (*layout).clone(); + unnamed_fields[i] = Offset { offset, layout }; + } + + Ok(sync::Arc::new(Layout::unnamed_fields( + size, + alignment, + unnamed_fields, + ))) + } +} + +fn record_layout( + db: &impl Db, + fields: &collections::HashMap, +) -> error::Result> { + let mut layouts = fields + .iter() + .map(|(n, f)| Ok((*n, db.entity_layout(*f)?))) + .collect::>>()?; + + if layouts.is_empty() { + Ok(sync::Arc::new(Layout::zero())) + } else { + layouts.sort_unstable_by_key(|(n, l)| (usize::max_value() - l.size, db.lookup_ident(*n))); + let alignment = layouts.iter().map(|(_, l)| l.alignment).max().unwrap(); + let mut size = 0; + + let named_fields = layouts + .into_iter() + .map(|(field, layout)| { + let offset = align_up(size, layout.alignment); + size = offset + layout.size; + let layout = (*layout).clone(); + let offset_layout = Offset { offset, layout }; + + NamedField { + field, + offset_layout, + } + }) + .collect::>(); + + Ok(sync::Arc::new(Layout::named_fields( + size, + alignment, + named_fields, + ))) + } +} + +fn un_op_layout( + db: &impl Db, + operator: element::UnOperator, + operand: ir::Entity, +) -> error::Result> { + match operator { + element::UnOperator::Not => Ok(sync::Arc::new(BOOL_LAYOUT)), + element::UnOperator::BNot + | element::UnOperator::Cl0 + | element::UnOperator::Cl1 + | element::UnOperator::Cls + | element::UnOperator::Ct0 + | element::UnOperator::Ct1 + | element::UnOperator::C0 + | element::UnOperator::C1 + | element::UnOperator::Sqrt => db.entity_layout(operand), + } +} + +fn bi_op_layout( + db: &impl Db, + lhs: ir::Entity, + operator: element::BiOperator, + rhs: ir::Entity, +) -> error::Result> { + let lhs = db.entity_layout(lhs)?; + let rhs = db.entity_layout(rhs)?; + + if lhs.size != rhs.size { + unreachable!() + } + + if lhs.alignment != rhs.alignment { + unreachable!() + } + + match operator { + element::BiOperator::Eq + | element::BiOperator::Ne + | element::BiOperator::Lt + | element::BiOperator::Ge + | element::BiOperator::Gt + | element::BiOperator::Le + | element::BiOperator::And + | element::BiOperator::Or + | element::BiOperator::Xor + | element::BiOperator::AndNot + | element::BiOperator::OrNot + | element::BiOperator::XorNot => Ok(sync::Arc::new(BOOL_LAYOUT)), + element::BiOperator::Cmp => unimplemented!(), + element::BiOperator::Add + | element::BiOperator::Sub + | element::BiOperator::Mul + | element::BiOperator::Div + | element::BiOperator::Rem + | element::BiOperator::BAnd + | element::BiOperator::BOr + | element::BiOperator::BXor + | element::BiOperator::BAndNot + | element::BiOperator::BOrNot + | element::BiOperator::BXorNot + | element::BiOperator::RotL + | element::BiOperator::RotR + | element::BiOperator::ShL + | element::BiOperator::ShR => Ok(lhs), + } +} + +fn variable_layout(db: &impl Db, initializer: ir::Entity) -> error::Result> { + db.entity_layout(initializer) +} + +fn select_layout( + db: &impl Db, + record: ir::Entity, + field: ir::Ident, +) -> error::Result> { + match *db.element(record)? { + element::Element::Record(element::Record { ref fields }) => { + if let Some(f) = fields.get(&field) { + db.entity_layout(*f) + } else { + Err(error::Error::UnknownSize) + } + } + _ => Err(error::Error::UnknownSize), + } +} + +fn apply_layout( + db: &impl Db, + function: ir::Entity, + _parameters: &[ir::Entity], +) -> error::Result> { + use crate::ty::db::TyDb; + + match *db.element(function)? { + element::Element::Closure(element::Closure { result, .. }) => { + element_layout(db, &*db.element(result)?) + } + _ => Err(error::Error::UnknownSize), + } +} + +fn parameter_layout(db: &impl Db, signature: ir::Entity) -> error::Result> { + db.entity_layout(signature) +} + +fn capture_layout(db: &impl Db, capture: ir::Entity) -> error::Result> { + db.entity_layout(capture) +} + +fn closure_layout( + db: &impl Db, + captures: &collections::HashMap, +) -> error::Result> { + let mut capture_layouts = captures + .iter() + .map(|(n, f)| Ok((*n, db.entity_layout(*f)?))) + .collect::>>()?; + let unnamed_fields = vec![Offset { + offset: 0, + layout: Layout::pointer(db.ptr_size()), + }]; + + capture_layouts + .sort_unstable_by_key(|(n, l)| (usize::max_value() - l.size, db.lookup_ident(*n))); + let alignment = capture_layouts + .iter() + .map(|(_, l)| l.alignment) + .max() + .unwrap_or(db.ptr_size() as usize); + let mut size = db.ptr_size() as usize; + + let named_fields = capture_layouts + .into_iter() + .map(|(field, layout)| { + let offset = align_up(size, layout.alignment); + size = offset + layout.size; + let layout = (*layout).clone(); + let offset_layout = Offset { offset, layout }; + + NamedField { + field, + offset_layout, + } + }) + .collect::>(); + + Ok(sync::Arc::new(Layout { + size, + alignment, + named_fields, + unnamed_fields, + })) +} + +fn module_layout( + db: &impl Db, + _variables: &collections::HashMap, +) -> error::Result> { + // TODO + unimplemented!() + /* + variables + .iter() + .map(|(k, v)| types.get(*v).map(|t| (k.clone(), t.clone()))) + .collect::>>() + .map(|fields| ty::Type::Record(ty::Record { fields })) + */ +} + +#[allow(clippy::cast_sign_loss, clippy::cast_possible_wrap)] +fn align_up(offset: usize, alignment: usize) -> usize { + debug_assert!(alignment.is_power_of_two()); + offset + ((-(offset as isize)) & (alignment as isize - 1)) as usize +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn align_up_4() { + assert_eq!(0, align_up(0, 4)); + assert_eq!(4, align_up(1, 4)); + assert_eq!(4, align_up(2, 4)); + assert_eq!(4, align_up(3, 4)); + assert_eq!(4, align_up(4, 4)); + assert_eq!(8, align_up(5, 4)); + assert_eq!(8, align_up(6, 4)); + assert_eq!(8, align_up(7, 4)); + assert_eq!(8, align_up(8, 4)); + assert_eq!(12, align_up(9, 4)); + } + + #[test] + fn align_up_8() { + assert_eq!(0, align_up(0, 8)); + assert_eq!(8, align_up(1, 8)); + assert_eq!(8, align_up(2, 8)); + assert_eq!(8, align_up(3, 8)); + assert_eq!(8, align_up(4, 8)); + assert_eq!(8, align_up(5, 8)); + assert_eq!(8, align_up(6, 8)); + assert_eq!(8, align_up(7, 8)); + assert_eq!(8, align_up(8, 8)); + assert_eq!(16, align_up(9, 8)); + } +} From 508197ac3b68971608464c4a9d2d6bd21c887555 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Flemstr=C3=B6m?= Date: Sun, 12 May 2019 21:30:33 +0200 Subject: [PATCH 17/22] Flatten entity tree size by one --- src/ir/builder.rs | 16 +++------------- src/ir/mod.rs | 8 +++----- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/src/ir/builder.rs b/src/ir/builder.rs index a14f11c..a5a29b1 100644 --- a/src/ir/builder.rs +++ b/src/ir/builder.rs @@ -37,20 +37,10 @@ where Builder { db, scope, infos } } - pub fn build_module( - mut self, - name: sync::Arc, - ast: &ast::Module, - ) -> Result { - let module_ident = self.db.ident(name.clone()); - let module_entity = self.db.entity( - Some(self.scope.entity), - ir::EntityRole::ModuleDefinition(module_ident), - ); + pub fn build_module(mut self, ast: &ast::Module) -> Result<(), error::Error> { + self.add_module(self.scope.entity, ast)?; - self.add_module(module_entity, ast)?; - - Ok(module_entity) + Ok(()) } fn add_module( diff --git a/src/ir/mod.rs b/src/ir/mod.rs index 7f8440f..adc53f0 100644 --- a/src/ir/mod.rs +++ b/src/ir/mod.rs @@ -126,6 +126,7 @@ impl EntityInfo { self.location } } + fn element(db: &impl Db, entity: Entity) -> error::Result> { Ok(db.entities()?.infos.get(&entity).unwrap().element.clone()) } @@ -142,11 +143,8 @@ fn entities(db: &impl Db) -> error::Result> { let entity = db.entity(None, EntityRole::File(*file)); let builder = builder::Builder::new(db, entity, &mut entities.infos); - let module_id = builder.build_module( - sync::Arc::new(db.file_relative_path(*file).as_str().to_owned()), - &*result, - )?; - entities.modules.push(module_id); + builder.build_module(&*result)?; + entities.modules.push(entity); } } Ok(sync::Arc::new(entities)) From ad2ae4035ed17f9a42e94d155fbf21c79bb15fb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Flemstr=C3=B6m?= Date: Sun, 12 May 2019 22:48:09 +0200 Subject: [PATCH 18/22] Fix all unit tests --- src/db.rs | 6 +- src/graph.rs | 21 ++- src/ir/builder.rs | 50 ++++--- src/ir/mod.rs | 15 ++- src/ir/tests.rs | 25 +++- src/layout/mod.rs | 50 +++---- src/source/db.rs | 32 ----- src/source/mod.rs | 30 ++++- src/syntax/db.rs | 26 ---- src/syntax/mod.rs | 26 +++- src/syntax/parser/mod.rs | 6 + src/ty/db.rs | 35 ----- src/ty/error.rs | 66 ++++++---- src/ty/infer.rs | 275 +++++++++++++++++++-------------------- src/ty/mod.rs | 25 +++- 15 files changed, 358 insertions(+), 330 deletions(-) delete mode 100644 src/source/db.rs delete mode 100644 src/syntax/db.rs delete mode 100644 src/ty/db.rs diff --git a/src/db.rs b/src/db.rs index 614e3b7..b047eb9 100644 --- a/src/db.rs +++ b/src/db.rs @@ -9,9 +9,9 @@ use crate::ty; interpreter::InterpreterStorage, ir::IrStorage, layout::LayoutStorage, - source::db::Source, - syntax::db::Syntax, - ty::db::Ty + source::SourceStorage, + syntax::SyntaxStorage, + ty::TyStorage )] #[derive(Debug, Default)] pub struct Db { diff --git a/src/graph.rs b/src/graph.rs index 8c1b6e5..acb014f 100644 --- a/src/graph.rs +++ b/src/graph.rs @@ -40,7 +40,7 @@ impl<'a> dot::GraphWalk<'a, Node, Edge> for Graph<'a> { use crate::ir::Db; let entities = self.db.entities().unwrap(); - borrow::Cow::Owned(entities.infos.keys().cloned().map(Node).collect()) + borrow::Cow::Owned(entities.all().map(Node).collect()) } fn edges(&'a self) -> borrow::Cow<'a, [Edge]> { @@ -49,11 +49,11 @@ impl<'a> dot::GraphWalk<'a, Node, Edge> for Graph<'a> { let mut edges = Vec::new(); let entities = self.db.entities().unwrap(); - for entity in entities.infos.keys() { - let (parent, role) = self.db.lookup_entity(*entity); + for child in entities.all() { + let (parent, role) = self.db.lookup_entity(child); if let Some(parent) = parent { let source = Node(parent); - let target = Node(*entity); + let target = Node(child); edges.push(Edge { source, target, @@ -90,7 +90,7 @@ impl<'a> dot::Labeller<'a, Node, Edge> for Graph<'a> { fn node_label(&'a self, n: &Node) -> dot::LabelText<'a> { use crate::ir::Db as _; use crate::layout::Db as _; - use crate::ty::db::TyDb as _; + use crate::ty::Db as _; use std::fmt::Write; let mut result = format!("({}) ", n.0.id()); @@ -153,11 +153,11 @@ impl<'a> dot::Labeller<'a, Node, Edge> for Graph<'a> { write!(result, "(unknown)").unwrap(); }; - if let Ok(ty) = self.db.entity_type(n.0) { + if let Ok(ty) = self.db.ty(n.0) { write!(result, "
{}", ty).unwrap(); } - if let Ok(layout) = self.db.entity_layout(n.0) { + if let Ok(layout) = self.db.layout(n.0) { write!(result, "
{}", layout).unwrap(); } @@ -165,16 +165,13 @@ impl<'a> dot::Labeller<'a, Node, Edge> for Graph<'a> { } fn edge_label(&'a self, e: &Edge) -> dot::LabelText<'a> { - use crate::ir::Db; - use crate::source::db::SourceDb; + use crate::ir::Db as _; + use crate::source::Db as _; match e.role { ir::EntityRole::File(file_id) => dot::LabelText::HtmlStr( format!("file {:?}", self.db.file_relative_path(file_id)).into(), ), - ir::EntityRole::Reference(ident) => dot::LabelText::HtmlStr( - format!("ref {:?}", self.db.lookup_ident(ident)).into(), - ), ir::EntityRole::RecordField(ident) => dot::LabelText::HtmlStr( format!("field {:?}", self.db.lookup_ident(ident)).into(), ), diff --git a/src/ir/builder.rs b/src/ir/builder.rs index a5a29b1..c57f943 100644 --- a/src/ir/builder.rs +++ b/src/ir/builder.rs @@ -19,10 +19,16 @@ pub struct Builder<'a, Db> { struct Scope { parent: Option>, entity: ir::Entity, + is_static: bool, locals: collections::HashMap, captures: collections::HashMap, } +enum CaptureStrategy { + Capture, + StaticRef, +} + impl<'a, Db> Builder<'a, Db> where Db: ir::Db, @@ -38,6 +44,7 @@ where } pub fn build_module(mut self, ast: &ast::Module) -> Result<(), error::Error> { + self.scope.is_static = true; self.add_module(self.scope.entity, ast)?; Ok(()) @@ -81,10 +88,7 @@ where ast: &ast::Reference, ) -> Result<(), error::Error> { let ident = self.db.ident(ast.value.clone()); - let entity = self - .db - .entity(Some(entity), ir::EntityRole::Reference(ident)); - let target = self + let (target, _) = self .scope .resolve_capture(self.db, ident, ast.context.span)?; @@ -474,11 +478,13 @@ where impl Scope { fn new(entity: ir::Entity) -> Self { let parent = None; + let is_static = false; let locals = collections::HashMap::new(); let captures = collections::HashMap::new(); Self { parent, + is_static, entity, locals, captures, @@ -490,25 +496,37 @@ impl Scope { db: &impl ir::Db, ident: ir::Ident, location: codespan::ByteSpan, - ) -> Result { + ) -> Result<(ir::Entity, CaptureStrategy), error::Error> { match self.locals.entry(ident) { - collections::hash_map::Entry::Occupied(entry) => Ok(*entry.get()), + collections::hash_map::Entry::Occupied(entry) => Ok(( + *entry.get(), + if self.is_static { + CaptureStrategy::StaticRef + } else { + CaptureStrategy::Capture + }, + )), collections::hash_map::Entry::Vacant(entry) => { if let Some(parent) = &mut self.parent { let capture_entity = db.entity( Some(self.entity), ir::EntityRole::ClosureCaptureDefinition(ident), ); - let parent_entity = parent.resolve_capture(db, ident, location)?; - self.captures.insert( - capture_entity, - element::Capture { - name: ident, - captured: parent_entity, - }, - ); - entry.insert(capture_entity); - Ok(capture_entity) + let (parent_entity, strategy) = parent.resolve_capture(db, ident, location)?; + + if let CaptureStrategy::Capture = strategy { + self.captures.insert( + capture_entity, + element::Capture { + name: ident, + captured: parent_entity, + }, + ); + entry.insert(capture_entity); + Ok((capture_entity, CaptureStrategy::Capture)) + } else { + Ok((parent_entity, CaptureStrategy::StaticRef)) + } } else { let reference = (*db.lookup_ident(ident)).clone(); Err(error::Error::UndefinedReference { diff --git a/src/ir/mod.rs b/src/ir/mod.rs index adc53f0..3bfddaa 100644 --- a/src/ir/mod.rs +++ b/src/ir/mod.rs @@ -13,7 +13,7 @@ pub mod location; mod tests; #[salsa::query_group(IrStorage)] -pub trait Db: salsa::Database + syntax::db::SyntaxDb { +pub trait Db: salsa::Database + syntax::Db { #[salsa::interned] fn ident(&self, id: sync::Arc) -> Ident; @@ -35,14 +35,13 @@ pub struct Entity(u32); #[derive(Clone, Debug, Eq, PartialEq)] pub struct Entities { - pub infos: collections::HashMap, - pub modules: Vec, + infos: collections::HashMap, + modules: Vec, } #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] pub enum EntityRole { File(source::FileId), - Reference(Ident), RecordField(Ident), TupleField(usize), VariableDefinition(Ident), @@ -115,6 +114,14 @@ impl Entities { Self { infos, modules } } + + pub fn all(&self) -> impl Iterator + '_ { + self.infos.keys().cloned() + } + + pub fn modules(&self) -> impl Iterator + '_ { + self.modules.iter().cloned() + } } impl EntityInfo { diff --git a/src/ir/tests.rs b/src/ir/tests.rs index 11ba663..7c5dcba 100644 --- a/src/ir/tests.rs +++ b/src/ir/tests.rs @@ -7,6 +7,7 @@ use crate::db; use crate::layout; use crate::source; use crate::test_util; +use std::any::Any; #[test] fn entity_assignments() -> Result<(), failure::Error> { @@ -62,8 +63,10 @@ a = || -> u32 { "#; let expected = Err(r#"error: undefined reference to `c` - :7:3 + | 7 | c | ^ + | "# .to_owned()); let actual = check_module("lexically_scoped_closure_vars", source); @@ -86,8 +89,10 @@ a = || -> u32 { "#; let expected = Err(r#"error: undefined reference to `c` - :3:7 + | 3 | b = c; | ^ + | "# .to_owned()); let actual = check_module("ordered_local_vars", source); @@ -106,16 +111,17 @@ a = || -> u32 { 1f32 + 2f64 }; "#; - let expected = Err(r#"error: type error -- :3:3 -3 | 1f32 + 2f64 - | ^^^^^^^^^^^ + let expected = Err(r#"error: expected `f32` but got `f64` - :3:10 + | 3 | 1f32 + 2f64 | ^^^^ expected `f32` but got `f64` + | - :3:3 + | 3 | 1f32 + 2f64 | ---- other operand has type `f32` + | "# .to_owned()); let actual = check_module("type_error", source); @@ -128,7 +134,8 @@ a = || -> u32 { fn check_module(name: &'static str, source: &str) -> Result<(), String> { use crate::ir::Db as _; use crate::layout::Db as _; - use crate::source::db::SourceDb; + use crate::source::Db as _; + use crate::ty::Db as _; let mut codemap = codespan::CodeMap::new(); let span = codemap @@ -152,9 +159,15 @@ fn check_module(name: &'static str, source: &str) -> Result<(), String> { db.set_all_source_roots(sync::Arc::new(vec![root_id])); db.set_ptr_size(layout::PtrSize::Size64); - db.entities() + let entities = db + .entities() .map_err(|e| crate::diagnostic::to_string(&codemap, &e))?; + for entity in entities.all() { + db.ty(entity) + .map_err(|e| crate::diagnostic::to_string(&codemap, &e))?; + } + test_util::render_graph(&format!(concat!(module_path!(), "::{}"), name), &db).unwrap(); Ok(()) diff --git a/src/layout/mod.rs b/src/layout/mod.rs index ae6d733..424639b 100644 --- a/src/layout/mod.rs +++ b/src/layout/mod.rs @@ -13,7 +13,7 @@ pub trait Db: salsa::Database + ir::Db { #[salsa::input] fn ptr_size(&self) -> PtrSize; - fn entity_layout(&self, entity: ir::Entity) -> error::Result>; + fn layout(&self, entity: ir::Entity) -> error::Result>; } #[derive(Clone, Debug, Eq, PartialEq)] @@ -151,7 +151,7 @@ impl fmt::Display for Offset { } } -fn entity_layout(db: &impl Db, entity: ir::Entity) -> error::Result> { +fn layout(db: &impl Db, entity: ir::Entity) -> error::Result> { let element = db.element(entity)?; let layout = element_layout(db, &*element)?; Ok(layout) @@ -211,7 +211,7 @@ fn tuple_layout(db: &impl Db, fields: &[ir::Entity]) -> error::Result>>()?; if layouts.is_empty() { @@ -244,7 +244,7 @@ fn record_layout( ) -> error::Result> { let mut layouts = fields .iter() - .map(|(n, f)| Ok((*n, db.entity_layout(*f)?))) + .map(|(n, f)| Ok((*n, db.layout(*f)?))) .collect::>>()?; if layouts.is_empty() { @@ -292,7 +292,7 @@ fn un_op_layout( | element::UnOperator::Ct1 | element::UnOperator::C0 | element::UnOperator::C1 - | element::UnOperator::Sqrt => db.entity_layout(operand), + | element::UnOperator::Sqrt => db.layout(operand), } } @@ -302,15 +302,11 @@ fn bi_op_layout( operator: element::BiOperator, rhs: ir::Entity, ) -> error::Result> { - let lhs = db.entity_layout(lhs)?; - let rhs = db.entity_layout(rhs)?; + let lhs = db.layout(lhs)?; + let rhs = db.layout(rhs)?; - if lhs.size != rhs.size { - unreachable!() - } - - if lhs.alignment != rhs.alignment { - unreachable!() + if lhs.size != rhs.size || lhs.alignment != rhs.alignment { + return Err(error::Error::UnknownSize); } match operator { @@ -346,7 +342,7 @@ fn bi_op_layout( } fn variable_layout(db: &impl Db, initializer: ir::Entity) -> error::Result> { - db.entity_layout(initializer) + db.layout(initializer) } fn select_layout( @@ -357,7 +353,7 @@ fn select_layout( match *db.element(record)? { element::Element::Record(element::Record { ref fields }) => { if let Some(f) = fields.get(&field) { - db.entity_layout(*f) + db.layout(*f) } else { Err(error::Error::UnknownSize) } @@ -371,22 +367,20 @@ fn apply_layout( function: ir::Entity, _parameters: &[ir::Entity], ) -> error::Result> { - use crate::ty::db::TyDb; - match *db.element(function)? { - element::Element::Closure(element::Closure { result, .. }) => { - element_layout(db, &*db.element(result)?) + element::Element::Closure(element::Closure { signature, .. }) => { + element_layout(db, &*db.element(signature)?) } _ => Err(error::Error::UnknownSize), } } fn parameter_layout(db: &impl Db, signature: ir::Entity) -> error::Result> { - db.entity_layout(signature) + db.layout(signature) } fn capture_layout(db: &impl Db, capture: ir::Entity) -> error::Result> { - db.entity_layout(capture) + db.layout(capture) } fn closure_layout( @@ -395,7 +389,7 @@ fn closure_layout( ) -> error::Result> { let mut capture_layouts = captures .iter() - .map(|(n, f)| Ok((*n, db.entity_layout(*f)?))) + .map(|(n, f)| Ok((*n, db.layout(*f)?))) .collect::>>()?; let unnamed_fields = vec![Offset { offset: 0, @@ -436,17 +430,9 @@ fn closure_layout( fn module_layout( db: &impl Db, - _variables: &collections::HashMap, + variables: &collections::HashMap, ) -> error::Result> { - // TODO - unimplemented!() - /* - variables - .iter() - .map(|(k, v)| types.get(*v).map(|t| (k.clone(), t.clone()))) - .collect::>>() - .map(|fields| ty::Type::Record(ty::Record { fields })) - */ + record_layout(db, variables) } #[allow(clippy::cast_sign_loss, clippy::cast_possible_wrap)] diff --git a/src/source/db.rs b/src/source/db.rs deleted file mode 100644 index 38b1cd3..0000000 --- a/src/source/db.rs +++ /dev/null @@ -1,32 +0,0 @@ -// This code is largely copied from rust-analyzer -#![allow(non_camel_case_types)] -use std::sync; - -use crate::source; - -#[salsa::query_group(Source)] -pub trait SourceDb: salsa::Database { - /// Text of the file. - #[salsa::input] - fn file_text(&self, file_id: source::FileId) -> sync::Arc; - - /// Span of the file. - #[salsa::input] - fn file_span(&self, file_id: source::FileId) -> codespan::ByteSpan; - - /// Path to a file, relative to the root of its source root. - #[salsa::input] - fn file_relative_path(&self, file_id: source::FileId) -> relative_path::RelativePathBuf; - - /// Source root of the file. - #[salsa::input] - fn file_source_root(&self, file_id: source::FileId) -> source::RootId; - - /// Contents of the source root. - #[salsa::input] - fn source_root(&self, id: source::RootId) -> sync::Arc; - - /// All source roots. - #[salsa::input] - fn all_source_roots(&self) -> sync::Arc>; -} diff --git a/src/source/mod.rs b/src/source/mod.rs index 641862f..05d89d9 100644 --- a/src/source/mod.rs +++ b/src/source/mod.rs @@ -7,9 +7,35 @@ //! //! Note that neither this module, nor any other part of the compiler do actual IO. //! -pub mod db; - use std::collections; +use std::sync; + +#[salsa::query_group(SourceStorage)] +pub trait Db: salsa::Database { + /// Text of the file. + #[salsa::input] + fn file_text(&self, file_id: FileId) -> sync::Arc; + + /// Span of the file. + #[salsa::input] + fn file_span(&self, file_id: FileId) -> codespan::ByteSpan; + + /// Path to a file, relative to the root of its source root. + #[salsa::input] + fn file_relative_path(&self, file_id: FileId) -> relative_path::RelativePathBuf; + + /// Source root of the file. + #[salsa::input] + fn file_source_root(&self, file_id: FileId) -> RootId; + + /// Contents of the source root. + #[salsa::input] + fn source_root(&self, id: RootId) -> sync::Arc; + + /// All source roots. + #[salsa::input] + fn all_source_roots(&self) -> sync::Arc>; +} /// `FileId` is an integer which uniquely identifies a file. /// diff --git a/src/syntax/db.rs b/src/syntax/db.rs deleted file mode 100644 index 8e1526b..0000000 --- a/src/syntax/db.rs +++ /dev/null @@ -1,26 +0,0 @@ -#![allow(non_camel_case_types)] -use std::sync; - -use crate::source; -use crate::syntax; - -#[salsa::query_group(Syntax)] -pub trait SyntaxDb: salsa::Database + source::db::SourceDb { - /// Parses the file into an AST module. - fn parse( - &self, - file_id: source::FileId, - ) -> Result>, syntax::parser::Error>; -} - -fn parse( - db: &impl SyntaxDb, - file_id: source::FileId, -) -> Result>, syntax::parser::Error> { - use crate::syntax::parser::Parse; - - let text = db.file_text(file_id); - let span = db.file_span(file_id); - - syntax::ast::Module::parse(span, &*text).map(sync::Arc::new) -} diff --git a/src/syntax/mod.rs b/src/syntax/mod.rs index 34059ff..edd02c1 100644 --- a/src/syntax/mod.rs +++ b/src/syntax/mod.rs @@ -1,3 +1,27 @@ +use std::sync; + +use crate::source; + pub mod ast; -pub mod db; pub mod parser; + +#[salsa::query_group(SyntaxStorage)] +pub trait Db: salsa::Database + source::Db { + /// Parses the file into an AST module. + fn parse( + &self, + file_id: source::FileId, + ) -> Result>, parser::Error>; +} + +fn parse( + db: &impl Db, + file_id: source::FileId, +) -> Result>, parser::Error> { + use crate::syntax::parser::Parse; + + let text = db.file_text(file_id); + let span = db.file_span(file_id); + + ast::Module::parse(span, &*text).map(sync::Arc::new) +} diff --git a/src/syntax/parser/mod.rs b/src/syntax/parser/mod.rs index 1862084..db24c38 100644 --- a/src/syntax/parser/mod.rs +++ b/src/syntax/parser/mod.rs @@ -427,8 +427,10 @@ main = || -> i32 { let expected = Err(r#"error: invalid token - :1:1 + | 1 | #+- | ^ + | "# .to_owned()); let actual = parse_module("test", r#"#+-"#); @@ -441,8 +443,10 @@ main = || -> i32 { let expected = Err(r#"error: unexpected token - :1:28 + | 1 | main = || -> u32 { 0u32 }; <-< | ^^^ + | help: valid tokens at this point: [Comment, Identifier] "# .to_owned()); @@ -781,8 +785,10 @@ help: valid tokens at this point: [Comment, Identifier] let expected = Err(r##"error: unexpected token - :1:2 + | 1 | (,) | ^ + | help: valid tokens at this point: ["!", "#$0", "#$1", "#0", "#1", "#^-", "#^0", "#^1", "(", ")", "^/", "{", "|", "~!", Identifier, NumberValue, StringValue, SymbolLabel] "##.to_owned()); let actual = parse_expression("test", r#"(,)"#); diff --git a/src/ty/db.rs b/src/ty/db.rs deleted file mode 100644 index d87ab06..0000000 --- a/src/ty/db.rs +++ /dev/null @@ -1,35 +0,0 @@ -use std::sync; - -use crate::ir; -use crate::ty; - -#[salsa::query_group(Ty)] -pub trait TyDb: salsa::Database + ir::Db { - fn entity_type(&self, entity: ir::Entity) -> Result, ty::error::Error>; - - fn bool_type(&self) -> sync::Arc; -} - -fn entity_type( - _ir: &impl TyDb, - _entity: ir::Entity, -) -> Result, ty::error::Error> { - Err(ty::error::Error { - expected: ty::error::ExpectedType::AnyOf(vec![]), - actual: sync::Arc::new(ty::Type::Placeholder), - main_entity: _entity, - aux_entities: vec![], - }) -} - -fn bool_type(db: &impl TyDb) -> sync::Arc { - let alternatives = vec![ - ty::Symbol { - label: db.ident(sync::Arc::new("f".to_owned())), - }, - ty::Symbol { - label: db.ident(sync::Arc::new("t".to_owned())), - }, - ]; - sync::Arc::new(ty::Type::Union(ty::Union { alternatives })) -} diff --git a/src/ty/error.rs b/src/ty/error.rs index 67a07a6..37f0a75 100644 --- a/src/ty/error.rs +++ b/src/ty/error.rs @@ -1,21 +1,33 @@ use std::fmt; +use std::result; use std::sync; +use crate::diagnostic; use crate::ir; use crate::ty; use crate::ty::class; #[derive(Clone, Debug, Eq, Fail, PartialEq)] -pub struct Error { +pub enum Error { + #[fail(display = "type conflict: {}", _0)] + Conflict(Conflict), + #[fail(display = "semantic error")] + Ir(#[cause] ir::error::Error), +} + +#[derive(Clone, Debug, Eq, PartialEq)] +pub struct Conflict { pub expected: ExpectedType, pub actual: sync::Arc, - pub main_entity: ir::Entity, + pub main_entity: ir::location::Location, pub aux_entities: Vec, } +pub type Result
= result::Result; + #[derive(Clone, Debug, Eq, PartialEq)] pub struct AuxEntity { - pub entity: ir::Entity, + pub entity: ir::location::Location, pub label: String, } @@ -27,7 +39,13 @@ pub enum ExpectedType { Union, } -impl fmt::Display for Error { +impl From for Error { + fn from(error: ir::error::Error) -> Self { + Error::Ir(error) + } +} + +impl fmt::Display for Conflict { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "expected ")?; self.expected.fmt(f)?; @@ -44,14 +62,17 @@ impl fmt::Display for ExpectedType { ExpectedType::Specific(ref ty) => write!(f, "`{}`", ty), ExpectedType::ScalarClass(ref class) => class.fmt(f), ExpectedType::AnyOf(ref options) => { - let last = options.len() - 1; - for (i, option) in options.iter().enumerate() { - if i == last { - write!(f, " or ")?; - } else if i > 0 { - write!(f, ", ")?; + if options.is_empty() { + write!(f, "nothing")?; + } else { + for (i, option) in options.iter().enumerate() { + if i + 1 == options.len() { + write!(f, " or ")?; + } else if i > 0 { + write!(f, ", ")?; + } + option.fmt(f)?; } - option.fmt(f)?; } Ok(()) } @@ -60,24 +81,26 @@ impl fmt::Display for ExpectedType { } } -/* impl diagnostic::Diagnostics for Error { fn to_diagnostics(&self, builder: &mut diagnostic::DiagnosticsBuilder) { - builder.add_label(codespan_reporting::Label { - span: entity, - message: None, - style: codespan_reporting::LabelStyle::Primary, - }); + match self { + Error::Conflict(conflict) => conflict.to_diagnostics(builder), + Error::Ir(error) => error.to_diagnostics(builder), + } + } +} +impl diagnostic::Diagnostics for Conflict { + fn to_diagnostics(&self, builder: &mut diagnostic::DiagnosticsBuilder) { builder.add_label(codespan_reporting::Label { - span: *main_entity, - message: Some(type_error.to_string()), + span: self.main_entity.0, + message: Some(self.to_string()), style: codespan_reporting::LabelStyle::Primary, }); - for aux_entity in aux_entities { + for aux_entity in &self.aux_entities { builder.add_label(codespan_reporting::Label { - span: aux_entity.entity, + span: aux_entity.entity.0, message: Some(aux_entity.label.clone()), style: codespan_reporting::LabelStyle::Secondary, }); @@ -86,4 +109,3 @@ impl diagnostic::Diagnostics for Error { builder.add_diagnostic(codespan_reporting::Severity::Error, None, &self.to_string()); } } -*/ diff --git a/src/ty/infer.rs b/src/ty/infer.rs index 3a8e657..5a2327f 100644 --- a/src/ty/infer.rs +++ b/src/ty/infer.rs @@ -6,59 +6,51 @@ use crate::ir; use crate::ir::element; use crate::ty; -pub struct System; - type Result = result::Result, ty::error::Error>; -fn infer_type(element: &element::Element, db: impl ty::db::TyDb) -> Result { +pub fn element_type(element: &element::Element, db: &impl ty::Db) -> Result { match *element { - element::Element::Reference(_) => unimplemented!(), - element::Element::Number(ref n) => { - Ok(sync::Arc::new(ty::Type::Number(infer_number_type(n)))) - } + element::Element::Reference(entity) => element_type(&*db.element(entity)?, db), + element::Element::Number(ref n) => Ok(sync::Arc::new(ty::Type::Number(number_type(n)))), element::Element::String(_) => Ok(sync::Arc::new(ty::Type::String)), element::Element::Symbol(element::Symbol { ref label }) => { Ok(sync::Arc::new(ty::Type::Symbol(ty::Symbol { label: *label, }))) } - element::Element::Tuple(element::Tuple { ref fields }) => infer_tuple_type(fields, db), - element::Element::Record(element::Record { ref fields }) => infer_record_type(fields, db), + element::Element::Tuple(element::Tuple { ref fields }) => tuple_type(fields, db), + element::Element::Record(element::Record { ref fields }) => record_type(fields, db), element::Element::UnOp(element::UnOp { operand, operator }) => { - infer_un_op_type(operand, operator, db) + un_op_type(operand, operator, db) } element::Element::BiOp(element::BiOp { lhs, operator, rhs }) => { - infer_bi_op_type(lhs, operator, rhs, db) + bi_op_type(lhs, operator, rhs, db) } element::Element::Variable(element::Variable { initializer, .. }) => { - infer_variable_type(initializer, db) + variable_type(initializer, db) } element::Element::Select(element::Select { record, field }) => { - infer_select_type(record, field, db) + select_type(record, field, db) } element::Element::Apply(element::Apply { function, ref parameters, - }) => infer_apply_type(function, parameters, db), + }) => apply_type(function, parameters, db), element::Element::Parameter(element::Parameter { signature, .. }) => { - infer_parameter_type(signature, db) - } - element::Element::Capture(element::Capture { captured, .. }) => { - infer_capture_type(captured, db) + parameter_type(signature, db) } + element::Element::Capture(element::Capture { captured, .. }) => capture_type(captured, db), element::Element::Closure(element::Closure { ref parameters, signature, result, .. - }) => infer_closure_type(parameters, signature, result, db), - element::Element::Module(element::Module { ref variables }) => { - infer_module_type(variables, db) - } + }) => closure_type(parameters, signature, result, db), + element::Element::Module(element::Module { ref variables }) => module_type(variables, db), } } -fn infer_number_type(number: &element::Number) -> ty::Number { +fn number_type(number: &element::Number) -> ty::Number { match *number { element::Number::U8(_) => ty::Number::U8, element::Number::U16(_) => ty::Number::U16, @@ -73,46 +65,46 @@ fn infer_number_type(number: &element::Number) -> ty::Number { } } -fn infer_tuple_type(fields: &[ir::Entity], db: impl ty::db::TyDb) -> Result { +fn tuple_type(fields: &[ir::Entity], db: &impl ty::Db) -> Result { let fields = fields .iter() - .map(|f| db.entity_type(*f)) + .map(|f| db.ty(*f)) .collect::, ty::error::Error>>()?; Ok(sync::Arc::new(ty::Type::Tuple(ty::Tuple { fields }))) } -fn infer_record_type( +fn record_type( fields: &collections::HashMap, - db: impl ty::db::TyDb, + db: &impl ty::Db, ) -> Result { let fields = fields .iter() - .map(|(k, v)| Ok((*k, db.entity_type(*v)?))) + .map(|(k, v)| Ok((*k, db.ty(*v)?))) .collect::, ty::error::Error>>()?; Ok(sync::Arc::new(ty::Type::Record(ty::Record { fields }))) } -fn infer_un_op_type( +fn un_op_type( operand: ir::Entity, operator: element::UnOperator, - db: impl ty::db::TyDb, + db: &impl ty::Db, ) -> Result { - let ty = db.entity_type(operand)?; + let ty = db.ty(operand)?; match operator { element::UnOperator::Not => { - let bool_type = db.bool_type(); + let bool_type = db.bool_ty(); if ty == bool_type { Ok(bool_type) } else { - Err(ty::error::Error { + Err(ty::error::Error::Conflict(ty::error::Conflict { expected: ty::error::ExpectedType::Specific(bool_type), actual: ty, - main_entity: operand, + main_entity: db.location(operand)?, aux_entities: vec![], - }) + })) } } - element::UnOperator::BNot => if_integral_then(operand, &ty, ty.clone()), + element::UnOperator::BNot => if_integral_then(operand, &ty, ty.clone(), db), element::UnOperator::Cl0 | element::UnOperator::Cl1 | element::UnOperator::Cls @@ -123,27 +115,28 @@ fn infer_un_op_type( operand, &ty, sync::Arc::new(ty::Type::Number(ty::Number::U32)), + db, ), - element::UnOperator::Sqrt => if_fractional_then(operand, &ty, ty.clone()), + element::UnOperator::Sqrt => if_fractional_then(operand, &ty, ty.clone(), db), } } -fn infer_bi_op_type( +fn bi_op_type( lhs: ir::Entity, operator: element::BiOperator, rhs: ir::Entity, - db: impl ty::db::TyDb, + db: &impl ty::Db, ) -> Result { // TODO: check scalar type semantics so e.g. records can't be divided. - let lhs_ty = db.entity_type(lhs)?; - let rhs_ty = db.entity_type(rhs)?; + let lhs_ty = db.ty(lhs)?; + let rhs_ty = db.ty(rhs)?; match operator { element::BiOperator::Eq | element::BiOperator::Ne | element::BiOperator::Lt | element::BiOperator::Ge | element::BiOperator::Gt - | element::BiOperator::Le => if_eq_then(lhs, &lhs_ty, rhs, &rhs_ty, &db.bool_type(), db), + | element::BiOperator::Le => if_eq_then(lhs, &lhs_ty, rhs, &rhs_ty, &db.bool_ty(), db), element::BiOperator::Cmp => unimplemented!(), element::BiOperator::Add | element::BiOperator::Sub @@ -166,20 +159,17 @@ fn infer_bi_op_type( &rhs_ty, &sync::Arc::new(ty::Type::Number(ty::Number::U32)), lhs_ty.clone(), + db, ), } } -fn infer_variable_type(initializer: ir::Entity, db: impl ty::db::TyDb) -> Result { - db.entity_type(initializer) +fn variable_type(initializer: ir::Entity, db: &impl ty::Db) -> Result { + db.ty(initializer) } -fn infer_select_type( - record: ir::Entity, - field: ir::Ident, - db: impl ty::db::TyDb, -) -> Result { - let record_ty = db.entity_type(record)?; +fn select_type(record: ir::Entity, field: ir::Ident, db: &impl ty::Db) -> Result { + let record_ty = db.ty(record)?; match *record_ty { ty::Type::Record(ty::Record { ref fields }) => { if let Some(t) = fields.get(&field) { @@ -187,41 +177,41 @@ fn infer_select_type( } else { let mut expected_fields = collections::HashMap::new(); expected_fields.insert(field.to_owned(), sync::Arc::new(ty::Type::Placeholder)); - Err(ty::error::Error { + Err(ty::error::Error::Conflict(ty::error::Conflict { expected: ty::error::ExpectedType::Specific(sync::Arc::new(ty::Type::Record( ty::Record { fields: expected_fields, }, ))), actual: record_ty.clone(), - main_entity: record, + main_entity: db.location(record)?, aux_entities: vec![], - }) + })) } } _ => { let mut expected_fields = collections::HashMap::new(); expected_fields.insert(field.to_owned(), sync::Arc::new(ty::Type::Placeholder)); - Err(ty::error::Error { + Err(ty::error::Error::Conflict(ty::error::Conflict { expected: ty::error::ExpectedType::Specific(sync::Arc::new(ty::Type::Record( ty::Record { fields: expected_fields, }, ))), actual: record_ty, - main_entity: record, + main_entity: db.location(record)?, aux_entities: vec![], - }) + })) } } } -fn infer_apply_type( +fn apply_type( function: ir::Entity, parameters: &[ir::Entity], - db: impl ty::db::TyDb, + db: &impl ty::Db, ) -> Result { - let function_ty = db.entity_type(function)?; + let function_ty = db.ty(function)?; match *function_ty { ty::Type::Function(ty::Function { parameters: ref formal_parameters, @@ -229,14 +219,14 @@ fn infer_apply_type( }) => { let parameters = parameters .iter() - .map(|p| db.entity_type(*p)) + .map(|p| db.ty(*p)) .collect::, ty::error::Error>>()?; if parameters == *formal_parameters { Ok(result.clone()) } else { // TODO: create a diff of expected and actual parameters - Err(ty::error::Error { + Err(ty::error::Error::Conflict(ty::error::Conflict { expected: ty::error::ExpectedType::Specific(sync::Arc::new( ty::Type::Function(ty::Function { parameters, @@ -244,12 +234,12 @@ fn infer_apply_type( }), )), actual: function_ty.clone(), - main_entity: function, + main_entity: db.location(function)?, aux_entities: vec![], - }) + })) } } - _ => Err(ty::error::Error { + _ => Err(ty::error::Error::Conflict(ty::error::Conflict { expected: ty::error::ExpectedType::Specific(sync::Arc::new(ty::Type::Function( ty::Function { parameters: vec![sync::Arc::new(ty::Type::Placeholder)], @@ -257,59 +247,65 @@ fn infer_apply_type( }, ))), actual: function_ty, - main_entity: function, + main_entity: db.location(function)?, aux_entities: vec![], - }), + })), } } -fn infer_parameter_type(signature: ir::Entity, db: impl ty::db::TyDb) -> Result { - db.entity_type(signature) +fn parameter_type(signature: ir::Entity, db: &impl ty::Db) -> Result { + db.ty(signature) } -fn infer_capture_type(capture: ir::Entity, db: impl ty::db::TyDb) -> Result { - db.entity_type(capture) +fn capture_type(capture: ir::Entity, db: &impl ty::Db) -> Result { + db.ty(capture) } -fn infer_closure_type( +fn closure_type( parameters: &[ir::Entity], signature: ir::Entity, result: ir::Entity, - db: impl ty::db::TyDb, + db: &impl ty::Db, ) -> Result { let parameters = parameters .iter() - .map(|p| db.entity_type(*p)) + .map(|p| db.ty(*p)) .collect::, ty::error::Error>>()?; - let result_ty = db.entity_type(result)?; - let signature_ty = db.entity_type(signature)?; + let signature_ty = db.ty(signature)?; + let result = signature_ty.clone(); - if signature_ty == result_ty { - let result = signature_ty.clone(); - Ok(sync::Arc::new(ty::Type::Function(ty::Function { - parameters, - result, - }))) - } else { - Err(ty::error::Error { - expected: ty::error::ExpectedType::Specific(signature_ty.clone()), - actual: result_ty.clone(), - main_entity: result, - aux_entities: vec![ty::error::AuxEntity { - entity: signature, - label: format!("declared return type is `{}`", signature_ty), - }], - }) - } + Ok(sync::Arc::new(ty::Type::Function(ty::Function { + parameters, + result, + }))) + // TODO: find a way to check result type + // let result_ty = db.ty(result)?; + // if signature_ty == result_ty { + // let result = signature_ty.clone(); + // Ok(sync::Arc::new(ty::Type::Function(ty::Function { + // parameters, + // result, + // }))) + // } else { + // Err(ty::error::Error::Conflict(ty::error::Conflict { + // expected: ty::error::ExpectedType::Specific(signature_ty.clone()), + // actual: result_ty.clone(), + // main_entity: db.location(result)?, + // aux_entities: vec![ty::error::AuxEntity { + // entity: db.location(signature)?, + // label: format!("declared return type is `{}`", signature_ty), + // }], + // })) + // } } -fn infer_module_type( +fn module_type( variables: &collections::HashMap, - db: impl ty::db::TyDb, + db: &impl ty::Db, ) -> Result { let fields = variables .iter() - .map(|(k, v)| Ok((*k, db.entity_type(*v)?))) + .map(|(k, v)| Ok((*k, db.ty(*v)?))) .collect::>()?; Ok(sync::Arc::new(ty::Type::Record(ty::Record { fields }))) } @@ -320,20 +316,20 @@ fn if_eq_then( rhs_entity: ir::Entity, rhs: &sync::Arc, result: &sync::Arc, - _db: impl ty::db::TyDb, + db: &impl ty::Db, ) -> Result { if lhs == rhs { Ok(result.clone()) } else { - Err(ty::error::Error { + Err(ty::error::Error::Conflict(ty::error::Conflict { expected: ty::error::ExpectedType::Specific(lhs.clone()), actual: rhs.clone(), - main_entity: rhs_entity, + main_entity: db.location(rhs_entity)?, aux_entities: vec![ty::error::AuxEntity { - entity: lhs_entity, + entity: db.location(lhs_entity)?, label: format!("other operand has type `{}`", lhs), }], - }) + })) } } @@ -342,33 +338,33 @@ fn bool_op( lhs: &sync::Arc, rhs_entity: ir::Entity, rhs: &sync::Arc, - db: impl ty::db::TyDb, + db: &impl ty::Db, ) -> Result { - let bool_type = db.bool_type(); + let bool_type = db.bool_ty(); if *lhs == bool_type { if *rhs == bool_type { Ok(bool_type) } else { - Err(ty::error::Error { + Err(ty::error::Error::Conflict(ty::error::Conflict { expected: ty::error::ExpectedType::Specific(bool_type), actual: rhs.clone(), - main_entity: rhs_entity, + main_entity: db.location(rhs_entity)?, aux_entities: vec![ty::error::AuxEntity { - entity: lhs_entity, + entity: db.location(lhs_entity)?, label: format!("other operand has type `{}`", lhs), }], - }) + })) } } else { - Err(ty::error::Error { + Err(ty::error::Error::Conflict(ty::error::Conflict { expected: ty::error::ExpectedType::Specific(bool_type), actual: lhs.clone(), - main_entity: lhs_entity, + main_entity: db.location(lhs_entity)?, aux_entities: vec![ty::error::AuxEntity { - entity: rhs_entity, + entity: db.location(rhs_entity)?, label: format!("other operand has type `{}`", rhs), }], - }) + })) } } @@ -377,50 +373,50 @@ fn or_op( lhs: &sync::Arc, rhs_entity: ir::Entity, rhs: &sync::Arc, - db: impl ty::db::TyDb, + db: &impl ty::Db, ) -> Result { - let bool_type = db.bool_type(); + let bool_type = db.bool_ty(); if let ty::Type::Union(ref u) = **lhs { if let ty::Type::Symbol(ref symbol) = **rhs { Ok(sync::Arc::new(ty::Type::Union(u.clone().with(symbol)))) } else { - Err(ty::error::Error { + Err(ty::error::Error::Conflict(ty::error::Conflict { expected: ty::error::ExpectedType::ScalarClass(ty::class::Scalar::Symbol), actual: rhs.clone(), - main_entity: rhs_entity, + main_entity: db.location(rhs_entity)?, aux_entities: vec![ty::error::AuxEntity { - entity: lhs_entity, + entity: db.location(lhs_entity)?, label: format!("other operand has type `{}`", lhs), }], - }) + })) } } else if *lhs == bool_type { if *rhs == bool_type { Ok(bool_type) } else { - Err(ty::error::Error { + Err(ty::error::Error::Conflict(ty::error::Conflict { expected: ty::error::ExpectedType::Specific(bool_type), actual: rhs.clone(), - main_entity: rhs_entity, + main_entity: db.location(rhs_entity)?, aux_entities: vec![ty::error::AuxEntity { - entity: lhs_entity, + entity: db.location(lhs_entity)?, label: format!("other operand has type `{}`", lhs), }], - }) + })) } } else { - Err(ty::error::Error { + Err(ty::error::Error::Conflict(ty::error::Conflict { expected: ty::error::ExpectedType::AnyOf(vec![ ty::error::ExpectedType::Specific(bool_type), ty::error::ExpectedType::Union, ]), actual: lhs.clone(), - main_entity: lhs_entity, + main_entity: db.location(lhs_entity)?, aux_entities: vec![ty::error::AuxEntity { - entity: rhs_entity, + entity: db.location(rhs_entity)?, label: format!("other operand has type `{}`", rhs), }], - }) + })) } } @@ -428,17 +424,18 @@ fn if_integral_then( entity: ir::Entity, ty: &sync::Arc, result: sync::Arc, + db: &impl ty::Db, ) -> Result { match ty.scalar_class() { ty::class::Scalar::Integral(_) => Ok(result), - _ => Err(ty::error::Error { + _ => Err(ty::error::Error::Conflict(ty::error::Conflict { expected: ty::error::ExpectedType::ScalarClass(ty::class::Scalar::Integral( ty::class::IntegralScalar::Any, )), actual: ty.clone(), - main_entity: entity, + main_entity: db.location(entity)?, aux_entities: vec![], - }), + })), } } @@ -449,34 +446,35 @@ fn if_integral_and_eq_then( rhs: &sync::Arc, expected: &sync::Arc, result: sync::Arc, + db: &impl ty::Db, ) -> Result { match lhs.scalar_class() { ty::class::Scalar::Integral(_) => { if rhs == expected { Ok(result) } else { - Err(ty::error::Error { + Err(ty::error::Error::Conflict(ty::error::Conflict { expected: ty::error::ExpectedType::Specific(expected.clone()), actual: rhs.clone(), - main_entity: rhs_entity, + main_entity: db.location(rhs_entity)?, aux_entities: vec![ty::error::AuxEntity { - entity: lhs_entity, + entity: db.location(lhs_entity)?, label: format!("other operand has type `{}`", lhs), }], - }) + })) } } - _ => Err(ty::error::Error { + _ => Err(ty::error::Error::Conflict(ty::error::Conflict { expected: ty::error::ExpectedType::ScalarClass(ty::class::Scalar::Integral( ty::class::IntegralScalar::Any, )), actual: lhs.clone(), - main_entity: lhs_entity, + main_entity: db.location(lhs_entity)?, aux_entities: vec![ty::error::AuxEntity { - entity: rhs_entity, + entity: db.location(rhs_entity)?, label: format!("other operand has type `{}`", rhs), }], - }), + })), } } @@ -484,14 +482,15 @@ fn if_fractional_then( entity: ir::Entity, ty: &sync::Arc, result: sync::Arc, + db: &impl ty::Db, ) -> Result { match ty.scalar_class() { ty::class::Scalar::Fractional => Ok(result), - _ => Err(ty::error::Error { + _ => Err(ty::error::Error::Conflict(ty::error::Conflict { expected: ty::error::ExpectedType::ScalarClass(ty::class::Scalar::Fractional), actual: ty.clone(), - main_entity: entity, + main_entity: db.location(entity)?, aux_entities: vec![], - }), + })), } } diff --git a/src/ty/mod.rs b/src/ty/mod.rs index cf0ccea..17b6889 100644 --- a/src/ty/mod.rs +++ b/src/ty/mod.rs @@ -5,10 +5,16 @@ use std::sync; use crate::ir; pub mod class; -pub mod db; pub mod error; pub mod infer; +#[salsa::query_group(TyStorage)] +pub trait Db: salsa::Database + ir::Db { + fn ty(&self, entity: ir::Entity) -> error::Result>; + + fn bool_ty(&self) -> sync::Arc; +} + #[derive(Clone, Debug, Eq, PartialEq)] pub enum Type { Number(Number), @@ -198,3 +204,20 @@ impl fmt::Display for Function { Ok(()) } } + +fn ty(db: &impl Db, entity: ir::Entity) -> error::Result> { + let element = db.element(entity)?; + infer::element_type(&*element, db) +} + +fn bool_ty(db: &impl Db) -> sync::Arc { + let alternatives = vec![ + Symbol { + label: db.ident(sync::Arc::new("f".to_owned())), + }, + Symbol { + label: db.ident(sync::Arc::new("t".to_owned())), + }, + ]; + sync::Arc::new(Type::Union(Union { alternatives })) +} From 86df9e9fe7924d6a3736696f81169d26a4f4ddca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Flemstr=C3=B6m?= Date: Thu, 27 Jun 2019 09:29:17 +0200 Subject: [PATCH 19/22] Misc changes --- Cargo.lock | 346 +++++++++++++++++------------------ Cargo.toml | 21 ++- src/codegen/abi_type.rs | 42 +++-- src/codegen/builtin.rs | 1 + src/codegen/data.rs | 2 +- src/codegen/error.rs | 59 ++++++ src/codegen/function.rs | 54 +----- src/codegen/mod.rs | 386 +++++++++++++++++++++++++++++++++------ src/error.rs | 2 +- src/interpreter/error.rs | 2 +- src/ir/error.rs | 2 +- src/ir/mod.rs | 17 +- src/layout/error.rs | 2 +- src/lib.rs | 14 +- src/module.rs | 4 +- src/syntax/parser/mod.rs | 6 +- src/ty/error.rs | 2 +- src/value.rs | 2 +- 18 files changed, 635 insertions(+), 329 deletions(-) create mode 100644 src/codegen/error.rs diff --git a/Cargo.lock b/Cargo.lock index 780390d..7eee1f4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -46,27 +46,26 @@ name = "atty" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", - "termion 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", + "termion 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "autocfg" -version = "0.1.2" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "backtrace" -version = "0.3.15" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-demangle 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -74,8 +73,8 @@ name = "backtrace-sys" version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -93,7 +92,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "bitflags" -version = "1.0.4" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -112,8 +111,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "block-padding 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "generic-array 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -131,31 +130,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "byteorder" -version = "1.3.1" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "cargo-husky" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "cc" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "cfg-if" -version = "0.1.7" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "chrono" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", + "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -166,7 +166,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -178,7 +178,7 @@ name = "cloudabi" version = "0.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -196,7 +196,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "codespan 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -288,8 +288,8 @@ dependencies = [ "cranelift-module 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", "cranelift-native 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", "errno 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", - "region 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", + "region 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "target-lexicon 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -300,7 +300,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.38 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -310,7 +310,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.38 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -328,7 +328,7 @@ name = "digest" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "generic-array 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -336,7 +336,7 @@ name = "dirs" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", "redox_users 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -347,8 +347,8 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.93 (registry+https://github.com/rust-lang/crates.io-index)", "strsim 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -388,8 +388,8 @@ dependencies = [ "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -398,7 +398,7 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "errno-dragonfly 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -408,7 +408,7 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -416,7 +416,7 @@ name = "failure" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "backtrace 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace 0.3.31 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -427,8 +427,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", - "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.38 (registry+https://github.com/rust-lang/crates.io-index)", + "synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -453,7 +453,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "generic-array" -version = "0.12.0" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -464,7 +464,7 @@ name = "heck" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "unicode-segmentation 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-segmentation 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -495,7 +495,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "lalrpop" -version = "0.17.0" +version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "ascii-canvas 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -505,12 +505,12 @@ dependencies = [ "docopt 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "ena 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lalrpop-util 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lalrpop-util 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)", "petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.93 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.93 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "term 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -519,7 +519,7 @@ dependencies = [ [[package]] name = "lalrpop-util" -version = "0.17.0" +version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -529,16 +529,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libc" -version = "0.2.54" +version = "0.2.58" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "linked-hash-map" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "lock_api" -version = "0.1.5" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -546,7 +550,7 @@ name = "log" version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -554,7 +558,7 @@ name = "mach" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -574,10 +578,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "num-integer" -version = "0.1.39" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -585,13 +590,16 @@ name = "num-traits" version = "0.1.43" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "num-traits" -version = "0.2.6" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "numtoa" @@ -608,7 +616,7 @@ name = "ordered-float" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -624,32 +632,28 @@ dependencies = [ "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "owning_ref" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "parking_lot" -version = "0.7.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lock_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "parking_lot_core" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -700,7 +704,7 @@ name = "pretty_env_logger" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "chrono 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -736,8 +740,8 @@ name = "rand" version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -754,7 +758,7 @@ name = "rand_chacha" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -792,7 +796,7 @@ name = "rand_jitter" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -804,7 +808,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -815,7 +819,7 @@ name = "rand_pcg" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -832,8 +836,8 @@ name = "raw-cpuid" version = "6.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -871,19 +875,19 @@ dependencies = [ [[package]] name = "regex" -version = "1.1.6" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "aho-corasick 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "utf8-ranges 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex-syntax" -version = "0.6.6" +version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -891,11 +895,11 @@ dependencies = [ [[package]] name = "region" -version = "2.0.0" +version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", "mach 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -907,7 +911,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "rustc-demangle" -version = "0.1.14" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -915,7 +919,7 @@ name = "rustc-hash" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -933,28 +937,29 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "salsa" -version = "0.12.0" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "derive-new 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lock_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "salsa-macros 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "salsa-macros 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "salsa-macros" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.38 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -972,7 +977,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "scopeguard" -version = "0.3.3" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -990,20 +995,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde" -version = "1.0.91" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.93 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_derive" -version = "1.0.91" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.38 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1013,7 +1018,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.93 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1034,12 +1039,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "smallvec" -version = "0.6.9" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "stable_deref_trait" -version = "1.1.1" +version = "0.6.10" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1051,7 +1051,7 @@ dependencies = [ "new_debug_unreachable 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "phf_shared 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", "precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.93 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache_codegen 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1085,22 +1085,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "structopt" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", - "structopt-derive 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", + "structopt-derive 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "structopt-derive" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.38 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1115,7 +1115,7 @@ dependencies = [ [[package]] name = "syn" -version = "0.15.34" +version = "0.15.38" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1133,12 +1133,12 @@ dependencies = [ [[package]] name = "synstructure" -version = "0.10.1" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.38 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1157,14 +1157,14 @@ name = "term" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "dirs 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "termcolor" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1172,10 +1172,10 @@ dependencies = [ [[package]] name = "termion" -version = "1.5.2" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", "numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1202,7 +1202,7 @@ name = "time" version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1211,31 +1211,32 @@ dependencies = [ name = "tin" version = "0.3.0" dependencies = [ - "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cargo-husky 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "cargo-husky 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "codespan 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "codespan-reporting 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "cranelift 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", "cranelift-module 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-native 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", "cranelift-simplejit 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", "dot 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "enum-primitive-derive 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lalrpop 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lalrpop-util 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lalrpop 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lalrpop-util 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "ordered-float 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "pretty_assertions 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "pretty_env_logger 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "salsa 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "structopt 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)", - "walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "salsa 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", + "structopt 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)", + "walkdir 2.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1250,7 +1251,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "unicode-segmentation" -version = "1.2.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1270,7 +1271,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "utf8-ranges" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1280,7 +1281,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "walkdir" -version = "2.2.7" +version = "2.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "same-file 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1331,21 +1332,21 @@ dependencies = [ "checksum arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "92c7fb76bc8826a8b33b4ee5bb07a247a81e76764ab4d55e8f73e3a4d8808c71" "checksum ascii-canvas 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff8eb72df928aafb99fe5d37b383f2fe25bd2a765e3e5f7c365916b6f2463a29" "checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" -"checksum autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a6d640bee2da49f60a4068a7fae53acde8982514ab7bae8b8cea9e88cbcfd799" -"checksum backtrace 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "f106c02a3604afcdc0df5d36cc47b44b55917dbaf3d808f71c163a0ddba64637" +"checksum autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "0e49efa51329a5fd37e7c79db4621af617cd4e3e5bc224939808d076077077bf" +"checksum backtrace 0.3.31 (registry+https://github.com/rust-lang/crates.io-index)" = "e0f77aa27f55a4beb477ff6bc4d9bf72f90eb422b19c1d8e5a644b8aeb674d66" "checksum backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6" "checksum bit-set 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e84c238982c4b1e1ee668d136c510c67a13465279c0cb367ea6baf6310620a80" "checksum bit-vec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f59bbe95d4e52a6398ec21238d31577f2b28a9d86807f06ca59d191d8440d0bb" -"checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" +"checksum bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d155346769a6855b86399e9bc3814ab343cd3d62c7e985113d46a0ec3c281fd" "checksum blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" "checksum block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" "checksum block-padding 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6d4dc3af3ee2e12f3e5d224e5e1e3d73668abbeb69e566d361f7d5563a4fdf09" "checksum byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" -"checksum byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a019b10a2a7cdeb292db131fc8113e57ea2a908f6e7894b0c3c671893b65dbeb" -"checksum cargo-husky 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "22f6d8b2af30e25d3ee4d72cdb7a127033ee6ee0ec50b47cdb6737e282797652" -"checksum cc 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)" = "a0c56216487bb80eec9c4516337b2588a4f2a2290d72a1416d930e4dcdb0c90d" -"checksum cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "11d43355396e872eefb45ce6342e4374ed7bc2b3a502d1b28e36d6e23c05d1f4" -"checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878" +"checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5" +"checksum cargo-husky 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee1f6a41bcc9d0aeff394d58275742a53beb62da685d8046c4756a8e4a507bbf" +"checksum cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)" = "39f75544d7bbaf57560d2168f28fd649ff9c76153874db88bdbdfd839b1a7e7d" +"checksum cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33" +"checksum chrono 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "77d81f58b7301084de3b958691458a53c3f7e0b1d702f77e550b6a88e3a88abe" "checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" "checksum codespan 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "03ed0fdf823b4a01c3b6a3e086b4d0a2def8d3cb75b110ec5c988fe2790860a9" @@ -1380,33 +1381,33 @@ dependencies = [ "checksum fixedbitset 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "86d4de0081402f5e88cdac65c8dcdcc73118c1a7a465e2a05f0da05843a8ea33" "checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" "checksum gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)" = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2" -"checksum generic-array 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3c0f28c2f5bfb5960175af447a2da7c18900693738343dc896ffbcabd9839592" +"checksum generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec" "checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" "checksum humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ca7e5f2e110db35f93b837c81797f3714500b81d517bf20c431b16d3ca4f114" "checksum indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7e81a7c05f79578dbc15793d8b619db9ba32b4577003ef3af1a91c416798c58d" "checksum itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5b8467d9c1cebe26feb08c640139247fac215782d35371ade9a2136ed6085358" "checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f" -"checksum lalrpop 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5b7f2d14eb07d819e961e5169f61d67de76a7cdbc6778b62192bcfe27c5af019" -"checksum lalrpop-util 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9768f55211206d3c17181108d8facb80bdffc1f1e674a67b1dddb2743529ca19" +"checksum lalrpop 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a3d111d79a3b76457aa1bcc699a736b6c623d14da0ec75737c01edb657469aef" +"checksum lalrpop-util 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6ab5dfdd35d987c6d328e371764cb6e4b6c63220db9364c291aa14d6fe50099a" "checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" -"checksum libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)" = "c6785aa7dd976f5fbf3b71cfd9cd49d7f783c1ff565a858d71031c6c313aa5c6" -"checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c" +"checksum libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)" = "6281b86796ba5e4366000be6e9e18bf35580adf9e63fbe2294aadb587613a319" +"checksum linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ae91b68aebc4ddb91978b11a1b02ddd8602a05ec19002801c5666000e05e0f83" +"checksum lock_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ed946d4529956a20f2d63ebe1b69996d5a2137c91913fe3ebbeff957f5bca7ff" "checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" "checksum mach 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "86dd2487cdfea56def77b88438a2c915fb45113c5319bfe7e14306ca4cd0b0e1" "checksum memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2efc7bc57c883d4a4d6e3246905283d8dae951bb3bd32f49d6ef297f546e1c39" "checksum new_debug_unreachable 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f40f005c60db6e03bae699e414c58bf9aa7ea02a2d0b9bfbcf19286cc4c82b30" "checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" -"checksum num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "e83d528d2677f0518c570baf2b7abdcf0cd2d248860b68507bdcb3e91d4c0cea" +"checksum num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "b85e541ef8255f6cf42bbfe4ef361305c6c135d10919ecc26126c4e5ae94bc09" "checksum num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31" -"checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1" +"checksum num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "6ba9a427cfca2be13aa6f6403b0b7e7368fe982bfa16fccc450ce74c46cd9b32" "checksum numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" "checksum opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "93f5bb2e8e8dec81642920ccff6b61f1eb94fa3020c5a325c9851ff604152409" "checksum ordered-float 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "18869315e81473c951eb56ad5558bbc56978562d3ecfb87abb7a1e944cea4518" "checksum ordermap 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a86ed3f5f244b372d6b1a00b72ef7f8876d0bc6a78a4c9985c53614041512063" "checksum output_vt100 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "53cdc5b785b7a58c5aad8216b3dfa114df64b0b06ae6e1501cef91df2fbdf8f9" -"checksum owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49a4b8ea2179e6a2e27411d3bca09ca6dd630821cf6894c6c7c8467a8ee7ef13" -"checksum parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab41b4aed082705d1056416ae4468b6ea99d52599ecf3169b00088d43113e337" -"checksum parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94c8c7923936b28d546dfd14d4472eaf34c99b14e1c973a32b3e6d4eb04298c9" +"checksum parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fa7767817701cce701d5585b9c4db3cdd02086398322c1d7e8bf5094a96a2ce7" +"checksum parking_lot_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cb88cb1cb3790baa6776844f968fea3be44956cf184fa1be5a03341f5491278c" "checksum petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)" = "9c3659d1ee90221741f65dd128d9998311b0e40c5d3c23a62445938214abce4f" "checksum phf_generator 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)" = "09364cc93c159b8b06b1f4dd8a4398984503483891b0c26b867cf431fb132662" "checksum phf_shared 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)" = "234f71a15de2288bcb7e3b6515828d22af7ec8598ee6d24c3b526fa0a80b67a0" @@ -1432,55 +1433,54 @@ dependencies = [ "checksum redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)" = "12229c14a0f65c4f1cb046a3b52047cdd9da1f4b30f8a39c5063c8bae515e252" "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" "checksum redox_users 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3fe5204c3a17e97dde73f285d49be585df59ed84b50a872baf416e73b62c3828" -"checksum regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "8f0a0bcab2fd7d1d7c54fa9eae6f43eddeb9ce2e7352f8518a814a4f65d60c58" -"checksum regex-syntax 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)" = "dcfd8681eebe297b81d98498869d4aae052137651ad7b96822f09ceb690d0a96" -"checksum region 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ace21a7fc79cffefeb66f2cc3ef22c7687015023bf7f85bec8840f0d46cb51cc" +"checksum regex 1.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "0b2f0808e7d7e4fb1cb07feb6ff2f4bc827938f24f8c2e6a3beb7370af544bdd" +"checksum regex-syntax 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "9d76410686f9e3a17f06128962e0ecc5755870bb890c34820c7af7f1db2e1d48" +"checksum region 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "448e868c6e4cfddfa49b6a72c95906c04e8547465e9536575b95c70a4044f856" "checksum relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0e7790c7f1cc73d831d28dc5a7deb316a006e7848e6a7f467cdb10a0a9e0fb1c" -"checksum rustc-demangle 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "ccc78bfd5acd7bf3e89cffcf899e5cb1a52d6fafa8dec2739ad70c9577a57288" +"checksum rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a7f4dccf6f4891ebcc0c39f9b6eb1a83b9bf5d747cb439ec6fba4f3b977038af" "checksum rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7540fc8b0c49f096ee9c961cda096467dce8084bec6bdca2fc83895fd9b28cb8" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" "checksum ryu 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "b96a9549dc8d48f2c283938303c4b5a77aa29bfbc5b54b084fb1630408899a8f" -"checksum salsa 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "249290390580a2ccdc1aa8256989733978a7c3e11e508abc529055ae4866e3a3" -"checksum salsa-macros 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9120ba92eda59ebd3a39e8245531df9a3805468bf38fe57fdfc30f14d0fdbea9" +"checksum salsa 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2891cd628406e8a0ca714b827511de1bff76f796e3382cc72a3de732ccad5aea" +"checksum salsa-macros 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b7f1e25ca2b995bdf032946174929d62156ffd57abd7ff88dc6f9bdeb5ac0c59" "checksum same-file 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8f20c4be53a8a1ff4c1f1b2bd14570d2f634628709752f0702ecdd2b3f9a5267" "checksum scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1d51f5df5af43ab3f1360b429fa5e0152ac5ce8c0bd6485cae490332e96846a8" -"checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" +"checksum scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b42e15e59b18a828bbf5c58ea01debb36b9b096346de35d941dcb89009f24a0d" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)" = "a72e9b96fa45ce22a4bc23da3858dfccfd60acd28a25bcd328a98fdd6bea43fd" -"checksum serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)" = "101b495b109a3e3ca8c4cbe44cf62391527cdfb6ba15821c5ce80bcd5ea23f9f" +"checksum serde 1.0.93 (registry+https://github.com/rust-lang/crates.io-index)" = "960e29cf7004b3b6e65fc5002981400eb3ccc017a08a2406940823e58e7179a9" +"checksum serde_derive 1.0.93 (registry+https://github.com/rust-lang/crates.io-index)" = "c4cce6663696bd38272e90bf34a0267e1226156c33f52d3f3915a2dd5d802085" "checksum serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)" = "5a23aa71d4a4d43fdbfaac00eff68ba8a06a51759a89ac3304323e800c4dd40d" "checksum sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b4d8bfd0e469f417657573d8451fb33d16cfe0989359b93baf3a1ffc639543d" "checksum siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0b8de496cf83d4ed58b6be86c3a275b8602f6ffe98d3024a869e124147a9a3ac" -"checksum smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c4488ae950c49d403731982257768f48fada354a5203fe81f9bb6f43ca9002be" -"checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" +"checksum smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ab606a9c5e214920bb66c458cd7be8ef094f813f20fe77a54cc7dbfff220d4b7" "checksum string_cache 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "25d70109977172b127fe834e5449e5ab1740b9ba49fa18a2020f509174f25423" "checksum string_cache_codegen 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1eea1eee654ef80933142157fdad9dd8bc43cf7c74e999e369263496f04ff4da" "checksum string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b1884d1bc09741d466d9b14e6d37ac89d6909cbcac41dd9ae982d4d063bbedfc" "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" "checksum strsim 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "032c03039aae92b350aad2e3779c352e104d919cb192ba2fabbd7b831ce4f0f6" -"checksum structopt 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)" = "3d0760c312538987d363c36c42339b55f5ee176ea8808bbe4543d484a291c8d1" -"checksum structopt-derive 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)" = "528aeb7351d042e6ffbc2a6fb76a86f9b622fdf7c25932798e7a82cb03bc94c6" +"checksum structopt 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)" = "fa19a5a708e22bb5be31c1b6108a2a902f909c4b9ba85cba44c06632386bc0ff" +"checksum structopt-derive 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)" = "c6d59d0ae8ef8de16e49e3ca7afa16024a3e0dfd974a75ef93fdc5464e34523f" "checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" -"checksum syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)" = "a1393e4a97a19c01e900df2aec855a29f71cf02c402e2f443b8d2747c25c5dbe" +"checksum syn 0.15.38 (registry+https://github.com/rust-lang/crates.io-index)" = "37ea458a750f59ab679b47fef9b6722c586c5742f4cfe18a120bbc807e5e01fd" "checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" -"checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015" +"checksum synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "02353edf96d6e4dc81aea2d8490a7e9db177bf8acb0e951c24940bf866cb313f" "checksum target-lexicon 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d6923974ce4eb5bd28814756256d8ab71c28dd6e7483313fe7ab6614306bf633" "checksum term 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "edd106a334b7657c10b7c540a0106114feadeb4dc314513e97df481d5d966f42" -"checksum termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4096add70612622289f2fdcdbd5086dc81c1e2675e6ae58d6c4f62a16c6d7f2f" -"checksum termion 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dde0593aeb8d47accea5392b39350015b5eccb12c0d98044d856983d89548dea" +"checksum termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "96d6098003bde162e4277c70665bd87c326f5a0c3f3fbfb285787fa482d54e6e" +"checksum termion 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6a8fb22f7cde82c8220e5aeacb3258ed7ce996142c77cba193f203515e26c330" "checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" "checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169" "checksum ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86" -"checksum unicode-segmentation 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "aa6024fc12ddfd1c6dbc14a80fa2324d4568849869b779f6bd37e5e4c03344d1" +"checksum unicode-segmentation 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1967f4cdfc355b37fd76d2a954fb2ed3871034eb4f26d60537d88795cfc332a9" "checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" "checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" -"checksum utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "796f7e48bef87609f7ade7e06495a87d5cd06c7866e6a5cbfceffc558a243737" +"checksum utf8-ranges 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9d50aa7650df78abf942826607c62468ce18d9019673d4a2ebe1865dbb96ffde" "checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" -"checksum walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "9d9d7ed3431229a144296213105a390676cc49c9b6a72bd19f3176c98e129fa1" +"checksum walkdir 2.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "c7904a7e2bb3cdf0cf5e783f44204a85a37a93151738fa349f06680f59a98b45" "checksum winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f10e386af2b13e47c89e7236a7a14a086791a2b88ebad6df9bf42040195cf770" "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" "checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9" diff --git a/Cargo.toml b/Cargo.toml index d2ae079..18c9916 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,10 +8,10 @@ repository = "https://github.com/dflemstr/tin" edition = "2018" [build-dependencies] -lalrpop = "0.17.0" +lalrpop = "0.17.1" failure = "0.1.5" -regex = "1.1.6" -walkdir = "2.2.7" +regex = "1.1.7" +walkdir = "2.2.8" [dependencies] cranelift = "0.30.0" @@ -20,21 +20,22 @@ cranelift-simplejit = "0.30.0" dot = "0.1.4" env_logger = "0.6.1" failure = "0.1.5" -lalrpop-util = "0.17.0" +lalrpop-util = "0.17.1" log = "0.4.6" -regex = "1.1.6" +regex = "1.1.7" pretty_env_logger = "0.3.0" -structopt = "0.2.15" +structopt = "0.2.16" lazy_static = "1.3.0" -byteorder = "1.3.1" +byteorder = "1.3.2" itertools = "0.8.0" codespan = "0.3.0" codespan-reporting = "0.3.0" enum-primitive-derive = "0.1.2" -num-traits = "0.2.6" -salsa = "0.12.0" +num-traits = "0.2.8" +salsa = "0.12.3" relative-path = "0.4.0" ordered-float = "1.0.2" +cranelift-native = "0.30.0" [features] default = ["parallel"] @@ -54,5 +55,5 @@ codegen-units = 1 pretty_assertions = "0.6.1" [dev-dependencies.cargo-husky] -version = "1.3.0" +version = "1.4.0" features = ["prepush-hook", "precommit-hook", "run-for-all", "run-cargo-test", "run-cargo-check", "run-cargo-clippy", "run-cargo-fmt"] diff --git a/src/codegen/abi_type.rs b/src/codegen/abi_type.rs index 078d21a..0507e96 100644 --- a/src/codegen/abi_type.rs +++ b/src/codegen/abi_type.rs @@ -4,13 +4,11 @@ use std::u32; use std::u64; use std::u8; -use crate::ir::component::ty; - -use cranelift::prelude::*; +use crate::ty; #[derive(Clone, Copy, Debug)] pub enum AbiType { - Scalar(Type), + Scalar(cranelift::codegen::ir::Type), Ptr, } @@ -28,29 +26,33 @@ impl AbiType { ty::Type::String | ty::Type::Tuple(_) | ty::Type::Record(_) | ty::Type::Function(_) => { AbiType::Ptr } - ty::Type::Symbol(_) => AbiType::Scalar(types::I8), + ty::Type::Symbol(_) => AbiType::Scalar(cranelift::codegen::ir::types::I8), ty::Type::Union(ty::Union { ref alternatives }) => { let n = alternatives.len(); // Assumes unions only store symbols for now if n <= 2 { - AbiType::Scalar(types::B1) + AbiType::Scalar(cranelift::codegen::ir::types::B1) } else if n as u64 <= u64::from(u8::max_value()) { - AbiType::Scalar(types::I8) + AbiType::Scalar(cranelift::codegen::ir::types::I8) } else if n as u64 <= u64::from(u16::max_value()) { - AbiType::Scalar(types::I16) + AbiType::Scalar(cranelift::codegen::ir::types::I16) } else if n as u64 <= u64::from(u32::max_value()) { - AbiType::Scalar(types::I32) + AbiType::Scalar(cranelift::codegen::ir::types::I32) } else if n as u64 <= u64::max_value() { - AbiType::Scalar(types::I64) + AbiType::Scalar(cranelift::codegen::ir::types::I64) } else { unimplemented!() } } + ty::Type::Placeholder => panic!("cannot lower placeholder type"), } } - pub fn into_specific(self, ptr_type: Type) -> Type { + pub fn into_specific( + self, + ptr_type: cranelift::codegen::ir::Type, + ) -> cranelift::codegen::ir::Type { match self { AbiType::Scalar(ty) => ty, AbiType::Ptr => ptr_type, @@ -59,12 +61,18 @@ impl AbiType { fn from_ir_number_type(ir_type: ty::Number) -> AbiType { match ir_type { - ty::Number::U8 | ty::Number::I8 => AbiType::Scalar(types::I8), - ty::Number::U16 | ty::Number::I16 => AbiType::Scalar(types::I16), - ty::Number::U32 | ty::Number::I32 => AbiType::Scalar(types::I32), - ty::Number::U64 | ty::Number::I64 => AbiType::Scalar(types::I64), - ty::Number::F32 => AbiType::Scalar(types::F32), - ty::Number::F64 => AbiType::Scalar(types::F64), + ty::Number::U8 | ty::Number::I8 => AbiType::Scalar(cranelift::codegen::ir::types::I8), + ty::Number::U16 | ty::Number::I16 => { + AbiType::Scalar(cranelift::codegen::ir::types::I16) + } + ty::Number::U32 | ty::Number::I32 => { + AbiType::Scalar(cranelift::codegen::ir::types::I32) + } + ty::Number::U64 | ty::Number::I64 => { + AbiType::Scalar(cranelift::codegen::ir::types::I64) + } + ty::Number::F32 => AbiType::Scalar(cranelift::codegen::ir::types::F32), + ty::Number::F64 => AbiType::Scalar(cranelift::codegen::ir::types::F64), } } } diff --git a/src/codegen/builtin.rs b/src/codegen/builtin.rs index 568ade6..2ca8e77 100644 --- a/src/codegen/builtin.rs +++ b/src/codegen/builtin.rs @@ -4,6 +4,7 @@ use std::slice; use std::str; use cranelift::prelude::types; +use log::debug; use crate::codegen::abi_type; use crate::module; diff --git a/src/codegen/data.rs b/src/codegen/data.rs index 45d4c59..0479e68 100644 --- a/src/codegen/data.rs +++ b/src/codegen/data.rs @@ -2,7 +2,7 @@ use std::fmt; use cranelift::prelude::*; -use crate::ir::component::layout; +use crate::layout; use crate::value; pub struct Translator<'a> { diff --git a/src/codegen/error.rs b/src/codegen/error.rs new file mode 100644 index 0000000..007a086 --- /dev/null +++ b/src/codegen/error.rs @@ -0,0 +1,59 @@ +use std::result; + +use crate::interpreter; +use crate::ir; +use crate::layout; +use crate::ty; + +/// Errors that may occur while building and interacting with an [`Ir`]. +#[derive(Clone, Debug, Eq, failure::Fail, PartialEq)] +pub enum Error { + /// Semantic error. + #[fail(display = "semantic error")] + Ir(#[cause] ir::error::Error), + + /// Type error. + #[fail(display = "type error")] + Ty(#[cause] ty::error::Error), + + /// Constexpr interpreter evaluation failed. + #[fail(display = "failed to evaluate constexpr")] + Constexpr(#[cause] interpreter::error::Error), + + /// Failed to determine data layout. + #[fail(display = "failed to determine data layout")] + Layout(#[cause] layout::error::Error), + + /// There were multiple codegen errors. + #[fail(display = "multiple codegen errors")] + Multiple { + /// The errors, in the order they were encountered in the codegen. + errors: Vec, + }, +} + +pub type Result = result::Result; + +impl From for Error { + fn from(error: ir::error::Error) -> Self { + Error::Ir(error) + } +} + +impl From for Error { + fn from(error: ty::error::Error) -> Self { + Error::Ty(error) + } +} + +impl From for Error { + fn from(error: interpreter::error::Error) -> Self { + Error::Constexpr(error) + } +} + +impl From for Error { + fn from(error: layout::error::Error) -> Self { + Error::Layout(error) + } +} diff --git a/src/codegen/function.rs b/src/codegen/function.rs index 7060a55..fa87235 100644 --- a/src/codegen/function.rs +++ b/src/codegen/function.rs @@ -8,13 +8,13 @@ use cranelift_simplejit; use crate::codegen::abi_type; use crate::codegen::builtin; use crate::codegen::util; -use crate::ir::component::constexpr; +use crate::db; +use crate::ir; use crate::ir::element; -use crate::ir::component::layout; use crate::ir::location; -use crate::ir::symbol; -use crate::ir::component::ty; +use crate::layout; use crate::module; +use crate::ty; use crate::value; pub struct Translator<'a, 'f> @@ -23,12 +23,7 @@ where { module: &'a mut cranelift_module::Module, builder: &'a mut FunctionBuilder<'f>, - constexprs: &'a specs::ReadStorage<'a, constexpr::Constexpr>, - elements: &'a specs::ReadStorage<'a, element::Element>, - layouts: &'a specs::ReadStorage<'a, layout::Layout>, - locations: &'a specs::ReadStorage<'a, location::Location>, - symbols: &'a specs::ReadStorage<'a, symbol::Symbol>, - types: &'a specs::ReadStorage<'a, ty::Type>, + db: &'a db::Db, ptr_type: Type, error_throw_ebb: Ebb, error_unwind_ebb: Ebb, @@ -42,12 +37,7 @@ impl<'a, 'f> Translator<'a, 'f> { pub fn new( module: &'a mut cranelift_module::Module, builder: &'a mut FunctionBuilder<'f>, - constexprs: &'a specs::ReadStorage<'a, constexpr::Constexpr>, - elements: &'a specs::ReadStorage<'a, element::Element>, - layouts: &'a specs::ReadStorage<'a, layout::Layout>, - locations: &'a specs::ReadStorage<'a, location::Location>, - symbols: &'a specs::ReadStorage<'a, symbol::Symbol>, - types: &'a specs::ReadStorage<'a, ty::Type>, + db: &'a db::Db, ptr_type: Type, error_throw_ebb: Ebb, error_unwind_ebb: Ebb, @@ -58,12 +48,7 @@ impl<'a, 'f> Translator<'a, 'f> { Translator { module, builder, - constexprs, - elements, - layouts, - locations, - symbols, - types, + db, ptr_type, error_throw_ebb, error_unwind_ebb, @@ -113,8 +98,8 @@ impl<'a, 'f> Translator<'a, 'f> { } } - fn eval_constexpr(&mut self, entity: ir::Entity, constexpr: &constexpr::Constexpr) -> Value { - if let value::Case::Number(ref n) = *constexpr.value.case() { + fn eval_value(&mut self, entity: ir::Entity, value: &value::Value) -> Value { + if let value::Case::Number(ref n) = *value.case() { match *n { value::Number::U8(ref v) => self.builder.ins().iconst(types::I8, i64::from(*v)), value::Number::U16(ref v) => self.builder.ins().iconst(types::I16, i64::from(*v)), @@ -426,11 +411,7 @@ impl<'a, 'f> Translator<'a, 'f> { .load(field_abi_type, mem_flags, record, field_offset) } - pub fn eval_parameter( - &mut self, - entity: ir::Entity, - _parameter: &element::Parameter, - ) -> Value { + pub fn eval_parameter(&mut self, entity: ir::Entity, _parameter: &element::Parameter) -> Value { self.builder.use_var(self.variables[&entity]) } @@ -545,21 +526,6 @@ impl<'a, 'f> Translator<'a, 'f> { (filename, filename_len, line, col) } - fn get_symbol(&self, entity: ir::Entity) -> Option<&symbol::Symbol> { - if let Some(symbol) = self.symbols.get(entity) { - Some(symbol) - } else if let Some(element) = self.elements.get(entity) { - match element { - element::Element::Capture(element::Capture { captured, .. }) => { - self.get_symbol(*captured) - } - _ => None, - } - } else { - None - } - } - pub fn builtin_alloc(&mut self, size: Value, align: Value) -> Value { let local_callee = self.declare_builtin(&builtin::ALLOC); diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs index 2206be4..aa90f46 100644 --- a/src/codegen/mod.rs +++ b/src/codegen/mod.rs @@ -1,77 +1,312 @@ //! A JIT compiler implementation based on the IR. +use log::debug; use std::collections; use std::fmt; +use std::ops; +use std::sync; use cranelift::codegen; +use cranelift::codegen::ir::immediates; +use cranelift::codegen::ir::types; +use cranelift::frontend; use cranelift_module; use cranelift_simplejit; +use crate::db; +use crate::interpreter; use crate::ir; -use crate::ir::component::constexpr; -use crate::ir::element; -use crate::ir::component::layout; -use crate::ir::location; -use crate::ir::symbol; -use crate::ir::component::ty; +use crate::ir::{element, Entity}; +use crate::layout; use crate::module; - -use cranelift::prelude::*; +use crate::ty; mod abi_type; mod builtin; mod data; +pub mod error; mod function; -#[cfg(test)] -mod tests; +// #[cfg(test)] +// mod tests; mod util; /// A codegen system, that can be used for JIT compilation. -pub struct Codegen<'a> { - entities: specs::Entities<'a>, - constexprs: specs::ReadStorage<'a, constexpr::Constexpr>, - elements: specs::ReadStorage<'a, element::Element>, - layouts: specs::ReadStorage<'a, layout::Layout>, - locations: specs::ReadStorage<'a, location::Location>, - symbols: specs::ReadStorage<'a, symbol::Symbol>, - types: specs::ReadStorage<'a, ty::Type>, - codemap: &'a codespan::CodeMap, +#[salsa::query_group(CodegenStorage)] +pub trait Db: salsa::Database + interpreter::Db + ir::Db + layout::Db + ty::Db { + #[salsa::dependencies] + fn codegen_function(&self, entity: ir::Entity) -> error::Result>>; + + #[salsa::dependencies] + fn codegen_data(&self, entity: ir::Entity) -> error::Result>>; + + fn codegen_ptr_type(&self) -> codegen::ir::Type; + + #[salsa::dependencies] + fn codegen_isa(&self) -> Isa; } -impl<'a> Codegen<'a> { - /// Creates a new codegen instance around the specified IR. - pub fn new(ir: &'a ir::Ir, codemap: &'a codespan::CodeMap) -> Self { - let entities = ir.world.entities(); - let constexprs = ir.world.read_storage(); - let elements = ir.world.read_storage(); - let layouts = ir.world.read_storage(); - let locations = ir.world.read_storage(); - let symbols = ir.world.read_storage(); - let types = ir.world.read_storage(); - - Codegen { - entities, - constexprs, +pub struct Function { + ctx: codegen::Context, +} + +pub struct Data { + ctx: cranelift_module::DataContext, +} + +#[derive(Clone)] +pub struct Isa { + raw: sync::Arc, +} + +struct Symbol<'a, D>(&'a D, ir::Entity); + +fn codegen_function( + db: &impl Db, + entity: ir::Entity, +) -> error::Result>> { + if let (element::Element::Closure(closure), ty::Type::Function(ty)) = + (&*db.element(entity)?, &*db.ty(entity)?) + { + let ptr_type = db.codegen_ptr_type(); + + let mut ctx = codegen::Context::new(); + ctx.func.signature.call_conv = db.codegen_isa().default_call_conv(); + populate_function_signature(ty, ptr_type, &mut ctx); + + let mut builder_context = frontend::FunctionBuilderContext::new(); + let mut builder = + cranelift::frontend::FunctionBuilder::new(&mut ctx.func, &mut builder_context); + + let name = Symbol(db, entity).to_string(); + let name_len = name.len(); + let name_data_id = util::define_string( + &mut module, + &mut defined_strings, + &format!("funcname:{}", sy), + name, + ); + let name_global_value = module.declare_data_in_func(name_data_id, builder.func); + + let entry_ebb = builder.create_ebb(); + builder.append_ebb_params_for_function_params(entry_ebb); + + let error_throw_ebb = builder.create_ebb(); + let error_unwind_ebb = builder.create_ebb(); + + builder.switch_to_block(entry_ebb); + builder.seal_block(entry_ebb); + + let variables = declare_variables( elements, - layouts, - locations, - symbols, types, - codemap, + ptr_type, + &mut builder, + &closure.parameters, + &closure.statements, + entry_ebb, + ); + + let result = { + let mut translation_ctx = function::Translator::new( + &mut module, + &mut builder, + db, + ptr_type, + error_throw_ebb, + error_unwind_ebb, + &variables, + &mut defined_strings, + codemap, + ); + + for stmt in &closure.statements { + translation_ctx.exec_element(*stmt, &*db.element(*stmt)?); + } + + translation_ctx.eval_element(closure.result, db.element(&*closure.result)?) + }; + + let null_error = builder.ins().iconst(ptr_type, 0); + builder.ins().return_(&[result, null_error]); + + let error_kind = builder.append_ebb_param(error_throw_ebb, types::I32); + let error_filename = builder.append_ebb_param(error_throw_ebb, ptr_type); + let error_filename_len = builder.append_ebb_param(error_throw_ebb, ptr_type); + let error_line = builder.append_ebb_param(error_throw_ebb, types::I32); + let error_col = builder.append_ebb_param(error_throw_ebb, types::I32); + builder.switch_to_block(error_throw_ebb); + builder.seal_block(error_throw_ebb); + + let error = { + let mut translation_ctx = function::Translator::new( + &mut module, + &mut builder, + db, + ptr_type, + error_throw_ebb, + error_unwind_ebb, + &variables, + &mut defined_strings, + codemap, + ); + translation_ctx.builtin_error(error_kind) + }; + builder.ins().jump( + error_unwind_ebb, + &[ + error, + error_filename, + error_filename_len, + error_line, + error_col, + ], + ); + + let error = builder.append_ebb_param(error_unwind_ebb, ptr_type); + let error_filename = builder.append_ebb_param(error_unwind_ebb, ptr_type); + let error_filename_len = builder.append_ebb_param(error_unwind_ebb, ptr_type); + let error_line = builder.append_ebb_param(error_unwind_ebb, types::I32); + let error_col = builder.append_ebb_param(error_unwind_ebb, types::I32); + builder.switch_to_block(error_unwind_ebb); + builder.seal_block(error_unwind_ebb); + + let name = builder.ins().global_value(ptr_type, name_global_value); + let name_len = builder.ins().iconst(ptr_type, name_len as i64); + + { + let mut translation_ctx = function::Translator::new( + &mut module, + &mut builder, + db, + ptr_type, + error_throw_ebb, + error_unwind_ebb, + &variables, + &mut defined_strings, + codemap, + ); + translation_ctx.builtin_unwind_frame( + error, + name, + name_len, + error_filename, + error_filename_len, + error_line, + error_col, + ); + }; + + let null_result = if ret_type.is_int() { + builder.ins().iconst(ret_type, 0) + } else if ret_type == types::F32 { + builder.ins().f32const(immediates::Ieee32::with_float(0.0)) + } else if ret_type == types::F64 { + builder.ins().f64const(immediates::Ieee64::with_float(0.0)) + } else { + unimplemented!() + }; + builder.ins().return_(&[null_result, error]); + + builder.finalize(); + + debug!("generated function: {}", builder.display(None)); + Ok(Some(sync::Arc::new(Function { ctx }))) + } else { + Ok(None) + } +} + +fn populate_function_signature( + ty: &ty::Function, + ptr_type: codegen::ir::Type, + ctx: &mut codegen::Context, +) { + for parameter in &ty.parameters { + ctx.func.signature.params.push(codegen::ir::AbiParam::new( + abi_type::AbiType::from_ir_type(parameter).into_specific(ptr_type), + )); + } + + let ret_type = abi_type::AbiType::from_ir_type(&ty.result).into_specific(ptr_type); + + // Result, error + ctx.func.signature.returns.extend(&[ + codegen::ir::AbiParam::new(ret_type), + codegen::ir::AbiParam::new(ptr_type), + ]); +} + +fn codegen_data(db: &impl Db, entity: ir::Entity) -> error::Result>> { + if let Some(value) = db.value(entity)? { + let layout = db.layout(entity)?; + let ptr_type = db.codegen_ptr_type(); + let mut ctx = cranelift_module::DataContext::new(); + let mut data = Vec::new(); + data::Translator::new(&mut data, ptr_type).store_value(&*layout, &value); + ctx.define(data.into_boxed_slice()); + Ok(Some(sync::Arc::new(Data { ctx }))) + } else { + Ok(None) + } +} + +fn codegen_ptr_type(db: &impl Db) -> codegen::ir::Type { + match db.ptr_size() { + layout::PtrSize::Size8 => codegen::ir::types::I8, + layout::PtrSize::Size16 => codegen::ir::types::I16, + layout::PtrSize::Size32 => codegen::ir::types::I32, + layout::PtrSize::Size64 => codegen::ir::types::I64, + } +} + +fn codegen_isa(db: &impl Db) -> Isa { + let flag_builder = codegen::settings::builder(); + let isa_builder = cranelift_native::builder().unwrap_or_else(|msg| { + panic!("host machine is not supported: {}", msg); + }); + let raw = isa_builder + .finish(codegen::settings::Flags::new(flag_builder)) + .into(); + Isa { raw } +} + +impl fmt::Debug for Function { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_struct("Function").finish() + } +} + +impl fmt::Debug for Data { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_struct("Data").finish() + } +} + +impl fmt::Debug for Isa { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_struct("Isa").finish() + } +} + +impl ops::Deref for Isa { + type Target = codegen::isa::TargetIsa; + + fn deref(&self) -> &Self::Target { + &*self.raw + } +} + +/* +impl<'a> Codegen<'a> { + /// Creates a new codegen instance around the specified IR. + pub fn new(db: &'a db::Db) -> Self { + Self { + db } } /// Compiles the captured IR into a module. pub fn compile(&self) -> module::Module { - let Codegen { - ref entities, - ref constexprs, - ref elements, - ref layouts, - ref locations, - ref symbols, - ref types, - ref codemap, - } = *self; + let entities = db.entities(); let mut builder = cranelift_simplejit::SimpleJITBuilder::new(); @@ -81,9 +316,11 @@ impl<'a> Codegen<'a> { cranelift_module::Module::new(builder); let ptr_type = module.target_config().pointer_type(); - let data_ctxs: Vec<_> = (entities, layouts, constexprs) - .best_join() - .best_map(|(entity, layout, constexpr)| { + let data_ctxs: Vec<_> = entities.all() + .map(|(entity, layout, constexpr)| { + let layout = self.db.layout(entity); + let value = self.db.value(entity); + let mut ctx = cranelift_module::DataContext::new(); let mut data = Vec::new(); data::Translator::new(&mut data, ptr_type).store_value(layout, &constexpr.value); @@ -94,8 +331,7 @@ impl<'a> Codegen<'a> { let mut defined_strings = collections::HashMap::new(); - let function_ctxs = (elements, symbols, types) - .join() + let function_ctxs = entities.all() .flat_map(|(el, sy, ty)| { if let Some((closure, ty)) = as_closure(el, ty) { let mut ctx: codegen::Context = module.make_context(); @@ -509,3 +745,49 @@ fn as_closure<'a, 'b>( _ => None, } } +*/ + +impl<'a, D> fmt::Display for Symbol<'a, D> +where + D: Db, +{ + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + symbol_fmt_impl(self.1, f, self.0) + } +} + +fn symbol_fmt_impl(entity: Entity, f: &mut fmt::Formatter, db: &impl Db) -> fmt::Result { + let (parent, role) = db.lookup_entity(entity); + + if let Some(parent) = parent { + symbol_fmt_impl(parent, f, db)?; + write!(f, ".")?; + } + + match role { + ir::EntityRole::File(file_id) => write!(f, "{:?}", db.file_relative_path(file_id)), + ir::EntityRole::RecordField(ident) => write!(f, "{}", db.lookup_ident(file_id)), + ir::EntityRole::TupleField(idx) => write!(f, "{}", idx), + ir::EntityRole::VariableDefinition(ident) => write!(f, "{}", db.lookup_ident(file_id)), + ir::EntityRole::VariableInitializer => write!(f, "(initializer)"), + ir::EntityRole::SelectField(ident) => write!(f, "{}", db.lookup_ident(ident)), + ir::EntityRole::AppliedFunction => write!(f, "(applied function)"), + ir::EntityRole::AppliedParameter(idx) => write!(f, "(parameter {})", idx), + ir::EntityRole::ParameterSignature => write!(f, "(signature)"), + ir::EntityRole::ClosureCaptureDefinition(ident) => { + write!(f, "(capture definition {})", db.lookup_ident(ident)) + } + ir::EntityRole::ClosureParameter(ident) => { + write!(f, "(parameter definition {})", db.lookup_ident(ident)) + } + ir::EntityRole::ClosureStatement(idx) => write!(f, "(statement {})", idx), + ir::EntityRole::ClosureSignature => write!(f, "(signature)"), + ir::EntityRole::ClosureResult => write!(f, "(result expression)"), + ir::EntityRole::ModuleDefinition(ident) => { + write!(f, "(parameter definition {})", db.lookup_ident(ident)) + } + ir::EntityRole::UnOperand => write!(f, "(operand)"), + ir::EntityRole::BiLhs => write!(f, "(left operand)"), + ir::EntityRole::BiRhs => write!(f, "(right operand)"), + } +} diff --git a/src/error.rs b/src/error.rs index 4c78a05..694ef14 100644 --- a/src/error.rs +++ b/src/error.rs @@ -7,7 +7,7 @@ use crate::ir; use crate::syntax::parser; /// An error that occurs while interacting with Tin. -#[derive(Clone, Debug, Fail, PartialEq)] +#[derive(Clone, Debug, failure::Fail, PartialEq)] pub enum Error { /// Interpreting the code failed. /// diff --git a/src/interpreter/error.rs b/src/interpreter/error.rs index 114b057..05ca8a0 100644 --- a/src/interpreter/error.rs +++ b/src/interpreter/error.rs @@ -3,7 +3,7 @@ use crate::ir; use crate::module; use std::result; -#[derive(Clone, Debug, Eq, Fail, PartialEq)] +#[derive(Clone, Debug, Eq, failure::Fail, PartialEq)] pub enum Error { #[fail(display = "semantic error: {}", _0)] Ir(#[cause] ir::error::Error), diff --git a/src/ir/error.rs b/src/ir/error.rs index 3b83efd..19397ea 100644 --- a/src/ir/error.rs +++ b/src/ir/error.rs @@ -2,7 +2,7 @@ use crate::diagnostic; use std::result; /// Errors that may occur while building and interacting with an [`Ir`]. -#[derive(Clone, Debug, Eq, Fail, PartialEq)] +#[derive(Clone, Debug, Eq, failure::Fail, PartialEq)] pub enum Error { /// The IR cannot be built because something refers to an identifier that is not defined. #[fail(display = "undefined reference to `{}`", reference)] diff --git a/src/ir/mod.rs b/src/ir/mod.rs index 3bfddaa..fb53e52 100644 --- a/src/ir/mod.rs +++ b/src/ir/mod.rs @@ -1,4 +1,5 @@ //! Intermediate representation variables for the compiler and interpreter. +use std::borrow; use std::collections; use std::sync; @@ -28,10 +29,10 @@ pub trait Db: salsa::Database + syntax::Db { } #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] -pub struct Ident(u32); +pub struct Ident(salsa::InternId); #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] -pub struct Entity(u32); +pub struct Entity(salsa::InternId); #[derive(Clone, Debug, Eq, PartialEq)] pub struct Entities { @@ -69,33 +70,33 @@ pub struct EntityInfo { impl Ident { pub fn id(self) -> u32 { - self.0 + u32::from(self.0) } } impl Entity { pub fn id(self) -> u32 { - self.0 + u32::from(self.0) } } impl salsa::InternKey for Ident { fn from_intern_id(v: salsa::InternId) -> Self { - Ident(v.as_u32()) + Ident(v) } fn as_intern_id(&self) -> salsa::InternId { - salsa::InternId::from(self.0) + self.0 } } impl salsa::InternKey for Entity { fn from_intern_id(v: salsa::InternId) -> Self { - Entity(v.as_u32()) + Entity(v) } fn as_intern_id(&self) -> salsa::InternId { - salsa::InternId::from(self.0) + self.0 } } diff --git a/src/layout/error.rs b/src/layout/error.rs index 3aa88c1..3a9e4c4 100644 --- a/src/layout/error.rs +++ b/src/layout/error.rs @@ -2,7 +2,7 @@ use crate::ir; use crate::ty; use std::result; -#[derive(Clone, Debug, Eq, Fail, PartialEq)] +#[derive(Clone, Debug, Eq, failure::Fail, PartialEq)] pub enum Error { #[fail(display = "semantic error: {}", _0)] Ir(#[cause] ir::error::Error), diff --git a/src/lib.rs b/src/lib.rs index b92940e..a440c06 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -43,21 +43,9 @@ unused_qualifications )] -#[macro_use] -extern crate enum_primitive_derive; -#[macro_use] -extern crate failure; -#[macro_use] -extern crate lalrpop_util; -#[macro_use] -extern crate lazy_static; -#[cfg(test)] -#[macro_use] -extern crate pretty_assertions; - use std::fmt; -// mod codegen; +mod codegen; mod db; mod interpreter; mod ir; diff --git a/src/module.rs b/src/module.rs index 0a6d934..9cd11f0 100644 --- a/src/module.rs +++ b/src/module.rs @@ -14,7 +14,7 @@ pub struct Module { } /// An error that may happen at runtime. -#[derive(Clone, Debug, Eq, Fail, PartialEq)] +#[derive(Clone, Debug, Eq, failure::Fail, PartialEq)] #[fail(display = "{}{}", kind, backtrace)] pub struct Error { kind: ErrorKind, @@ -43,7 +43,7 @@ pub struct Point { } /// The various kinds of allowed errors. -#[derive(Clone, Copy, Debug, Eq, PartialEq, Primitive)] +#[derive(Clone, Copy, Debug, Eq, PartialEq, enum_primitive_derive::Primitive)] pub enum ErrorKind { /// An unknown error has occurred. /// diff --git a/src/syntax/parser/mod.rs b/src/syntax/parser/mod.rs index db24c38..584ef10 100644 --- a/src/syntax/parser/mod.rs +++ b/src/syntax/parser/mod.rs @@ -8,7 +8,7 @@ use crate::syntax::ast; mod util; -lalrpop_mod!( +lalrpop_util::lalrpop_mod!( #[allow(clippy::all)] #[allow(clippy::pedantic)] #[allow(deprecated)] @@ -29,7 +29,7 @@ pub struct Context { } /// An error that occurs while parsing Tin. -#[derive(Clone, Debug, Eq, Fail, PartialEq)] +#[derive(Clone, Debug, Eq, failure::Fail, PartialEq)] pub enum Error { /// There was an invalid token in the code. #[fail(display = "invalid token")] @@ -166,7 +166,7 @@ fn handle_parse_result( macro_rules! parser_impl { ($stat:ident, $parser:ident, $result:ty) => { - lazy_static! { + lazy_static::lazy_static! { static ref $stat: crate::syntax::parser::grammar::$parser = { crate::syntax::parser::grammar::$parser::new() }; } diff --git a/src/ty/error.rs b/src/ty/error.rs index 37f0a75..b84a3ce 100644 --- a/src/ty/error.rs +++ b/src/ty/error.rs @@ -7,7 +7,7 @@ use crate::ir; use crate::ty; use crate::ty::class; -#[derive(Clone, Debug, Eq, Fail, PartialEq)] +#[derive(Clone, Debug, Eq, failure::Fail, PartialEq)] pub enum Error { #[fail(display = "type conflict: {}", _0)] Conflict(Conflict), diff --git a/src/value.rs b/src/value.rs index b1e0332..77604a8 100644 --- a/src/value.rs +++ b/src/value.rs @@ -2,7 +2,7 @@ use std::cmp; use std::collections; use std::sync; -lazy_static! { +lazy_static::lazy_static! { pub static ref NIL: Value = { Value::new(Case::Symbol(Symbol { label: sync::Arc::new("nil".to_owned()), From 7e1d6dad21cb9b57d9422ef2d0b312db49fd321b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Flemstr=C3=B6m?= Date: Sat, 27 Jul 2019 21:52:11 +0200 Subject: [PATCH 20/22] Make codegen compile --- Cargo.lock | 383 +++++++++---------- Cargo.toml | 20 +- src/bin/tin.rs | 10 +- src/codegen/function.rs | 393 ++++++++++++------- src/codegen/mod.rs | 779 +++++++++++--------------------------- src/codegen/util.rs | 11 +- src/ir/mod.rs | 1 + src/ir/tests.rs | 5 +- src/source/mod.rs | 48 ++- src/syntax/parser/util.rs | 6 +- 10 files changed, 726 insertions(+), 930 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7eee1f4..b3a431d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,10 +2,10 @@ # It is not intended for manual editing. [[package]] name = "aho-corasick" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -27,7 +27,7 @@ dependencies = [ [[package]] name = "arrayvec" -version = "0.4.10" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", @@ -43,38 +43,36 @@ dependencies = [ [[package]] name = "atty" -version = "0.2.11" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", - "termion 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "autocfg" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "backtrace" -version = "0.3.31" +version = "0.3.33" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace-sys 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "backtrace-sys" -version = "0.1.28" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -100,7 +98,7 @@ name = "blake2-rfc" version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -140,7 +138,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "cc" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -153,7 +151,7 @@ name = "chrono" version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", @@ -165,7 +163,7 @@ version = "2.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -206,91 +204,91 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "cranelift" -version = "0.30.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cranelift-codegen 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cranelift-frontend 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-codegen 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-frontend 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cranelift-bforest" -version = "0.30.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cranelift-entity 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-entity 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cranelift-codegen" -version = "0.30.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cranelift-bforest 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cranelift-codegen-meta 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cranelift-entity 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-bforest 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-codegen-meta 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-entity 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "target-lexicon 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "target-lexicon 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cranelift-codegen-meta" -version = "0.30.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cranelift-entity 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-entity 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cranelift-entity" -version = "0.30.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "cranelift-frontend" -version = "0.30.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cranelift-codegen 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "target-lexicon 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-codegen 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "target-lexicon 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cranelift-module" -version = "0.30.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cranelift-codegen 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cranelift-entity 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-codegen 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-entity 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cranelift-native" -version = "0.30.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cranelift-codegen 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-codegen 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)", "raw-cpuid 6.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "target-lexicon 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "target-lexicon 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cranelift-simplejit" -version = "0.30.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cranelift-codegen 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cranelift-module 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cranelift-native 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-codegen 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-module 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-native 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)", "errno 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "region 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "target-lexicon 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "target-lexicon 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -299,18 +297,18 @@ name = "ctor" version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.38 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.42 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "derive-new" -version = "0.5.6" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.38 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.42 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -325,7 +323,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "digest" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -336,7 +334,7 @@ name = "dirs" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "redox_users 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -347,8 +345,8 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.93 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", "strsim 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -367,7 +365,7 @@ name = "ena" version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -382,13 +380,13 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -398,7 +396,7 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "errno-dragonfly 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -408,7 +406,7 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -416,7 +414,7 @@ name = "failure" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "backtrace 0.3.31 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace 0.3.33 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -426,8 +424,8 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.38 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.42 (registry+https://github.com/rust-lang/crates.io-index)", "synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -499,7 +497,7 @@ version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "ascii-canvas 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "bit-set 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "docopt 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -507,10 +505,10 @@ dependencies = [ "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "lalrpop-util 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)", "petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.93 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.93 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "term 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -529,7 +527,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libc" -version = "0.2.58" +version = "0.2.60" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -547,7 +545,7 @@ dependencies = [ [[package]] name = "log" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -558,12 +556,12 @@ name = "mach" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "memchr" -version = "2.2.0" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -581,7 +579,7 @@ name = "num-integer" version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -598,14 +596,9 @@ name = "num-traits" version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "numtoa" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "opaque-debug" version = "0.2.2" @@ -649,9 +642,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -705,8 +698,8 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "chrono 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", - "env_logger 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -729,7 +722,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "quote" -version = "0.6.12" +version = "0.6.13" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", @@ -740,8 +733,8 @@ name = "rand" version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -758,7 +751,7 @@ name = "rand_chacha" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -796,7 +789,7 @@ name = "rand_jitter" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -808,7 +801,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -819,7 +812,7 @@ name = "rand_pcg" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -837,7 +830,7 @@ version = "6.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -851,16 +844,8 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.1.54" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "redox_termios" -version = "0.1.1" +version = "0.1.56" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] name = "redox_users" @@ -870,27 +855,27 @@ dependencies = [ "argon2rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex" -version = "1.1.7" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "aho-corasick 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "utf8-ranges 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex-syntax" -version = "0.6.7" +version = "0.6.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "ucd-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -899,7 +884,7 @@ version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "mach 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -932,7 +917,7 @@ dependencies = [ [[package]] name = "ryu" -version = "0.2.8" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -940,11 +925,11 @@ name = "salsa" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "derive-new 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "derive-new 0.5.7 (registry+https://github.com/rust-lang/crates.io-index)", "indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "lock_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "salsa-macros 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -958,13 +943,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.38 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.42 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "same-file" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -995,30 +980,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde" -version = "1.0.93" +version = "1.0.97" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde_derive 1.0.93 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_derive" -version = "1.0.93" +version = "1.0.97" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.38 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.42 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_json" -version = "1.0.39" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", - "ryu 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.93 (registry+https://github.com/rust-lang/crates.io-index)", + "ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1027,7 +1012,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "digest 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1051,7 +1036,7 @@ dependencies = [ "new_debug_unreachable 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "phf_shared 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", "precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.93 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache_codegen 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1064,7 +1049,7 @@ dependencies = [ "phf_generator 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", "phf_shared 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1085,22 +1070,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "structopt" -version = "0.2.16" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", - "structopt-derive 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)", + "structopt-derive 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "structopt-derive" -version = "0.2.16" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.38 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.42 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1115,11 +1100,11 @@ dependencies = [ [[package]] name = "syn" -version = "0.15.38" +version = "0.15.42" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1137,19 +1122,19 @@ version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.38 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.42 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "target-lexicon" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1170,17 +1155,6 @@ dependencies = [ "wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "termion" -version = "1.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", - "numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "textwrap" version = "0.11.0" @@ -1202,8 +1176,8 @@ name = "time" version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1215,28 +1189,28 @@ dependencies = [ "cargo-husky 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "codespan 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "codespan-reporting 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cranelift 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cranelift-module 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cranelift-native 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cranelift-simplejit 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-module 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-native 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-simplejit 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)", "dot 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "enum-primitive-derive 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "env_logger 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "lalrpop 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)", "lalrpop-util 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "ordered-float 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "pretty_assertions 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "pretty_env_logger 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "salsa 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", - "structopt 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)", - "walkdir 2.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "structopt 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", + "walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1246,7 +1220,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "ucd-util" -version = "0.1.3" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1281,10 +1255,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "walkdir" -version = "2.2.8" +version = "2.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "same-file 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1326,15 +1300,15 @@ dependencies = [ ] [metadata] -"checksum aho-corasick 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e6f484ae0c99fec2e858eb6134949117399f222608d84cadb3f58c1f97c2364c" +"checksum aho-corasick 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)" = "36b7aa1ccb7d7ea3f437cf025a2ab1c47cc6c1bc9fc84918ff449def12f5e282" "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" "checksum argon2rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3f67b0b6a86dae6e67ff4ca2b6201396074996379fba2b92ff649126f37cb392" -"checksum arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "92c7fb76bc8826a8b33b4ee5bb07a247a81e76764ab4d55e8f73e3a4d8808c71" +"checksum arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b8d73f9beda665eaa98ab9e4f7442bd4e7de6652587de55b2525e52e29c1b0ba" "checksum ascii-canvas 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff8eb72df928aafb99fe5d37b383f2fe25bd2a765e3e5f7c365916b6f2463a29" -"checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" -"checksum autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "0e49efa51329a5fd37e7c79db4621af617cd4e3e5bc224939808d076077077bf" -"checksum backtrace 0.3.31 (registry+https://github.com/rust-lang/crates.io-index)" = "e0f77aa27f55a4beb477ff6bc4d9bf72f90eb422b19c1d8e5a644b8aeb674d66" -"checksum backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6" +"checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90" +"checksum autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "22130e92352b948e7e82a49cdb0aa94f2211761117f29e052dd397c1ac33542b" +"checksum backtrace 0.3.33 (registry+https://github.com/rust-lang/crates.io-index)" = "88fb679bc9af8fa639198790a77f52d345fe13656c08b43afa9424c206b731c6" +"checksum backtrace-sys 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)" = "82a830b4ef2d1124a711c71d263c5abdc710ef8e907bd508c88be475cebc422b" "checksum bit-set 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e84c238982c4b1e1ee668d136c510c67a13465279c0cb367ea6baf6310620a80" "checksum bit-vec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f59bbe95d4e52a6398ec21238d31577f2b28a9d86807f06ca59d191d8440d0bb" "checksum bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d155346769a6855b86399e9bc3814ab343cd3d62c7e985113d46a0ec3c281fd" @@ -1344,7 +1318,7 @@ dependencies = [ "checksum byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" "checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5" "checksum cargo-husky 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee1f6a41bcc9d0aeff394d58275742a53beb62da685d8046c4756a8e4a507bbf" -"checksum cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)" = "39f75544d7bbaf57560d2168f28fd649ff9c76153874db88bdbdfd839b1a7e7d" +"checksum cc 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)" = "ce400c638d48ee0e9ab75aef7997609ec57367ccfe1463f21bf53c3eca67bf46" "checksum cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33" "checksum chrono 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "77d81f58b7301084de3b958691458a53c3f7e0b1d702f77e550b6a88e3a88abe" "checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" @@ -1352,27 +1326,27 @@ dependencies = [ "checksum codespan 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "03ed0fdf823b4a01c3b6a3e086b4d0a2def8d3cb75b110ec5c988fe2790860a9" "checksum codespan-reporting 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2ae73f6c4b3803dc2a0fe08ed1ce40e8f3f94ecc8394a82e0696bbc86d4e4fc3" "checksum constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8ff012e225ce166d4422e0e78419d901719760f62ae2b7969ca6b564d1b54a9e" -"checksum cranelift 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)" = "135f36eed3a578925d4b8dd506e4df596c55615d2603c47e8638b8f6acc5bf22" -"checksum cranelift-bforest 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e5a357d20666bf4a8c2d626a19f1b59dbca66cd844fb1e66c5612254fd0f7505" -"checksum cranelift-codegen 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ab00cb149a5bb0f7e6dd391357356a5d71c335a431e8eece94f32da2d5a043f7" -"checksum cranelift-codegen-meta 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e3797a2f450ac71297e083dd440d0cdd0d3bceabe4a3ca6bcb9e4077e9c0327d" -"checksum cranelift-entity 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5b66e28877b75b3d2b31250f780bb5db8f68ae3df681cd56add803b2567ac4fd" -"checksum cranelift-frontend 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b72d55fd732b1f7a99d043a36c54a5679b6ec8bc777c8d954fb97c4fa0fce7eb" -"checksum cranelift-module 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)" = "83558a9230d46c75091fb6a1fe357ac693a669a85396da3c37a4ccd7d9f4acc3" -"checksum cranelift-native 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d0239f34836621a127c2132980b2f5c32a1be1c40e2d1a9a1a9bd5af33c12aee" -"checksum cranelift-simplejit 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)" = "caa00fb269e166f786a2c8e10e5866e365c7620c3686a7b592292f6d9cb0e2ff" +"checksum cranelift 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e1862679d0d787f236a1ca89b4c4c2f3626e8ce9a5b50f0c62bd297cb2d0e90a" +"checksum cranelift-bforest 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60b4a5e7a7d418613617ce28df210d3bab92c6267762d3c6583b0369d7355f9e" +"checksum cranelift-codegen 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b0f313414896a0e26f2fc72262dc08211eeef7185f0c9a9c933310579991f2bf" +"checksum cranelift-codegen-meta 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bd9de6ac290a8e10cb61b7e99518a71e5ba4569aed84a35d950c66055f6ba8a8" +"checksum cranelift-entity 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fdda254bea18087a038982b9ede454736306b107bc0043d01bf563d2ee2fb88e" +"checksum cranelift-frontend 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e861f15ddb60a02f39af80d6168aac6939484b3a36b9f954648547ebf23b366b" +"checksum cranelift-module 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3f48d8868cd2a02dca3afad9eafbd4c7c741edd8cb4d8283ebd9e7b6b634e4f3" +"checksum cranelift-native 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2717b586de288286ceba665c842e30f3b41b43f8d29e8b9444c38d91d2814549" +"checksum cranelift-simplejit 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)" = "320125bf4c31aa9658f42a3586ae6ad3f752c6881e3799fb8b4d8b11887a2af4" "checksum ctor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "3b4c17619643c1252b5f690084b82639dd7fac141c57c8e77a00e0148132092c" -"checksum derive-new 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "6ca414e896ae072546f4d789f452daaecf60ddee4c9df5dc6d5936d769e3d87c" +"checksum derive-new 0.5.7 (registry+https://github.com/rust-lang/crates.io-index)" = "c3fd04571b29c91cfbe1e7c9a228e069ac8635f180ffb4ccd6a6907617ee8bb0" "checksum diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "3c2b69f912779fbb121ceb775d74d51e915af17aaebc38d28a592843a2dd0a3a" "checksum difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198" -"checksum digest 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05f47366984d3ad862010e22c7ce81a7dbcaebbdfb37241a620f8b6596ee135c" +"checksum digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" "checksum dirs 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3fd78930633bd1c6e35c4b42b1df7b0cbc6bc191146e512bb3bedf243fcc3901" "checksum docopt 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7f525a586d310c87df72ebcd98009e57f1cc030c8c268305287a476beb653969" "checksum dot 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a74b6c4d4a1cff5f454164363c16b72fa12463ca6b31f4b5f2035a65fa3d5906" "checksum either 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5527cfe0d098f36e3f8839852688e63c8fff1c90b2b405aef730615f9a7bcf7b" "checksum ena 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3dc01d68e08ca384955a3aeba9217102ca1aa85b6e168639bf27739f1d749d87" "checksum enum-primitive-derive 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2b90e520ec62c1864c8c78d637acbfe8baf5f63240f2fb8165b8325c07812dd" -"checksum env_logger 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b61fa891024a945da30a9581546e8cfaf5602c7b3f4c137a2805cf388f92075a" +"checksum env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "aafcde04e90a5226a6443b7aabdb016ba2f8307c847d524724bd9b346dd1a2d3" "checksum errno 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c2a071601ed01b988f896ab14b95e67335d1eeb50190932a1320f7fe3cadc84e" "checksum errno-dragonfly 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "14ca354e36190500e1e1fb267c647932382b54053c50b14970856c0b00a35067" "checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" @@ -1390,18 +1364,17 @@ dependencies = [ "checksum lalrpop 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a3d111d79a3b76457aa1bcc699a736b6c623d14da0ec75737c01edb657469aef" "checksum lalrpop-util 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6ab5dfdd35d987c6d328e371764cb6e4b6c63220db9364c291aa14d6fe50099a" "checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" -"checksum libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)" = "6281b86796ba5e4366000be6e9e18bf35580adf9e63fbe2294aadb587613a319" +"checksum libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "d44e80633f007889c7eff624b709ab43c92d708caad982295768a7b13ca3b5eb" "checksum linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ae91b68aebc4ddb91978b11a1b02ddd8602a05ec19002801c5666000e05e0f83" "checksum lock_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ed946d4529956a20f2d63ebe1b69996d5a2137c91913fe3ebbeff957f5bca7ff" -"checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" +"checksum log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "c275b6ad54070ac2d665eef9197db647b32239c9d244bfb6f041a766d00da5b3" "checksum mach 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "86dd2487cdfea56def77b88438a2c915fb45113c5319bfe7e14306ca4cd0b0e1" -"checksum memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2efc7bc57c883d4a4d6e3246905283d8dae951bb3bd32f49d6ef297f546e1c39" +"checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e" "checksum new_debug_unreachable 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f40f005c60db6e03bae699e414c58bf9aa7ea02a2d0b9bfbcf19286cc4c82b30" "checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" "checksum num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "b85e541ef8255f6cf42bbfe4ef361305c6c135d10919ecc26126c4e5ae94bc09" "checksum num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31" "checksum num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "6ba9a427cfca2be13aa6f6403b0b7e7368fe982bfa16fccc450ce74c46cd9b32" -"checksum numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" "checksum opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "93f5bb2e8e8dec81642920ccff6b61f1eb94fa3020c5a325c9851ff604152409" "checksum ordered-float 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "18869315e81473c951eb56ad5558bbc56978562d3ecfb87abb7a1e944cea4518" "checksum ordermap 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a86ed3f5f244b372d6b1a00b72ef7f8876d0bc6a78a4c9985c53614041512063" @@ -1417,7 +1390,7 @@ dependencies = [ "checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" "checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" "checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" -"checksum quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "faf4799c5d274f3868a4aae320a0a182cbd2baee377b378f080e16a23e9d80db" +"checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" "checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" "checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" "checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" @@ -1430,27 +1403,26 @@ dependencies = [ "checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" "checksum raw-cpuid 6.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "30a9d219c32c9132f7be513c18be77c9881c7107d2ab5569d205a6a0f0e6dc7d" "checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" -"checksum redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)" = "12229c14a0f65c4f1cb046a3b52047cdd9da1f4b30f8a39c5063c8bae515e252" -"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" +"checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" "checksum redox_users 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3fe5204c3a17e97dde73f285d49be585df59ed84b50a872baf416e73b62c3828" -"checksum regex 1.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "0b2f0808e7d7e4fb1cb07feb6ff2f4bc827938f24f8c2e6a3beb7370af544bdd" -"checksum regex-syntax 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "9d76410686f9e3a17f06128962e0ecc5755870bb890c34820c7af7f1db2e1d48" +"checksum regex 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6b23da8dfd98a84bd7e08700190a5d9f7d2d38abd4369dd1dae651bc40bfd2cc" +"checksum regex-syntax 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "cd5485bf1523a9ed51c4964273f22f63f24e31632adb5dad134f488f86a3875c" "checksum region 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "448e868c6e4cfddfa49b6a72c95906c04e8547465e9536575b95c70a4044f856" "checksum relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0e7790c7f1cc73d831d28dc5a7deb316a006e7848e6a7f467cdb10a0a9e0fb1c" "checksum rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a7f4dccf6f4891ebcc0c39f9b6eb1a83b9bf5d747cb439ec6fba4f3b977038af" "checksum rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7540fc8b0c49f096ee9c961cda096467dce8084bec6bdca2fc83895fd9b28cb8" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -"checksum ryu 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "b96a9549dc8d48f2c283938303c4b5a77aa29bfbc5b54b084fb1630408899a8f" +"checksum ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c92464b447c0ee8c4fb3824ecc8383b81717b9f1e74ba2e72540aef7b9f82997" "checksum salsa 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2891cd628406e8a0ca714b827511de1bff76f796e3382cc72a3de732ccad5aea" "checksum salsa-macros 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b7f1e25ca2b995bdf032946174929d62156ffd57abd7ff88dc6f9bdeb5ac0c59" -"checksum same-file 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8f20c4be53a8a1ff4c1f1b2bd14570d2f634628709752f0702ecdd2b3f9a5267" +"checksum same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "585e8ddcedc187886a30fa705c47985c3fa88d06624095856b36ca0b82ff4421" "checksum scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1d51f5df5af43ab3f1360b429fa5e0152ac5ce8c0bd6485cae490332e96846a8" "checksum scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b42e15e59b18a828bbf5c58ea01debb36b9b096346de35d941dcb89009f24a0d" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum serde 1.0.93 (registry+https://github.com/rust-lang/crates.io-index)" = "960e29cf7004b3b6e65fc5002981400eb3ccc017a08a2406940823e58e7179a9" -"checksum serde_derive 1.0.93 (registry+https://github.com/rust-lang/crates.io-index)" = "c4cce6663696bd38272e90bf34a0267e1226156c33f52d3f3915a2dd5d802085" -"checksum serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)" = "5a23aa71d4a4d43fdbfaac00eff68ba8a06a51759a89ac3304323e800c4dd40d" +"checksum serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)" = "d46b3dfedb19360a74316866cef04687cd4d6a70df8e6a506c63512790769b72" +"checksum serde_derive 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)" = "c22a0820adfe2f257b098714323563dd06426502abbbce4f51b72ef544c5027f" +"checksum serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)" = "051c49229f282f7c6f3813f8286cc1e3323e8051823fce42c7ea80fe13521704" "checksum sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b4d8bfd0e469f417657573d8451fb33d16cfe0989359b93baf3a1ffc639543d" "checksum siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0b8de496cf83d4ed58b6be86c3a275b8602f6ffe98d3024a869e124147a9a3ac" "checksum smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ab606a9c5e214920bb66c458cd7be8ef094f813f20fe77a54cc7dbfff220d4b7" @@ -1459,28 +1431,27 @@ dependencies = [ "checksum string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b1884d1bc09741d466d9b14e6d37ac89d6909cbcac41dd9ae982d4d063bbedfc" "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" "checksum strsim 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "032c03039aae92b350aad2e3779c352e104d919cb192ba2fabbd7b831ce4f0f6" -"checksum structopt 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)" = "fa19a5a708e22bb5be31c1b6108a2a902f909c4b9ba85cba44c06632386bc0ff" -"checksum structopt-derive 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)" = "c6d59d0ae8ef8de16e49e3ca7afa16024a3e0dfd974a75ef93fdc5464e34523f" +"checksum structopt 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "16c2cdbf9cc375f15d1b4141bc48aeef444806655cd0e904207edc8d68d86ed7" +"checksum structopt-derive 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "53010261a84b37689f9ed7d395165029f9cc7abb9f56bbfe86bee2597ed25107" "checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" -"checksum syn 0.15.38 (registry+https://github.com/rust-lang/crates.io-index)" = "37ea458a750f59ab679b47fef9b6722c586c5742f4cfe18a120bbc807e5e01fd" +"checksum syn 0.15.42 (registry+https://github.com/rust-lang/crates.io-index)" = "eadc09306ca51a40555dd6fc2b415538e9e18bc9f870e47b1a524a79fe2dcf5e" "checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" "checksum synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "02353edf96d6e4dc81aea2d8490a7e9db177bf8acb0e951c24940bf866cb313f" -"checksum target-lexicon 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d6923974ce4eb5bd28814756256d8ab71c28dd6e7483313fe7ab6614306bf633" +"checksum target-lexicon 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1b0ab4982b8945c35cc1c46a83a9094c414f6828a099ce5dcaa8ee2b04642dcb" "checksum term 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "edd106a334b7657c10b7c540a0106114feadeb4dc314513e97df481d5d966f42" "checksum termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "96d6098003bde162e4277c70665bd87c326f5a0c3f3fbfb285787fa482d54e6e" -"checksum termion 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6a8fb22f7cde82c8220e5aeacb3258ed7ce996142c77cba193f203515e26c330" "checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" "checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169" -"checksum ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86" +"checksum ucd-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "fa9b3b49edd3468c0e6565d85783f51af95212b6fa3986a5500954f00b460874" "checksum unicode-segmentation 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1967f4cdfc355b37fd76d2a954fb2ed3871034eb4f26d60537d88795cfc332a9" "checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" "checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" "checksum utf8-ranges 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9d50aa7650df78abf942826607c62468ce18d9019673d4a2ebe1865dbb96ffde" "checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" -"checksum walkdir 2.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "c7904a7e2bb3cdf0cf5e783f44204a85a37a93151738fa349f06680f59a98b45" +"checksum walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "9658c94fa8b940eab2250bd5a457f9c48b748420d71293b165c8cdbe2f55f71e" "checksum winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f10e386af2b13e47c89e7236a7a14a086791a2b88ebad6df9bf42040195cf770" "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" "checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9" diff --git a/Cargo.toml b/Cargo.toml index 18c9916..543451b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,21 +10,21 @@ edition = "2018" [build-dependencies] lalrpop = "0.17.1" failure = "0.1.5" -regex = "1.1.7" -walkdir = "2.2.8" +regex = "1.2.0" +walkdir = "2.2.9" [dependencies] -cranelift = "0.30.0" -cranelift-module = "0.30.0" -cranelift-simplejit = "0.30.0" +cranelift = "0.37.0" +cranelift-module = "0.37.0" +cranelift-simplejit = "0.37.0" dot = "0.1.4" -env_logger = "0.6.1" +env_logger = "0.6.2" failure = "0.1.5" lalrpop-util = "0.17.1" -log = "0.4.6" -regex = "1.1.7" +log = "0.4.7" +regex = "1.2.0" pretty_env_logger = "0.3.0" -structopt = "0.2.16" +structopt = "0.2.18" lazy_static = "1.3.0" byteorder = "1.3.2" itertools = "0.8.0" @@ -35,7 +35,7 @@ num-traits = "0.2.8" salsa = "0.12.3" relative-path = "0.4.0" ordered-float = "1.0.2" -cranelift-native = "0.30.0" +cranelift-native = "0.37.0" [features] default = ["parallel"] diff --git a/src/bin/tin.rs b/src/bin/tin.rs index ae8bfab..4e12bcd 100644 --- a/src/bin/tin.rs +++ b/src/bin/tin.rs @@ -1,11 +1,3 @@ -extern crate failure; -#[macro_use] -extern crate log; -extern crate pretty_env_logger; -#[macro_use] -extern crate structopt; -extern crate tin; - use std::fs; use std::io; use std::path; @@ -14,7 +6,7 @@ use std::sync::atomic; static REPORTED_DIAGNOSTICS: atomic::AtomicBool = atomic::AtomicBool::new(false); -#[derive(Debug, StructOpt)] +#[derive(Debug, structopt::StructOpt)] #[structopt(name = "tin")] struct Options { /// Source file to compile (that contains a main function); will use stdin if omitted. diff --git a/src/codegen/function.rs b/src/codegen/function.rs index fa87235..bf933e0 100644 --- a/src/codegen/function.rs +++ b/src/codegen/function.rs @@ -7,6 +7,7 @@ use cranelift_simplejit; use crate::codegen::abi_type; use crate::codegen::builtin; +use crate::codegen::error; use crate::codegen::util; use crate::db; use crate::ir; @@ -17,33 +18,36 @@ use crate::module; use crate::ty; use crate::value; -pub struct Translator<'a, 'f> +pub struct Translator<'a, 'f, B, D> where 'f: 'a, + B: cranelift_module::Backend, { - module: &'a mut cranelift_module::Module, + module: &'a mut cranelift_module::Module, builder: &'a mut FunctionBuilder<'f>, - db: &'a db::Db, + db: &'a D, ptr_type: Type, error_throw_ebb: Ebb, error_unwind_ebb: Ebb, variables: &'a collections::HashMap, defined_strings: &'a mut collections::HashMap, - codemap: &'a codespan::CodeMap, } -impl<'a, 'f> Translator<'a, 'f> { +impl<'a, 'f, B, D> Translator<'a, 'f, B, D> +where + B: cranelift_module::Backend, + D: super::Db, +{ #[cfg_attr(feature = "cargo-clippy", allow(clippy::too_many_arguments))] pub fn new( - module: &'a mut cranelift_module::Module, + module: &'a mut cranelift_module::Module, builder: &'a mut FunctionBuilder<'f>, - db: &'a db::Db, + db: &'a D, ptr_type: Type, error_throw_ebb: Ebb, error_unwind_ebb: Ebb, variables: &'a collections::HashMap, defined_strings: &'a mut collections::HashMap, - codemap: &'a codespan::CodeMap, ) -> Self { Translator { module, @@ -54,27 +58,44 @@ impl<'a, 'f> Translator<'a, 'f> { error_unwind_ebb, variables, defined_strings, - codemap, } } - pub fn exec_element(&mut self, entity: ir::Entity, element: &element::Element) { + pub fn exec_element( + &mut self, + entity: ir::Entity, + element: &element::Element, + ) -> error::Result<()> { if let element::Element::Variable(ref v) = element { - self.exec_variable(entity, v); + self.exec_variable(entity, v)?; } else { - self.eval_element(entity, element); + self.eval_element(entity, element)?; } + Ok(()) } - pub fn exec_variable(&mut self, entity: ir::Entity, variable: &element::Variable) { - let initializer_element = self.elements.get(variable.initializer).unwrap(); - let value = self.eval_element(variable.initializer, initializer_element); + pub fn exec_variable( + &mut self, + entity: ir::Entity, + variable: &element::Variable, + ) -> error::Result<()> { + use crate::ir::Db as _; + + let initializer_element = self.db.element(variable.initializer)?; + let value = self.eval_element(variable.initializer, &*initializer_element)?; self.builder.def_var(self.variables[&entity], value); + Ok(()) } - pub fn eval_element(&mut self, entity: ir::Entity, element: &element::Element) -> Value { - if let Some(constexpr) = self.constexprs.get(entity) { - self.eval_constexpr(entity, constexpr) + pub fn eval_element( + &mut self, + entity: ir::Entity, + element: &element::Element, + ) -> error::Result { + use crate::interpreter::Db as _; + + if let Some(value) = self.db.value(entity)? { + self.eval_value(entity, &value) } else { match *element { element::Element::Number(ref v) => self.eval_number_value(entity, v), @@ -94,40 +115,55 @@ impl<'a, 'f> Translator<'a, 'f> { element::Element::Capture(ref v) => self.eval_capture(entity, v), element::Element::Closure(ref v) => self.eval_closure(entity, v), element::Element::Module(ref v) => self.eval_module(entity, v), + element::Element::Reference(entity) => { + self.eval_element(entity, &*self.db.element(entity)?) + } } } } - fn eval_value(&mut self, entity: ir::Entity, value: &value::Value) -> Value { + fn eval_value(&mut self, entity: ir::Entity, value: &value::Value) -> error::Result { + use crate::layout::Db as _; + use crate::ty::Db as _; + if let value::Case::Number(ref n) = *value.case() { match *n { - value::Number::U8(ref v) => self.builder.ins().iconst(types::I8, i64::from(*v)), - value::Number::U16(ref v) => self.builder.ins().iconst(types::I16, i64::from(*v)), - value::Number::U32(ref v) => self.builder.ins().iconst(types::I32, i64::from(*v)), + value::Number::U8(ref v) => Ok(self.builder.ins().iconst(types::I8, i64::from(*v))), + value::Number::U16(ref v) => { + Ok(self.builder.ins().iconst(types::I16, i64::from(*v))) + } + value::Number::U32(ref v) => { + Ok(self.builder.ins().iconst(types::I32, i64::from(*v))) + } value::Number::U64(ref v) => { #[cfg_attr( feature = "cargo-clippy", allow(clippy::cast_possible_truncation, clippy::cast_possible_wrap) )] let value = *v as i64; - self.builder.ins().iconst(types::I64, value) + Ok(self.builder.ins().iconst(types::I64, value)) } - value::Number::I8(ref v) => self.builder.ins().iconst(types::I8, i64::from(*v)), - value::Number::I16(ref v) => self.builder.ins().iconst(types::I16, i64::from(*v)), - value::Number::I32(ref v) => self.builder.ins().iconst(types::I32, i64::from(*v)), - value::Number::I64(ref v) => self.builder.ins().iconst(types::I64, *v), - value::Number::F32(ref v) => self + value::Number::I8(ref v) => Ok(self.builder.ins().iconst(types::I8, i64::from(*v))), + value::Number::I16(ref v) => { + Ok(self.builder.ins().iconst(types::I16, i64::from(*v))) + } + value::Number::I32(ref v) => { + Ok(self.builder.ins().iconst(types::I32, i64::from(*v))) + } + value::Number::I64(ref v) => Ok(self.builder.ins().iconst(types::I64, *v)), + value::Number::F32(ref v) => Ok(self .builder .ins() - .f32const(Ieee32::with_float(v.into_inner())), - value::Number::F64(ref v) => self + .f32const(Ieee32::with_float(v.into_inner()))), + value::Number::F64(ref v) => Ok(self .builder .ins() - .f64const(Ieee64::with_float(v.into_inner())), + .f64const(Ieee64::with_float(v.into_inner()))), } } else { - let ty = self.types.get(entity).unwrap(); - let abi_type = abi_type::AbiType::from_ir_type(ty).into_specific(self.ptr_type); + let ty = self.db.ty(entity)?; + let layout = self.db.layout(entity)?; + let abi_type = abi_type::AbiType::from_ir_type(&*ty).into_specific(self.ptr_type); assert_eq!(self.ptr_type, abi_type); @@ -137,12 +173,13 @@ impl<'a, 'f> Translator<'a, 'f> { &entity.id().to_string(), cranelift_module::Linkage::Local, false, + Some(layout.alignment as u8), ) .unwrap(); let global_value = self .module .declare_data_in_func(data_id, &mut self.builder.func); - self.builder.ins().global_value(self.ptr_type, global_value) + Ok(self.builder.ins().global_value(self.ptr_type, global_value)) } } @@ -151,50 +188,65 @@ impl<'a, 'f> Translator<'a, 'f> { &mut self, _entity: ir::Entity, number_value: &element::Number, - ) -> Value { + ) -> error::Result { match *number_value { - element::Number::U8(v) => self.builder.ins().iconst(types::I8, i64::from(v)), - element::Number::U16(v) => self.builder.ins().iconst(types::I16, i64::from(v)), - element::Number::U32(v) => self.builder.ins().iconst(types::I32, i64::from(v)), - element::Number::U64(v) => self.builder.ins().iconst(types::I64, v as i64), - element::Number::I8(v) => self.builder.ins().iconst(types::I8, i64::from(v)), - element::Number::I16(v) => self.builder.ins().iconst(types::I16, i64::from(v)), - element::Number::I32(v) => self.builder.ins().iconst(types::I32, i64::from(v)), - element::Number::I64(v) => self.builder.ins().iconst(types::I64, v), - element::Number::F32(v) => self + element::Number::U8(v) => Ok(self.builder.ins().iconst(types::I8, i64::from(v))), + element::Number::U16(v) => Ok(self.builder.ins().iconst(types::I16, i64::from(v))), + element::Number::U32(v) => Ok(self.builder.ins().iconst(types::I32, i64::from(v))), + element::Number::U64(v) => Ok(self.builder.ins().iconst(types::I64, v as i64)), + element::Number::I8(v) => Ok(self.builder.ins().iconst(types::I8, i64::from(v))), + element::Number::I16(v) => Ok(self.builder.ins().iconst(types::I16, i64::from(v))), + element::Number::I32(v) => Ok(self.builder.ins().iconst(types::I32, i64::from(v))), + element::Number::I64(v) => Ok(self.builder.ins().iconst(types::I64, v)), + element::Number::F32(v) => Ok(self .builder .ins() - .f32const(Ieee32::with_float(v.into_inner())), - element::Number::F64(v) => self + .f32const(Ieee32::with_float(v.into_inner()))), + element::Number::F64(v) => Ok(self .builder .ins() - .f64const(Ieee64::with_float(v.into_inner())), + .f64const(Ieee64::with_float(v.into_inner()))), } } - pub fn eval_string_value(&mut self, entity: ir::Entity, _string_value: &str) -> Value { + pub fn eval_string_value( + &mut self, + entity: ir::Entity, + _string_value: &str, + ) -> error::Result { + use crate::layout::Db as _; + // TODO: create data symbol + let layout = self.db.layout(entity)?; let symbol = self .module .declare_data( &format!("__data_{}", entity.id()), cranelift_module::Linkage::Local, false, + Some(layout.alignment as u8), ) .unwrap(); let local_id = self .module .declare_data_in_func(symbol, &mut self.builder.func); - self.builder.ins().symbol_value(self.ptr_type, local_id) + Ok(self.builder.ins().symbol_value(self.ptr_type, local_id)) } #[cfg_attr( feature = "cargo-clippy", allow(clippy::cast_possible_truncation, clippy::cast_possible_wrap) )] - pub fn eval_tuple(&mut self, entity: ir::Entity, tuple: &element::Tuple) -> Value { - let layout = self.layouts.get(entity).unwrap(); + pub fn eval_tuple( + &mut self, + entity: ir::Entity, + tuple: &element::Tuple, + ) -> error::Result { + use crate::ir::Db as _; + use crate::layout::Db as _; + + let layout = self.db.layout(entity)?; let alloc_size = self.builder.ins().iconst(self.ptr_type, layout.size as i64); let alloc_align = self .builder @@ -208,16 +260,23 @@ impl<'a, 'f> Translator<'a, 'f> { for (idx, offset_layout) in layout.unnamed_fields.iter().enumerate() { let value = tuple.fields[idx]; - let value = self.eval_element(value, self.elements.get(value).unwrap()); + let value = self.eval_element(value, &*self.db.element(value)?)?; let offset = offset_layout.offset as i32; self.builder.ins().store(mem_flags, value, result, offset); } - result + Ok(result) } - pub fn eval_record(&mut self, entity: ir::Entity, record: &element::Record) -> Value { - let layout = self.layouts.get(entity).unwrap(); + pub fn eval_record( + &mut self, + entity: ir::Entity, + record: &element::Record, + ) -> error::Result { + use crate::ir::Db as _; + use crate::layout::Db as _; + + let layout = self.db.layout(entity)?; #[cfg_attr( feature = "cargo-clippy", @@ -241,7 +300,7 @@ impl<'a, 'f> Translator<'a, 'f> { for named_field in &layout.named_fields { let value = record.fields[&named_field.field]; - let value = self.eval_element(value, self.elements.get(value).unwrap()); + let value = self.eval_element(value, &*self.db.element(value)?)?; #[cfg_attr( feature = "cargo-clippy", @@ -251,47 +310,59 @@ impl<'a, 'f> Translator<'a, 'f> { self.builder.ins().store(mem_flags, value, result, offset); } - result + Ok(result) } - pub fn eval_un_op(&mut self, _entity: ir::Entity, un_op: &element::UnOp) -> Value { + pub fn eval_un_op( + &mut self, + _entity: ir::Entity, + un_op: &element::UnOp, + ) -> error::Result { + use crate::ir::Db as _; + let element::UnOp { operator, operand } = un_op; - let operand = *operand; - let operand_value = self.eval_element(operand, self.elements.get(operand).unwrap()); + let operand_value = self.eval_element(*operand, &*self.db.element(*operand)?)?; match operator { element::UnOperator::Not | element::UnOperator::BNot => { - self.builder.ins().bnot(operand_value) + Ok(self.builder.ins().bnot(operand_value)) } - element::UnOperator::Cl0 => self.builder.ins().clz(operand_value), + element::UnOperator::Cl0 => Ok(self.builder.ins().clz(operand_value)), element::UnOperator::Cl1 => { let inverted = self.builder.ins().bnot(operand_value); - self.builder.ins().clz(inverted) + Ok(self.builder.ins().clz(inverted)) } - element::UnOperator::Cls => self.builder.ins().cls(operand_value), - element::UnOperator::Ct0 => self.builder.ins().ctz(operand_value), + element::UnOperator::Cls => Ok(self.builder.ins().cls(operand_value)), + element::UnOperator::Ct0 => Ok(self.builder.ins().ctz(operand_value)), element::UnOperator::Ct1 => { let inverted = self.builder.ins().bnot(operand_value); - self.builder.ins().ctz(inverted) + Ok(self.builder.ins().ctz(inverted)) } element::UnOperator::C0 => { let inverted = self.builder.ins().bnot(operand_value); - self.builder.ins().popcnt(inverted) + Ok(self.builder.ins().popcnt(inverted)) } - element::UnOperator::C1 => self.builder.ins().popcnt(operand_value), - element::UnOperator::Sqrt => self.builder.ins().sqrt(operand_value), + element::UnOperator::C1 => Ok(self.builder.ins().popcnt(operand_value)), + element::UnOperator::Sqrt => Ok(self.builder.ins().sqrt(operand_value)), } } - pub fn eval_bi_op(&mut self, entity: ir::Entity, bi_op: &element::BiOp) -> Value { + pub fn eval_bi_op( + &mut self, + entity: ir::Entity, + bi_op: &element::BiOp, + ) -> error::Result { + use crate::ir::Db as _; + use crate::ty::Db as _; + let element::BiOp { lhs, operator, rhs } = bi_op; let lhs = *lhs; let rhs = *rhs; // TODO: support lazy evaluation - let lhs_value = self.eval_element(lhs, self.elements.get(lhs).unwrap()); - let rhs_value = self.eval_element(rhs, self.elements.get(rhs).unwrap()); + let lhs_value = self.eval_element(lhs, &*self.db.element(lhs)?)?; + let rhs_value = self.eval_element(rhs, &*self.db.element(rhs)?)?; match operator { element::BiOperator::Eq => unimplemented!(), @@ -301,84 +372,97 @@ impl<'a, 'f> Translator<'a, 'f> { element::BiOperator::Gt => unimplemented!(), element::BiOperator::Le => unimplemented!(), element::BiOperator::Cmp => unimplemented!(), - element::BiOperator::Add => match self.types.get(lhs).unwrap().scalar_class() { - ty::class::Scalar::Integral(_) => self.builder.ins().iadd(lhs_value, rhs_value), - ty::class::Scalar::Fractional => self.builder.ins().fadd(lhs_value, rhs_value), + element::BiOperator::Add => match self.db.ty(lhs)?.scalar_class() { + ty::class::Scalar::Integral(_) => Ok(self.builder.ins().iadd(lhs_value, rhs_value)), + ty::class::Scalar::Fractional => Ok(self.builder.ins().fadd(lhs_value, rhs_value)), _ => unreachable!(), }, - element::BiOperator::Sub => match self.types.get(lhs).unwrap().scalar_class() { - ty::class::Scalar::Integral(_) => self.builder.ins().isub(lhs_value, rhs_value), - ty::class::Scalar::Fractional => self.builder.ins().fsub(lhs_value, rhs_value), + element::BiOperator::Sub => match self.db.ty(lhs)?.scalar_class() { + ty::class::Scalar::Integral(_) => Ok(self.builder.ins().isub(lhs_value, rhs_value)), + ty::class::Scalar::Fractional => Ok(self.builder.ins().fsub(lhs_value, rhs_value)), _ => unreachable!(), }, - element::BiOperator::Mul => match self.types.get(lhs).unwrap().scalar_class() { - ty::class::Scalar::Integral(_) => self.builder.ins().imul(lhs_value, rhs_value), - ty::class::Scalar::Fractional => self.builder.ins().fmul(lhs_value, rhs_value), + element::BiOperator::Mul => match self.db.ty(lhs)?.scalar_class() { + ty::class::Scalar::Integral(_) => Ok(self.builder.ins().imul(lhs_value, rhs_value)), + ty::class::Scalar::Fractional => Ok(self.builder.ins().fmul(lhs_value, rhs_value)), _ => unreachable!(), }, - element::BiOperator::Div => match self.types.get(lhs).unwrap().scalar_class() { + element::BiOperator::Div => match self.db.ty(lhs)?.scalar_class() { ty::class::Scalar::Integral(ty::class::IntegralScalar::Unsigned) => { - self.error_if_zero(entity, rhs_value, module::ErrorKind::IntegerDivisonByZero); - self.builder.ins().udiv(lhs_value, rhs_value) + self.error_if_zero(entity, rhs_value, module::ErrorKind::IntegerDivisonByZero)?; + Ok(self.builder.ins().udiv(lhs_value, rhs_value)) } ty::class::Scalar::Integral(ty::class::IntegralScalar::Signed) => { - self.error_if_zero(entity, rhs_value, module::ErrorKind::IntegerDivisonByZero); - self.builder.ins().sdiv(lhs_value, rhs_value) + self.error_if_zero(entity, rhs_value, module::ErrorKind::IntegerDivisonByZero)?; + Ok(self.builder.ins().sdiv(lhs_value, rhs_value)) } - ty::class::Scalar::Fractional => self.builder.ins().fdiv(lhs_value, rhs_value), + ty::class::Scalar::Fractional => Ok(self.builder.ins().fdiv(lhs_value, rhs_value)), _ => unreachable!(), }, - element::BiOperator::Rem => match self.types.get(lhs).unwrap().scalar_class() { + element::BiOperator::Rem => match self.db.ty(lhs)?.scalar_class() { ty::class::Scalar::Integral(ty::class::IntegralScalar::Unsigned) => { - self.error_if_zero(entity, rhs_value, module::ErrorKind::IntegerDivisonByZero); - self.builder.ins().urem(lhs_value, rhs_value) + self.error_if_zero(entity, rhs_value, module::ErrorKind::IntegerDivisonByZero)?; + Ok(self.builder.ins().urem(lhs_value, rhs_value)) } ty::class::Scalar::Integral(ty::class::IntegralScalar::Signed) => { - self.error_if_zero(entity, rhs_value, module::ErrorKind::IntegerDivisonByZero); - self.builder.ins().srem(lhs_value, rhs_value) + self.error_if_zero(entity, rhs_value, module::ErrorKind::IntegerDivisonByZero)?; + Ok(self.builder.ins().srem(lhs_value, rhs_value)) } _ => unreachable!(), }, element::BiOperator::And | element::BiOperator::BAnd => { - self.builder.ins().band(lhs_value, rhs_value) + Ok(self.builder.ins().band(lhs_value, rhs_value)) } element::BiOperator::Or | element::BiOperator::BOr => { - self.builder.ins().bor(lhs_value, rhs_value) + Ok(self.builder.ins().bor(lhs_value, rhs_value)) } element::BiOperator::Xor | element::BiOperator::BXor => { - self.builder.ins().bxor(lhs_value, rhs_value) + Ok(self.builder.ins().bxor(lhs_value, rhs_value)) } element::BiOperator::AndNot | element::BiOperator::BAndNot => { - self.builder.ins().band_not(lhs_value, rhs_value) + Ok(self.builder.ins().band_not(lhs_value, rhs_value)) } element::BiOperator::OrNot | element::BiOperator::BOrNot => { - self.builder.ins().bor_not(lhs_value, rhs_value) + Ok(self.builder.ins().bor_not(lhs_value, rhs_value)) } element::BiOperator::XorNot | element::BiOperator::BXorNot => { - self.builder.ins().bxor_not(lhs_value, rhs_value) + Ok(self.builder.ins().bxor_not(lhs_value, rhs_value)) } - element::BiOperator::RotL => self.builder.ins().rotl(lhs_value, rhs_value), - element::BiOperator::RotR => self.builder.ins().rotr(lhs_value, rhs_value), - element::BiOperator::ShL => self.builder.ins().ishl(lhs_value, rhs_value), - element::BiOperator::ShR => match self.types.get(lhs).unwrap().scalar_class() { + element::BiOperator::RotL => Ok(self.builder.ins().rotl(lhs_value, rhs_value)), + element::BiOperator::RotR => Ok(self.builder.ins().rotr(lhs_value, rhs_value)), + element::BiOperator::ShL => Ok(self.builder.ins().ishl(lhs_value, rhs_value)), + element::BiOperator::ShR => match self.db.ty(lhs)?.scalar_class() { ty::class::Scalar::Integral(ty::class::IntegralScalar::Unsigned) => { - self.builder.ins().ushr(lhs_value, rhs_value) + Ok(self.builder.ins().ushr(lhs_value, rhs_value)) } ty::class::Scalar::Integral(ty::class::IntegralScalar::Signed) => { - self.builder.ins().sshr(lhs_value, rhs_value) + Ok(self.builder.ins().sshr(lhs_value, rhs_value)) } _ => unreachable!(), }, } } - pub fn eval_variable(&mut self, entity: ir::Entity, _variable: &element::Variable) -> Value { - self.builder.use_var(self.variables[&entity]) + pub fn eval_variable( + &mut self, + entity: ir::Entity, + _variable: &element::Variable, + ) -> error::Result { + Ok(self.builder.use_var(self.variables[&entity])) } - pub fn eval_select(&mut self, _entity: ir::Entity, select: &element::Select) -> Value { - let record_layout = self.layouts.get(select.record).unwrap(); - let record_type = match self.types.get(select.record).unwrap() { + pub fn eval_select( + &mut self, + _entity: ir::Entity, + select: &element::Select, + ) -> error::Result { + use crate::ir::Db as _; + use crate::layout::Db as _; + use crate::ty::Db as _; + + let record_layout = self.db.layout(select.record)?; + let ty = self.db.ty(select.record)?; + let record_type = match &*ty { ty::Type::Record(r) => r, _ => unreachable!(), }; @@ -394,7 +478,7 @@ impl<'a, 'f> Translator<'a, 'f> { let field_offset = record_layout .named_fields .iter() - .find(|f| *f.field == select.field) + .find(|f| f.field == select.field) .unwrap() .offset_layout .offset as i32; @@ -404,35 +488,46 @@ impl<'a, 'f> Translator<'a, 'f> { mem_flags.set_aligned(); mem_flags.set_readonly(); - let record = self.eval_element(select.record, self.elements.get(select.record).unwrap()); + let record = self.eval_element(select.record, &*self.db.element(select.record)?)?; - self.builder + Ok(self + .builder .ins() - .load(field_abi_type, mem_flags, record, field_offset) + .load(field_abi_type, mem_flags, record, field_offset)) } - pub fn eval_parameter(&mut self, entity: ir::Entity, _parameter: &element::Parameter) -> Value { - self.builder.use_var(self.variables[&entity]) + pub fn eval_parameter( + &mut self, + entity: ir::Entity, + _parameter: &element::Parameter, + ) -> error::Result { + Ok(self.builder.use_var(self.variables[&entity])) } - pub fn eval_apply(&mut self, entity: ir::Entity, apply: &element::Apply) -> Value { + pub fn eval_apply( + &mut self, + entity: ir::Entity, + apply: &element::Apply, + ) -> error::Result { + use crate::ir::Db as _; + use crate::ty::Db as _; + let mut sig = self.module.make_signature(); for parameter in &apply.parameters { sig.params.push(AbiParam::new( - abi_type::AbiType::from_ir_type(self.types.get(*parameter).unwrap()) + abi_type::AbiType::from_ir_type(&*self.db.ty(*parameter)?) .into_specific(self.ptr_type), )); } // Result sig.returns.push(AbiParam::new( - abi_type::AbiType::from_ir_type(self.types.get(entity).unwrap()) - .into_specific(self.ptr_type), + abi_type::AbiType::from_ir_type(&*self.db.ty(entity)?).into_specific(self.ptr_type), )); // Error sig.returns.push(AbiParam::new(self.ptr_type)); - let name = self.get_symbol(apply.function).unwrap().to_string(); + let name = super::Symbol(self.db, apply.function).to_string(); let callee = self .module .declare_function(&name, cranelift_module::Linkage::Import, &sig) @@ -444,8 +539,8 @@ impl<'a, 'f> Translator<'a, 'f> { let parameter_values = apply .parameters .iter() - .map(|p| self.eval_element(*p, self.elements.get(*p).unwrap())) - .collect::>(); + .map(|p| Ok(self.eval_element(*p, &*self.db.element(*p)?)?)) + .collect::>>()?; let call = self.builder.ins().call(local_callee, ¶meter_values); @@ -453,7 +548,7 @@ impl<'a, 'f> Translator<'a, 'f> { let result = results[0]; let error = results[1]; - let location = self.locations.get(entity).unwrap().0; + let location = self.db.location(entity)?; let (filename, filename_len, line, col) = self.immediate_location(location); self.builder.ins().brnz( @@ -461,22 +556,41 @@ impl<'a, 'f> Translator<'a, 'f> { self.error_unwind_ebb, &[error, filename, filename_len, line, col], ); - result + + Ok(result) } - pub fn eval_capture(&mut self, entity: ir::Entity, _capture: &element::Capture) -> Value { - self.builder.use_var(self.variables[&entity]) + pub fn eval_capture( + &mut self, + entity: ir::Entity, + _capture: &element::Capture, + ) -> error::Result { + Ok(self.builder.use_var(self.variables[&entity])) } - pub fn eval_closure(&mut self, _entity: ir::Entity, _closure: &element::Closure) -> Value { + pub fn eval_closure( + &mut self, + _entity: ir::Entity, + _closure: &element::Closure, + ) -> error::Result { unimplemented!() } - pub fn eval_module(&mut self, _entity: ir::Entity, _module: &element::Module) -> Value { + pub fn eval_module( + &mut self, + _entity: ir::Entity, + _module: &element::Module, + ) -> error::Result { unimplemented!() } - pub fn error_if_zero(&mut self, entity: ir::Entity, value: Value, kind: module::ErrorKind) { + pub fn error_if_zero( + &mut self, + entity: ir::Entity, + value: Value, + kind: module::ErrorKind, + ) -> error::Result<()> { + use crate::ir::Db as _; use num_traits::cast::ToPrimitive; let kind = self @@ -484,7 +598,7 @@ impl<'a, 'f> Translator<'a, 'f> { .ins() .iconst(types::I32, i64::from(kind.to_u32().unwrap())); - let location = self.locations.get(entity).unwrap().0; + let location = self.db.location(entity)?; let (filename, filename_len, line, col) = self.immediate_location(location); @@ -493,13 +607,23 @@ impl<'a, 'f> Translator<'a, 'f> { self.error_throw_ebb, &[kind, filename, filename_len, line, col], ); + + Ok(()) } pub fn immediate_location( &mut self, - location: codespan::ByteSpan, + location: location::Location, ) -> (Value, Value, Value, Value) { - let filemap = self.codemap.find_file(location.start()).unwrap(); + let location = location.0; + + let filemap = self + .db + .code_map() + .raw + .find_file(location.start()) + .unwrap() + .clone(); let (line, col) = filemap.location(location.start()).unwrap(); let filename = filemap.name().to_string(); let filename_len = filename.len(); @@ -590,7 +714,10 @@ impl<'a, 'f> Translator<'a, 'f> { } } -impl<'a, 'f> fmt::Debug for Translator<'a, 'f> { +impl<'a, 'f, B, D> fmt::Debug for Translator<'a, 'f, B, D> +where + B: cranelift_module::Backend, +{ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("Translator").finish() } diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs index aa90f46..d935c92 100644 --- a/src/codegen/mod.rs +++ b/src/codegen/mod.rs @@ -15,7 +15,7 @@ use cranelift_simplejit; use crate::db; use crate::interpreter; use crate::ir; -use crate::ir::{element, Entity}; +use crate::ir::element; use crate::layout; use crate::module; use crate::ty; @@ -33,10 +33,7 @@ mod util; #[salsa::query_group(CodegenStorage)] pub trait Db: salsa::Database + interpreter::Db + ir::Db + layout::Db + ty::Db { #[salsa::dependencies] - fn codegen_function(&self, entity: ir::Entity) -> error::Result>>; - - #[salsa::dependencies] - fn codegen_data(&self, entity: ir::Entity) -> error::Result>>; + fn codegen(&self) -> error::Result>; fn codegen_ptr_type(&self) -> codegen::ir::Type; @@ -54,37 +51,128 @@ pub struct Data { #[derive(Clone)] pub struct Isa { - raw: sync::Arc, + raw: sync::Arc, +} + +struct Symbol<'d, D>(&'d D, ir::Entity); + +struct Codegen<'m, 'd, B, D> +where + B: cranelift_module::Backend, +{ + ptr_type: codegen::ir::Type, + module: &'m mut cranelift_module::Module, + db: &'d D, + defined_strings: collections::HashMap, +} + +fn codegen(db: &impl Db) -> error::Result> { + let ptr_type = db.codegen_ptr_type(); + let mut builder = + cranelift_simplejit::SimpleJITBuilder::new(cranelift_module::default_libcall_names()); + let mut module: cranelift_module::Module = + cranelift_module::Module::new(builder); + let mut codegen = Codegen::new(ptr_type, &mut module, db); + codegen.codegen_all()?; + + Ok(sync::Arc::new(module::Module::new( + module, + collections::HashMap::new(), + ))) +} + +fn codegen_ptr_type(db: &impl Db) -> codegen::ir::Type { + match db.ptr_size() { + layout::PtrSize::Size8 => codegen::ir::types::I8, + layout::PtrSize::Size16 => codegen::ir::types::I16, + layout::PtrSize::Size32 => codegen::ir::types::I32, + layout::PtrSize::Size64 => codegen::ir::types::I64, + } } -struct Symbol<'a, D>(&'a D, ir::Entity); +fn codegen_isa(db: &impl Db) -> Isa { + let flag_builder = codegen::settings::builder(); + let isa_builder = cranelift_native::builder().unwrap_or_else(|msg| { + panic!("host machine is not supported: {}", msg); + }); + let raw = isa_builder + .finish(codegen::settings::Flags::new(flag_builder)) + .into(); + Isa { raw } +} + +impl<'m, 'd, B, D> Codegen<'m, 'd, B, D> +where + B: cranelift_module::Backend, + D: Db, +{ + fn new( + ptr_type: codegen::ir::Type, + module: &'m mut cranelift_module::Module, + db: &'d D, + ) -> Self { + let defined_strings = collections::HashMap::new(); + Self { + ptr_type, + module, + db, + defined_strings, + } + } + + fn codegen_all(&mut self) -> error::Result<()> { + for module_entity in self.db.entities()?.modules() { + match &*self.db.element(module_entity)? { + ir::element::Element::Module(ir::element::Module { variables }) => { + for value in variables.values() { + self.codegen_definition(*value)?; + } + } + _ => unreachable!(), + } + } + Ok(()) + } -fn codegen_function( - db: &impl Db, - entity: ir::Entity, -) -> error::Result>> { - if let (element::Element::Closure(closure), ty::Type::Function(ty)) = - (&*db.element(entity)?, &*db.ty(entity)?) - { - let ptr_type = db.codegen_ptr_type(); + fn codegen_definition(&mut self, entity: ir::Entity) -> error::Result<()> { + match ( + &*self.db.element(entity)?, + &*self.db.ty(entity)?, + self.db.value(entity)?, + ) { + (element::Element::Closure(ref closure), ty::Type::Function(ref ty), _) => { + self.codegen_function(entity, closure, ty)?; + Ok(()) + } + _ => Ok(()), // TODO logic error + } + } + + fn codegen_function( + &mut self, + entity: ir::Entity, + closure: &element::Closure, + ty: &ty::Function, + ) -> error::Result> { + use cranelift::codegen::ir::InstBuilder; let mut ctx = codegen::Context::new(); - ctx.func.signature.call_conv = db.codegen_isa().default_call_conv(); - populate_function_signature(ty, ptr_type, &mut ctx); + ctx.func.signature.call_conv = self.db.codegen_isa().default_call_conv(); + let ret_type = self.populate_function_signature(ty, &mut ctx); let mut builder_context = frontend::FunctionBuilderContext::new(); let mut builder = cranelift::frontend::FunctionBuilder::new(&mut ctx.func, &mut builder_context); - let name = Symbol(db, entity).to_string(); + let name = Symbol(self.db, entity).to_string(); let name_len = name.len(); let name_data_id = util::define_string( - &mut module, - &mut defined_strings, - &format!("funcname:{}", sy), + self.module, + &mut self.defined_strings, + &format!("funcname:{}", name), name, ); - let name_global_value = module.declare_data_in_func(name_data_id, builder.func); + let name_global_value = self.module.declare_data_in_func(name_data_id, builder.func); let entry_ebb = builder.create_ebb(); builder.append_ebb_params_for_function_params(entry_ebb); @@ -95,42 +183,38 @@ fn codegen_function( builder.switch_to_block(entry_ebb); builder.seal_block(entry_ebb); - let variables = declare_variables( - elements, - types, - ptr_type, + let variables = self.declare_variables( &mut builder, &closure.parameters, &closure.statements, entry_ebb, - ); + )?; let result = { let mut translation_ctx = function::Translator::new( - &mut module, + self.module, &mut builder, - db, - ptr_type, + self.db, + self.ptr_type, error_throw_ebb, error_unwind_ebb, &variables, - &mut defined_strings, - codemap, + &mut self.defined_strings, ); for stmt in &closure.statements { - translation_ctx.exec_element(*stmt, &*db.element(*stmt)?); + translation_ctx.exec_element(*stmt, &*self.db.element(*stmt)?)?; } - translation_ctx.eval_element(closure.result, db.element(&*closure.result)?) + translation_ctx.eval_element(closure.result, &*self.db.element(closure.result)?)? }; - let null_error = builder.ins().iconst(ptr_type, 0); + let null_error = builder.ins().iconst(self.ptr_type, 0); builder.ins().return_(&[result, null_error]); let error_kind = builder.append_ebb_param(error_throw_ebb, types::I32); - let error_filename = builder.append_ebb_param(error_throw_ebb, ptr_type); - let error_filename_len = builder.append_ebb_param(error_throw_ebb, ptr_type); + let error_filename = builder.append_ebb_param(error_throw_ebb, self.ptr_type); + let error_filename_len = builder.append_ebb_param(error_throw_ebb, self.ptr_type); let error_line = builder.append_ebb_param(error_throw_ebb, types::I32); let error_col = builder.append_ebb_param(error_throw_ebb, types::I32); builder.switch_to_block(error_throw_ebb); @@ -138,15 +222,14 @@ fn codegen_function( let error = { let mut translation_ctx = function::Translator::new( - &mut module, + self.module, &mut builder, - db, - ptr_type, + self.db, + self.ptr_type, error_throw_ebb, error_unwind_ebb, &variables, - &mut defined_strings, - codemap, + &mut self.defined_strings, ); translation_ctx.builtin_error(error_kind) }; @@ -161,28 +244,27 @@ fn codegen_function( ], ); - let error = builder.append_ebb_param(error_unwind_ebb, ptr_type); - let error_filename = builder.append_ebb_param(error_unwind_ebb, ptr_type); - let error_filename_len = builder.append_ebb_param(error_unwind_ebb, ptr_type); + let error = builder.append_ebb_param(error_unwind_ebb, self.ptr_type); + let error_filename = builder.append_ebb_param(error_unwind_ebb, self.ptr_type); + let error_filename_len = builder.append_ebb_param(error_unwind_ebb, self.ptr_type); let error_line = builder.append_ebb_param(error_unwind_ebb, types::I32); let error_col = builder.append_ebb_param(error_unwind_ebb, types::I32); builder.switch_to_block(error_unwind_ebb); builder.seal_block(error_unwind_ebb); - let name = builder.ins().global_value(ptr_type, name_global_value); - let name_len = builder.ins().iconst(ptr_type, name_len as i64); + let name = builder.ins().global_value(self.ptr_type, name_global_value); + let name_len = builder.ins().iconst(self.ptr_type, name_len as i64); { let mut translation_ctx = function::Translator::new( - &mut module, + self.module, &mut builder, - db, - ptr_type, + self.db, + self.ptr_type, error_throw_ebb, error_unwind_ebb, &variables, - &mut defined_strings, - codemap, + &mut self.defined_strings, ); translation_ctx.builtin_unwind_frame( error, @@ -209,64 +291,99 @@ fn codegen_function( builder.finalize(); debug!("generated function: {}", builder.display(None)); - Ok(Some(sync::Arc::new(Function { ctx }))) - } else { - Ok(None) + Ok(sync::Arc::new(Function { ctx })) } -} -fn populate_function_signature( - ty: &ty::Function, - ptr_type: codegen::ir::Type, - ctx: &mut codegen::Context, -) { - for parameter in &ty.parameters { - ctx.func.signature.params.push(codegen::ir::AbiParam::new( - abi_type::AbiType::from_ir_type(parameter).into_specific(ptr_type), - )); + fn populate_function_signature( + &mut self, + ty: &ty::Function, + ctx: &mut codegen::Context, + ) -> codegen::ir::Type { + for parameter in &ty.parameters { + ctx.func.signature.params.push(codegen::ir::AbiParam::new( + abi_type::AbiType::from_ir_type(parameter).into_specific(self.ptr_type), + )); + } + + let ret_type = abi_type::AbiType::from_ir_type(&ty.result).into_specific(self.ptr_type); + + // Result, error + ctx.func.signature.returns.extend(&[ + codegen::ir::AbiParam::new(ret_type), + codegen::ir::AbiParam::new(self.ptr_type), + ]); + + ret_type } - let ret_type = abi_type::AbiType::from_ir_type(&ty.result).into_specific(ptr_type); + fn codegen_data(&mut self, entity: ir::Entity) -> error::Result>> { + if let Some(value) = self.db.value(entity)? { + let layout = self.db.layout(entity)?; + let ptr_type = self.db.codegen_ptr_type(); + let mut ctx = cranelift_module::DataContext::new(); + let mut data = Vec::new(); + data::Translator::new(&mut data, ptr_type).store_value(&*layout, &value); + ctx.define(data.into_boxed_slice()); + Ok(Some(sync::Arc::new(Data { ctx }))) + } else { + Ok(None) + } + } - // Result, error - ctx.func.signature.returns.extend(&[ - codegen::ir::AbiParam::new(ret_type), - codegen::ir::AbiParam::new(ptr_type), - ]); -} + fn declare_variables( + &mut self, + builder: &mut cranelift::frontend::FunctionBuilder, + params: &[ir::Entity], + statements: &[ir::Entity], + entry_ebb: codegen::ir::Ebb, + ) -> error::Result> { + let mut next_var = 0; + let mut variables = collections::HashMap::new(); + + for (i, param) in params.iter().enumerate() { + let param_initializer = builder.ebb_params(entry_ebb)[i]; + let var = self.declare_variable(builder, &mut variables, &mut next_var, *param)?; + builder.def_var(var, param_initializer); + } -fn codegen_data(db: &impl Db, entity: ir::Entity) -> error::Result>> { - if let Some(value) = db.value(entity)? { - let layout = db.layout(entity)?; - let ptr_type = db.codegen_ptr_type(); - let mut ctx = cranelift_module::DataContext::new(); - let mut data = Vec::new(); - data::Translator::new(&mut data, ptr_type).store_value(&*layout, &value); - ctx.define(data.into_boxed_slice()); - Ok(Some(sync::Arc::new(Data { ctx }))) - } else { - Ok(None) + for statement in statements { + self.declare_variables_in_element(builder, &mut variables, &mut next_var, *statement)?; + } + + Ok(variables) } -} -fn codegen_ptr_type(db: &impl Db) -> codegen::ir::Type { - match db.ptr_size() { - layout::PtrSize::Size8 => codegen::ir::types::I8, - layout::PtrSize::Size16 => codegen::ir::types::I16, - layout::PtrSize::Size32 => codegen::ir::types::I32, - layout::PtrSize::Size64 => codegen::ir::types::I64, + fn declare_variables_in_element( + &mut self, + builder: &mut cranelift::frontend::FunctionBuilder, + variables: &mut collections::HashMap, + next_var: &mut u32, + entity: ir::Entity, + ) -> error::Result<()> { + if let element::Element::Variable(_) = *self.db.element(entity)? { + self.declare_variable(builder, variables, next_var, entity)?; + } + Ok(()) } -} -fn codegen_isa(db: &impl Db) -> Isa { - let flag_builder = codegen::settings::builder(); - let isa_builder = cranelift_native::builder().unwrap_or_else(|msg| { - panic!("host machine is not supported: {}", msg); - }); - let raw = isa_builder - .finish(codegen::settings::Flags::new(flag_builder)) - .into(); - Isa { raw } + fn declare_variable( + &mut self, + builder: &mut cranelift::frontend::FunctionBuilder, + variables: &mut collections::HashMap, + next_var: &mut u32, + entity: ir::Entity, + ) -> error::Result { + let ty = self.db.ty(entity)?; + Ok(*variables.entry(entity).or_insert_with(|| { + let var = cranelift::frontend::Variable::with_u32(*next_var); + *next_var += 1; + builder.declare_var( + var, + abi_type::AbiType::from_ir_type(&*ty).into_specific(self.ptr_type), + ); + var + })) + } } impl fmt::Debug for Function { @@ -288,466 +405,14 @@ impl fmt::Debug for Isa { } impl ops::Deref for Isa { - type Target = codegen::isa::TargetIsa; + type Target = dyn codegen::isa::TargetIsa; fn deref(&self) -> &Self::Target { &*self.raw } } -/* -impl<'a> Codegen<'a> { - /// Creates a new codegen instance around the specified IR. - pub fn new(db: &'a db::Db) -> Self { - Self { - db - } - } - - /// Compiles the captured IR into a module. - pub fn compile(&self) -> module::Module { - let entities = db.entities(); - - let mut builder = cranelift_simplejit::SimpleJITBuilder::new(); - - builder.symbols(builtin::BUILTINS.iter().map(|b| (b.symbol, b.ptr))); - - let mut module: cranelift_module::Module = - cranelift_module::Module::new(builder); - let ptr_type = module.target_config().pointer_type(); - - let data_ctxs: Vec<_> = entities.all() - .map(|(entity, layout, constexpr)| { - let layout = self.db.layout(entity); - let value = self.db.value(entity); - - let mut ctx = cranelift_module::DataContext::new(); - let mut data = Vec::new(); - data::Translator::new(&mut data, ptr_type).store_value(layout, &constexpr.value); - ctx.define(data.into_boxed_slice()); - (entity, ctx) - }) - .best_collect(); - - let mut defined_strings = collections::HashMap::new(); - - let function_ctxs = entities.all() - .flat_map(|(el, sy, ty)| { - if let Some((closure, ty)) = as_closure(el, ty) { - let mut ctx: codegen::Context = module.make_context(); - let mut builder_context = FunctionBuilderContext::new(); - - for parameter in &ty.parameters { - ctx.func.signature.params.push(AbiParam::new( - abi_type::AbiType::from_ir_type(parameter).into_specific(ptr_type), - )); - } - let ret_type = - abi_type::AbiType::from_ir_type(&ty.result).into_specific(ptr_type); - // Result - ctx.func.signature.returns.push(AbiParam::new(ret_type)); - // Error - ctx.func.signature.returns.push(AbiParam::new(ptr_type)); - - { - let mut builder = FunctionBuilder::new(&mut ctx.func, &mut builder_context); - - let name = sy.to_string(); - let name_len = name.len(); - let name_data_id = util::define_string( - &mut module, - &mut defined_strings, - &format!("funcname:{}", sy), - name, - ); - let name_global_value = - module.declare_data_in_func(name_data_id, builder.func); - - let entry_ebb = builder.create_ebb(); - builder.append_ebb_params_for_function_params(entry_ebb); - - let error_throw_ebb = builder.create_ebb(); - let error_unwind_ebb = builder.create_ebb(); - - builder.switch_to_block(entry_ebb); - builder.seal_block(entry_ebb); - - let variables = declare_variables( - elements, - types, - ptr_type, - &mut builder, - &closure.parameters, - &closure.statements, - entry_ebb, - ); - - let result = { - let mut translation_ctx = function::Translator::new( - &mut module, - &mut builder, - constexprs, - elements, - layouts, - locations, - symbols, - types, - ptr_type, - error_throw_ebb, - error_unwind_ebb, - &variables, - &mut defined_strings, - codemap, - ); - - for stmt in &closure.statements { - translation_ctx - .exec_element(*stmt, self.elements.get(*stmt).unwrap()); - } - - translation_ctx.eval_element( - closure.result, - self.elements.get(closure.result).unwrap(), - ) - }; - - let null_error = builder.ins().iconst(ptr_type, 0); - builder.ins().return_(&[result, null_error]); - - let error_kind = builder.append_ebb_param(error_throw_ebb, types::I32); - let error_filename = builder.append_ebb_param(error_throw_ebb, ptr_type); - let error_filename_len = - builder.append_ebb_param(error_throw_ebb, ptr_type); - let error_line = builder.append_ebb_param(error_throw_ebb, types::I32); - let error_col = builder.append_ebb_param(error_throw_ebb, types::I32); - builder.switch_to_block(error_throw_ebb); - builder.seal_block(error_throw_ebb); - - let error = { - let mut translation_ctx = function::Translator::new( - &mut module, - &mut builder, - constexprs, - elements, - layouts, - locations, - symbols, - types, - ptr_type, - error_throw_ebb, - error_unwind_ebb, - &variables, - &mut defined_strings, - codemap, - ); - translation_ctx.builtin_error(error_kind) - }; - builder.ins().jump( - error_unwind_ebb, - &[ - error, - error_filename, - error_filename_len, - error_line, - error_col, - ], - ); - - let error = builder.append_ebb_param(error_unwind_ebb, ptr_type); - let error_filename = builder.append_ebb_param(error_unwind_ebb, ptr_type); - let error_filename_len = - builder.append_ebb_param(error_unwind_ebb, ptr_type); - let error_line = builder.append_ebb_param(error_unwind_ebb, types::I32); - let error_col = builder.append_ebb_param(error_unwind_ebb, types::I32); - builder.switch_to_block(error_unwind_ebb); - builder.seal_block(error_unwind_ebb); - - let name = builder.ins().global_value(ptr_type, name_global_value); - let name_len = builder.ins().iconst(ptr_type, name_len as i64); - - { - let mut translation_ctx = function::Translator::new( - &mut module, - &mut builder, - constexprs, - elements, - layouts, - locations, - symbols, - types, - ptr_type, - error_throw_ebb, - error_unwind_ebb, - &variables, - &mut defined_strings, - codemap, - ); - translation_ctx.builtin_unwind_frame( - error, - name, - name_len, - error_filename, - error_filename_len, - error_line, - error_col, - ); - }; - - let null_result = if ret_type.is_int() { - builder.ins().iconst(ret_type, 0) - } else if ret_type == types::F32 { - builder.ins().f32const(Ieee32::with_float(0.0)) - } else if ret_type == types::F64 { - builder.ins().f64const(Ieee64::with_float(0.0)) - } else { - unimplemented!() - }; - builder.ins().return_(&[null_result, error]); - - builder.finalize(); - - debug!("generated function: {}", builder.display(None)); - } - - let mut result = Vec::new(); - - if sy.is_top_level() { - let mut public_ctx: codegen::Context = module.make_context(); - let mut public_builder_context = FunctionBuilderContext::new(); - - for i in 0..ty.parameters.len() { - public_ctx - .func - .signature - .params - .push(ctx.func.signature.params[i]); - } - // Error pointer - public_ctx - .func - .signature - .params - .push(AbiParam::new(ptr_type)); - - // Result - public_ctx - .func - .signature - .returns - .push(AbiParam::new(ret_type)); - - { - let mut builder = FunctionBuilder::new( - &mut public_ctx.func, - &mut public_builder_context, - ); - let entry_ebb = builder.create_ebb(); - builder.append_ebb_params_for_function_params(entry_ebb); - - let error_ebb = builder.create_ebb(); - - builder.switch_to_block(entry_ebb); - builder.seal_block(entry_ebb); - - let fn_name = sy.to_string(); - let callee = module - .declare_function( - &fn_name, - cranelift_module::Linkage::Local, - &ctx.func.signature, - ) - .unwrap(); - let local_callee = - module.declare_func_in_func(callee, &mut builder.func); - - let (error_out_ptr, parameter_values) = - builder.ebb_params(entry_ebb).split_last().unwrap(); - let error_out_ptr = *error_out_ptr; - let parameter_values = parameter_values.to_vec(); - - let call = builder.ins().call(local_callee, ¶meter_values); - - let results = builder.inst_results(call); - let result = results[0]; - let error = results[1]; - - builder - .ins() - .brnz(error, error_ebb, &[error, error_out_ptr]); - builder.ins().return_(&[result]); - - let error = builder.append_ebb_param(error_ebb, ptr_type); - let error_out_ptr = builder.append_ebb_param(error_ebb, ptr_type); - builder.switch_to_block(error_ebb); - builder.seal_block(error_ebb); - - let null_result = if ret_type.is_int() { - builder.ins().iconst(ret_type, 0) - } else if ret_type == types::F32 { - builder.ins().f32const(Ieee32::with_float(0.0)) - } else if ret_type == types::F64 { - builder.ins().f64const(Ieee64::with_float(0.0)) - } else { - unimplemented!() - }; - - let mut mem_flags = MemFlags::new(); - mem_flags.set_notrap(); - mem_flags.set_aligned(); - builder.ins().store(mem_flags, error, error_out_ptr, 0_i32); - builder.ins().return_(&[null_result]); - - builder.finalize(); - } - - result.push((sy.clone().into_public(), public_ctx)); - } - result.push((sy.clone(), ctx)); - - result - } else { - Vec::new() - } - }) - .collect::>(); - - let mut declared_functions = Vec::new(); - let mut declared_data = Vec::new(); - let mut function_ids = collections::HashMap::new(); - - for (entity, ctx) in data_ctxs { - let data_name = entity.id().to_string(); - let data_id = module - .declare_data(&data_name, cranelift_module::Linkage::Local, false) - .unwrap(); - declared_data.push((data_id, ctx)); - } - - for (sy, ctx) in function_ctxs { - let fn_name = sy.to_string(); - let fn_id = module - .declare_function( - &fn_name, - if sy.is_public() { - cranelift_module::Linkage::Export - } else { - cranelift_module::Linkage::Local - }, - &ctx.func.signature, - ) - .unwrap(); - declared_functions.push((fn_id, ctx)); - if sy.is_public() { - function_ids.insert(fn_name["public:".len()..].to_owned(), fn_id); - } - } - - for (id, data_ctx) in declared_data { - module.define_data(id, &data_ctx).unwrap(); - } - - for (id, mut function_ctx) in declared_functions { - module.define_function(id, &mut function_ctx).unwrap(); - module.clear_context(&mut function_ctx); - } - - module.finalize_definitions(); - - module::Module::new(module, function_ids) - } -} - -impl<'a> fmt::Debug for Codegen<'a> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_struct("Codegen").finish() - } -} - -fn declare_variables( - elements: &specs::ReadStorage, - types: &specs::ReadStorage, - ptr_type: Type, - builder: &mut FunctionBuilder, - params: &[ir::Entity], - statements: &[ir::Entity], - entry_ebb: Ebb, -) -> collections::HashMap { - let mut next_var = 0; - let mut variables = collections::HashMap::new(); - - for (i, param) in params.iter().enumerate() { - let param_initializer = builder.ebb_params(entry_ebb)[i]; - let var = declare_variable( - types, - ptr_type, - builder, - &mut variables, - &mut next_var, - *param, - ); - builder.def_var(var, param_initializer); - } - - for statement in statements { - declare_variables_in_element( - elements, - types, - ptr_type, - builder, - &mut variables, - &mut next_var, - *statement, - ); - } - - variables -} - -fn declare_variables_in_element( - elements: &specs::ReadStorage, - types: &specs::ReadStorage, - ptr_type: Type, - builder: &mut FunctionBuilder, - variables: &mut collections::HashMap, - next_var: &mut usize, - entity: ir::Entity, -) { - if let element::Element::Variable(_) = *elements.get(entity).unwrap() { - declare_variable(types, ptr_type, builder, variables, next_var, entity); - } -} - -fn declare_variable( - types: &specs::ReadStorage, - ptr_type: Type, - builder: &mut FunctionBuilder, - variables: &mut collections::HashMap, - next_var: &mut usize, - entity: ir::Entity, -) -> Variable { - *variables.entry(entity).or_insert_with(|| { - let var = Variable::new(*next_var); - *next_var += 1; - builder.declare_var( - var, - abi_type::AbiType::from_ir_type(types.get(entity).unwrap()).into_specific(ptr_type), - ); - var - }) -} - -fn as_closure<'a, 'b>( - element: &'a element::Element, - ty: &'b ty::Type, -) -> Option<(&'a element::Closure, &'b ty::Function)> { - match (element, ty) { - (element::Element::Closure(c), ty::Type::Function(f)) => Some((c, f)), - _ => None, - } -} -*/ - -impl<'a, D> fmt::Display for Symbol<'a, D> +impl<'d, D> fmt::Display for Symbol<'d, D> where D: Db, { @@ -756,7 +421,7 @@ where } } -fn symbol_fmt_impl(entity: Entity, f: &mut fmt::Formatter, db: &impl Db) -> fmt::Result { +fn symbol_fmt_impl(entity: ir::Entity, f: &mut fmt::Formatter, db: &impl Db) -> fmt::Result { let (parent, role) = db.lookup_entity(entity); if let Some(parent) = parent { @@ -766,9 +431,9 @@ fn symbol_fmt_impl(entity: Entity, f: &mut fmt::Formatter, db: &impl Db) -> fmt: match role { ir::EntityRole::File(file_id) => write!(f, "{:?}", db.file_relative_path(file_id)), - ir::EntityRole::RecordField(ident) => write!(f, "{}", db.lookup_ident(file_id)), + ir::EntityRole::RecordField(ident) => write!(f, "{}", db.lookup_ident(ident)), ir::EntityRole::TupleField(idx) => write!(f, "{}", idx), - ir::EntityRole::VariableDefinition(ident) => write!(f, "{}", db.lookup_ident(file_id)), + ir::EntityRole::VariableDefinition(ident) => write!(f, "{}", db.lookup_ident(ident)), ir::EntityRole::VariableInitializer => write!(f, "(initializer)"), ir::EntityRole::SelectField(ident) => write!(f, "{}", db.lookup_ident(ident)), ir::EntityRole::AppliedFunction => write!(f, "(applied function)"), diff --git a/src/codegen/util.rs b/src/codegen/util.rs index d641d33..a595824 100644 --- a/src/codegen/util.rs +++ b/src/codegen/util.rs @@ -1,14 +1,17 @@ use std::collections; -pub fn define_string( - module: &mut cranelift_module::Module, +pub fn define_string( + module: &mut cranelift_module::Module, defined_strings: &mut collections::HashMap, name: &str, string: String, -) -> cranelift_module::DataId { +) -> cranelift_module::DataId +where + B: cranelift_module::Backend, +{ *defined_strings.entry(name.to_owned()).or_insert_with(|| { let data_id = module - .declare_data(&name, cranelift_module::Linkage::Local, false) + .declare_data(&name, cranelift_module::Linkage::Local, false, None) .unwrap(); let mut ctx = cranelift_module::DataContext::new(); diff --git a/src/ir/mod.rs b/src/ir/mod.rs index fb53e52..b6727f0 100644 --- a/src/ir/mod.rs +++ b/src/ir/mod.rs @@ -1,6 +1,7 @@ //! Intermediate representation variables for the compiler and interpreter. use std::borrow; use std::collections; +use std::fmt; use std::sync; use crate::source; diff --git a/src/ir/tests.rs b/src/ir/tests.rs index 7c5dcba..f208e7b 100644 --- a/src/ir/tests.rs +++ b/src/ir/tests.rs @@ -138,9 +138,7 @@ fn check_module(name: &'static str, source: &str) -> Result<(), String> { use crate::ty::Db as _; let mut codemap = codespan::CodeMap::new(); - let span = codemap - .add_filemap(codespan::FileName::Virtual(name.into()), source.to_owned()) - .span(); + codemap.add_filemap(codespan::FileName::Virtual(name.into()), source.to_owned()); let root_id = source::RootId(1); let file_id = source::FileId(1); @@ -152,7 +150,6 @@ fn check_module(name: &'static str, source: &str) -> Result<(), String> { let mut db = db::Db::new(); db.set_file_text(file_id, sync::Arc::new(source.to_owned())); - db.set_file_span(file_id, span); db.set_file_relative_path(file_id, path); db.set_file_source_root(file_id, root_id); db.set_source_root(root_id, sync::Arc::new(root)); diff --git a/src/source/mod.rs b/src/source/mod.rs index 05d89d9..4e1cda4 100644 --- a/src/source/mod.rs +++ b/src/source/mod.rs @@ -16,10 +16,6 @@ pub trait Db: salsa::Database { #[salsa::input] fn file_text(&self, file_id: FileId) -> sync::Arc; - /// Span of the file. - #[salsa::input] - fn file_span(&self, file_id: FileId) -> codespan::ByteSpan; - /// Path to a file, relative to the root of its source root. #[salsa::input] fn file_relative_path(&self, file_id: FileId) -> relative_path::RelativePathBuf; @@ -35,6 +31,12 @@ pub trait Db: salsa::Database { /// All source roots. #[salsa::input] fn all_source_roots(&self) -> sync::Arc>; + + #[salsa::dependencies] + fn code_map(&self) -> sync::Arc; + + /// Span of the file. + fn file_span(&self, file_id: FileId) -> codespan::ByteSpan; } /// `FileId` is an integer which uniquely identifies a file. @@ -59,3 +61,41 @@ pub struct RootId(pub u32); pub struct Root { pub files: collections::HashMap, } + +#[derive(Default, Clone, Debug)] +pub struct CodeMap { + pub raw: codespan::CodeMap, + file_maps: collections::HashMap>>, +} + +#[derive(Default, Clone, Debug)] +pub struct Text(sync::Arc); + +fn code_map(db: &impl Db) -> sync::Arc { + let mut raw = codespan::CodeMap::new(); + let mut file_maps = collections::HashMap::new(); + + for root_id in &*db.all_source_roots() { + let source_root = db.source_root(*root_id); + for (path, file) in &source_root.files { + let text = db.file_text(*file); + let file_map = raw.add_filemap( + codespan::FileName::Virtual(path.as_str().to_owned().into()), + Text(text), + ); + file_maps.insert(*file, file_map); + } + } + + sync::Arc::new(CodeMap { raw, file_maps }) +} + +fn file_span(db: &impl Db, file_id: FileId) -> codespan::ByteSpan { + db.code_map().file_maps[&file_id].span() +} + +impl AsRef for Text { + fn as_ref(&self) -> &str { + &*self.0 + } +} diff --git a/src/syntax/parser/util.rs b/src/syntax/parser/util.rs index 51d67f5..5c52e1c 100644 --- a/src/syntax/parser/util.rs +++ b/src/syntax/parser/util.rs @@ -277,13 +277,13 @@ pub fn parse_escaped_string( // The +1 is for the initial quote char unicode_start = codespan::ByteOffset((i + 1) as codespan::RawOffset); } - 'a'...'f' => { + 'a'..='f' => { unicode = (c as u32 - 'a' as u32 + 10) + 16 * unicode; } - 'A'...'F' => { + 'A'..='F' => { unicode = (c as u32 - 'A' as u32 + 10) + 16 * unicode; } - '0'...'9' => { + '0'..='9' => { unicode = (c as u32 - '0' as u32) + 16 * unicode; } '}' => { From 6cad5ee161ffd87310c64d23b5c2e1fbd6f41ce0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Flemstr=C3=B6m?= Date: Sun, 18 Aug 2019 17:40:49 +0200 Subject: [PATCH 21/22] Misc changes --- Cargo.lock | 561 +++++++++++++++++++++++++++-------------- Cargo.toml | 18 +- src/bin/tin.rs | 3 +- src/codegen/mod.rs | 288 +++++++++++++++++---- src/codegen/tests.rs | 100 +++++--- src/db.rs | 2 + src/graph.rs | 3 - src/interpreter/mod.rs | 4 +- src/ir/mod.rs | 1 - src/module.rs | 25 +- 10 files changed, 713 insertions(+), 292 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b3a431d..6a78493 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,7 +2,7 @@ # It is not intended for manual editing. [[package]] name = "aho-corasick" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -17,13 +17,9 @@ dependencies = [ ] [[package]] -name = "argon2rs" -version = "0.2.5" +name = "arrayref" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", - "scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] name = "arrayvec" @@ -46,7 +42,7 @@ name = "atty" version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -57,13 +53,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "backtrace" -version = "0.3.33" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "backtrace-sys 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -71,8 +67,16 @@ name = "backtrace-sys" version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "base64" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -94,10 +98,11 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "blake2-rfc" -version = "0.2.18" +name = "blake2b_simd" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -131,6 +136,15 @@ name = "byteorder" version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "c2-chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ppv-lite86 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "cargo-husky" version = "1.4.0" @@ -138,7 +152,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "cc" -version = "1.0.38" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -151,7 +165,7 @@ name = "chrono" version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", @@ -204,111 +218,171 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "cranelift" -version = "0.37.0" +version = "0.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cranelift-codegen 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cranelift-frontend 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-codegen 0.38.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-frontend 0.38.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cranelift-bforest" -version = "0.37.0" +version = "0.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cranelift-entity 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-entity 0.38.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cranelift-codegen" -version = "0.37.0" +version = "0.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cranelift-bforest 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cranelift-codegen-meta 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cranelift-entity 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-bforest 0.38.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-codegen-meta 0.38.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-entity 0.38.0 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "target-lexicon 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cranelift-codegen-meta" -version = "0.37.0" +version = "0.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cranelift-entity 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-entity 0.38.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cranelift-entity" -version = "0.37.0" +version = "0.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "cranelift-frontend" -version = "0.37.0" +version = "0.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cranelift-codegen 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-codegen 0.38.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "target-lexicon 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cranelift-module" -version = "0.37.0" +version = "0.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cranelift-codegen 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cranelift-entity 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-codegen 0.38.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-entity 0.38.0 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cranelift-native" -version = "0.37.0" +version = "0.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cranelift-codegen 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-codegen 0.38.0 (registry+https://github.com/rust-lang/crates.io-index)", "raw-cpuid 6.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "target-lexicon 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cranelift-simplejit" -version = "0.37.0" +version = "0.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cranelift-codegen 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cranelift-module 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cranelift-native 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-codegen 0.38.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-module 0.38.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-native 0.38.0 (registry+https://github.com/rust-lang/crates.io-index)", "errno 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "region 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "target-lexicon 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "crossbeam" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-channel 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-deque 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-epoch 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crossbeam-channel" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crossbeam-deque" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-epoch 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memoffset 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crossbeam-queue" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crossbeam-utils" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "ctor" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.42 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "derive-new" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.42 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -334,8 +408,8 @@ name = "dirs" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_users 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_users 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -345,8 +419,8 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", "strsim 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -365,7 +439,7 @@ name = "ena" version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -385,8 +459,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -396,7 +470,7 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "errno-dragonfly 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -406,7 +480,7 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -414,7 +488,7 @@ name = "failure" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "backtrace 0.3.33 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace 0.3.34 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -425,7 +499,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.42 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", "synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -457,6 +531,16 @@ dependencies = [ "typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "getrandom" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "wasi 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "heck" version = "0.3.1" @@ -505,10 +589,10 @@ dependencies = [ "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "lalrpop-util 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)", "petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "term 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -527,17 +611,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libc" -version = "0.2.60" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "linked-hash-map" -version = "0.5.2" +version = "0.2.62" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "lock_api" -version = "0.2.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -545,7 +624,7 @@ dependencies = [ [[package]] name = "log" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -556,7 +635,7 @@ name = "mach" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -564,6 +643,14 @@ name = "memchr" version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "memoffset" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "new_debug_unreachable" version = "1.0.3" @@ -601,7 +688,7 @@ dependencies = [ [[package]] name = "opaque-debug" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -627,23 +714,22 @@ dependencies = [ [[package]] name = "parking_lot" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "lock_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lock_api 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot_core 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "parking_lot_core" -version = "0.5.0" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", @@ -676,6 +762,11 @@ dependencies = [ "siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "ppv-lite86" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "precomputed-hash" version = "0.1.1" @@ -687,19 +778,19 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "ctor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "ctor 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "output_vt100 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "pretty_env_logger" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "chrono 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -710,6 +801,14 @@ dependencies = [ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "proc-macro2" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "quick-error" version = "1.2.2" @@ -728,15 +827,23 @@ dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "quote" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rand" version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -746,6 +853,19 @@ dependencies = [ "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rand" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "getrandom 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_pcg 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rand_chacha" version = "0.1.1" @@ -755,19 +875,36 @@ dependencies = [ "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rand_chacha" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "c2-chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rand_core" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_core" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "rand_core" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "getrandom 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rand_hc" version = "0.1.0" @@ -776,6 +913,14 @@ dependencies = [ "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rand_isaac" version = "0.1.1" @@ -789,8 +934,8 @@ name = "rand_jitter" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -801,8 +946,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -813,7 +958,16 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_pcg" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -830,7 +984,7 @@ version = "6.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -849,34 +1003,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "redox_users" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "argon2rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", + "rust-argon2 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "aho-corasick 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "utf8-ranges 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex-syntax" -version = "0.6.10" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "ucd-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] name = "region" @@ -884,7 +1034,7 @@ version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "mach 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -894,9 +1044,19 @@ name = "relative-path" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "rust-argon2" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", + "blake2b_simd 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rustc-demangle" -version = "0.1.15" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -922,29 +1082,29 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "salsa" -version = "0.12.3" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "derive-new 0.5.7 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "derive-new 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)", "indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lock_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "salsa-macros 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", + "salsa-macros 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "salsa-macros" -version = "0.12.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.42 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -955,11 +1115,6 @@ dependencies = [ "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "scoped_threadpool" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "scopeguard" version = "1.0.0" @@ -980,20 +1135,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde" -version = "1.0.97" +version = "1.0.99" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde_derive 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_derive" -version = "1.0.97" +version = "1.0.99" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.42 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1003,7 +1158,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1014,7 +1169,7 @@ dependencies = [ "block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1036,7 +1191,7 @@ dependencies = [ "new_debug_unreachable 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "phf_shared 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", "precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache_codegen 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1085,7 +1240,7 @@ dependencies = [ "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.42 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1100,7 +1255,7 @@ dependencies = [ [[package]] name = "syn" -version = "0.15.42" +version = "0.15.44" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1108,6 +1263,16 @@ dependencies = [ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "syn" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "synom" version = "0.11.3" @@ -1123,7 +1288,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.42 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1152,7 +1317,7 @@ name = "termcolor" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "wincolor 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1176,7 +1341,7 @@ name = "time" version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1189,10 +1354,10 @@ dependencies = [ "cargo-husky 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "codespan 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "codespan-reporting 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cranelift 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cranelift-module 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cranelift-native 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cranelift-simplejit 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift 0.38.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-module 0.38.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-native 0.38.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-simplejit 0.38.0 (registry+https://github.com/rust-lang/crates.io-index)", "dot 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "enum-primitive-derive 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1201,14 +1366,14 @@ dependencies = [ "lalrpop 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)", "lalrpop-util 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "ordered-float 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "pretty_assertions 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "pretty_env_logger 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pretty_env_logger 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "salsa 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", + "salsa 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "structopt 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1218,11 +1383,6 @@ name = "typenum" version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "ucd-util" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "unicode-segmentation" version = "1.3.0" @@ -1244,8 +1404,8 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "utf8-ranges" -version = "1.0.3" +name = "unicode-xid" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1263,6 +1423,11 @@ dependencies = [ "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "wasi" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "winapi" version = "0.3.7" @@ -1292,7 +1457,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "wincolor" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1300,25 +1465,27 @@ dependencies = [ ] [metadata] -"checksum aho-corasick 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)" = "36b7aa1ccb7d7ea3f437cf025a2ab1c47cc6c1bc9fc84918ff449def12f5e282" +"checksum aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d" "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" -"checksum argon2rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3f67b0b6a86dae6e67ff4ca2b6201396074996379fba2b92ff649126f37cb392" +"checksum arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0d382e583f07208808f6b1249e60848879ba3543f57c32277bf52d69c2f0f0ee" "checksum arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b8d73f9beda665eaa98ab9e4f7442bd4e7de6652587de55b2525e52e29c1b0ba" "checksum ascii-canvas 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff8eb72df928aafb99fe5d37b383f2fe25bd2a765e3e5f7c365916b6f2463a29" "checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90" "checksum autocfg 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "22130e92352b948e7e82a49cdb0aa94f2211761117f29e052dd397c1ac33542b" -"checksum backtrace 0.3.33 (registry+https://github.com/rust-lang/crates.io-index)" = "88fb679bc9af8fa639198790a77f52d345fe13656c08b43afa9424c206b731c6" +"checksum backtrace 0.3.34 (registry+https://github.com/rust-lang/crates.io-index)" = "b5164d292487f037ece34ec0de2fcede2faa162f085dd96d2385ab81b12765ba" "checksum backtrace-sys 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)" = "82a830b4ef2d1124a711c71d263c5abdc710ef8e907bd508c88be475cebc422b" +"checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" "checksum bit-set 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e84c238982c4b1e1ee668d136c510c67a13465279c0cb367ea6baf6310620a80" "checksum bit-vec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f59bbe95d4e52a6398ec21238d31577f2b28a9d86807f06ca59d191d8440d0bb" "checksum bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d155346769a6855b86399e9bc3814ab343cd3d62c7e985113d46a0ec3c281fd" -"checksum blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" +"checksum blake2b_simd 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "461f4b879a8eb70c1debf7d0788a9a5ff15f1ea9d25925fea264ef4258bed6b2" "checksum block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" "checksum block-padding 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6d4dc3af3ee2e12f3e5d224e5e1e3d73668abbeb69e566d361f7d5563a4fdf09" "checksum byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" "checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5" +"checksum c2-chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7d64d04786e0f528460fc884753cf8dddcc466be308f6026f8e355c41a0e4101" "checksum cargo-husky 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee1f6a41bcc9d0aeff394d58275742a53beb62da685d8046c4756a8e4a507bbf" -"checksum cc 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)" = "ce400c638d48ee0e9ab75aef7997609ec57367ccfe1463f21bf53c3eca67bf46" +"checksum cc 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)" = "b548a4ee81fccb95919d4e22cfea83c7693ebfd78f0495493178db20b3139da7" "checksum cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33" "checksum chrono 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "77d81f58b7301084de3b958691458a53c3f7e0b1d702f77e550b6a88e3a88abe" "checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" @@ -1326,17 +1493,23 @@ dependencies = [ "checksum codespan 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "03ed0fdf823b4a01c3b6a3e086b4d0a2def8d3cb75b110ec5c988fe2790860a9" "checksum codespan-reporting 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2ae73f6c4b3803dc2a0fe08ed1ce40e8f3f94ecc8394a82e0696bbc86d4e4fc3" "checksum constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8ff012e225ce166d4422e0e78419d901719760f62ae2b7969ca6b564d1b54a9e" -"checksum cranelift 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e1862679d0d787f236a1ca89b4c4c2f3626e8ce9a5b50f0c62bd297cb2d0e90a" -"checksum cranelift-bforest 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60b4a5e7a7d418613617ce28df210d3bab92c6267762d3c6583b0369d7355f9e" -"checksum cranelift-codegen 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b0f313414896a0e26f2fc72262dc08211eeef7185f0c9a9c933310579991f2bf" -"checksum cranelift-codegen-meta 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bd9de6ac290a8e10cb61b7e99518a71e5ba4569aed84a35d950c66055f6ba8a8" -"checksum cranelift-entity 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fdda254bea18087a038982b9ede454736306b107bc0043d01bf563d2ee2fb88e" -"checksum cranelift-frontend 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e861f15ddb60a02f39af80d6168aac6939484b3a36b9f954648547ebf23b366b" -"checksum cranelift-module 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3f48d8868cd2a02dca3afad9eafbd4c7c741edd8cb4d8283ebd9e7b6b634e4f3" -"checksum cranelift-native 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2717b586de288286ceba665c842e30f3b41b43f8d29e8b9444c38d91d2814549" -"checksum cranelift-simplejit 0.37.0 (registry+https://github.com/rust-lang/crates.io-index)" = "320125bf4c31aa9658f42a3586ae6ad3f752c6881e3799fb8b4d8b11887a2af4" -"checksum ctor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "3b4c17619643c1252b5f690084b82639dd7fac141c57c8e77a00e0148132092c" -"checksum derive-new 0.5.7 (registry+https://github.com/rust-lang/crates.io-index)" = "c3fd04571b29c91cfbe1e7c9a228e069ac8635f180ffb4ccd6a6907617ee8bb0" +"checksum cranelift 0.38.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c0773a83655dd8abf9a0bcfa139eddb083dd101bd6b2fe7feb51b11c73883ba3" +"checksum cranelift-bforest 0.38.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b4775737968254a3616d260c08249c9e01187b48b01fd0ef5df2edfb24fe0923" +"checksum cranelift-codegen 0.38.0 (registry+https://github.com/rust-lang/crates.io-index)" = "86df46c579467ac304b60eed476d73a5369e356ef438753dd559b23fca9876dc" +"checksum cranelift-codegen-meta 0.38.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e910e577db63abe6d7ff26db9c7856baa99040f517c7fdbf65b8d44464fb9adb" +"checksum cranelift-entity 0.38.0 (registry+https://github.com/rust-lang/crates.io-index)" = "71db53666f5819b71e672cfba8e669e50d81e3b741188829bab9d7348c35a508" +"checksum cranelift-frontend 0.38.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9ab1585400abfee0d2a70bb28544cbcbffb47c51071f56b553d62c702febf858" +"checksum cranelift-module 0.38.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ea12b34e62a4e066158d226b7a5efb0a3ab39676da4406731faa6813a974c98" +"checksum cranelift-native 0.38.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7233c2e94db0e70969da23a87c61659322004ad35f8dc3dd4d7b0330b33ea993" +"checksum cranelift-simplejit 0.38.0 (registry+https://github.com/rust-lang/crates.io-index)" = "884b7bc4b34be33290579d9d5c2583eb36718304f7bacac0d347650e89d6ab94" +"checksum crossbeam 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2d818a4990769aac0c7ff1360e233ef3a41adcb009ebb2036bf6915eb0f6b23c" +"checksum crossbeam-channel 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c8ec7fcd21571dc78f96cc96243cab8d8f035247c3efd16c687be154c3fa9efa" +"checksum crossbeam-deque 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b18cd2e169ad86297e6bc0ad9aa679aee9daa4f19e8163860faf7c164e4f5a71" +"checksum crossbeam-epoch 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "fedcd6772e37f3da2a9af9bf12ebe046c0dfe657992377b4df982a2b54cd37a9" +"checksum crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7c979cd6cfe72335896575c6b5688da489e420d36a27a0b9eb0c73db574b4a4b" +"checksum crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)" = "04973fa96e96579258a5091af6003abde64af786b860f18622b82e026cca60e6" +"checksum ctor 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "5b6b2f4752cc29efbfd03474c532ce8f916f2d44ec5bb8c21f93bc76e5365528" +"checksum derive-new 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)" = "71f31892cd5c62e414316f2963c5689242c43d8e7bbcaaeca97e5e28c95d91d9" "checksum diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "3c2b69f912779fbb121ceb775d74d51e915af17aaebc38d28a592843a2dd0a3a" "checksum difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198" "checksum digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" @@ -1356,6 +1529,7 @@ dependencies = [ "checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" "checksum gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)" = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2" "checksum generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec" +"checksum getrandom 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "6171a6cc63fbabbe27c2b5ee268e8b7fe5dc1eb0dd2dfad537c1dfed6f69117e" "checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" "checksum humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ca7e5f2e110db35f93b837c81797f3714500b81d517bf20c431b16d3ca4f114" "checksum indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7e81a7c05f79578dbc15793d8b619db9ba32b4577003ef3af1a91c416798c58d" @@ -1364,64 +1538,72 @@ dependencies = [ "checksum lalrpop 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a3d111d79a3b76457aa1bcc699a736b6c623d14da0ec75737c01edb657469aef" "checksum lalrpop-util 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6ab5dfdd35d987c6d328e371764cb6e4b6c63220db9364c291aa14d6fe50099a" "checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" -"checksum libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "d44e80633f007889c7eff624b709ab43c92d708caad982295768a7b13ca3b5eb" -"checksum linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ae91b68aebc4ddb91978b11a1b02ddd8602a05ec19002801c5666000e05e0f83" -"checksum lock_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ed946d4529956a20f2d63ebe1b69996d5a2137c91913fe3ebbeff957f5bca7ff" -"checksum log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "c275b6ad54070ac2d665eef9197db647b32239c9d244bfb6f041a766d00da5b3" +"checksum libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)" = "34fcd2c08d2f832f376f4173a231990fa5aef4e99fb569867318a227ef4c06ba" +"checksum lock_api 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f8912e782533a93a167888781b836336a6ca5da6175c05944c86cf28c31104dc" +"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" "checksum mach 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "86dd2487cdfea56def77b88438a2c915fb45113c5319bfe7e14306ca4cd0b0e1" "checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e" +"checksum memoffset 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ce6075db033bbbb7ee5a0bbd3a3186bbae616f57fb001c485c7ff77955f8177f" "checksum new_debug_unreachable 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f40f005c60db6e03bae699e414c58bf9aa7ea02a2d0b9bfbcf19286cc4c82b30" "checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" "checksum num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "b85e541ef8255f6cf42bbfe4ef361305c6c135d10919ecc26126c4e5ae94bc09" "checksum num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31" "checksum num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "6ba9a427cfca2be13aa6f6403b0b7e7368fe982bfa16fccc450ce74c46cd9b32" -"checksum opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "93f5bb2e8e8dec81642920ccff6b61f1eb94fa3020c5a325c9851ff604152409" +"checksum opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" "checksum ordered-float 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "18869315e81473c951eb56ad5558bbc56978562d3ecfb87abb7a1e944cea4518" "checksum ordermap 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a86ed3f5f244b372d6b1a00b72ef7f8876d0bc6a78a4c9985c53614041512063" "checksum output_vt100 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "53cdc5b785b7a58c5aad8216b3dfa114df64b0b06ae6e1501cef91df2fbdf8f9" -"checksum parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fa7767817701cce701d5585b9c4db3cdd02086398322c1d7e8bf5094a96a2ce7" -"checksum parking_lot_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cb88cb1cb3790baa6776844f968fea3be44956cf184fa1be5a03341f5491278c" +"checksum parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252" +"checksum parking_lot_core 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b876b1b9e7ac6e1a74a6da34d25c42e17e8862aa409cbbbdcfc8d86c6f3bc62b" "checksum petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)" = "9c3659d1ee90221741f65dd128d9998311b0e40c5d3c23a62445938214abce4f" "checksum phf_generator 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)" = "09364cc93c159b8b06b1f4dd8a4398984503483891b0c26b867cf431fb132662" "checksum phf_shared 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)" = "234f71a15de2288bcb7e3b6515828d22af7ec8598ee6d24c3b526fa0a80b67a0" +"checksum ppv-lite86 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e3cbf9f658cdb5000fcf6f362b8ea2ba154b9f146a61c7a20d647034c6b6561b" "checksum precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" "checksum pretty_assertions 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3f81e1644e1b54f5a68959a29aa86cde704219254669da328ecfdf6a1f09d427" -"checksum pretty_env_logger 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "df8b3f4e0475def7d9c2e5de8e5a1306949849761e107b360d03e98eafaffd61" +"checksum pretty_env_logger 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "717ee476b1690853d222af4634056d830b5197ffd747726a9a1eee6da9f49074" "checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" +"checksum proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4c5c2380ae88876faae57698be9e9775e3544decad214599c3a6266cca6ac802" "checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" "checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" "checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" +"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" "checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" +"checksum rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d47eab0e83d9693d40f825f86948aa16eff6750ead4bdffc4ab95b8b3a7f052c" "checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" +"checksum rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "03a2a90da8c7523f554344f921aa97283eadf6ac484a6d2a7d0212fa7f8d6853" "checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" -"checksum rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d0e7a549d590831370895ab7ba4ea0c1b6b011d106b5ff2da6eee112615e6dc0" +"checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" +"checksum rand_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "615e683324e75af5d43d8f7a39ffe3ee4a9dc42c5c701167a71dc59c3a493aca" "checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" +"checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" "checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" "checksum rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b" "checksum rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" "checksum rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" +"checksum rand_pcg 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e196346cbbc5c70c77e7b4926147ee8e383a38ee4d15d58a08098b169e492b6" "checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" "checksum raw-cpuid 6.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "30a9d219c32c9132f7be513c18be77c9881c7107d2ab5569d205a6a0f0e6dc7d" "checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" "checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" -"checksum redox_users 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3fe5204c3a17e97dde73f285d49be585df59ed84b50a872baf416e73b62c3828" -"checksum regex 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6b23da8dfd98a84bd7e08700190a5d9f7d2d38abd4369dd1dae651bc40bfd2cc" -"checksum regex-syntax 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "cd5485bf1523a9ed51c4964273f22f63f24e31632adb5dad134f488f86a3875c" +"checksum redox_users 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4ecedbca3bf205f8d8f5c2b44d83cd0690e39ee84b951ed649e9f1841132b66d" +"checksum regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88c3d9193984285d544df4a30c23a4e62ead42edf70a4452ceb76dac1ce05c26" +"checksum regex-syntax 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b143cceb2ca5e56d5671988ef8b15615733e7ee16cd348e064333b251b89343f" "checksum region 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "448e868c6e4cfddfa49b6a72c95906c04e8547465e9536575b95c70a4044f856" "checksum relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0e7790c7f1cc73d831d28dc5a7deb316a006e7848e6a7f467cdb10a0a9e0fb1c" -"checksum rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a7f4dccf6f4891ebcc0c39f9b6eb1a83b9bf5d747cb439ec6fba4f3b977038af" +"checksum rust-argon2 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4ca4eaef519b494d1f2848fc602d18816fed808a981aedf4f1f00ceb7c9d32cf" +"checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" "checksum rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7540fc8b0c49f096ee9c961cda096467dce8084bec6bdca2fc83895fd9b28cb8" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" "checksum ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c92464b447c0ee8c4fb3824ecc8383b81717b9f1e74ba2e72540aef7b9f82997" -"checksum salsa 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2891cd628406e8a0ca714b827511de1bff76f796e3382cc72a3de732ccad5aea" -"checksum salsa-macros 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b7f1e25ca2b995bdf032946174929d62156ffd57abd7ff88dc6f9bdeb5ac0c59" +"checksum salsa 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e3265a2a9bbd384bd2a9f9511c2c18fb41f62c412516052e8934517dc8ff64f1" +"checksum salsa-macros 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "377ce29c5660dcc5c3f66660a7e49940b8328e3d940255ef9d4c2be1f7b474a9" "checksum same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "585e8ddcedc187886a30fa705c47985c3fa88d06624095856b36ca0b82ff4421" -"checksum scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1d51f5df5af43ab3f1360b429fa5e0152ac5ce8c0bd6485cae490332e96846a8" "checksum scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b42e15e59b18a828bbf5c58ea01debb36b9b096346de35d941dcb89009f24a0d" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum serde 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)" = "d46b3dfedb19360a74316866cef04687cd4d6a70df8e6a506c63512790769b72" -"checksum serde_derive 1.0.97 (registry+https://github.com/rust-lang/crates.io-index)" = "c22a0820adfe2f257b098714323563dd06426502abbbce4f51b72ef544c5027f" +"checksum serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)" = "fec2851eb56d010dc9a21b89ca53ee75e6528bab60c11e89d38390904982da9f" +"checksum serde_derive 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)" = "cb4dc18c61206b08dc98216c98faa0232f4337e1e1b8574551d5bad29ea1b425" "checksum serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)" = "051c49229f282f7c6f3813f8286cc1e3323e8051823fce42c7ea80fe13521704" "checksum sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b4d8bfd0e469f417657573d8451fb33d16cfe0989359b93baf3a1ffc639543d" "checksum siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0b8de496cf83d4ed58b6be86c3a275b8602f6ffe98d3024a869e124147a9a3ac" @@ -1434,7 +1616,8 @@ dependencies = [ "checksum structopt 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "16c2cdbf9cc375f15d1b4141bc48aeef444806655cd0e904207edc8d68d86ed7" "checksum structopt-derive 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "53010261a84b37689f9ed7d395165029f9cc7abb9f56bbfe86bee2597ed25107" "checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" -"checksum syn 0.15.42 (registry+https://github.com/rust-lang/crates.io-index)" = "eadc09306ca51a40555dd6fc2b415538e9e18bc9f870e47b1a524a79fe2dcf5e" +"checksum syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)" = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" +"checksum syn 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "158521e6f544e7e3dcfc370ac180794aa38cb34a1b1e07609376d4adcf429b93" "checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" "checksum synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "02353edf96d6e4dc81aea2d8490a7e9db177bf8acb0e951c24940bf866cb313f" "checksum target-lexicon 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1b0ab4982b8945c35cc1c46a83a9094c414f6828a099ce5dcaa8ee2b04642dcb" @@ -1444,16 +1627,16 @@ dependencies = [ "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" "checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169" -"checksum ucd-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "fa9b3b49edd3468c0e6565d85783f51af95212b6fa3986a5500954f00b460874" "checksum unicode-segmentation 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1967f4cdfc355b37fd76d2a954fb2ed3871034eb4f26d60537d88795cfc332a9" "checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" "checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" -"checksum utf8-ranges 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9d50aa7650df78abf942826607c62468ce18d9019673d4a2ebe1865dbb96ffde" +"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" "checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" "checksum walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "9658c94fa8b940eab2250bd5a457f9c48b748420d71293b165c8cdbe2f55f71e" +"checksum wasi 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fd5442abcac6525a045cc8c795aedb60da7a2e5e89c7bf18a0d5357849bb23c7" "checksum winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f10e386af2b13e47c89e7236a7a14a086791a2b88ebad6df9bf42040195cf770" "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" "checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9" "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -"checksum wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "561ed901ae465d6185fa7864d63fbd5720d0ef718366c9a4dc83cf6170d7e9ba" +"checksum wincolor 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "96f5016b18804d24db43cebf3c77269e7569b8954a8464501c216cc5e070eaa9" diff --git a/Cargo.toml b/Cargo.toml index 543451b..963bb27 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,20 +10,20 @@ edition = "2018" [build-dependencies] lalrpop = "0.17.1" failure = "0.1.5" -regex = "1.2.0" +regex = "1.2.1" walkdir = "2.2.9" [dependencies] -cranelift = "0.37.0" -cranelift-module = "0.37.0" -cranelift-simplejit = "0.37.0" +cranelift = "0.38.0" +cranelift-module = "0.38.0" +cranelift-simplejit = "0.38.0" dot = "0.1.4" env_logger = "0.6.2" failure = "0.1.5" lalrpop-util = "0.17.1" -log = "0.4.7" -regex = "1.2.0" -pretty_env_logger = "0.3.0" +log = "0.4.8" +regex = "1.2.1" +pretty_env_logger = "0.3.1" structopt = "0.2.18" lazy_static = "1.3.0" byteorder = "1.3.2" @@ -32,10 +32,10 @@ codespan = "0.3.0" codespan-reporting = "0.3.0" enum-primitive-derive = "0.1.2" num-traits = "0.2.8" -salsa = "0.12.3" +salsa = "0.13.0" relative-path = "0.4.0" ordered-float = "1.0.2" -cranelift-native = "0.37.0" +cranelift-native = "0.38.0" [features] default = ["parallel"] diff --git a/src/bin/tin.rs b/src/bin/tin.rs index 4e12bcd..ae0ece2 100644 --- a/src/bin/tin.rs +++ b/src/bin/tin.rs @@ -1,3 +1,4 @@ +use log::error; use std::fs; use std::io; use std::path; @@ -59,7 +60,7 @@ fn run() -> Result { .map_err(|e| report_diagnostics(tin.codemap(), e))?; let entrypoint = module - .function::>("main") + .function::, _>("TODO", "main") .ok_or_else(|| failure::err_msg("missing a main function"))?; let result = entrypoint.call()?; diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs index d935c92..ca8de8d 100644 --- a/src/codegen/mod.rs +++ b/src/codegen/mod.rs @@ -1,7 +1,9 @@ //! A JIT compiler implementation based on the IR. use log::debug; +use log::trace; use std::collections; use std::fmt; +use std::mem; use std::ops; use std::sync; @@ -25,8 +27,8 @@ mod builtin; mod data; pub mod error; mod function; -// #[cfg(test)] -// mod tests; +#[cfg(test)] +mod tests; mod util; /// A codegen system, that can be used for JIT compilation. @@ -41,10 +43,6 @@ pub trait Db: salsa::Database + interpreter::Db + ir::Db + layout::Db + ty::Db { fn codegen_isa(&self) -> Isa; } -pub struct Function { - ctx: codegen::Context, -} - pub struct Data { ctx: cranelift_module::DataContext, } @@ -56,6 +54,13 @@ pub struct Isa { struct Symbol<'d, D>(&'d D, ir::Entity); +struct Function { + ctx: codegen::Context, + name: String, + entity: ir::Entity, + is_public: bool, +} + struct Codegen<'m, 'd, B, D> where B: cranelift_module::Backend, @@ -63,22 +68,24 @@ where ptr_type: codegen::ir::Type, module: &'m mut cranelift_module::Module, db: &'d D, + functions: Vec, defined_strings: collections::HashMap, + exposed_functions: + collections::HashMap<(relative_path::RelativePathBuf, String), cranelift_module::FuncId>, } fn codegen(db: &impl Db) -> error::Result> { let ptr_type = db.codegen_ptr_type(); let mut builder = cranelift_simplejit::SimpleJITBuilder::new(cranelift_module::default_libcall_names()); + builder.symbols(builtin::BUILTINS.iter().map(|b| (b.symbol, b.ptr))); let mut module: cranelift_module::Module = cranelift_module::Module::new(builder); let mut codegen = Codegen::new(ptr_type, &mut module, db); codegen.codegen_all()?; + let function_ids = codegen.exposed_functions; - Ok(sync::Arc::new(module::Module::new( - module, - collections::HashMap::new(), - ))) + Ok(sync::Arc::new(module::Module::new(module, function_ids))) } fn codegen_ptr_type(db: &impl Db) -> codegen::ir::Type { @@ -112,40 +119,123 @@ where db: &'d D, ) -> Self { let defined_strings = collections::HashMap::new(); + let exposed_functions = collections::HashMap::new(); + let functions = Vec::new(); Self { ptr_type, module, db, defined_strings, + exposed_functions, + functions, } } fn codegen_all(&mut self) -> error::Result<()> { - for module_entity in self.db.entities()?.modules() { - match &*self.db.element(module_entity)? { - ir::element::Element::Module(ir::element::Module { variables }) => { - for value in variables.values() { - self.codegen_definition(*value)?; + for entity in self.db.entities()?.all() { + self.codegen_entity(entity)?; + } + + for Function { + name, + entity, + ctx, + is_public, + } in &mut self.functions + { + let linkage = if *is_public { + cranelift_module::Linkage::Export + } else { + cranelift_module::Linkage::Local + }; + let func_id = self + .module + .declare_function(name, linkage, &ctx.func.signature) + .unwrap(); + + self.module.define_function(func_id, ctx).unwrap(); + self.module.clear_context(ctx); + + if *is_public { + if let (Some(parent_id), ir::EntityRole::VariableDefinition(func_ident)) = + self.db.lookup_entity(*entity) + { + let (_, parent_role) = self.db.lookup_entity(parent_id); + if let ir::EntityRole::File(file_id) = parent_role { + let func_ident = (*self.db.lookup_ident(func_ident)).clone(); + let file_path = (*self.db.file_relative_path(file_id)).to_owned(); + self.exposed_functions + .insert((file_path, func_ident), func_id); + } else { + debug!( + "not exposing function `{}` because it is not at module level (parent role is {:?})", + name, + parent_role, + ); } + } else { + debug!("not exposing function `{}` because it is not directly a variable definition", name); } - _ => unreachable!(), } } + self.module.finalize_definitions(); + Ok(()) } - fn codegen_definition(&mut self, entity: ir::Entity) -> error::Result<()> { - match ( - &*self.db.element(entity)?, - &*self.db.ty(entity)?, - self.db.value(entity)?, - ) { - (element::Element::Closure(ref closure), ty::Type::Function(ref ty), _) => { - self.codegen_function(entity, closure, ty)?; - Ok(()) + fn codegen_entity(&mut self, entity: ir::Entity) -> error::Result<()> { + match &*self.db.element(entity)? { + ir::element::Element::Module(ir::element::Module { variables }) => { + for value in variables.values() { + self.codegen_definition(*value, true)?; + } } - _ => Ok(()), // TODO logic error + ir::element::Element::Closure(ir::element::Closure { statements, .. }) => { + for statement in statements { + self.codegen_definition(*statement, false)?; + } + } + _ => (), } + Ok(()) + } + + fn codegen_definition(&mut self, entity: ir::Entity, top_level: bool) -> error::Result<()> { + match &*self.db.element(entity)? { + element::Element::Variable(ref variable) => { + let initializer = self.db.element(variable.initializer)?; + match (&*initializer, &*self.db.ty(entity)?) { + (element::Element::Closure(ref closure), ty::Type::Function(ref ty)) => { + let (name, ctx) = self.codegen_function(entity, closure, ty)?; + + if top_level { + let (name, ctx) = self.codegen_public_wrapper_function( + entity, closure, ty, &name, &ctx, + )?; + let is_public = true; + self.functions.push(Function { + name, + entity, + ctx, + is_public, + }); + } + + let is_public = false; + self.functions.push(Function { + name, + entity, + ctx, + is_public, + }); + } + _ => (), + } + } + _ => (), + } + + Ok(()) } fn codegen_function( @@ -153,12 +243,12 @@ where entity: ir::Entity, closure: &element::Closure, ty: &ty::Function, - ) -> error::Result> { + ) -> error::Result<(String, codegen::Context)> { use cranelift::codegen::ir::InstBuilder; let mut ctx = codegen::Context::new(); ctx.func.signature.call_conv = self.db.codegen_isa().default_call_conv(); - let ret_type = self.populate_function_signature(ty, &mut ctx); + let ret_type = self.populate_function_signature(ty, &mut ctx, false); let mut builder_context = frontend::FunctionBuilderContext::new(); let mut builder = @@ -170,7 +260,7 @@ where self.module, &mut self.defined_strings, &format!("funcname:{}", name), - name, + name.clone(), ); let name_global_value = self.module.declare_data_in_func(name_data_id, builder.func); @@ -252,8 +342,8 @@ where builder.switch_to_block(error_unwind_ebb); builder.seal_block(error_unwind_ebb); - let name = builder.ins().global_value(self.ptr_type, name_global_value); - let name_len = builder.ins().iconst(self.ptr_type, name_len as i64); + let name_value = builder.ins().global_value(self.ptr_type, name_global_value); + let name_len_value = builder.ins().iconst(self.ptr_type, name_len as i64); { let mut translation_ctx = function::Translator::new( @@ -268,8 +358,8 @@ where ); translation_ctx.builtin_unwind_frame( error, - name, - name_len, + name_value, + name_len_value, error_filename, error_filename_len, error_line, @@ -277,7 +367,101 @@ where ); }; - let null_result = if ret_type.is_int() { + let null_result = >::default_value(ret_type, &mut builder); + builder.ins().return_(&[null_result, error]); + + builder.finalize(); + + debug!( + "generated function `{}`:\n\n{}", + name, + builder.display(None) + ); + Ok((name, ctx)) + } + + fn codegen_public_wrapper_function( + &mut self, + entity: ir::Entity, + closure: &element::Closure, + ty: &ty::Function, + wrapped_name: &str, + wrapped: &codegen::Context, + ) -> error::Result<(String, codegen::Context)> { + use cranelift::codegen::ir::InstBuilder; + + let mut ctx: codegen::Context = self.module.make_context(); + let mut builder_context = frontend::FunctionBuilderContext::new(); + + let name = format!("public:{}", Symbol(self.db, entity)); + let ret_type = self.populate_function_signature(ty, &mut ctx, true); + + let mut builder = + cranelift::frontend::FunctionBuilder::new(&mut ctx.func, &mut builder_context); + let entry_ebb = builder.create_ebb(); + builder.append_ebb_params_for_function_params(entry_ebb); + + let error_ebb = builder.create_ebb(); + + builder.switch_to_block(entry_ebb); + builder.seal_block(entry_ebb); + + let callee = self + .module + .declare_function( + wrapped_name, + cranelift_module::Linkage::Local, + &wrapped.func.signature, + ) + .unwrap(); + let local_callee = self.module.declare_func_in_func(callee, &mut builder.func); + + let (error_out_ptr, parameter_values) = builder.ebb_params(entry_ebb).split_last().unwrap(); + let error_out_ptr = *error_out_ptr; + let parameter_values = parameter_values.to_vec(); + + let call = builder.ins().call(local_callee, ¶meter_values); + + let results = builder.inst_results(call); + let result = results[0]; + let error = results[1]; + + builder + .ins() + .brnz(error, error_ebb, &[error, error_out_ptr]); + builder.ins().return_(&[result]); + + let error = builder.append_ebb_param(error_ebb, self.ptr_type); + let error_out_ptr = builder.append_ebb_param(error_ebb, self.ptr_type); + builder.switch_to_block(error_ebb); + builder.seal_block(error_ebb); + + let null_result = >::default_value(ret_type, &mut builder); + + let mut mem_flags = codegen::ir::MemFlags::new(); + mem_flags.set_notrap(); + mem_flags.set_aligned(); + builder.ins().store(mem_flags, error, error_out_ptr, 0_i32); + builder.ins().return_(&[null_result]); + + builder.finalize(); + + debug!( + "generated public wrapper function `{}`:\n\n{}", + name, + builder.display(None) + ); + + Ok((name, ctx)) + } + + fn default_value( + ret_type: codegen::ir::Type, + builder: &mut frontend::FunctionBuilder, + ) -> codegen::ir::Value { + use cranelift::codegen::ir::InstBuilder; + + if ret_type.is_int() { builder.ins().iconst(ret_type, 0) } else if ret_type == types::F32 { builder.ins().f32const(immediates::Ieee32::with_float(0.0)) @@ -285,19 +469,14 @@ where builder.ins().f64const(immediates::Ieee64::with_float(0.0)) } else { unimplemented!() - }; - builder.ins().return_(&[null_result, error]); - - builder.finalize(); - - debug!("generated function: {}", builder.display(None)); - Ok(sync::Arc::new(Function { ctx })) + } } fn populate_function_signature( &mut self, ty: &ty::Function, ctx: &mut codegen::Context, + is_public: bool, ) -> codegen::ir::Type { for parameter in &ty.parameters { ctx.func.signature.params.push(codegen::ir::AbiParam::new( @@ -306,12 +485,24 @@ where } let ret_type = abi_type::AbiType::from_ir_type(&ty.result).into_specific(self.ptr_type); - - // Result, error - ctx.func.signature.returns.extend(&[ - codegen::ir::AbiParam::new(ret_type), - codegen::ir::AbiParam::new(self.ptr_type), - ]); + // Result + ctx.func + .signature + .returns + .push(codegen::ir::AbiParam::new(ret_type)); + + // Error: if the function is public, pass in error pointer; else, use multiple return values + if is_public { + ctx.func + .signature + .params + .push(codegen::ir::AbiParam::new(self.ptr_type)); + } else { + ctx.func + .signature + .returns + .push(codegen::ir::AbiParam::new(self.ptr_type)) + } ret_type } @@ -448,9 +639,6 @@ fn symbol_fmt_impl(entity: ir::Entity, f: &mut fmt::Formatter, db: &impl Db) -> ir::EntityRole::ClosureStatement(idx) => write!(f, "(statement {})", idx), ir::EntityRole::ClosureSignature => write!(f, "(signature)"), ir::EntityRole::ClosureResult => write!(f, "(result expression)"), - ir::EntityRole::ModuleDefinition(ident) => { - write!(f, "(parameter definition {})", db.lookup_ident(ident)) - } ir::EntityRole::UnOperand => write!(f, "(operand)"), ir::EntityRole::BiLhs => write!(f, "(left operand)"), ir::EntityRole::BiRhs => write!(f, "(right operand)"), diff --git a/src/codegen/tests.rs b/src/codegen/tests.rs index 1aaa409..d4c7b52 100644 --- a/src/codegen/tests.rs +++ b/src/codegen/tests.rs @@ -3,6 +3,7 @@ use failure; use super::*; use crate::ir; +use crate::source; use crate::syntax::ast; use crate::test_util; @@ -16,7 +17,9 @@ main = || -> u32 { 42u32 }; let mut module = compile_module("immediate", source)?; - let main = module.function::>("main").unwrap(); + let main = module + .function::, _>("immediate", "main") + .unwrap(); let result = main.call(); assert_eq!(Ok(42), result); @@ -33,7 +36,9 @@ main = || -> u32 { a = 43u32; a }; let mut module = compile_module("variable", source)?; - let main = module.function::>("main").unwrap(); + let main = module + .function::, _>("variable", "main") + .unwrap(); let result = main.call(); assert_eq!(Ok(43), result); @@ -51,7 +56,7 @@ main = |a: u32| -> u32 { a }; let mut module = compile_module("parameter1", source)?; let main = module - .function::>("main") + .function::, _>("parameter1", "main") .unwrap(); let result = main.call(43); @@ -70,7 +75,7 @@ main = |a: u32, b: u32| -> u32 { b }; let mut module = compile_module("parameter2", source)?; let main = module - .function::>("main") + .function::, _>("parameter2", "main") .unwrap(); let result = main.call(1, 43); @@ -89,7 +94,7 @@ main = |a: u32, b: u32, c: u32| -> u32 { c }; let mut module = compile_module("parameter3", source)?; let main = module - .function::>("main") + .function::, _>("parameter3", "main") .unwrap(); let result = main.call(1, 2, 43); @@ -108,7 +113,7 @@ main = |a: u32, b: u32, c: u32, d: u32| -> u32 { d }; let mut module = compile_module("parameter4", source)?; let main = module - .function::>("main") + .function::, _>("parameter4", "main") .unwrap(); let result = main.call(1, 2, 3, 43); @@ -127,7 +132,7 @@ main = |a: u32, b: u32, c: u32, d: u32, e: u32| -> u32 { e }; let mut module = compile_module("parameter5", source)?; let main = module - .function::>("main") + .function::, _>("parameter5", "main") .unwrap(); let result = main.call(1, 2, 3, 4, 43); @@ -146,7 +151,7 @@ main = |a: u32, b: u32, c: u32, d: u32, e: u32, f: u32| -> u32 { f }; let mut module = compile_module("parameter6", source)?; let main = module - .function::>("main") + .function::, _>("parameter6", "main") .unwrap(); let result = main.call(1, 2, 3, 4, 5, 43); @@ -166,7 +171,7 @@ main = |y: u32| -> u32 { a = other(y); other(other(a)) }; let mut module = compile_module("apply", source)?; let main = module - .function::>("main") + .function::, _>("apply", "main") .unwrap(); let result = main.call(43); @@ -184,7 +189,9 @@ main = || -> u32 { a = { x: 1u32, y: 2u32, z: 3u32}; a.y }; let mut module = compile_module("record", source)?; - let main = module.function::>("main").unwrap(); + let main = module + .function::, _>("record", "main") + .unwrap(); let result = main.call(); assert_eq!(Ok(2), result); @@ -201,7 +208,9 @@ main = || -> u32 { a = 1u32; b = 2u32; (a * 24u32 + b * 3u32) / 10u32 }; let mut module = compile_module("operators_u32", source)?; - let main = module.function::>("main").unwrap(); + let main = module + .function::, _>("operators_u32", "main") + .unwrap(); let result = main.call(); assert_eq!(Ok(3), result); @@ -218,7 +227,9 @@ main = || -> f32 { a = 1f32; b = 2f32; (a * 24f32 + b * 3f32) / 10f32 }; let mut module = compile_module("operators_f32", source)?; - let main = module.function::>("main").unwrap(); + let main = module + .function::, _>("operators_f32", "main") + .unwrap(); let result = main.call(); assert_eq!(Ok(3.0), result); @@ -235,7 +246,9 @@ main = || -> f64 { a = 1f64; b = 2f64; (a * 24f64 + b * 3f64) / 10f64 }; let mut module = compile_module("operators_f64", source)?; - let main = module.function::>("main").unwrap(); + let main = module + .function::, _>("operators_f64", "main") + .unwrap(); let result = main.call(); assert_eq!(Ok(3.0), result); @@ -252,7 +265,9 @@ main = || -> u32 { a = 1u32; b = 2u32; a + b }; let mut module = compile_module("add_u32", source)?; - let main = module.function::>("main").unwrap(); + let main = module + .function::, _>("add_u32", "main") + .unwrap(); let result = main.call(); assert_eq!(Ok(3), result); @@ -269,7 +284,9 @@ main = || -> i32 { a = 1i32; b = 2i32; a + b }; let mut module = compile_module("add_i32", source)?; - let main = module.function::>("main").unwrap(); + let main = module + .function::, _>("add_i32", "main") + .unwrap(); let result = main.call(); assert_eq!(Ok(3), result); @@ -286,7 +303,9 @@ main = || -> f32 { a = 1f32; b = 2f32; a + b }; let mut module = compile_module("add_f32", source)?; - let main = module.function::>("main").unwrap(); + let main = module + .function::, _>("add_f32", "main") + .unwrap(); let result = main.call(); assert_eq!(Ok(3.0), result); @@ -303,7 +322,9 @@ main = || -> u32 { a = 2u32; b = 1u32; a - b }; let mut module = compile_module("sub_u32", source)?; - let main = module.function::>("main").unwrap(); + let main = module + .function::, _>("sub_u32", "main") + .unwrap(); let result = main.call(); assert_eq!(Ok(1), result); @@ -320,7 +341,9 @@ main = || -> i32 { a = 1i32; b = 2i32; a - b }; let mut module = compile_module("sub_i32", source)?; - let main = module.function::>("main").unwrap(); + let main = module + .function::, _>("sub_i32", "main") + .unwrap(); let result = main.call(); assert_eq!(Ok(-1), result); @@ -337,7 +360,9 @@ main = || -> f32 { a = 2f32; b = 1f32; a - b }; let mut module = compile_module("sub_f32", source)?; - let main = module.function::>("main").unwrap(); + let main = module + .function::, _>("sub_f32", "main") + .unwrap(); let result = main.call(); assert_eq!(Ok(1.0), result); @@ -345,19 +370,34 @@ main = || -> f32 { a = 2f32; b = 1f32; a - b }; } fn compile_module(name: &'static str, source: &str) -> Result { - use crate::syntax::parser::Parse; + use crate::codegen::Db as _; + use crate::codegen::Db as _; + use crate::layout::Db as _; + use crate::source::Db as _; + use crate::ty::Db as _; let mut codemap = codespan::CodeMap::new(); - let span = codemap - .add_filemap(codespan::FileName::Virtual(name.into()), source.to_owned()) - .span(); - let ast_module = ast::Module::parse(span, source)?; - let mut ir = ir::Ir::new(); - ir.load(&ast_module)?; - ir.check_types()?; - test_util::render_graph(&format!(concat!(module_path!(), "::{}"), name), &ir)?; - let compiler = Codegen::new(&ir, &codemap); - let module = compiler.compile(); + codemap.add_filemap(codespan::FileName::Virtual(name.into()), source.to_owned()); + + let root_id = source::RootId(1); + let file_id = source::FileId(1); + let path = relative_path::RelativePath::new(name).to_owned(); + let mut files = collections::HashMap::new(); + files.insert(path.clone(), file_id); + let root = source::Root { files }; + + let mut db = db::Db::new(); + + db.set_file_text(file_id, sync::Arc::new(source.to_owned())); + db.set_file_relative_path(file_id, path); + db.set_file_source_root(file_id, root_id); + db.set_source_root(root_id, sync::Arc::new(root)); + db.set_all_source_roots(sync::Arc::new(vec![root_id])); + db.set_ptr_size(layout::PtrSize::Size64); + + let module = (*db.codegen()?).clone(); + + test_util::render_graph(&format!(concat!(module_path!(), "::{}"), name), &db).unwrap(); Ok(module) } diff --git a/src/db.rs b/src/db.rs index b047eb9..e88a2a2 100644 --- a/src/db.rs +++ b/src/db.rs @@ -1,3 +1,4 @@ +use crate::codegen; use crate::interpreter; use crate::ir; use crate::layout; @@ -6,6 +7,7 @@ use crate::syntax; use crate::ty; #[salsa::database( + codegen::CodegenStorage, interpreter::InterpreterStorage, ir::IrStorage, layout::LayoutStorage, diff --git a/src/graph.rs b/src/graph.rs index acb014f..130c570 100644 --- a/src/graph.rs +++ b/src/graph.rs @@ -201,9 +201,6 @@ impl<'a> dot::Labeller<'a, Node, Edge> for Graph<'a> { } ir::EntityRole::ClosureSignature => dot::LabelText::HtmlStr("sig".into()), ir::EntityRole::ClosureResult => dot::LabelText::HtmlStr("result".into()), - ir::EntityRole::ModuleDefinition(ident) => dot::LabelText::HtmlStr( - format!("mod {:?}", self.db.lookup_ident(ident)).into(), - ), ir::EntityRole::UnOperand => dot::LabelText::HtmlStr("op".into()), ir::EntityRole::BiLhs => dot::LabelText::HtmlStr("lhs".into()), ir::EntityRole::BiRhs => dot::LabelText::HtmlStr("rhs".into()), diff --git a/src/interpreter/mod.rs b/src/interpreter/mod.rs index f0b2eaf..0cd7b76 100644 --- a/src/interpreter/mod.rs +++ b/src/interpreter/mod.rs @@ -325,9 +325,7 @@ fn add(lhs: &value::Value, rhs: &value::Value) -> Result { - match_number!("+", (lhs, rhs), |l, r| int: Ok((l.wrapping_add(*r)).into()), frac: Ok((l.into_inner() + r.into_inner()).into())) - } + (value::Case::Number(lhs), value::Case::Number(rhs)) => match_number!("+", (lhs, rhs), |l, r| int: Ok((l.wrapping_add(*r)).into()), frac: Ok((l.into_inner() + r.into_inner()).into())), other => Err(error::Error::RuntimeTypeConflict(format!( "operation + not supported on values {:?}", other diff --git a/src/ir/mod.rs b/src/ir/mod.rs index b6727f0..1c6d2aa 100644 --- a/src/ir/mod.rs +++ b/src/ir/mod.rs @@ -57,7 +57,6 @@ pub enum EntityRole { ClosureStatement(usize), ClosureSignature, ClosureResult, - ModuleDefinition(Ident), UnOperand, BiLhs, BiRhs, diff --git a/src/module.rs b/src/module.rs index 9cd11f0..c8622a5 100644 --- a/src/module.rs +++ b/src/module.rs @@ -3,14 +3,18 @@ use std::collections; use std::fmt; use std::mem; use std::ptr; +use std::sync; use cranelift_module; use cranelift_simplejit; /// A compiled module, the result of an invocation of `Tin::compile`. +#[derive(Clone)] pub struct Module { - compiled: cranelift_module::Module, - function_ids: collections::HashMap, + compiled: + sync::Arc>>, + function_ids: + collections::HashMap<(relative_path::RelativePathBuf, String), cranelift_module::FuncId>, } /// An error that may happen at runtime. @@ -166,8 +170,12 @@ define_function!( impl Module { pub(crate) fn new( compiled: cranelift_module::Module, - function_ids: collections::HashMap, + function_ids: collections::HashMap< + (relative_path::RelativePathBuf, String), + cranelift_module::FuncId, + >, ) -> Self { + let compiled = sync::Arc::new(sync::Mutex::new(compiled)); Module { compiled, function_ids, @@ -177,13 +185,18 @@ impl Module { /// Fetches the specified function with the specified signature. /// /// Returns `None` if the signature does not match the compiled function. - pub fn function(&mut self, name: &str) -> Option + pub fn function(&mut self, module: P, name: &str) -> Option where F: Function, + P: AsRef, { - if let Some(id) = self.function_ids.get(name) { + if let Some(id) = self + .function_ids + .get(&(module.as_ref().to_owned(), name.to_owned())) + { + let mut compiled = self.compiled.lock().unwrap(); // TODO: type check - Some(unsafe { F::from_ptr(self.compiled.get_finalized_function(*id)) }) + Some(unsafe { F::from_ptr(compiled.get_finalized_function(*id)) }) } else { None } From 20a329ef7f91da6d28fa2577313326dd10771c8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Flemstr=C3=B6m?= Date: Sun, 18 Aug 2019 17:49:33 +0200 Subject: [PATCH 22/22] Fix small compilation errors --- src/codegen/mod.rs | 43 +++----------------------------------- tests/integration_tests.rs | 4 ++-- 2 files changed, 5 insertions(+), 42 deletions(-) diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs index ca8de8d..59b677a 100644 --- a/src/codegen/mod.rs +++ b/src/codegen/mod.rs @@ -36,22 +36,12 @@ mod util; pub trait Db: salsa::Database + interpreter::Db + ir::Db + layout::Db + ty::Db { #[salsa::dependencies] fn codegen(&self) -> error::Result>; - - fn codegen_ptr_type(&self) -> codegen::ir::Type; - - #[salsa::dependencies] - fn codegen_isa(&self) -> Isa; } pub struct Data { ctx: cranelift_module::DataContext, } -#[derive(Clone)] -pub struct Isa { - raw: sync::Arc, -} - struct Symbol<'d, D>(&'d D, ir::Entity); struct Function { @@ -75,7 +65,7 @@ where } fn codegen(db: &impl Db) -> error::Result> { - let ptr_type = db.codegen_ptr_type(); + let ptr_type = codegen_ptr_type(db); let mut builder = cranelift_simplejit::SimpleJITBuilder::new(cranelift_module::default_libcall_names()); builder.symbols(builtin::BUILTINS.iter().map(|b| (b.symbol, b.ptr))); @@ -97,17 +87,6 @@ fn codegen_ptr_type(db: &impl Db) -> codegen::ir::Type { } } -fn codegen_isa(db: &impl Db) -> Isa { - let flag_builder = codegen::settings::builder(); - let isa_builder = cranelift_native::builder().unwrap_or_else(|msg| { - panic!("host machine is not supported: {}", msg); - }); - let raw = isa_builder - .finish(codegen::settings::Flags::new(flag_builder)) - .into(); - Isa { raw } -} - impl<'m, 'd, B, D> Codegen<'m, 'd, B, D> where B: cranelift_module::Backend, @@ -246,8 +225,7 @@ where ) -> error::Result<(String, codegen::Context)> { use cranelift::codegen::ir::InstBuilder; - let mut ctx = codegen::Context::new(); - ctx.func.signature.call_conv = self.db.codegen_isa().default_call_conv(); + let mut ctx = self.module.make_context(); let ret_type = self.populate_function_signature(ty, &mut ctx, false); let mut builder_context = frontend::FunctionBuilderContext::new(); @@ -510,10 +488,9 @@ where fn codegen_data(&mut self, entity: ir::Entity) -> error::Result>> { if let Some(value) = self.db.value(entity)? { let layout = self.db.layout(entity)?; - let ptr_type = self.db.codegen_ptr_type(); let mut ctx = cranelift_module::DataContext::new(); let mut data = Vec::new(); - data::Translator::new(&mut data, ptr_type).store_value(&*layout, &value); + data::Translator::new(&mut data, self.ptr_type).store_value(&*layout, &value); ctx.define(data.into_boxed_slice()); Ok(Some(sync::Arc::new(Data { ctx }))) } else { @@ -589,20 +566,6 @@ impl fmt::Debug for Data { } } -impl fmt::Debug for Isa { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_struct("Isa").finish() - } -} - -impl ops::Deref for Isa { - type Target = dyn codegen::isa::TargetIsa; - - fn deref(&self) -> &Self::Target { - &*self.raw - } -} - impl<'d, D> fmt::Display for Symbol<'d, D> where D: Db, diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs index d4f9acd..e0681f4 100644 --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -35,7 +35,7 @@ fn test_ok(path: &str) -> Result<(), failure::Error> { let main = module .unwrap() - .function::>("main") + .function::, _>("TODO", "main") .unwrap(); assert_eq!(Ok(0), main.call()); @@ -68,7 +68,7 @@ fn test_err(path: &str, err: &str) -> Result<(), failure::Error> { .map_err(|e| report_diagnostics(tin.codemap(), e, &mut err_actual)) { let _ = module - .function::>("main") + .function::, _>("TODO", "main") .unwrap() .call() .map_err(|e| report_error(e, &mut err_actual));