diff --git a/.cargo/config b/.cargo/config.toml similarity index 100% rename from .cargo/config rename to .cargo/config.toml diff --git a/Cargo.lock b/Cargo.lock index 10533c69..ea80d114 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,13 +4,14 @@ version = 3 [[package]] name = "ahash" -version = "0.7.8" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ - "getrandom", + "cfg-if 1.0.0", "once_cell", "version_check", + "zerocopy", ] [[package]] @@ -22,6 +23,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "allocator-api2" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" + [[package]] name = "ansi_term" version = "0.12.1" @@ -33,9 +40,9 @@ dependencies = [ [[package]] name = "arc-swap" -version = "1.5.1" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "983cd8b9d4b02a6dc6ffa557262eb5858a27a0038ffffe21a0f133eaa819a164" +checksum = "69f7f8c3906b62b754cd5326047894316021dcfe5a194c8ea52bdd94934a3457" [[package]] name = "ariadne" @@ -54,7 +61,7 @@ checksum = "76464446b8bc32758d7e88ee1a804d9914cd9b1cb264c029899680b0be29826f" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.99", ] [[package]] @@ -259,7 +266,7 @@ dependencies = [ name = "dada-collections" version = "0.1.0" dependencies = [ - "indexmap", + "indexmap 1.9.1", "rustc-hash", "typed-index-collections", ] @@ -453,12 +460,15 @@ dependencies = [ [[package]] name = "dashmap" -version = "4.0.2" +version = "5.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e77a43b28d0668df09411cb0bc9a8c2adc40f9a048afe863e05fd43251e8e39c" +checksum = "907076dfda823b0b36d2a1bb5f90c96660a5bbcd7729e10727f07858f22c4edc" dependencies = [ "cfg-if 1.0.0", - "num_cpus", + "hashbrown 0.12.3", + "lock_api", + "once_cell", + "parking_lot_core 0.9.3", ] [[package]] @@ -469,7 +479,7 @@ checksum = "3418329ca0ad70234b9735dc4ceed10af4df60eff9c8e7b06cb5e520d92c3535" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.99", ] [[package]] @@ -484,6 +494,12 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c02b5d1d1e6ba431b960d4bf971c8b0e2d2942b8cbc577d9bdf9c60fca5d41d" +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + [[package]] name = "extension-trait" version = "1.0.1" @@ -492,7 +508,7 @@ checksum = "5129068fe3183546eaa0529af88ab0afbcddec2a373db69e94a20b8d5f6c4d74" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.99", ] [[package]] @@ -530,17 +546,6 @@ dependencies = [ "cfg-if 0.1.10", ] -[[package]] -name = "getrandom" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "wasi", -] - [[package]] name = "globset" version = "0.4.9" @@ -556,26 +561,27 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.11.2" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" -dependencies = [ - "ahash", -] +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "hashbrown" -version = "0.12.3" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +dependencies = [ + "ahash", + "allocator-api2", +] [[package]] name = "hashlink" -version = "0.7.0" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7249a3129cbc1ffccd74857f81464a323a152173cdb134e0fd81bc803b29facf" +checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7" dependencies = [ - "hashbrown 0.11.2", + "hashbrown 0.14.3", ] [[package]] @@ -587,6 +593,12 @@ dependencies = [ "unicode-segmentation", ] +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + [[package]] name = "hermit-abi" version = "0.1.19" @@ -650,6 +662,16 @@ dependencies = [ "hashbrown 0.12.3", ] +[[package]] +name = "indexmap" +version = "2.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +dependencies = [ + "equivalent", + "hashbrown 0.14.3", +] + [[package]] name = "instant" version = "0.1.12" @@ -700,9 +722,9 @@ checksum = "8371e4e5341c3a96db127eb2465ac681ced4c433e01dd0e938adbef26ba93ba5" [[package]] name = "lock_api" -version = "0.4.7" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" dependencies = [ "autocfg", "scopeguard", @@ -806,9 +828,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.13.1" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "074864da206b4973b84eb91683020dbefd6a8c3f0f38e054d93954e891935e4e" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "overload" @@ -885,7 +907,7 @@ dependencies = [ "proc-macro-error-attr", "proc-macro2", "quote", - "syn", + "syn 1.0.99", "version_check", ] @@ -902,18 +924,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.43" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a2ca2c61bc9f3d74d2886294ab7b9853abd9c1ad903a3ac7815c58989bb7bab" +checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.21" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -975,16 +997,16 @@ dependencies = [ [[package]] name = "salsa-2022" version = "0.1.0" -source = "git+https://github.com/salsa-rs/salsa/?branch=master#80d0d141945051ec86ecd979ac06cca1e364b27e" +source = "git+https://github.com/salsa-rs/salsa/?branch=master#f5aec4abefb4c5e67cba6d8ea91c216bc2838f10" dependencies = [ "arc-swap", "crossbeam", "crossbeam-utils", "dashmap", "hashlink", - "indexmap", + "indexmap 2.2.6", "log", - "parking_lot 0.11.2", + "parking_lot 0.12.1", "rustc-hash", "salsa-2022-macros", "smallvec", @@ -993,13 +1015,13 @@ dependencies = [ [[package]] name = "salsa-2022-macros" version = "0.1.0" -source = "git+https://github.com/salsa-rs/salsa/?branch=master#80d0d141945051ec86ecd979ac06cca1e364b27e" +source = "git+https://github.com/salsa-rs/salsa/?branch=master#f5aec4abefb4c5e67cba6d8ea91c216bc2838f10" dependencies = [ "eyre", - "heck", + "heck 0.4.1", "proc-macro2", "quote", - "syn", + "syn 1.0.99", ] [[package]] @@ -1034,7 +1056,7 @@ checksum = "d3d8e8de557aee63c26b85b947f5e59b690d0454c753f3adeb5cd7835ab88391" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.99", ] [[package]] @@ -1056,7 +1078,7 @@ checksum = "1fe39d9fbb0ebf5eb2c7cb7e2a47e4f462fad1379f1166b8ae49ad9eae89a7ca" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.99", ] [[package]] @@ -1122,11 +1144,11 @@ version = "0.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0" dependencies = [ - "heck", + "heck 0.3.3", "proc-macro-error", "proc-macro2", "quote", - "syn", + "syn 1.0.99", ] [[package]] @@ -1140,6 +1162,17 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "syn" +version = "2.0.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44cfb93f38070beee36b3fef7d4f5a16f27751d94b187b666a5cc5e9b0d30687" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "textwrap" version = "0.11.0" @@ -1166,7 +1199,7 @@ checksum = "12bafc5b54507e0149cdf1b145a5d80ab80a90bcd9275df43d4fff68460f6c21" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.99", ] [[package]] @@ -1230,7 +1263,7 @@ checksum = "9724f9a975fb987ef7a3cd9be0350edcbe130698af5b8f7a631e23d42d052484" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.99", ] [[package]] @@ -1253,7 +1286,7 @@ checksum = "11c75893af559bc8e10716548bdef5cb2b983f8e637db9d0e15126b61b484ee2" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.99", ] [[package]] @@ -1439,7 +1472,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn", + "syn 1.0.99", "wasm-bindgen-shared", ] @@ -1473,7 +1506,7 @@ checksum = "5be8e654bdd9b79216c2929ab90721aa82faf65c48cdf08bdc4e7f51357b80da" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.99", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -1666,3 +1699,23 @@ name = "yansi" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" + +[[package]] +name = "zerocopy" +version = "0.7.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.58", +] diff --git a/components/dada-db/src/lib.rs b/components/dada-db/src/lib.rs index a79083c8..53370d57 100644 --- a/components/dada-db/src/lib.rs +++ b/components/dada-db/src/lib.rs @@ -27,11 +27,7 @@ pub struct Db { storage: salsa::Storage, } -impl salsa::Database for Db { - fn salsa_runtime(&self) -> &salsa::Runtime { - self.storage.runtime() - } -} +impl salsa::Database for Db {} impl salsa::ParallelDatabase for Db { fn snapshot(&self) -> salsa::Snapshot { @@ -49,7 +45,7 @@ impl Db { /// Set the breakpoints within the given file where the interpreter stops and executes callbacks. pub fn set_breakpoints(&mut self, input_file: InputFile, locations: Vec) { - input_file.set_breakpoint_locations(self, locations); + input_file.set_breakpoint_locations(self).to(locations); } /// Checks `input_file` for compilation errors and returns all relevant diagnostics. diff --git a/components/dada-execute/src/machine/op.rs b/components/dada-execute/src/machine/op.rs index adce1d50..32cb57fa 100644 --- a/components/dada-execute/src/machine/op.rs +++ b/components/dada-execute/src/machine/op.rs @@ -15,9 +15,6 @@ pub(crate) trait MachineOp: + std::ops::Index + Debug { - /// Gives a frozen view onto the state of the machine. - fn view(&self) -> &Machine; - fn frames(&self) -> &IndexVec; fn push_frame( &mut self, @@ -29,7 +26,6 @@ pub(crate) trait MachineOp: fn clear_frame(&mut self); fn pop_frame(&mut self) -> Frame; fn top_frame(&self) -> Option<&Frame>; - fn top_frame_index(&self) -> Option; fn object(&self, object: Object) -> &ObjectData; fn object_mut(&mut self, object: Object) -> &mut ObjectData; @@ -62,10 +58,6 @@ pub(crate) trait MachineOp: } impl MachineOp for Machine { - fn view(&self) -> &Machine { - self - } - fn frames(&self) -> &IndexVec { &self.stack.frames } @@ -132,15 +124,6 @@ impl MachineOp for Machine { self.stack.frames.last() } - fn top_frame_index(&self) -> Option { - let l = self.stack.frames.len(); - if l == 0 { - None - } else { - Some(FrameIndex::from(l - 1)) - } - } - #[track_caller] fn object(&self, object: Object) -> &ObjectData { self.heap diff --git a/components/dada-id/src/lib.rs b/components/dada-id/src/lib.rs index 70f0b9fe..1bc69a7c 100644 --- a/components/dada-id/src/lib.rs +++ b/components/dada-id/src/lib.rs @@ -25,8 +25,8 @@ pub mod prelude { } /// This module is used by the `tables` macro. +#[allow(non_camel_case_types)] pub mod table_types { - #![allow(non_camel_case_types)] pub type alloc = crate::alloc_table::AllocTable; pub type intern = crate::intern_table::InternTable; } diff --git a/components/dada-ir/src/class.rs b/components/dada-ir/src/class.rs index 300be913..8df9795a 100644 --- a/components/dada-ir/src/class.rs +++ b/components/dada-ir/src/class.rs @@ -6,17 +6,18 @@ use crate::{ }; #[salsa::tracked] +#[customize(DebugWithDb)] pub struct Class { #[id] - name: Word, + pub name: Word, - input_file: InputFile, + pub input_file: InputFile, #[return_ref] - signature_syntax: syntax::Signature, + pub signature_syntax: syntax::Signature, /// Overall span of the class (including any body) - span: Span, + pub span: Span, } impl Class { diff --git a/components/dada-ir/src/code/bir.rs b/components/dada-ir/src/code/bir.rs index 2e7aeaff..a0b5bf10 100644 --- a/components/dada-ir/src/code/bir.rs +++ b/components/dada-ir/src/code/bir.rs @@ -22,23 +22,24 @@ use salsa::DebugWithDb; use super::{syntax, validated}; #[salsa::tracked] +#[customize(DebugWithDb)] pub struct Bir { /// Name of file containing the code from which this Bir was created. - input_file: InputFile, + pub input_file: InputFile, /// Name of function containing the code from which this Bir was created. - function_name: Word, + pub function_name: Word, /// Syntax tree from which this Bir was created. - syntax_tree: syntax::Tree, + pub syntax_tree: syntax::Tree, /// The BIR bir #[return_ref] - data: BirData, + pub data: BirData, /// Origins of expr in the BIR. Used to trace back to a source span. #[return_ref] - origins: Origins, + pub origins: Origins, } impl Anchored for Bir { diff --git a/components/dada-ir/src/code/syntax.rs b/components/dada-ir/src/code/syntax.rs index 5225262d..818ab792 100644 --- a/components/dada-ir/src/code/syntax.rs +++ b/components/dada-ir/src/code/syntax.rs @@ -46,18 +46,19 @@ pub enum GenericParameter { /// The "syntax tree" is the parsed form of a function body. /// It maps more-or-less directly to what the user typed. #[salsa::tracked] +#[customize(DebugWithDb)] pub struct Tree { /// Identifies the root expression in the function body. #[return_ref] - data: TreeData, + pub data: TreeData, /// Interning tables for expressions and the like. #[return_ref] - tables: Tables, + pub tables: Tables, /// The span information for each node in the tree. #[return_ref] - spans: Spans, + pub spans: Spans, } impl DebugWithDb for Tree { diff --git a/components/dada-ir/src/code/validated.rs b/components/dada-ir/src/code/validated.rs index 36ebae7a..6cc4df4e 100644 --- a/components/dada-ir/src/code/validated.rs +++ b/components/dada-ir/src/code/validated.rs @@ -13,15 +13,16 @@ use super::syntax; /// The "validated" form of a particular [syntax tree](`crate::code::syntax::Tree`). #[salsa::tracked] +#[customize(DebugWithDb)] pub struct Tree { /// The function that this tree is associated with. - function: Function, + pub function: Function, #[return_ref] - data: TreeData, + pub data: TreeData, #[return_ref] - origins: Origins, + pub origins: Origins, } impl DebugWithDb for Tree { diff --git a/components/dada-ir/src/format_string.rs b/components/dada-ir/src/format_string.rs index 6ee8b4aa..e9d29649 100644 --- a/components/dada-ir/src/format_string.rs +++ b/components/dada-ir/src/format_string.rs @@ -4,6 +4,7 @@ use crate::{token_tree::TokenTree, word::Word}; #[salsa::interned] +#[customize(DebugWithDb)] #[derive(Clone, Debug, PartialEq, Eq, Hash)] #[allow(clippy::len_without_is_empty)] pub struct FormatString { @@ -28,8 +29,9 @@ impl salsa::DebugWithDb for FormatString { } #[salsa::interned] +#[customize(DebugWithDb)] pub struct FormatStringSection { - data: FormatStringSectionData, + pub data: FormatStringSectionData, } #[derive(Clone, Debug, PartialEq, Eq, Hash)] diff --git a/components/dada-ir/src/function.rs b/components/dada-ir/src/function.rs index 999b46f7..714d90cd 100644 --- a/components/dada-ir/src/function.rs +++ b/components/dada-ir/src/function.rs @@ -12,15 +12,16 @@ use crate::{ }; #[salsa::tracked] +#[customize(DebugWithDb)] pub struct Function { #[id] - name: Word, + pub name: Word, - input_file: InputFile, + pub input_file: InputFile, /// The function signature. #[return_ref] - signature_syntax: FunctionSignature, + pub signature_syntax: FunctionSignature, /// The body and parameters of functions are only parsed /// on demand by invoking (e.g.) `syntax_tree` from the @@ -30,10 +31,10 @@ pub struct Function { /// been parsed must be specified explicitly by the /// creator of the function. This is used for synthesizing /// a 'main' function from a module, for example. - unparsed_code: Option, + pub unparsed_code: Option, /// Overall span of the function (including the code) - span: Span, + pub span: Span, } #[derive(Clone, PartialEq, Eq, Debug)] diff --git a/components/dada-ir/src/in_ir_db.rs b/components/dada-ir/src/in_ir_db.rs index e9291959..a5b72c10 100644 --- a/components/dada-ir/src/in_ir_db.rs +++ b/components/dada-ir/src/in_ir_db.rs @@ -1,8 +1,16 @@ +use salsa::database::AsSalsaDatabase; + pub struct InIrDb<'me, T: ?Sized> { this: &'me T, db: &'me dyn crate::Db, } +impl AsSalsaDatabase for InIrDb<'_, T> { + fn as_salsa_database(&self) -> &dyn salsa::Database { + self.db.as_salsa_database() + } +} + impl<'me, T> InIrDb<'me, T> { pub fn db(&self) -> &'me dyn crate::Db { self.db diff --git a/components/dada-ir/src/input_file.rs b/components/dada-ir/src/input_file.rs index db6f3d07..42b79379 100644 --- a/components/dada-ir/src/input_file.rs +++ b/components/dada-ir/src/input_file.rs @@ -6,16 +6,17 @@ use crate::{ }; #[salsa::input] +#[customize(DebugWithDb)] pub struct InputFile { - name: Word, + pub name: Word, /// The raw contents of this input file, as a string. #[return_ref] - source_text: String, + pub source_text: String, /// The locations of any breakpoints set in this file. #[return_ref] - breakpoint_locations: Vec, + pub breakpoint_locations: Vec, } impl InputFile { diff --git a/components/dada-ir/src/source_file.rs b/components/dada-ir/src/source_file.rs index a741c2aa..cf21d042 100644 --- a/components/dada-ir/src/source_file.rs +++ b/components/dada-ir/src/source_file.rs @@ -4,20 +4,21 @@ use crate::{input_file::InputFile, item::Item}; #[salsa::tracked] /// The result of parsing an input file like `foo.dada`, or the /// value from the playground. A program is a collection of files. +#[customize(DebugWithDb)] pub struct SourceFile { #[id] - input_file: InputFile, + pub input_file: InputFile, /// The items found in the file. #[return_ref] - items: Vec, + pub items: Vec, /// Top-level "main" function from this file (if any). /// This function will also be present in `items`. /// /// This is not a function declaed with `fn` but rather just /// code the user added at the top of the file. - main_fn: Option, + pub main_fn: Option, } pub const TOP_LEVEL_FN: &str = "builtin@main"; diff --git a/components/dada-ir/src/token_tree.rs b/components/dada-ir/src/token_tree.rs index e65ac36a..52c5a59b 100644 --- a/components/dada-ir/src/token_tree.rs +++ b/components/dada-ir/src/token_tree.rs @@ -5,11 +5,12 @@ use crate::{ }; #[salsa::tracked] +#[customize(DebugWithDb)] pub struct TokenTree { - input_file: InputFile, - span: Span, + pub input_file: InputFile, + pub span: Span, #[return_ref] - tokens: Vec, + pub tokens: Vec, } impl Anchored for TokenTree { diff --git a/components/dada-ir/src/word.rs b/components/dada-ir/src/word.rs index 2b9e5d62..81811a96 100644 --- a/components/dada-ir/src/word.rs +++ b/components/dada-ir/src/word.rs @@ -2,6 +2,7 @@ use salsa::DebugWithDb; #[salsa::interned] #[derive(Clone, Debug, PartialEq, Eq, Hash)] +#[customize(DebugWithDb)] pub struct Word { #[return_ref] pub string: String, @@ -34,6 +35,7 @@ impl DebugWithDb for Word { #[salsa::interned] #[derive(Clone, Debug, PartialEq, Eq, Hash)] +#[customize(DebugWithDb)] pub struct Words { #[return_ref] pub elements: Vec, diff --git a/components/dada-lang/src/test_harness.rs b/components/dada-lang/src/test_harness.rs index 90884d1c..ef03fd13 100644 --- a/components/dada-lang/src/test_harness.rs +++ b/components/dada-lang/src/test_harness.rs @@ -555,17 +555,6 @@ impl std::fmt::Display for OtherErrors { } } -#[derive(Debug)] -struct ExpectedDiagnosticNotFound(ExpectedDiagnostic); - -impl std::error::Error for ExpectedDiagnosticNotFound {} - -impl std::fmt::Display for ExpectedDiagnosticNotFound { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{self:#?}") - } -} - /// Part of the code to check diagnostics: the diagnostics checker pushes /// strings into these vectors so we can display a nice diff. /// diff --git a/components/dada-lang/src/test_harness/heap_graph_query.rs b/components/dada-lang/src/test_harness/heap_graph_query.rs index 07073dac..8111e435 100644 --- a/components/dada-lang/src/test_harness/heap_graph_query.rs +++ b/components/dada-lang/src/test_harness/heap_graph_query.rs @@ -10,7 +10,7 @@ use crate::test_harness::QueryKind; use super::{Errors, Query}; impl super::Options { - #[tracing::instrument(level = "Debug", skip(self, db, errors))] + // #[tracing::instrument(level = "Debug", skip(self, db, errors))] pub(super) async fn perform_heap_graph_query_on_db( &self, db: &mut dada_db::Db, diff --git a/components/dada-lsp/src/db.rs b/components/dada-lsp/src/db.rs index 0b75e616..9b3474dc 100644 --- a/components/dada-lsp/src/db.rs +++ b/components/dada-lsp/src/db.rs @@ -36,7 +36,7 @@ impl LspServerDatabase { pub fn did_open(&mut self, params: DidOpenTextDocumentParams) { let input_file = self.input_file_from_uri(¶ms.text_document.uri); let source_text = params.text_document.text; - input_file.set_source_text(&mut self.db, source_text); + input_file.set_source_text(&mut self.db).to(source_text); self.spawn_check( params.text_document.uri, params.text_document.version, @@ -49,7 +49,7 @@ impl LspServerDatabase { // Since we asked for Sync full, just grab all the text from params let change = params.content_changes.into_iter().next().unwrap(); let source_text = change.text; - input_file.set_source_text(&mut self.db, source_text); + input_file.set_source_text(&mut self.db).to(source_text); self.spawn_check( params.text_document.uri, params.text_document.version, diff --git a/components/dada-parse/src/parser.rs b/components/dada-parse/src/parser.rs index 74120eaf..879a4bdf 100644 --- a/components/dada-parse/src/parser.rs +++ b/components/dada-parse/src/parser.rs @@ -1,5 +1,3 @@ -use std::string::ToString; - use crate::{ token_test::{AnyTree, TokenTest}, tokens::Tokens, diff --git a/components/dada-parse/src/parser/expr.rs b/components/dada-parse/src/parser/expr.rs index b16afd1d..45eca9ed 100644 --- a/components/dada-parse/src/parser/expr.rs +++ b/components/dada-parse/src/parser/expr.rs @@ -51,7 +51,6 @@ impl CodeParser<'_, '_> { } } - /// fn parse_named_expr(&mut self) -> Option { let name = self.parse_label(); let expr = if name.is_some() { diff --git a/components/dada-parse/src/parser/ty.rs b/components/dada-parse/src/parser/ty.rs index 105574bd..2f527d24 100644 --- a/components/dada-parse/src/parser/ty.rs +++ b/components/dada-parse/src/parser/ty.rs @@ -8,9 +8,7 @@ use super::{CodeParser, Parser, SpanFallover}; impl CodeParser<'_, '_> { /// Parse `: Ty`. pub(crate) fn parse_colon_ty(&mut self) -> Option { - let Some(colon_span) = self.eat_op(Op::Colon) else { - return None; - }; + let colon_span = self.eat_op(Op::Colon)?; let opt_ty = self.parse_ty(); if opt_ty.is_none() { self.error_at_current_token("expected type after `:`") @@ -81,9 +79,7 @@ impl CodeParser<'_, '_> { } pub(crate) fn parse_perm_paths(&mut self) -> Option { - let Some((span, token_tree)) = self.delimited('{') else { - return None; - }; + let (span, token_tree) = self.delimited('{')?; let mut parser = Parser::new(self.db, token_tree); let mut subparser = parser.code_parser(self.tables, self.spans); let paths = subparser.parse_only_paths(); diff --git a/components/dada-parse/src/token_test.rs b/components/dada-parse/src/token_test.rs index cfac2324..1c47f25c 100644 --- a/components/dada-parse/src/token_test.rs +++ b/components/dada-parse/src/token_test.rs @@ -21,9 +21,7 @@ impl TokenTest for Keyword { type Narrow = Self; fn test(self, db: &dyn crate::Db, token: Token, _span: FileSpan) -> Option { - let Some(str) = token.alphabetic_str(db) else { - return None; - }; + let str = token.alphabetic_str(db)?; if str == self.str() { Some(self) diff --git a/components/dada-validate/src/validate/validator/string_literals.rs b/components/dada-validate/src/validate/validator/string_literals.rs index a5b65139..9c04b278 100644 --- a/components/dada-validate/src/validate/validator/string_literals.rs +++ b/components/dada-validate/src/validate/validator/string_literals.rs @@ -1,7 +1,6 @@ use super::*; impl Validator<'_> { - /// pub(super) fn concatenate( &mut self, concatenate_expr: syntax::Expr, diff --git a/components/dada-web/src/lib.rs b/components/dada-web/src/lib.rs index 064d2ce2..c8f808b3 100644 --- a/components/dada-web/src/lib.rs +++ b/components/dada-web/src/lib.rs @@ -1,4 +1,5 @@ #![allow(clippy::unused_unit)] // wasm-bindgen seems to trigger this +#![allow(clippy::assigning_clones)] // `clone_into` is annoying use dada_error_format::format_diagnostics; use dada_execute::kernel::BufferKernel; @@ -69,21 +70,25 @@ impl DadaCompiler { #[wasm_bindgen] pub fn with_source_text(mut self, source_text: String) -> Self { tracing::debug!("with_source_text: {source_text:?}"); - self.input_file.set_source_text(&mut self.db, source_text); + self.input_file + .set_source_text(&mut self.db) + .to(source_text); self } #[wasm_bindgen] pub fn with_breakpoint(mut self, line0: u32, column0: u32) -> Self { self.input_file - .set_breakpoint_locations(&mut self.db, vec![LineColumn::new0(line0, column0)]); + .set_breakpoint_locations(&mut self.db) + .to(vec![LineColumn::new0(line0, column0)]); self } #[wasm_bindgen] pub fn without_breakpoint(mut self) -> Self { self.input_file - .set_breakpoint_locations(&mut self.db, vec![]); + .set_breakpoint_locations(&mut self.db) + .to(vec![]); self }