difftreelog
build merge dependency updates
in: master
49 files changed
Cargo.lockdiffbeforeafterboth1# This file is automatically @generated by Cargo.1# This file is automatically @generated by Cargo.2# It is not intended for manual editing.2# It is not intended for manual editing.3version = 33version = 4445[[package]]5[[package]]6name = "ahash"6name = "aho-corasick"7version = "0.8.12"7version = "1.1.4"8source = "registry+https://github.com/rust-lang/crates.io-index"8source = "registry+https://github.com/rust-lang/crates.io-index"9checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75"9checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301"10dependencies = [10dependencies = [11 "cfg-if",12 "once_cell",13 "version_check",14 "zerocopy",11 "memchr",15]12]161317[[package]]14[[package]]18name = "aho-corasick"15name = "aliasable"19version = "1.1.3"16version = "0.1.3"20source = "registry+https://github.com/rust-lang/crates.io-index"17source = "registry+https://github.com/rust-lang/crates.io-index"21checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"18checksum = "250f629c0161ad8107cf89319e990051fae62832fd343083bea452d93e2205fd"22dependencies = [23 "memchr",24]251926[[package]]20[[package]]27name = "allocator-api2"21name = "allocator-api2"312532[[package]]26[[package]]33name = "annotate-snippets"27name = "annotate-snippets"34version = "0.10.2"28version = "0.12.11"35source = "registry+https://github.com/rust-lang/crates.io-index"29source = "registry+https://github.com/rust-lang/crates.io-index"36checksum = "6d9b665789884a7e8fb06c84b295e923b03ca51edbb7d08f91a6a50322ecbfe6"30checksum = "16e4850548ff4a25a77ce3bda7241874e17fb702ea551f0cc62a2dbe052f1272"37dependencies = [31dependencies = [38 "anstyle",32 "anstyle",39 "unicode-width",33 "unicode-width",40]34]3536[[package]]37name = "annotated-string"38version = "0.3.0"39source = "registry+https://github.com/rust-lang/crates.io-index"40checksum = "298ed730801db3c02f2edba003c9420a0f57ea48d37fdc5601c536113668c059"41dependencies = [42 "hi-doc-jumprope",43 "itertools",44 "ouroboros",45]414642[[package]]47[[package]]43name = "anstream"48name = "anstream"44version = "0.6.20"49version = "0.6.21"45source = "registry+https://github.com/rust-lang/crates.io-index"50source = "registry+https://github.com/rust-lang/crates.io-index"46checksum = "3ae563653d1938f79b1ab1b5e668c87c76a9930414574a6583a7b7e11a8e6192"51checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a"47dependencies = [52dependencies = [48 "anstyle",53 "anstyle",49 "anstyle-parse",54 "anstyle-parse",566157[[package]]62[[package]]58name = "anstyle"63name = "anstyle"59version = "1.0.11"64version = "1.0.13"60source = "registry+https://github.com/rust-lang/crates.io-index"65source = "registry+https://github.com/rust-lang/crates.io-index"61checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd"66checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78"626763[[package]]68[[package]]64name = "anstyle-parse"69name = "anstyle-parse"717672[[package]]77[[package]]73name = "anstyle-query"78name = "anstyle-query"74version = "1.1.4"79version = "1.1.5"75source = "registry+https://github.com/rust-lang/crates.io-index"80source = "registry+https://github.com/rust-lang/crates.io-index"76checksum = "9e231f6134f61b71076a3eab506c379d4f36122f2af15a9ff04415ea4c3339e2"81checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc"77dependencies = [82dependencies = [78 "windows-sys 0.60.2",83 "windows-sys 0.61.2",79]84]808581[[package]]86[[package]]82name = "anstyle-wincon"87name = "anstyle-wincon"83version = "3.0.10"88version = "3.0.11"84source = "registry+https://github.com/rust-lang/crates.io-index"89source = "registry+https://github.com/rust-lang/crates.io-index"85checksum = "3e0633414522a32ffaac8ac6cc8f748e090c5717661fddeea04219e2344f5f2a"90checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d"86dependencies = [91dependencies = [87 "anstyle",92 "anstyle",88 "once_cell_polyfill",93 "once_cell_polyfill",89 "windows-sys 0.60.2",94 "windows-sys 0.61.2",90]95]919692[[package]]97[[package]]93name = "anyhow"98name = "anyhow"94version = "1.0.99"99version = "1.0.101"95source = "registry+https://github.com/rust-lang/crates.io-index"100source = "registry+https://github.com/rust-lang/crates.io-index"96checksum = "b0674a1ddeecb70197781e945de4b3b8ffb61fa939a5597bcf48503737663100"101checksum = "5f0e0fee31ef5ed1ba1316088939cea399010ed7731dba877ed44aeb407a75ea"102103[[package]]104name = "ar_archive_writer"105version = "0.5.1"106source = "registry+https://github.com/rust-lang/crates.io-index"107checksum = "7eb93bbb63b9c227414f6eb3a0adfddca591a8ce1e9b60661bb08969b87e340b"108dependencies = [109 "object",110]9711198[[package]]112[[package]]99name = "autocfg"113name = "autocfg"107source = "registry+https://github.com/rust-lang/crates.io-index"121source = "registry+https://github.com/rust-lang/crates.io-index"108checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"122checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"109110[[package]]111name = "beef"112version = "0.5.2"113source = "registry+https://github.com/rust-lang/crates.io-index"114checksum = "3a8241f3ebb85c056b509d4327ad0358fbbba6ffb340bf388f26350aeda225b1"115123116[[package]]124[[package]]117name = "bitflags"125name = "bitflags"118version = "2.9.2"126version = "2.10.0"119source = "registry+https://github.com/rust-lang/crates.io-index"127source = "registry+https://github.com/rust-lang/crates.io-index"120checksum = "6a65b545ab31d687cff52899d4890855fec459eb6afe0da6417b8a18da87aa29"128checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3"121129122[[package]]130[[package]]123name = "block-buffer"131name = "block-buffer"130138131[[package]]139[[package]]132name = "bumpalo"140name = "bumpalo"133version = "3.19.0"141version = "3.19.1"134source = "registry+https://github.com/rust-lang/crates.io-index"142source = "registry+https://github.com/rust-lang/crates.io-index"135checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43"143checksum = "5dd9dc738b7a8311c7ade152424974d8115f2cdad61e8dab8dac9f2362298510"144dependencies = [145 "allocator-api2",146]136147137[[package]]148[[package]]138name = "cc"149name = "cc"139version = "1.2.33"150version = "1.2.55"140source = "registry+https://github.com/rust-lang/crates.io-index"151source = "registry+https://github.com/rust-lang/crates.io-index"141checksum = "3ee0f8803222ba5a7e2777dd72ca451868909b1ac410621b676adf07280e9b5f"152checksum = "47b26a0954ae34af09b50f0de26458fa95369a0d478d8236d3f93082b219bd29"142dependencies = [153dependencies = [154 "find-msvc-tools",143 "shlex",155 "shlex",144]156]145157146[[package]]158[[package]]147name = "cfg-if"159name = "cfg-if"148version = "1.0.3"160version = "1.0.4"149source = "registry+https://github.com/rust-lang/crates.io-index"161source = "registry+https://github.com/rust-lang/crates.io-index"150checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9"162checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"151163152[[package]]164[[package]]153name = "clap"165name = "clap"154version = "4.5.45"166version = "4.5.57"155source = "registry+https://github.com/rust-lang/crates.io-index"167source = "registry+https://github.com/rust-lang/crates.io-index"156checksum = "1fc0e74a703892159f5ae7d3aac52c8e6c392f5ae5f359c70b5881d60aaac318"168checksum = "6899ea499e3fb9305a65d5ebf6e3d2248c5fab291f300ad0a704fbe142eae31a"157dependencies = [169dependencies = [158 "clap_builder",170 "clap_builder",159 "clap_derive",171 "clap_derive",160]172]161173162[[package]]174[[package]]163name = "clap_builder"175name = "clap_builder"164version = "4.5.44"176version = "4.5.57"165source = "registry+https://github.com/rust-lang/crates.io-index"177source = "registry+https://github.com/rust-lang/crates.io-index"166checksum = "b3e7f4214277f3c7aa526a59dd3fbe306a370daee1f8b7b8c987069cd8e888a8"178checksum = "7b12c8b680195a62a8364d16b8447b01b6c2c8f9aaf68bee653be34d4245e238"167dependencies = [179dependencies = [168 "anstream",180 "anstream",169 "anstyle",181 "anstyle",173185174[[package]]186[[package]]175name = "clap_complete"187name = "clap_complete"176version = "4.5.57"188version = "4.5.65"177source = "registry+https://github.com/rust-lang/crates.io-index"189source = "registry+https://github.com/rust-lang/crates.io-index"178checksum = "4d9501bd3f5f09f7bbee01da9a511073ed30a80cd7a509f1214bb74eadea71ad"190checksum = "430b4dc2b5e3861848de79627b2bedc9f3342c7da5173a14eaa5d0f8dc18ae5d"179dependencies = [191dependencies = [180 "clap",192 "clap",181]193]182194183[[package]]195[[package]]184name = "clap_derive"196name = "clap_derive"185version = "4.5.45"197version = "4.5.55"186source = "registry+https://github.com/rust-lang/crates.io-index"198source = "registry+https://github.com/rust-lang/crates.io-index"187checksum = "14cb31bb0a7d536caef2639baa7fad459e15c3144efefa6dbd1c84562c4739f6"199checksum = "a92793da1a46a5f2a02a6f4c46c6496b28c43638adea8306fcb0caa1634f24e5"188dependencies = [200dependencies = [189 "heck",201 "heck 0.5.0",190 "proc-macro2",202 "proc-macro2",191 "quote",203 "quote",192 "syn",204 "syn",193]205]194206195[[package]]207[[package]]196name = "clap_lex"208name = "clap_lex"197version = "0.7.5"209version = "0.7.7"198source = "registry+https://github.com/rust-lang/crates.io-index"210source = "registry+https://github.com/rust-lang/crates.io-index"199checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675"211checksum = "c3e64b0cc0439b12df2fa678eae89a1c56a529fd067a9115f7827f1fffd22b32"200212201[[package]]213[[package]]202name = "colorchoice"214name = "colorchoice"233245234[[package]]246[[package]]235name = "crypto-common"247name = "crypto-common"236version = "0.1.6"248version = "0.1.7"237source = "registry+https://github.com/rust-lang/crates.io-index"249source = "registry+https://github.com/rust-lang/crates.io-index"238checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"250checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a"239dependencies = [251dependencies = [240 "generic-array",252 "generic-array",241 "typenum",253 "typenum",259271260[[package]]272[[package]]261name = "dprint-core"273name = "dprint-core"262version = "0.65.0"274version = "0.67.4"263source = "registry+https://github.com/rust-lang/crates.io-index"275source = "registry+https://github.com/rust-lang/crates.io-index"264checksum = "b569f4e3085ae957ecc37588e6b2227791b72745434eae966db29e122ba27f0d"276checksum = "2c1d827947704a9495f705d6aeed270fa21a67f825f22902c28f38dc3af7a9ae"265dependencies = [277dependencies = [266 "anyhow",278 "anyhow",267 "bumpalo",279 "bumpalo",280 "hashbrown 0.15.5",268 "indexmap 2.10.0",281 "indexmap",269 "rustc-hash",282 "rustc-hash 2.1.1",270 "serde",283 "serde",271 "unicode-width",284 "unicode-width",272]285]297310298[[package]]311[[package]]299name = "errno"312name = "errno"300version = "0.3.13"313version = "0.3.14"301source = "registry+https://github.com/rust-lang/crates.io-index"314source = "registry+https://github.com/rust-lang/crates.io-index"302checksum = "778e2ac28f6c47af28e4907f13ffd1e1ddbd400980a9abd7c8df189bf578a5ad"315checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"303dependencies = [316dependencies = [304 "libc",317 "libc",305 "windows-sys 0.60.2",318 "windows-sys 0.61.2",306]319]320321[[package]]322name = "extension-trait"323version = "1.0.2"324source = "registry+https://github.com/rust-lang/crates.io-index"325checksum = "dd65f1b59dd22d680c7a626cc4a000c1e03d241c51c3e034d2bc9f1e90734f9b"326dependencies = [327 "proc-macro2",328 "quote",329 "syn",330]307331308[[package]]332[[package]]309name = "fastrand"333name = "fastrand"310version = "2.3.0"334version = "2.3.0"311source = "registry+https://github.com/rust-lang/crates.io-index"335source = "registry+https://github.com/rust-lang/crates.io-index"312checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"336checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"337338[[package]]339name = "find-msvc-tools"340version = "0.1.9"341source = "registry+https://github.com/rust-lang/crates.io-index"342checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582"313343314[[package]]344[[package]]315name = "fnv"345name = "fnv"323source = "registry+https://github.com/rust-lang/crates.io-index"353source = "registry+https://github.com/rust-lang/crates.io-index"324checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"354checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"355356[[package]]357name = "foldhash"358version = "0.2.0"359source = "registry+https://github.com/rust-lang/crates.io-index"360checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb"325361326[[package]]362[[package]]327name = "generic-array"363name = "generic-array"335371336[[package]]372[[package]]337name = "getrandom"373name = "getrandom"338version = "0.2.16"374version = "0.3.4"339source = "registry+https://github.com/rust-lang/crates.io-index"375source = "registry+https://github.com/rust-lang/crates.io-index"340checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592"376checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd"341dependencies = [377dependencies = [342 "cfg-if",378 "cfg-if",343 "libc",379 "libc",380 "r-efi",344 "wasi 0.11.1+wasi-snapshot-preview1",381 "wasip2",345]382]346383347[[package]]384[[package]]348name = "getrandom"385name = "hashbrown"349version = "0.3.3"386version = "0.14.5"350source = "registry+https://github.com/rust-lang/crates.io-index"387source = "registry+https://github.com/rust-lang/crates.io-index"351checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4"388checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"352dependencies = [353 "cfg-if",354 "libc",355 "r-efi",356 "wasi 0.14.2+wasi-0.2.4",357]358389359[[package]]390[[package]]360name = "hashbrown"391name = "hashbrown"361version = "0.12.3"392version = "0.15.5"362source = "registry+https://github.com/rust-lang/crates.io-index"393source = "registry+https://github.com/rust-lang/crates.io-index"363checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"394checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1"395dependencies = [396 "allocator-api2",397 "equivalent",398 "foldhash 0.1.5",399]364400365[[package]]401[[package]]366name = "hashbrown"402name = "hashbrown"367version = "0.14.5"403version = "0.16.1"368source = "registry+https://github.com/rust-lang/crates.io-index"404source = "registry+https://github.com/rust-lang/crates.io-index"369checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"405checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100"370dependencies = [406dependencies = [371 "ahash",372 "allocator-api2",407 "allocator-api2",408 "equivalent",409 "foldhash 0.2.0",373]410]374411375[[package]]412[[package]]376name = "hashbrown"413name = "heck"377version = "0.15.5"414version = "0.4.1"378source = "registry+https://github.com/rust-lang/crates.io-index"415source = "registry+https://github.com/rust-lang/crates.io-index"379checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1"416checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"380dependencies = [381 "allocator-api2",382 "equivalent",383 "foldhash",384]385417386[[package]]418[[package]]387name = "heck"419name = "heck"391423392[[package]]424[[package]]393name = "hi-doc"425name = "hi-doc"394version = "0.1.1"426version = "0.3.0"395source = "registry+https://github.com/rust-lang/crates.io-index"427source = "registry+https://github.com/rust-lang/crates.io-index"396checksum = "d2390a0c9be1370168ef9557833bad3bfa37e1720df61d7f7034f18c07b4e006"428checksum = "f70fb920ba34768415fb239d7d607486083bfc38ad35e3f1d558697f9f646f11"397dependencies = [429dependencies = [430 "annotated-string",431 "extension-trait",432 "itertools",398 "num-traits",433 "num-traits",399 "rand",434 "rand",400 "random_color",435 "random_color",401 "range-map",436 "range-map",402 "smallvec",437 "smallvec",438 "tree-sitter-highlight",439 "unicode-box-drawing",403]440]404441405[[package]]442[[package]]406name = "indexmap"443name = "hi-doc-jumprope"407version = "1.9.3"444version = "1.2.1"408source = "registry+https://github.com/rust-lang/crates.io-index"445source = "registry+https://github.com/rust-lang/crates.io-index"409checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"446checksum = "236c25809a9c0a0249b3488feb57744e12aa64e4f3db851980eab303719c7bdd"410dependencies = [447dependencies = [411 "autocfg",448 "rand",412 "hashbrown 0.12.3",449 "str_indices",413]450]414451415[[package]]452[[package]]416name = "indexmap"453name = "indexmap"417version = "2.10.0"454version = "2.13.0"418source = "registry+https://github.com/rust-lang/crates.io-index"455source = "registry+https://github.com/rust-lang/crates.io-index"419checksum = "fe4cd85333e22411419a0bcae1297d25e58c9443848b11dc6a86fefe8c78a661"456checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017"420dependencies = [457dependencies = [421 "equivalent",458 "equivalent",422 "hashbrown 0.15.5",459 "hashbrown 0.16.1",423 "serde",460 "serde",461 "serde_core",424]462]425463426[[package]]464[[package]]427name = "indoc"465name = "indoc"428version = "2.0.6"466version = "2.0.7"429source = "registry+https://github.com/rust-lang/crates.io-index"467source = "registry+https://github.com/rust-lang/crates.io-index"430checksum = "f4c7245a08504955605670dbf141fceab975f15ca21570696aebe9d2e71576bd"468checksum = "79cf5c93f93228cf8efb3ba362535fb11199ac548a09ce117c9b1adc3030d706"469dependencies = [470 "rustversion",471]431472432[[package]]473[[package]]433name = "insta"474name = "insta"434version = "1.43.1"475version = "1.46.3"435source = "registry+https://github.com/rust-lang/crates.io-index"476source = "registry+https://github.com/rust-lang/crates.io-index"436checksum = "154934ea70c58054b556dd430b99a98c2a7ff5309ac9891597e339b5c28f4371"477checksum = "e82db8c87c7f1ccecb34ce0c24399b8a73081427f3c7c50a5d597925356115e4"437dependencies = [478dependencies = [438 "console",479 "console",439 "once_cell",480 "once_cell",440 "similar",481 "similar",482 "tempfile",441]483]442484443[[package]]485[[package]]444name = "is_terminal_polyfill"486name = "is_terminal_polyfill"445version = "1.70.1"487version = "1.70.2"446source = "registry+https://github.com/rust-lang/crates.io-index"488source = "registry+https://github.com/rust-lang/crates.io-index"447checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"489checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695"448490449[[package]]491[[package]]450name = "itertools"492name = "itertools"451version = "0.13.0"493version = "0.14.0"452source = "registry+https://github.com/rust-lang/crates.io-index"494source = "registry+https://github.com/rust-lang/crates.io-index"453checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"495checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285"454dependencies = [496dependencies = [455 "either",497 "either",456]498]457499458[[package]]500[[package]]459name = "itoa"501name = "itoa"460version = "1.0.15"502version = "1.0.17"461source = "registry+https://github.com/rust-lang/crates.io-index"503source = "registry+https://github.com/rust-lang/crates.io-index"462checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"504checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2"463505464[[package]]506[[package]]465name = "jrsonnet"507name = "jrsonnet"495dependencies = [537dependencies = [496 "annotate-snippets",538 "annotate-snippets",497 "anyhow",539 "anyhow",498 "hashbrown 0.14.5",499 "hi-doc",540 "hi-doc",500 "jrsonnet-gcmodule",541 "jrsonnet-gcmodule",501 "jrsonnet-interner",542 "jrsonnet-interner",504 "jrsonnet-types",545 "jrsonnet-types",505 "num-bigint",546 "num-bigint",506 "pathdiff",547 "pathdiff",507 "rustc-hash",548 "rustc-hash 2.1.1",549 "rustversion",508 "serde",550 "serde",509 "stacker",551 "stacker",510 "static_assertions",552 "static_assertions",528570529[[package]]571[[package]]530name = "jrsonnet-gcmodule"572name = "jrsonnet-gcmodule"531version = "0.3.10"573version = "0.4.0"532source = "registry+https://github.com/rust-lang/crates.io-index"533checksum = "87122f4aa9b77c38f96e43d9ba4b7717d63aa87b137090a16ec0107cf17abdac"534dependencies = [574dependencies = [535 "jrsonnet-gcmodule-derive",575 "jrsonnet-gcmodule-derive",536]576]537577538[[package]]578[[package]]539name = "jrsonnet-gcmodule-derive"579name = "jrsonnet-gcmodule-derive"540version = "0.3.10"580version = "0.4.0"541source = "registry+https://github.com/rust-lang/crates.io-index"542checksum = "17eefaaba135591284e11cda15ed067247bec5fe9ece4fabc2c0df650d7b955a"543dependencies = [581dependencies = [544 "proc-macro2",582 "proc-macro2",545 "quote",583 "quote",550name = "jrsonnet-interner"588name = "jrsonnet-interner"551version = "0.5.0-pre97"589version = "0.5.0-pre97"552dependencies = [590dependencies = [553 "hashbrown 0.14.5",591 "hashbrown 0.16.1",554 "jrsonnet-gcmodule",592 "jrsonnet-gcmodule",555 "rustc-hash",593 "rustc-hash 2.1.1",556]594]557595558[[package]]596[[package]]601 "md5",639 "md5",602 "num-bigint",640 "num-bigint",603 "regex",641 "regex",604 "rustc-hash",642 "rustc-hash 2.1.1",605 "serde",643 "serde",606 "serde_json",644 "serde_json",607 "serde_yaml_with_quirks",645 "serde_yaml_with_quirks",620658621[[package]]659[[package]]622name = "json-structural-diff"660name = "json-structural-diff"623version = "0.1.0"661version = "0.2.0"624source = "registry+https://github.com/rust-lang/crates.io-index"662source = "registry+https://github.com/rust-lang/crates.io-index"625checksum = "25c7940d3c84d2079306c176c7b2b37622b6bc5e43fbd1541b1e4a4e1fd02045"663checksum = "e878e36a8a44c158505c2c818abdc1350413ad83dcb774a0459f6a7ef2b65cbf"626dependencies = [664dependencies = [627 "difflib",665 "difflib",628 "regex",666 "regex",638 "cpufeatures",676 "cpufeatures",639]677]640641[[package]]642name = "lazy_static"643version = "1.5.0"644source = "registry+https://github.com/rust-lang/crates.io-index"645checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"646678647[[package]]679[[package]]648name = "libc"680name = "libc"649version = "0.2.175"681version = "0.2.180"650source = "registry+https://github.com/rust-lang/crates.io-index"682source = "registry+https://github.com/rust-lang/crates.io-index"651checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543"683checksum = "bcc35a38544a891a5f7c865aca548a982ccb3b8650a5b06d0fd33a10283c56fc"652684653[[package]]685[[package]]654name = "libjsonnet"686name = "libjsonnet"661 "jrsonnet-stdlib",693 "jrsonnet-stdlib",662]694]663664[[package]]665name = "linked-hash-map"666version = "0.5.6"667source = "registry+https://github.com/rust-lang/crates.io-index"668checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f"669695670[[package]]696[[package]]671name = "linux-raw-sys"697name = "linux-raw-sys"672version = "0.9.4"698version = "0.11.0"673source = "registry+https://github.com/rust-lang/crates.io-index"699source = "registry+https://github.com/rust-lang/crates.io-index"674checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12"700checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039"675701676[[package]]702[[package]]677name = "logos"703name = "logos"678version = "0.14.4"704version = "0.16.1"679source = "registry+https://github.com/rust-lang/crates.io-index"705source = "registry+https://github.com/rust-lang/crates.io-index"680checksum = "7251356ef8cb7aec833ddf598c6cb24d17b689d20b993f9d11a3d764e34e6458"706checksum = "eb2c55a318a87600ea870ff8c2012148b44bf18b74fad48d0f835c38c7d07c5f"681dependencies = [707dependencies = [682 "logos-derive",708 "logos-derive",683]709]684710685[[package]]711[[package]]686name = "logos-codegen"712name = "logos-codegen"687version = "0.14.4"713version = "0.16.1"688source = "registry+https://github.com/rust-lang/crates.io-index"714source = "registry+https://github.com/rust-lang/crates.io-index"689checksum = "59f80069600c0d66734f5ff52cc42f2dabd6b29d205f333d61fd7832e9e9963f"715checksum = "58b3ffaa284e1350d017a57d04ada118c4583cf260c8fb01e0fe28a2e9cf8970"690dependencies = [716dependencies = [691 "beef",692 "fnv",717 "fnv",693 "lazy_static",694 "proc-macro2",718 "proc-macro2",695 "quote",719 "quote",720 "regex-automata",696 "regex-syntax",721 "regex-syntax",697 "syn",722 "syn",698]723]699724700[[package]]725[[package]]701name = "logos-derive"726name = "logos-derive"702version = "0.14.4"727version = "0.16.1"703source = "registry+https://github.com/rust-lang/crates.io-index"728source = "registry+https://github.com/rust-lang/crates.io-index"704checksum = "24fb722b06a9dc12adb0963ed585f19fc61dc5413e6a9be9422ef92c091e731d"729checksum = "52d3a9855747c17eaf4383823f135220716ab49bea5fbea7dd42cc9a92f8aa31"705dependencies = [730dependencies = [706 "logos-codegen",731 "logos-codegen",707]732]708733709[[package]]734[[package]]710name = "lru"735name = "lru"711version = "0.12.5"736version = "0.16.3"712source = "registry+https://github.com/rust-lang/crates.io-index"737source = "registry+https://github.com/rust-lang/crates.io-index"713checksum = "234cf4f4a04dc1f57e24b96cc0cd600cf2af460d4161ac5ecdd0af8e1f3b2a38"738checksum = "a1dc47f592c06f33f8e3aea9591776ec7c9f9e4124778ff8a3c3b87159f7e593"714dependencies = [739dependencies = [715 "hashbrown 0.15.5",740 "hashbrown 0.16.1",716]741]717742718[[package]]743[[package]]719name = "md5"744name = "md5"720version = "0.7.0"745version = "0.8.0"721source = "registry+https://github.com/rust-lang/crates.io-index"746source = "registry+https://github.com/rust-lang/crates.io-index"722checksum = "490cc448043f947bae3cbee9c203358d62dbee0db12107a74be5c30ccfd09771"747checksum = "ae960838283323069879657ca3de837e9f7bbb4c7bf6ea7f1b290d5e9476d2e0"723748724[[package]]749[[package]]725name = "memchr"750name = "memchr"726version = "2.7.5"751version = "2.8.0"727source = "registry+https://github.com/rust-lang/crates.io-index"752source = "registry+https://github.com/rust-lang/crates.io-index"728checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0"753checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79"729730[[package]]731name = "memoffset"732version = "0.9.1"733source = "registry+https://github.com/rust-lang/crates.io-index"734checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"735dependencies = [736 "autocfg",737]738754739[[package]]755[[package]]740name = "mimalloc-sys"756name = "mimalloc-sys"784 "autocfg",800 "autocfg",785]801]802803[[package]]804name = "object"805version = "0.37.3"806source = "registry+https://github.com/rust-lang/crates.io-index"807checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe"808dependencies = [809 "memchr",810]786811787[[package]]812[[package]]788name = "once_cell"813name = "once_cell"792817793[[package]]818[[package]]794name = "once_cell_polyfill"819name = "once_cell_polyfill"795version = "1.70.1"820version = "1.70.2"796source = "registry+https://github.com/rust-lang/crates.io-index"821source = "registry+https://github.com/rust-lang/crates.io-index"797checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad"822checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe"823824[[package]]825name = "ouroboros"826version = "0.18.5"827source = "registry+https://github.com/rust-lang/crates.io-index"828checksum = "1e0f050db9c44b97a94723127e6be766ac5c340c48f2c4bb3ffa11713744be59"829dependencies = [830 "aliasable",831 "ouroboros_macro",832 "static_assertions",833]834835[[package]]836name = "ouroboros_macro"837version = "0.18.5"838source = "registry+https://github.com/rust-lang/crates.io-index"839checksum = "3c7028bdd3d43083f6d8d4d5187680d0d3560d54df4cc9d752005268b41e64d0"840dependencies = [841 "heck 0.4.1",842 "proc-macro2",843 "proc-macro2-diagnostics",844 "quote",845 "syn",846]798847799[[package]]848[[package]]800name = "pathdiff"849name = "pathdiff"840889841[[package]]890[[package]]842name = "proc-macro2"891name = "proc-macro2"843version = "1.0.101"892version = "1.0.106"844source = "registry+https://github.com/rust-lang/crates.io-index"893source = "registry+https://github.com/rust-lang/crates.io-index"845checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de"894checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"846dependencies = [895dependencies = [847 "unicode-ident",896 "unicode-ident",848]897]898899[[package]]900name = "proc-macro2-diagnostics"901version = "0.10.1"902source = "registry+https://github.com/rust-lang/crates.io-index"903checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8"904dependencies = [905 "proc-macro2",906 "quote",907 "syn",908 "version_check",909 "yansi",910]849911850[[package]]912[[package]]851name = "psm"913name = "psm"852version = "0.1.26"914version = "0.1.30"853source = "registry+https://github.com/rust-lang/crates.io-index"915source = "registry+https://github.com/rust-lang/crates.io-index"854checksum = "6e944464ec8536cd1beb0bbfd96987eb5e3b72f2ecdafdc5c769a37f1fa2ae1f"916checksum = "3852766467df634d74f0b2d7819bf8dc483a0eb2e3b0f50f756f9cfe8b0d18d8"855dependencies = [917dependencies = [918 "ar_archive_writer",856 "cc",919 "cc",857]920]858921859[[package]]922[[package]]860name = "quote"923name = "quote"861version = "1.0.40"924version = "1.0.44"862source = "registry+https://github.com/rust-lang/crates.io-index"925source = "registry+https://github.com/rust-lang/crates.io-index"863checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"926checksum = "21b2ebcf727b7760c461f091f9f0f539b77b8e87f2fd88131e7f1b433b3cece4"864dependencies = [927dependencies = [865 "proc-macro2",928 "proc-macro2",866]929]873936874[[package]]937[[package]]875name = "rand"938name = "rand"876version = "0.8.5"939version = "0.9.2"877source = "registry+https://github.com/rust-lang/crates.io-index"940source = "registry+https://github.com/rust-lang/crates.io-index"878checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"941checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1"879dependencies = [942dependencies = [880 "libc",881 "rand_chacha",943 "rand_chacha",882 "rand_core",944 "rand_core",883]945]884946885[[package]]947[[package]]886name = "rand_chacha"948name = "rand_chacha"887version = "0.3.1"949version = "0.9.0"888source = "registry+https://github.com/rust-lang/crates.io-index"950source = "registry+https://github.com/rust-lang/crates.io-index"889checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"951checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb"890dependencies = [952dependencies = [891 "ppv-lite86",953 "ppv-lite86",892 "rand_core",954 "rand_core",893]955]894956895[[package]]957[[package]]896name = "rand_core"958name = "rand_core"897version = "0.6.4"959version = "0.9.5"898source = "registry+https://github.com/rust-lang/crates.io-index"960source = "registry+https://github.com/rust-lang/crates.io-index"899checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"961checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c"900dependencies = [962dependencies = [901 "getrandom 0.2.16",963 "getrandom",902]964]903965904[[package]]966[[package]]905name = "random_color"967name = "random_color"906version = "0.8.0"968version = "1.1.0"907source = "registry+https://github.com/rust-lang/crates.io-index"969source = "registry+https://github.com/rust-lang/crates.io-index"908checksum = "0085421bc527effa7ed6d46bac0a28734663c47abe03d80a5e78e441fad85196"970checksum = "d635c5e80ae160390ac62ca027d2d06c94c1dc69e5c0a12f1e3a53664dc84966"909dependencies = [971dependencies = [910 "rand",972 "rand",911]973]921983922[[package]]984[[package]]923name = "regex"985name = "regex"924version = "1.11.1"986version = "1.12.3"925source = "registry+https://github.com/rust-lang/crates.io-index"987source = "registry+https://github.com/rust-lang/crates.io-index"926checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191"988checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276"927dependencies = [989dependencies = [928 "aho-corasick",990 "aho-corasick",929 "memchr",991 "memchr",933995934[[package]]996[[package]]935name = "regex-automata"997name = "regex-automata"936version = "0.4.9"998version = "0.4.14"937source = "registry+https://github.com/rust-lang/crates.io-index"999source = "registry+https://github.com/rust-lang/crates.io-index"938checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908"1000checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f"939dependencies = [1001dependencies = [940 "aho-corasick",1002 "aho-corasick",941 "memchr",1003 "memchr",9441006945[[package]]1007[[package]]946name = "regex-syntax"1008name = "regex-syntax"947version = "0.8.5"1009version = "0.8.9"948source = "registry+https://github.com/rust-lang/crates.io-index"1010source = "registry+https://github.com/rust-lang/crates.io-index"949checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"1011checksum = "a96887878f22d7bad8a3b6dc5b7440e0ada9a245242924394987b21cf2210a4c"9501012951[[package]]1013[[package]]952name = "rowan"1014name = "rowan"953version = "0.15.17"1015version = "0.16.1"954source = "registry+https://github.com/rust-lang/crates.io-index"1016source = "registry+https://github.com/rust-lang/crates.io-index"955checksum = "d4f1e4a001f863f41ea8d0e6a0c34b356d5b733db50dadab3efef640bafb779b"1017checksum = "417a3a9f582e349834051b8a10c8d71ca88da4211e4093528e36b9845f6b5f21"956dependencies = [1018dependencies = [957 "countme",1019 "countme",958 "hashbrown 0.14.5",1020 "hashbrown 0.14.5",959 "memoffset",960 "rustc-hash",1021 "rustc-hash 1.1.0",961 "text-size",1022 "text-size",962]1023]9631024967source = "registry+https://github.com/rust-lang/crates.io-index"1028source = "registry+https://github.com/rust-lang/crates.io-index"968checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"1029checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"10301031[[package]]1032name = "rustc-hash"1033version = "2.1.1"1034source = "registry+https://github.com/rust-lang/crates.io-index"1035checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d"9691036970[[package]]1037[[package]]971name = "rustix"1038name = "rustix"972version = "1.0.8"1039version = "1.1.3"973source = "registry+https://github.com/rust-lang/crates.io-index"1040source = "registry+https://github.com/rust-lang/crates.io-index"974checksum = "11181fbabf243db407ef8df94a6ce0b2f9a733bd8be4ad02b4eda9602296cac8"1041checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34"975dependencies = [1042dependencies = [976 "bitflags",1043 "bitflags",977 "errno",1044 "errno",978 "libc",1045 "libc",979 "linux-raw-sys",1046 "linux-raw-sys",980 "windows-sys 0.60.2",1047 "windows-sys 0.61.2",981]1048]10491050[[package]]1051name = "rustversion"1052version = "1.0.22"1053source = "registry+https://github.com/rust-lang/crates.io-index"1054checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"9821055983[[package]]1056[[package]]984name = "ryu"1057name = "ryu"985version = "1.0.20"1058version = "1.0.22"986source = "registry+https://github.com/rust-lang/crates.io-index"1059source = "registry+https://github.com/rust-lang/crates.io-index"987checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f"1060checksum = "a50f4cf475b65d88e057964e0e9bb1f0aa9bbb2036dc65c64596b42932536984"9881061989[[package]]1062[[package]]990name = "serde"1063name = "serde"991version = "1.0.219"1064version = "1.0.228"992source = "registry+https://github.com/rust-lang/crates.io-index"1065source = "registry+https://github.com/rust-lang/crates.io-index"993checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6"1066checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"994dependencies = [1067dependencies = [1068 "serde_core",995 "serde_derive",1069 "serde_derive",996]1070]10711072[[package]]1073name = "serde_core"1074version = "1.0.228"1075source = "registry+https://github.com/rust-lang/crates.io-index"1076checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"1077dependencies = [1078 "serde_derive",1079]9971080998[[package]]1081[[package]]999name = "serde_derive"1082name = "serde_derive"1000version = "1.0.219"1083version = "1.0.228"1001source = "registry+https://github.com/rust-lang/crates.io-index"1084source = "registry+https://github.com/rust-lang/crates.io-index"1002checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00"1085checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"1003dependencies = [1086dependencies = [1004 "proc-macro2",1087 "proc-macro2",1005 "quote",1088 "quote",100810911009[[package]]1092[[package]]1010name = "serde_json"1093name = "serde_json"1011version = "1.0.143"1094version = "1.0.149"1012source = "registry+https://github.com/rust-lang/crates.io-index"1095source = "registry+https://github.com/rust-lang/crates.io-index"1013checksum = "d401abef1d108fbd9cbaebc3e46611f4b1021f714a0597a71f41ee463f5f4a5a"1096checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86"1014dependencies = [1097dependencies = [1098 "indexmap",1015 "itoa",1099 "itoa",1016 "memchr",1100 "memchr",1017 "ryu",1018 "serde",1101 "serde",1102 "serde_core",1103 "zmij",1019]1104]102011051021[[package]]1106[[package]]1022name = "serde_yaml_with_quirks"1107name = "serde_yaml_with_quirks"1023version = "0.8.24"1108version = "0.9.34"1024source = "registry+https://github.com/rust-lang/crates.io-index"1109source = "registry+https://github.com/rust-lang/crates.io-index"1025checksum = "47c5983eba86eae2d0058c35fb1065ccffb23af7f8965871069269088098321a"1110checksum = "d852180e55e824bb347a8e3cdbbca1f02513ea1fa00188f1b2a8a255ac3d6cf9"1026dependencies = [1111dependencies = [1027 "indexmap 1.9.3",1112 "indexmap",1113 "itoa",1028 "ryu",1114 "ryu",1029 "serde",1115 "serde",1030 "yaml-rust",1116 "unsafe-libyaml",1031]1117]103211181033[[package]]1119[[package]]108211681083[[package]]1169[[package]]1084name = "stacker"1170name = "stacker"1085version = "0.1.21"1171version = "0.1.23"1086source = "registry+https://github.com/rust-lang/crates.io-index"1172source = "registry+https://github.com/rust-lang/crates.io-index"1087checksum = "cddb07e32ddb770749da91081d8d0ac3a16f1a569a18b20348cd371f5dead06b"1173checksum = "08d74a23609d509411d10e2176dc2a4346e3b4aea2e7b1869f19fdedbc71c013"1088dependencies = [1174dependencies = [1089 "cc",1175 "cc",1090 "cfg-if",1176 "cfg-if",1099source = "registry+https://github.com/rust-lang/crates.io-index"1185source = "registry+https://github.com/rust-lang/crates.io-index"1100checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"1186checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"11871188[[package]]1189name = "str_indices"1190version = "0.4.4"1191source = "registry+https://github.com/rust-lang/crates.io-index"1192checksum = "d08889ec5408683408db66ad89e0e1f93dff55c73a4ccc71c427d5b277ee47e6"11931194[[package]]1195name = "streaming-iterator"1196version = "0.1.9"1197source = "registry+https://github.com/rust-lang/crates.io-index"1198checksum = "2b2231b7c3057d5e4ad0156fb3dc807d900806020c5ffa3ee6ff2c8c76fb8520"110111991102[[package]]1200[[package]]1103name = "strsim"1201name = "strsim"110712051108[[package]]1206[[package]]1109name = "syn"1207name = "syn"1110version = "2.0.106"1208version = "2.0.114"1111source = "registry+https://github.com/rust-lang/crates.io-index"1209source = "registry+https://github.com/rust-lang/crates.io-index"1112checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6"1210checksum = "d4d107df263a3013ef9b1879b0df87d706ff80f65a86ea879bd9c31f9b307c2a"1113dependencies = [1211dependencies = [1114 "proc-macro2",1212 "proc-macro2",1115 "quote",1213 "quote",112912271130[[package]]1228[[package]]1131name = "tempfile"1229name = "tempfile"1132version = "3.21.0"1230version = "3.24.0"1133source = "registry+https://github.com/rust-lang/crates.io-index"1231source = "registry+https://github.com/rust-lang/crates.io-index"1134checksum = "15b61f8f20e3a6f7e0649d825294eaf317edce30f82cf6026e7e4cb9222a7d1e"1232checksum = "655da9c7eb6305c55742045d5a8d2037996d61d8de95806335c7c86ce0f82e9c"1135dependencies = [1233dependencies = [1136 "fastrand",1234 "fastrand",1137 "getrandom 0.3.3",1235 "getrandom",1138 "once_cell",1236 "once_cell",1139 "rustix",1237 "rustix",1140 "windows-sys 0.60.2",1238 "windows-sys 0.61.2",1141]1239]114212401143[[package]]1241[[package]]116012581161[[package]]1259[[package]]1162name = "thiserror"1260name = "thiserror"1163version = "1.0.69"1261version = "2.0.18"1164source = "registry+https://github.com/rust-lang/crates.io-index"1262source = "registry+https://github.com/rust-lang/crates.io-index"1165checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"1263checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4"1166dependencies = [1264dependencies = [1167 "thiserror-impl",1265 "thiserror-impl",1168]1266]116912671170[[package]]1268[[package]]1171name = "thiserror-impl"1269name = "thiserror-impl"1172version = "1.0.69"1270version = "2.0.18"1173source = "registry+https://github.com/rust-lang/crates.io-index"1271source = "registry+https://github.com/rust-lang/crates.io-index"1174checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"1272checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5"1175dependencies = [1273dependencies = [1176 "proc-macro2",1274 "proc-macro2",1177 "quote",1275 "quote",1178 "syn",1276 "syn",1179]1277]12781279[[package]]1280name = "tree-sitter"1281version = "0.26.5"1282source = "registry+https://github.com/rust-lang/crates.io-index"1283checksum = "12987371f54efc9b9306a20dc87ed5aaee9f320c8a8b115e28515c412b2efe39"1284dependencies = [1285 "cc",1286 "regex",1287 "regex-syntax",1288 "serde_json",1289 "streaming-iterator",1290 "tree-sitter-language",1291]12921293[[package]]1294name = "tree-sitter-highlight"1295version = "0.26.5"1296source = "registry+https://github.com/rust-lang/crates.io-index"1297checksum = "2b688407049ea1b55a7e872f138947d22389118b9c4d09b459cb34ca205e41c0"1298dependencies = [1299 "regex",1300 "streaming-iterator",1301 "thiserror",1302 "tree-sitter",1303]13041305[[package]]1306name = "tree-sitter-language"1307version = "0.1.7"1308source = "registry+https://github.com/rust-lang/crates.io-index"1309checksum = "009994f150cc0cd50ff54917d5bc8bffe8cad10ca10d81c34da2ec421ae61782"118013101181[[package]]1311[[package]]1182name = "typenum"1312name = "typenum"1183version = "1.18.0"1313version = "1.19.0"1184source = "registry+https://github.com/rust-lang/crates.io-index"1314source = "registry+https://github.com/rust-lang/crates.io-index"1185checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f"1315checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb"118613161187[[package]]1317[[package]]1188name = "ungrammar"1318name = "ungrammar"1189version = "1.16.1"1319version = "1.16.1"1190source = "registry+https://github.com/rust-lang/crates.io-index"1320source = "registry+https://github.com/rust-lang/crates.io-index"1191checksum = "a3e5df347f0bf3ec1d670aad6ca5c6a1859cd9ea61d2113125794654ccced68f"1321checksum = "a3e5df347f0bf3ec1d670aad6ca5c6a1859cd9ea61d2113125794654ccced68f"13221323[[package]]1324name = "unicode-box-drawing"1325version = "0.3.0"1326source = "registry+https://github.com/rust-lang/crates.io-index"1327checksum = "2a1f97719cf40224391201fc11e7f5b0cc0ba21416367cfc914e2d45af4e42ef"119213281193[[package]]1329[[package]]1194name = "unicode-ident"1330name = "unicode-ident"1195version = "1.0.18"1331version = "1.0.22"1196source = "registry+https://github.com/rust-lang/crates.io-index"1332source = "registry+https://github.com/rust-lang/crates.io-index"1197checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"1333checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5"119813341199[[package]]1335[[package]]1200name = "unicode-width"1336name = "unicode-width"1201version = "0.1.14"1337version = "0.2.2"1202source = "registry+https://github.com/rust-lang/crates.io-index"1338source = "registry+https://github.com/rust-lang/crates.io-index"1203checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af"1339checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254"13401341[[package]]1342name = "unsafe-libyaml"1343version = "0.2.11"1344source = "registry+https://github.com/rust-lang/crates.io-index"1345checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861"120413461205[[package]]1347[[package]]1206name = "utf8parse"1348name = "utf8parse"1214source = "registry+https://github.com/rust-lang/crates.io-index"1356source = "registry+https://github.com/rust-lang/crates.io-index"1215checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"1357checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"12161217[[package]]1218name = "wasi"1219version = "0.11.1+wasi-snapshot-preview1"1220source = "registry+https://github.com/rust-lang/crates.io-index"1221checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"122213581223[[package]]1359[[package]]1224name = "wasi"1360name = "wasip2"1225version = "0.14.2+wasi-0.2.4"1361version = "1.0.2+wasi-0.2.9"1226source = "registry+https://github.com/rust-lang/crates.io-index"1362source = "registry+https://github.com/rust-lang/crates.io-index"1227checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3"1363checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5"1228dependencies = [1364dependencies = [1229 "wit-bindgen-rt",1365 "wit-bindgen",1230]1366]123113671232[[package]]1368[[package]]1233name = "windows-link"1369name = "windows-link"1234version = "0.1.3"1370version = "0.2.1"1235source = "registry+https://github.com/rust-lang/crates.io-index"1371source = "registry+https://github.com/rust-lang/crates.io-index"1236checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a"1372checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"123713731238[[package]]1374[[package]]1239name = "windows-sys"1375name = "windows-sys"1240version = "0.59.0"1376version = "0.59.0"1241source = "registry+https://github.com/rust-lang/crates.io-index"1377source = "registry+https://github.com/rust-lang/crates.io-index"1242checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"1378checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"1243dependencies = [1379dependencies = [1244 "windows-targets 0.52.6",1380 "windows-targets",1245]1381]124613821247[[package]]1383[[package]]1248name = "windows-sys"1384name = "windows-sys"1249version = "0.60.2"1385version = "0.61.2"1250source = "registry+https://github.com/rust-lang/crates.io-index"1386source = "registry+https://github.com/rust-lang/crates.io-index"1251checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb"1387checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"1252dependencies = [1388dependencies = [1253 "windows-targets 0.53.3",1389 "windows-link",1254]1390]125513911256[[package]]1392[[package]]1259source = "registry+https://github.com/rust-lang/crates.io-index"1395source = "registry+https://github.com/rust-lang/crates.io-index"1260checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"1396checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"1261dependencies = [1397dependencies = [1262 "windows_aarch64_gnullvm 0.52.6",1398 "windows_aarch64_gnullvm",1263 "windows_aarch64_msvc 0.52.6",1399 "windows_aarch64_msvc",1264 "windows_i686_gnu 0.52.6",1400 "windows_i686_gnu",1265 "windows_i686_gnullvm 0.52.6",1401 "windows_i686_gnullvm",1266 "windows_i686_msvc 0.52.6",1402 "windows_i686_msvc",1267 "windows_x86_64_gnu 0.52.6",1403 "windows_x86_64_gnu",1268 "windows_x86_64_gnullvm 0.52.6",1404 "windows_x86_64_gnullvm",1269 "windows_x86_64_msvc 0.52.6",1405 "windows_x86_64_msvc",1270]1406]12711272[[package]]1273name = "windows-targets"1274version = "0.53.3"1275source = "registry+https://github.com/rust-lang/crates.io-index"1276checksum = "d5fe6031c4041849d7c496a8ded650796e7b6ecc19df1a431c1a363342e5dc91"1277dependencies = [1278 "windows-link",1279 "windows_aarch64_gnullvm 0.53.0",1280 "windows_aarch64_msvc 0.53.0",1281 "windows_i686_gnu 0.53.0",1282 "windows_i686_gnullvm 0.53.0",1283 "windows_i686_msvc 0.53.0",1284 "windows_x86_64_gnu 0.53.0",1285 "windows_x86_64_gnullvm 0.53.0",1286 "windows_x86_64_msvc 0.53.0",1287]128814071289[[package]]1408[[package]]1290name = "windows_aarch64_gnullvm"1409name = "windows_aarch64_gnullvm"1291version = "0.52.6"1410version = "0.52.6"1292source = "registry+https://github.com/rust-lang/crates.io-index"1411source = "registry+https://github.com/rust-lang/crates.io-index"1293checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"1412checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"12941295[[package]]1296name = "windows_aarch64_gnullvm"1297version = "0.53.0"1298source = "registry+https://github.com/rust-lang/crates.io-index"1299checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764"130014131301[[package]]1414[[package]]1302name = "windows_aarch64_msvc"1415name = "windows_aarch64_msvc"1303version = "0.52.6"1416version = "0.52.6"1304source = "registry+https://github.com/rust-lang/crates.io-index"1417source = "registry+https://github.com/rust-lang/crates.io-index"1305checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"1418checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"13061307[[package]]1308name = "windows_aarch64_msvc"1309version = "0.53.0"1310source = "registry+https://github.com/rust-lang/crates.io-index"1311checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c"131214191313[[package]]1420[[package]]1314name = "windows_i686_gnu"1421name = "windows_i686_gnu"1315version = "0.52.6"1422version = "0.52.6"1316source = "registry+https://github.com/rust-lang/crates.io-index"1423source = "registry+https://github.com/rust-lang/crates.io-index"1317checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"1424checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"13181319[[package]]1320name = "windows_i686_gnu"1321version = "0.53.0"1322source = "registry+https://github.com/rust-lang/crates.io-index"1323checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3"132414251325[[package]]1426[[package]]1326name = "windows_i686_gnullvm"1427name = "windows_i686_gnullvm"1327version = "0.52.6"1428version = "0.52.6"1328source = "registry+https://github.com/rust-lang/crates.io-index"1429source = "registry+https://github.com/rust-lang/crates.io-index"1329checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"1430checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"13301331[[package]]1332name = "windows_i686_gnullvm"1333version = "0.53.0"1334source = "registry+https://github.com/rust-lang/crates.io-index"1335checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11"133614311337[[package]]1432[[package]]1338name = "windows_i686_msvc"1433name = "windows_i686_msvc"1339version = "0.52.6"1434version = "0.52.6"1340source = "registry+https://github.com/rust-lang/crates.io-index"1435source = "registry+https://github.com/rust-lang/crates.io-index"1341checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"1436checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"13421343[[package]]1344name = "windows_i686_msvc"1345version = "0.53.0"1346source = "registry+https://github.com/rust-lang/crates.io-index"1347checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d"134814371349[[package]]1438[[package]]1350name = "windows_x86_64_gnu"1439name = "windows_x86_64_gnu"1351version = "0.52.6"1440version = "0.52.6"1352source = "registry+https://github.com/rust-lang/crates.io-index"1441source = "registry+https://github.com/rust-lang/crates.io-index"1353checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"1442checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"13541355[[package]]1356name = "windows_x86_64_gnu"1357version = "0.53.0"1358source = "registry+https://github.com/rust-lang/crates.io-index"1359checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba"136014431361[[package]]1444[[package]]1362name = "windows_x86_64_gnullvm"1445name = "windows_x86_64_gnullvm"1363version = "0.52.6"1446version = "0.52.6"1364source = "registry+https://github.com/rust-lang/crates.io-index"1447source = "registry+https://github.com/rust-lang/crates.io-index"1365checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"1448checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"13661367[[package]]1368name = "windows_x86_64_gnullvm"1369version = "0.53.0"1370source = "registry+https://github.com/rust-lang/crates.io-index"1371checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57"137214491373[[package]]1450[[package]]1374name = "windows_x86_64_msvc"1451name = "windows_x86_64_msvc"1375version = "0.52.6"1452version = "0.52.6"1376source = "registry+https://github.com/rust-lang/crates.io-index"1453source = "registry+https://github.com/rust-lang/crates.io-index"1377checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"1454checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"13781379[[package]]1380name = "windows_x86_64_msvc"1381version = "0.53.0"1382source = "registry+https://github.com/rust-lang/crates.io-index"1383checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486"138414551385[[package]]1456[[package]]1386name = "wit-bindgen-rt"1457name = "wit-bindgen"1387version = "0.39.0"1458version = "0.51.0"1388source = "registry+https://github.com/rust-lang/crates.io-index"1459source = "registry+https://github.com/rust-lang/crates.io-index"1389checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1"1460checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5"1390dependencies = [1391 "bitflags",1392]139314611394[[package]]1462[[package]]1395name = "xshell"1463name = "xshell"1412dependencies = [1480dependencies = [1413 "anyhow",1481 "anyhow",1414 "clap",1482 "clap",1415 "indexmap 2.10.0",1483 "indexmap",1416 "itertools",1484 "itertools",1417 "proc-macro2",1485 "proc-macro2",1418 "quote",1486 "quote",1421]1489]142214901423[[package]]1491[[package]]1424name = "yaml-rust"1492name = "yansi"1425version = "0.4.5"1493version = "1.0.1"1426source = "registry+https://github.com/rust-lang/crates.io-index"1494source = "registry+https://github.com/rust-lang/crates.io-index"1427checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85"1495checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049"1428dependencies = [1429 "linked-hash-map",1430]143114961432[[package]]1497[[package]]1433name = "zerocopy"1498name = "zerocopy"1434version = "0.8.26"1499version = "0.8.39"1435source = "registry+https://github.com/rust-lang/crates.io-index"1500source = "registry+https://github.com/rust-lang/crates.io-index"1436checksum = "1039dd0d3c310cf05de012d8a39ff557cb0d23087fd44cad61df08fc31907a2f"1501checksum = "db6d35d663eadb6c932438e763b262fe1a70987f9ae936e60158176d710cae4a"1437dependencies = [1502dependencies = [1438 "zerocopy-derive",1503 "zerocopy-derive",1439]1504]144015051441[[package]]1506[[package]]1442name = "zerocopy-derive"1507name = "zerocopy-derive"1443version = "0.8.26"1508version = "0.8.39"1444source = "registry+https://github.com/rust-lang/crates.io-index"1509source = "registry+https://github.com/rust-lang/crates.io-index"1445checksum = "9ecf5b4cc5364572d7f4c329661bcc82724222973f2cab6f050a4e5c22f75181"1510checksum = "4122cd3169e94605190e77839c9a40d40ed048d305bfdc146e7df40ab0f3e517"1446dependencies = [1511dependencies = [1447 "proc-macro2",1512 "proc-macro2",1448 "quote",1513 "quote",1449 "syn",1514 "syn",1450]1515]15161517[[package]]1518name = "zmij"1519version = "1.0.19"1520source = "registry+https://github.com/rust-lang/crates.io-index"1521checksum = "3ff05f8caa9038894637571ae6b9e29466c1f4f829d26c9b28f869a29cbe3445"14511522Cargo.tomldiffbeforeafterboth19jrsonnet-stdlib = { path = "./crates/jrsonnet-stdlib", version = "0.5.0-pre97" }19jrsonnet-stdlib = { path = "./crates/jrsonnet-stdlib", version = "0.5.0-pre97" }20jrsonnet-cli = { path = "./crates/jrsonnet-cli", version = "0.5.0-pre97" }20jrsonnet-cli = { path = "./crates/jrsonnet-cli", version = "0.5.0-pre97" }21jrsonnet-types = { path = "./crates/jrsonnet-types", version = "0.5.0-pre97" }21jrsonnet-types = { path = "./crates/jrsonnet-types", version = "0.5.0-pre97" }22jrsonnet-gcmodule = { version = "0.3.7" }22jrsonnet-gcmodule = { version = "0.4.0", path = "../gcmodule" }23# Diagnostics.23# Diagnostics.24# hi-doc is my library, which handles text formatting very well, but isn't polished enough yet24# hi-doc is my library, which handles text formatting very well, but isn't polished enough yet25# Previous implementation was based on annotate-snippets, which I don't like for many reasons.25# Previous implementation was based on annotate-snippets, which I don't like for many reasons.26#26#27# I'm against using miette, because I want to reuse data between interpreter and annotations, yet miette27# I'm against using miette, because I want to reuse data between interpreter and annotations, yet miette28# and other libraries want to handle spans etc by itself, which is okay for compiler diagnostics, but is28# and other libraries want to handle spans etc by itself, which is okay for compiler diagnostics, but is29# bad for interpreter, where interpreter and parser are paired much closer.29# bad for interpreter, where interpreter and parser are paired much closer.30hi-doc = "0.1.1"30hi-doc = "0.3.0"31annotate-snippets = "0.10.1"31annotate-snippets = "0.12.11"323233# CLI33# CLI34clap = "4.5"34clap = "4.5"37# Parsing, manifestification is implemented manually everywhere37# Parsing, manifestification is implemented manually everywhere38# Note on serde_yaml_with_quirks: This is a fork of serde-yaml with legacy yaml 1.1 support:38# Note on serde_yaml_with_quirks: This is a fork of serde-yaml with legacy yaml 1.1 support:39# https://github.com/dtolnay/serde-yaml/pull/22539# https://github.com/dtolnay/serde-yaml/pull/22540serde = "1.0.197"40serde = "1.0.228"41serde_json = "1.0.114"41serde_json = "1.0.149"42serde_yaml_with_quirks = "0.8.24"42serde_yaml_with_quirks = "0.9.34"434344# Error handling44# Error handling45anyhow = "1.0.83"45anyhow = "1.0.101"46thiserror = "1.0.60"46thiserror = "2.0.18"474748# Code formatting48# Code formatting49dprint-core = "0.65.0"49dprint-core = "0.67.4"505051# Stdlib hashing functions51# Stdlib hashing functions52md5 = "0.7.0"52md5 = "0.8.0"53sha1 = "0.10.6"53sha1 = "0.10.6"54sha2 = "0.10.8"54sha2 = "0.10.9"55sha3 = "0.10.8"55sha3 = "0.10.8"565657# Source code parsing.57# Source code parsing.58# Jrsonnet has two parsers for jsonnet - one is for execution, and another is for better parsing diagnostics/lints/LSP.58# Jrsonnet has two parsers for jsonnet - one is for execution, and another is for better parsing diagnostics/lints/LSP.59# First (and fast one) is based on peg, second is based on rowan.59# First (and fast one) is based on peg, second is based on rowan.60peg = "0.8.3"60peg = "0.8.5"61logos = "0.14.0"61logos = "0.16.1"62ungrammar = "1.16.1"62ungrammar = "1.16.1"63rowan = "0.15.15"63rowan = "0.16.1"646465mimallocator = "0.1.3"65mimallocator = "0.1.3"66indoc = "2.0"66indoc = "2.0"67insta = "1.39"67insta = "1.46"68tempfile = "3.10"68tempfile = "3.24"69pathdiff = "0.2.1"69pathdiff = "0.2.3"70hashbrown = "0.14.5"70hashbrown = "0.16.1"71static_assertions = "1.1"71static_assertions = "1.1"72rustc-hash = "1.1"72rustc-hash = "2.1"73num-bigint = "0.4.5"73num-bigint = "0.4.6"74strsim = "0.11.0"74strsim = "0.11.1"75proc-macro2 = "1.0"75proc-macro2 = "1.0"76quote = "1.0"76quote = "1.0"77syn = "2.0"77syn = "2.0"78drop_bomb = "0.1.5"78drop_bomb = "0.1.5"79base64 = "0.22.1"79base64 = "0.22.1"80indexmap = "2.2.3"80indexmap = "2.13.0"81itertools = "0.13.0"81itertools = "0.14.0"82xshell = "0.2.6"82xshell = "0.2.7"838384lsp-server = "0.7.6"84lsp-server = "0.7.9"85lsp-types = "0.96.0"85lsp-types = "0.97.0"868687regex = "1.10"87regex = "1.12"88lru = "0.12.3"88lru = "0.16.3"898990json-structural-diff = "0.1.0"90json-structural-diff = "0.2.0"91syn-dissect-closure = "0.1.0"91syn-dissect-closure = "0.1.0"929293[workspace.lints.rust]93[workspace.lints.rust]bindings/jsonnet/Cargo.tomldiffbeforeafterboth39interop-threading = []39interop-threading = []404041experimental = ["exp-preserve-order", "exp-destruct"]41experimental = ["exp-preserve-order", "exp-destruct"]42exp-preserve-order = ["jrsonnet-evaluator/exp-preserve-order"]42exp-preserve-order = ["jrsonnet-evaluator/exp-preserve-order", "jrsonnet-stdlib/exp-preserve-order"]43exp-destruct = ["jrsonnet-evaluator/exp-destruct"]43exp-destruct = ["jrsonnet-evaluator/exp-destruct"]4444bindings/jsonnet/src/import.rsdiffbeforeafterboth223use std::{3use std::{4 alloc::Layout,4 alloc::Layout,5 any::Any,6 cell::RefCell,5 cell::RefCell,7 collections::HashMap,6 collections::HashMap,8 env::current_dir,7 env::current_dir,17 error::{ErrorKind::*, Result},16 error::{ErrorKind::*, Result},18 ImportResolver,17 ImportResolver,19};18};20use jrsonnet_gcmodule::Trace;19use jrsonnet_gcmodule::Acyclic;21use jrsonnet_parser::{SourceDirectory, SourceFile, SourcePath};20use jrsonnet_parser::{SourceDirectory, SourceFile, SourcePath};222123use crate::VM;22use crate::VM;32) -> c_int;31) -> c_int;333234/// Resolves imports using callback33/// Resolves imports using callback35#[derive(Trace)]34#[derive(Acyclic)]36pub struct CallbackImportResolver {35pub struct CallbackImportResolver {37 #[trace(skip)]38 cb: JsonnetImportCallback,36 cb: JsonnetImportCallback,39 #[trace(skip)]40 ctx: *mut c_void,37 ctx: *mut c_void,41 out: RefCell<HashMap<SourcePath, Vec<u8>>>,38 out: RefCell<HashMap<SourcePath, Vec<u8>>>,42}39}103 Ok(self.out.borrow().get(resolved).unwrap().clone())100 Ok(self.out.borrow().get(resolved).unwrap().clone())104 }101 }105106 fn as_any(&self) -> &dyn Any {107 self108 }109110 fn as_any_mut(&mut self) -> &mut dyn Any {111 self112 }113}102}114103115/// # Safety104/// # Safetybindings/jsonnet/src/interop.rsdiffbeforeafterboth606061#[cfg(feature = "interop-common")]61#[cfg(feature = "interop-common")]62mod common {62mod common {63 use jrsonnet_evaluator::trace::{CompactFormat, ExplainingFormat, JsFormat, PathResolver};63 use jrsonnet_evaluator::trace::{CompactFormat, HiDocFormat, JsFormat, PathResolver};646465 use crate::VM;65 use crate::VM;666676 }76 }77 1 => vm.trace_format = Box::new(JsFormat { max_trace: 20 }),77 1 => vm.trace_format = Box::new(JsFormat { max_trace: 20 }),78 2 => {78 2 => {79 vm.trace_format = Box::new(ExplainingFormat {79 vm.trace_format = Box::new(HiDocFormat {80 resolver: PathResolver::new_cwd_fallback(),80 resolver: PathResolver::new_cwd_fallback(),81 max_trace: 20,81 max_trace: 20,82 });82 });bindings/jsonnet/src/lib.rsdiffbeforeafterboth17 ffi::{CStr, CString, OsStr},17 ffi::{CStr, CString, OsStr},18 os::raw::{c_char, c_double, c_int, c_uint},18 os::raw::{c_char, c_double, c_int, c_uint},19 path::{Path, PathBuf},19 path::{Path, PathBuf},20 rc::Rc,20};21};212222use jrsonnet_evaluator::{23use jrsonnet_evaluator::{23 apply_tla, bail,24 apply_tla, bail,24 function::TlaArg,25 function::TlaArg,25 gc::{GcHashMap, TraceBox},26 gc::WithCapacityExt as _,26 manifest::{JsonFormat, ManifestFormat, ToStringFormat},27 manifest::{JsonFormat, ManifestFormat, ToStringFormat},28 rustc_hash::FxHashMap,27 stack::set_stack_depth_limit,29 stack::set_stack_depth_limit,28 tb,29 trace::{CompactFormat, PathResolver, TraceFormat},30 trace::{CompactFormat, PathResolver, TraceFormat},30 FileImportResolver, IStr, ImportResolver, Result, State, Val,31 FileImportResolver, IStr, ImportResolver, Result, State, Val,31};32};32use jrsonnet_gcmodule::Trace;33use jrsonnet_gcmodule::Acyclic;33use jrsonnet_parser::SourcePath;34use jrsonnet_parser::SourcePath;34use jrsonnet_stdlib::ContextInitializer;35use jrsonnet_stdlib::ContextInitializer;353647 b"v0.20.0\0"48 b"v0.20.0\0"48}49}495050unsafe fn parse_path(input: &CStr) -> Cow<Path> {51unsafe fn parse_path(input: &CStr) -> Cow<'_, Path> {51 #[cfg(target_family = "unix")]52 #[cfg(target_family = "unix")]52 {53 {53 use std::os::unix::ffi::OsStrExt;54 use std::os::unix::ffi::OsStrExt;61 }62 }62}63}636464unsafe fn unparse_path(input: &Path) -> Cow<CStr> {65unsafe fn unparse_path(input: &Path) -> Cow<'_, CStr> {65 #[cfg(target_family = "unix")]66 #[cfg(target_family = "unix")]66 {67 {67 use std::os::unix::ffi::OsStrExt;68 use std::os::unix::ffi::OsStrExt;76 }77 }77}78}787979#[derive(Trace)]80#[derive(Acyclic)]80struct VMImportResolver {81struct VMImportResolver {81 #[trace(tracking(force))]82 inner: RefCell<TraceBox<dyn ImportResolver>>,82 inner: RefCell<Rc<dyn ImportResolver>>,83}83}84impl VMImportResolver {84impl VMImportResolver {85 fn new(value: impl ImportResolver) -> Self {85 fn new(value: impl ImportResolver) -> Self {86 Self {86 Self {87 inner: RefCell::new(tb!(value)),87 inner: RefCell::new(Rc::new(value)),88 }88 }89 }89 }90}90}105 self.inner.borrow().resolve(path)105 self.inner.borrow().resolve(path)106 }106 }107108 fn as_any(&self) -> &dyn Any {109 self110 }111 fn as_any_mut(&mut self) -> &mut dyn Any {112 self113 }114}107}115108116pub struct VM {109pub struct VM {117 state: State,110 state: State,118 manifest_format: Box<dyn ManifestFormat>,111 manifest_format: Box<dyn ManifestFormat>,119 trace_format: Box<dyn TraceFormat>,112 trace_format: Box<dyn TraceFormat>,120 tla_args: GcHashMap<IStr, TlaArg>,113 tla_args: FxHashMap<IStr, TlaArg>,121}114}122impl VM {115impl VM {123 fn replace_import_resolver(&self, resolver: impl ImportResolver) {116 fn replace_import_resolver(&self, resolver: impl ImportResolver) {124 *self117 *(self.state.import_resolver() as &dyn Any)125 .state126 .import_resolver()127 .as_any()128 .downcast_ref::<VMImportResolver>()118 .downcast_ref::<VMImportResolver>()129 .expect("valid resolver ty")119 .expect("valid resolver ty")130 .inner120 .inner131 .borrow_mut() = tb!(resolver);121 .borrow_mut() = Rc::new(resolver);132 }122 }133 fn add_jpath(&self, path: PathBuf) {123 fn add_jpath(&self, path: PathBuf) {134 self.state124 let ir = self.state.import_resolver();135 .import_resolver()136 .as_any()125 let vmi = (ir as &dyn Any)137 .downcast_ref::<VMImportResolver>()126 .downcast_ref::<VMImportResolver>()138 .expect("valid resolver ty")127 .expect("valid resolver ty");139 .inner128 let vmi = &mut *vmi.inner.borrow_mut();140 .borrow_mut()141 .as_any_mut()129 (vmi as &mut dyn Any)142 .downcast_mut::<FileImportResolver>()130 .downcast_mut::<FileImportResolver>()143 .expect("jpaths are not compatible with callback imports!")131 .expect("jpaths are not compatible with callback imports!")144 .add_jpath(path);132 .add_jpath(path);158 state,146 state,159 manifest_format: Box::new(JsonFormat::default()),147 manifest_format: Box::new(JsonFormat::default()),160 trace_format: Box::new(CompactFormat::default()),148 trace_format: Box::new(CompactFormat::default()),161 tla_args: GcHashMap::new(),149 tla_args: FxHashMap::new(),162 }))150 }))163}151}164152cmds/jrsonnet-fmt/src/main.rsdiffbeforeafterboth46 o46 o47 }};47 }};48 (@s; $o:ident: str($e:expr $(,)?) $($t:tt)*) => {{48 (@s; $o:ident: str($e:expr $(,)?) $($t:tt)*) => {{49 $o.push_str($e);49 $o.push_string($e.to_owned());50 pi!(@s; $o: $($t)*);50 pi!(@s; $o: $($t)*);51 }};51 }};52 (@s; $o:ident: string($e:expr $(,)?) $($t:tt)*) => {{52 (@s; $o:ident: string($e:expr $(,)?) $($t:tt)*) => {{711 let mut builder = hi_doc::SnippetBuilder::new(input);711 let mut builder = hi_doc::SnippetBuilder::new(input);712 for error in errors {712 for error in errors {713 builder713 builder714 .error(hi_doc::Text::single(714 .error(hi_doc::Text::fragment(715 format!("{:?}", error.error).chars(),715 format!("{:?}", error.error),716 Formatting::default(),716 Formatting::default(),717 ))717 ))718 .range(718 .range(cmds/jrsonnet/Cargo.tomldiffbeforeafterboth44# --exp-apply44# --exp-apply45exp-apply = []45exp-apply = []4647nightly = ["jrsonnet-evaluator/nightly"]484649[dependencies]47[dependencies]50jrsonnet-evaluator.workspace = true48jrsonnet-evaluator.workspace = truecrates/jrsonnet-cli/src/tla.rsdiffbeforeafterboth2use jrsonnet_evaluator::{2use jrsonnet_evaluator::{3 error::{ErrorKind, Result},3 error::{ErrorKind, Result},4 function::TlaArg,4 function::TlaArg,5 gc::GcHashMap,5 gc::WithCapacityExt as _,6 rustc_hash::FxHashMap,6 IStr,7 IStr,7};8};8use jrsonnet_parser::{ParserSettings, Source};9use jrsonnet_parser::{ParserSettings, Source};32 tla_code_file: Vec<ExtFile>,33 tla_code_file: Vec<ExtFile>,33}34}34impl TlaOpts {35impl TlaOpts {35 pub fn tla_opts(&self) -> Result<GcHashMap<IStr, TlaArg>> {36 pub fn tla_opts(&self) -> Result<FxHashMap<IStr, TlaArg>> {36 let mut out = GcHashMap::new();37 let mut out = FxHashMap::new();37 for (name, value) in self38 for (name, value) in self38 .tla_str39 .tla_str39 .iter()40 .iter()crates/jrsonnet-cli/src/trace.rsdiffbeforeafterboth1use clap::{Parser, ValueEnum};1use clap::{Parser, ValueEnum};2use jrsonnet_evaluator::trace::{2use jrsonnet_evaluator::trace::{CompactFormat, HiDocFormat, PathResolver, TraceFormat};3 CompactFormat, ExplainingFormat, HiDocFormat, PathResolver, TraceFormat,4};536#[derive(PartialEq, Eq, ValueEnum, Clone)]4#[derive(PartialEq, Eq, ValueEnum, Clone)]9 Compact,7 Compact,10 /// Display source code with attached trace annotations8 /// Display source code with attached trace annotations11 Explaining,9 Explaining,12 /// Experimental trace formatting based on hi-doc library10 /// Trace formatting based on hi-doc library13 HiDoc,11 HiDoc,14}12}151338 padding: 4,36 padding: 4,39 max_trace,37 max_trace,40 }),38 }),41 TraceFormatName::Explaining => Box::new(ExplainingFormat {39 TraceFormatName::Explaining | TraceFormatName::HiDoc => Box::new(HiDocFormat {42 resolver,43 max_trace,44 }),45 TraceFormatName::HiDoc => Box::new(HiDocFormat {46 resolver,40 resolver,47 max_trace,41 max_trace,48 }),42 }),crates/jrsonnet-evaluator/Cargo.tomldiffbeforeafterboth7repository.workspace = true7repository.workspace = true8version.workspace = true8version.workspace = true910build = "build.rs"91110[lints]12[lints]11workspace = true13workspace = true16explaining-traces = ["annotate-snippets", "hi-doc"]18explaining-traces = ["annotate-snippets", "hi-doc"]17# Allows library authors to throw custom errors19# Allows library authors to throw custom errors18anyhow-error = ["anyhow"]20anyhow-error = ["anyhow"]19# Adds ability to build import closure in async20async-import = []212122# Allows to preserve field order in objects22# Allows to preserve field order in objects23exp-preserve-order = []23exp-preserve-order = []30# obj?.field, obj?.['field']30# obj?.field, obj?.['field']31exp-null-coaelse = ["jrsonnet-parser/exp-null-coaelse"]31exp-null-coaelse = ["jrsonnet-parser/exp-null-coaelse"]3233# Improves performance, and implements some useful things using nightly-only features34nightly = ["hashbrown/nightly"]353236[dependencies]33[dependencies]37jrsonnet-interner.workspace = true34jrsonnet-interner.workspace = true41jrsonnet-gcmodule.workspace = true38jrsonnet-gcmodule.workspace = true423943pathdiff.workspace = true40pathdiff.workspace = true44hashbrown.workspace = true45static_assertions.workspace = true41static_assertions.workspace = true464247rustc-hash.workspace = true43rustc-hash.workspace = true60# Bigint56# Bigint61num-bigint = { workspace = true, features = ["serde"], optional = true }57num-bigint = { workspace = true, features = ["serde"], optional = true }5862stacker = "0.1.15"59stacker = "0.1.23"6061[build-dependencies]62rustversion = "1.0.22"6363crates/jrsonnet-evaluator/build.rsdiffbeforeafterbothno changes
crates/jrsonnet-evaluator/src/arr/mod.rsdiffbeforeafterboth1use std::{any::Any, num::NonZeroU32};1use std::{2 any::Any,3 fmt::{self},4 num::NonZeroU32,5};263use jrsonnet_gcmodule::{Cc, Trace};7use jrsonnet_gcmodule::{cc_dyn, Cc};4use jrsonnet_interner::IBytes;8use jrsonnet_interner::IBytes;5use jrsonnet_parser::LocExpr;9use jrsonnet_parser::LocExpr;6107use crate::{function::FuncVal, gc::TraceBox, tb, Context, Result, Thunk, Val};11use crate::{function::FuncVal, Context, Result, Thunk, Val};8129mod spec;13mod spec;10pub use spec::{ArrayLike, *};14pub use spec::{ArrayLike, *};111512/// Represents a Jsonnet array value.16cc_dyn!(17 #[doc = "Represents a Jsonnet array value."]13#[derive(Debug, Clone, Trace)]18 #[derive(Clone)]14// may contain other ArrValue19 ArrValue,20 ArrayLike,15#[trace(tracking(force))]21 pub fn new() {...}16pub struct ArrValue(Cc<TraceBox<dyn ArrayLike>>);22);23impl fmt::Debug for ArrValue {24 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {25 self.0.fmt(f)26 }27}172818pub trait ArrayLikeIter<T>: Iterator<Item = T> + DoubleEndedIterator + ExactSizeIterator {}29pub trait ArrayLikeIter<T>: Iterator<Item = T> + DoubleEndedIterator + ExactSizeIterator {}19impl<I, T> ArrayLikeIter<T> for I where30impl<I, T> ArrayLikeIter<T> for I where22}33}233424impl ArrValue {35impl ArrValue {25 pub fn new(v: impl ArrayLike) -> Self {26 Self(Cc::new(tb!(v)))27 }28 pub fn empty() -> Self {36 pub fn empty() -> Self {29 Self::new(RangeArray::empty())37 Self::new(RangeArray::empty())30 }38 }233 }241 }234}242}235236#[cfg(target_pointer_width = "64")]237static_assertions::assert_eq_size!(ArrValue, [u8; 8]);238243crates/jrsonnet-evaluator/src/async_import.rsdiffbeforeafterboth1use std::{cell::RefCell, future::Future, path::Path};1use std::{any::Any, cell::RefCell, future::Future, path::Path};223use jrsonnet_gcmodule::Trace;3use jrsonnet_gcmodule::Acyclic;4use jrsonnet_interner::IStr;4use jrsonnet_interner::IStr;5use jrsonnet_parser::{5use jrsonnet_parser::{6 ArgsDesc, AssertStmt, BindSpec, CompSpec, Destruct, Expr, FieldMember, FieldName, ForSpecData,6 ArgsDesc, AssertStmt, BindSpec, CompSpec, Destruct, Expr, FieldMember, FieldName, ForSpecData,7 IfSpecData, LocExpr, Member, ObjBody, Param, ParamsDesc, ParserSettings, SliceDesc, Source,7 IfSpecData, LocExpr, Member, ObjBody, Param, ParamsDesc, ParserSettings, SliceDesc, Source,8 SourcePath,8 SourcePath,9};9};10use rustc_hash::FxHashMap;101111use crate::{bail, gc::GcHashMap, FileData, ImportResolver, State};12use crate::{bail, FileData, ImportResolver, State};121313pub struct Import {14pub struct Import {14 path: IStr,15 path: IStr,132 ObjBody::ObjComp(_) => todo!(),133 ObjBody::ObjComp(_) => todo!(),133 }134 }134 }135 }135 match &*expr.0 {136 match &*expr.expr() {136 Expr::Import(v) | Expr::ImportStr(v) | Expr::ImportBin(v) => {137 Expr::Import(v) | Expr::ImportStr(v) | Expr::ImportBin(v) => {137 if let Expr::Str(s) = &*v.0 {138 if let Expr::Str(s) = &*v.expr() {138 out.0.push(Import {139 out.0.push(Import {139 path: s.clone(),140 path: s.clone(),140 expression: matches!(&*expr.0, Expr::Import(_)),141 expression: matches!(&*expr.expr(), Expr::Import(_)),141 });142 });142 }143 }143 // Non-string import will fail in runtime144 // Non-string import will fail in runtime250 ) -> impl Future<Output = Result<Vec<u8>, Self::Error>>;251 ) -> impl Future<Output = Result<Vec<u8>, Self::Error>>;251}252}252253253#[derive(Trace)]254#[derive(Acyclic)]254struct ResolvedImportResolver {255struct ResolvedImportResolver {255 resolved: RefCell<GcHashMap<(SourcePath, IStr), (SourcePath, bool)>>,256 resolved: RefCell<FxHashMap<(SourcePath, IStr), (SourcePath, bool)>>,256}257}257impl ImportResolver for ResolvedImportResolver {258impl ImportResolver for ResolvedImportResolver {258 fn load_file_contents(&self, _resolved: &SourcePath) -> crate::Result<Vec<u8>> {259 fn load_file_contents(&self, _resolved: &SourcePath) -> crate::Result<Vec<u8>> {279 ))280 ))280 }281 }281282 fn as_any(&self) -> &dyn std::any::Any {283 self284 }285}282}286283287enum Job {284enum Job {295where292where296 H: AsyncImportResolver,293 H: AsyncImportResolver,297{294{298 let mut resolved = s295 let resolved = (s.import_resolver() as &dyn Any)299 .import_resolver()300 .as_any()301 .downcast_ref::<ResolvedImportResolver>()296 .downcast_ref::<ResolvedImportResolver>()302 .map_or_else(GcHashMap::new, |resolver| {297 .expect("for async imports, import_resolver should be set to ResolvedImportResolver");303 std::mem::take(&mut *resolver.resolved.borrow_mut())298304 });299 let mut resolved_map = resolved.resolved.borrow_mut();300305 let mut queue = vec![Job::LoadFile {301 let mut queue = vec![Job::LoadFile {306 path: handler.resolve(path.as_ref()).await?,302 path: handler.resolve(path.as_ref()).await?,344 }340 }345 Job::ResolveImport { from, import } => {341 Job::ResolveImport { from, import } => {346 if let Some((resolved, expression)) =342 if let Some((resolved, expression)) =347 resolved.get_mut(&(from.clone(), import.path.clone()))343 resolved_map.get_mut(&(from.clone(), import.path.clone()))348 {344 {349 if import.expression && !*expression {345 if import.expression && !*expression {350 *expression = true;346 *expression = true;360 }356 }361 }357 }362 }358 }363 s.set_import_resolver(ResolvedImportResolver {364 resolved: RefCell::new(resolved),365 });366 Ok(())359 Ok(())367}360}368361crates/jrsonnet-evaluator/src/ctx.rsdiffbeforeafterboth223use jrsonnet_gcmodule::{Cc, Trace};3use jrsonnet_gcmodule::{Cc, Trace};4use jrsonnet_interner::IStr;4use jrsonnet_interner::IStr;5use rustc_hash::FxHashMap;566use crate::{7use crate::{7 error::ErrorKind::*, gc::GcHashMap, map::LayeredHashMap, ObjValue, Pending, Result, State,8 error::ErrorKind::*, gc::WithCapacityExt as _, map::LayeredHashMap, ObjValue, Pending, Result,8 Thunk, Val,9 State, Thunk, Val,9};10};1011888989 #[must_use]90 #[must_use]90 pub fn with_var(self, name: impl Into<IStr>, value: Val) -> Self {91 pub fn with_var(self, name: impl Into<IStr>, value: Val) -> Self {91 let mut new_bindings = GcHashMap::with_capacity(1);92 let mut new_bindings = FxHashMap::with_capacity(1);92 new_bindings.insert(name.into(), Thunk::evaluated(value));93 new_bindings.insert(name.into(), Thunk::evaluated(value));93 self.extend(new_bindings, None, None, None)94 self.extend(new_bindings, None, None, None)94 }95 }959696 #[must_use]97 #[must_use]97 pub fn extend(98 pub fn extend(98 self,99 self,99 new_bindings: GcHashMap<IStr, Thunk<Val>>,100 new_bindings: FxHashMap<IStr, Thunk<Val>>,100 new_dollar: Option<ObjValue>,101 new_dollar: Option<ObjValue>,101 new_sup: Option<ObjValue>,102 new_sup: Option<ObjValue>,102 new_this: Option<ObjValue>,103 new_this: Option<ObjValue>,128129129pub struct ContextBuilder {130pub struct ContextBuilder {130 state: Option<State>,131 state: Option<State>,131 bindings: GcHashMap<IStr, Thunk<Val>>,132 bindings: FxHashMap<IStr, Thunk<Val>>,132 extend: Option<Context>,133 extend: Option<Context>,133}134}134135138 pub fn dangerous_empty_state() -> Self {139 pub fn dangerous_empty_state() -> Self {139 Self {140 Self {140 state: None,141 state: None,141 bindings: GcHashMap::new(),142 bindings: FxHashMap::new(),142 extend: None,143 extend: None,143 }144 }144 }145 }148 pub fn with_capacity(state: State, capacity: usize) -> Self {149 pub fn with_capacity(state: State, capacity: usize) -> Self {149 Self {150 Self {150 state: Some(state),151 state: Some(state),151 bindings: GcHashMap::with_capacity(capacity),152 bindings: FxHashMap::with_capacity(capacity),152 extend: None,153 extend: None,153 }154 }154 }155 }155 pub fn extend(parent: Context) -> Self {156 pub fn extend(parent: Context) -> Self {156 Self {157 Self {157 state: parent.0.state.clone(),158 state: parent.0.state.clone(),158 bindings: GcHashMap::new(),159 bindings: FxHashMap::new(),159 extend: Some(parent),160 extend: Some(parent),160 }161 }161 }162 }crates/jrsonnet-evaluator/src/error.rsdiffbeforeafterboth138 #[error("assert failed: {}", format_empty_str(.0))]138 #[error("assert failed: {}", format_empty_str(.0))]139 AssertionFailed(IStr),139 AssertionFailed(IStr),140140141 #[error("local is not defined: {0}{}", format_found(.1, "local"))]141 #[error("local is not defined: {0}{found}", found = format_found(.1, "local"))]142 VariableIsNotDefined(IStr, Vec<IStr>),142 VariableIsNotDefined(IStr, Vec<IStr>),143 #[error("duplicate local var: {0}")]143 #[error("duplicate local var: {0}")]144 DuplicateLocalVar(IStr),144 DuplicateLocalVar(IStr),145145146 #[error("type mismatch: expected {}, got {2} {0}", .1.iter().map(|e| format!("{e}")).collect::<Vec<_>>().join(", "))]146 #[error("type mismatch: expected {expected}, got {2} {0}", expected = .1.iter().map(|e| format!("{e}")).collect::<Vec<_>>().join(", "))]147 TypeMismatch(&'static str, Vec<ValType>, ValType),147 TypeMismatch(&'static str, Vec<ValType>, ValType),148 #[error("no such field: {}{}", format_empty_str(.0), format_found(.1, "field"))]148 #[error("no such field: {}{}", format_empty_str(.0), format_found(.1, "field"))]149 NoSuchField(IStr, Vec<IStr>),149 NoSuchField(IStr, Vec<IStr>),154 UnknownFunctionParameter(String),154 UnknownFunctionParameter(String),155 #[error("argument {0} is already bound")]155 #[error("argument {0} is already bound")]156 BindingParameterASecondTime(IStr),156 BindingParameterASecondTime(IStr),157 #[error("too many args, function has {0}{}", format_signature(.1))]157 #[error("too many args, function has {0}{sig}", sig = format_signature(.1))]158 TooManyArgsFunctionHas(usize, FunctionSignature),158 TooManyArgsFunctionHas(usize, FunctionSignature),159 #[error("function argument is not passed: {}{}", .0.as_ref().map_or("<unnamed>", IStr::as_str), format_signature(.1))]159 #[error("function argument is not passed: {}{}", .0.as_ref().map_or("<unnamed>", IStr::as_str), format_signature(.1))]160 FunctionParameterNotBoundInCall(Option<IStr>, FunctionSignature),160 FunctionParameterNotBoundInCall(Option<IStr>, FunctionSignature),crates/jrsonnet-evaluator/src/evaluate/destructure.rsdiffbeforeafterboth1use jrsonnet_interner::IStr;1use jrsonnet_interner::IStr;2use jrsonnet_parser::{BindSpec, Destruct};2use jrsonnet_parser::{BindSpec, Destruct};3use rustc_hash::FxHashMap;344use crate::{5use crate::{5 bail,6 bail,6 error::{ErrorKind::*, Result},7 error::{ErrorKind::*, Result},7 evaluate, evaluate_method, evaluate_named,8 evaluate, evaluate_method, evaluate_named, Context, Pending, Thunk, Val,8 gc::GcHashMap,9 Context, Pending, Thunk, Val,10};9};111015 d: &Destruct,14 d: &Destruct,16 parent: Thunk<Val>,15 parent: Thunk<Val>,17 fctx: Pending<Context>,16 fctx: Pending<Context>,18 new_bindings: &mut GcHashMap<IStr, Thunk<Val>>,17 new_bindings: &mut FxHashMap<IStr, Thunk<Val>>,19) -> Result<()> {18) -> Result<()> {20 match d {19 match d {21 Destruct::Full(v) => {20 Destruct::Full(v) => {163pub fn evaluate_dest(162pub fn evaluate_dest(164 d: &BindSpec,163 d: &BindSpec,165 fctx: Pending<Context>,164 fctx: Pending<Context>,166 new_bindings: &mut GcHashMap<IStr, Thunk<Val>>,165 new_bindings: &mut FxHashMap<IStr, Thunk<Val>>,167) -> Result<()> {166) -> Result<()> {168 match d {167 match d {169 BindSpec::Field { into, value } => {168 BindSpec::Field { into, value } => {crates/jrsonnet-evaluator/src/evaluate/mod.rsdiffbeforeafterboth7 ForSpecData, IfSpecData, LiteralType, LocExpr, Member, ObjBody, ParamsDesc,7 ForSpecData, IfSpecData, LiteralType, LocExpr, Member, ObjBody, ParamsDesc,8};8};9use jrsonnet_types::ValType;9use jrsonnet_types::ValType;10use rustc_hash::FxHashMap;101111use self::destructure::destruct;12use self::destructure::destruct;12use crate::{13use crate::{16 error::{suggest_object_fields, ErrorKind::*},17 error::{suggest_object_fields, ErrorKind::*},17 evaluate::operator::{evaluate_add_op, evaluate_binary_op_special, evaluate_unary_op},18 evaluate::operator::{evaluate_add_op, evaluate_binary_op_special, evaluate_unary_op},18 function::{CallLocation, FuncDesc, FuncVal},19 function::{CallLocation, FuncDesc, FuncVal},20 gc::WithCapacityExt as _,19 in_frame,21 in_frame,20 typed::Typed,22 typed::Typed,21 val::{CachedUnbound, IndexableVal, NumValue, StrValue, Thunk},23 val::{CachedUnbound, IndexableVal, NumValue, StrValue, Thunk},22 Context, Error, GcHashMap, ObjValue, ObjValueBuilder, ObjectAssertion, Pending, Result,24 Context, Error, ObjValue, ObjValueBuilder, ObjectAssertion, Pending, Result, ResultExt,23 ResultExt, Unbound, Val,25 Unbound, Val,24};26};25pub mod destructure;27pub mod destructure;122 Val::Arr(list) => {124 Val::Arr(list) => {123 for item in list.iter_lazy() {125 for item in list.iter_lazy() {124 let fctx = Pending::new();126 let fctx = Pending::new();125 let mut new_bindings = GcHashMap::with_capacity(var.capacity_hint());127 let mut new_bindings = FxHashMap::with_capacity(var.capacity_hint());126 destruct(var, item, fctx.clone(), &mut new_bindings)?;128 destruct(var, item, fctx.clone(), &mut new_bindings)?;127 let ctx = ctx129 let ctx = ctx128 .clone()130 .clone()140 false,142 false,141 ) {143 ) {142 let fctx = Pending::new();144 let fctx = Pending::new();143 let mut new_bindings = GcHashMap::with_capacity(var.capacity_hint());145 let mut new_bindings = FxHashMap::with_capacity(var.capacity_hint());144 let obj = obj.clone();146 let obj = obj.clone();145 let value = Thunk::evaluated(Val::Arr(ArrValue::lazy(vec![147 let value = Thunk::evaluated(Val::Arr(ArrValue::lazy(vec![146 Thunk::evaluated(Val::string(field.clone())),148 Thunk::evaluated(Val::string(field.clone())),181 fn bind(&self, sup: Option<ObjValue>, this: Option<ObjValue>) -> Result<Context> {183 fn bind(&self, sup: Option<ObjValue>, this: Option<ObjValue>) -> Result<Context> {182 let fctx = Context::new_future();184 let fctx = Context::new_future();183 let mut new_bindings =185 let mut new_bindings =184 GcHashMap::with_capacity(self.locals.iter().map(BindSpec::capacity_hint).sum());186 FxHashMap::with_capacity(self.locals.iter().map(BindSpec::capacity_hint).sum());185 for b in self.locals.iter() {187 for b in self.locals.iter() {186 evaluate_dest(b, fctx.clone(), &mut new_bindings)?;188 evaluate_dest(b, fctx.clone(), &mut new_bindings)?;187 }189 }329 }331 }330 }332 }331 let this = builder.build();333 let this = builder.build();332 fctx.fill(ctx.extend(GcHashMap::new(), None, None, Some(this.clone())));334 fctx.fill(ctx.extend(FxHashMap::new(), None, None, Some(this.clone())));333 Ok(this)335 Ok(this)334}336}335337357 let this = builder.build();359 let this = builder.build();358 for (ctx, fctx) in ctxs {360 for (ctx, fctx) in ctxs {359 let _ctx = ctx361 let _ctx = ctx360 .extend(GcHashMap::new(), None, None, Some(this.clone()))362 .extend(FxHashMap::new(), None, None, Some(this.clone()))361 .into_future(fctx);363 .into_future(fctx);362 }364 }363 this365 this581 Ok(indexable)583 Ok(indexable)582 })?,584 })?,583 LocalExpr(bindings, returned) => {585 LocalExpr(bindings, returned) => {584 let mut new_bindings: GcHashMap<IStr, Thunk<Val>> =586 let mut new_bindings: FxHashMap<IStr, Thunk<Val>> =585 GcHashMap::with_capacity(bindings.iter().map(BindSpec::capacity_hint).sum());587 FxHashMap::with_capacity(bindings.iter().map(BindSpec::capacity_hint).sum());586 let fctx = Context::new_future();588 let fctx = Context::new_future();587 for b in bindings {589 for b in bindings {588 evaluate_dest(b, fctx.clone(), &mut new_bindings)?;590 evaluate_dest(b, fctx.clone(), &mut new_bindings)?;crates/jrsonnet-evaluator/src/evaluate/operator.rsdiffbeforeafterboth223use jrsonnet_parser::{BinaryOpType, LocExpr, UnaryOpType};3use jrsonnet_parser::{BinaryOpType, LocExpr, UnaryOpType};445#[cfg(feature = "exp-bigint")]6use num_traits::{FromPrimitive, ToPrimitive};78#[cfg(feature = "exp-bigint")]9use crate::val::NumValue;10use crate::{5use crate::{11 arr::ArrValue,6 arr::ArrValue,12 bail,7 bail,crates/jrsonnet-evaluator/src/function/arglike.rsdiffbeforeafterboth1use hashbrown::HashMap;1use std::collections::HashMap;22use jrsonnet_gcmodule::Trace;3use jrsonnet_gcmodule::Trace;3use jrsonnet_interner::IStr;4use jrsonnet_interner::IStr;4use jrsonnet_parser::{ArgsDesc, LocExpr};5use jrsonnet_parser::{ArgsDesc, LocExpr};566use crate::{evaluate, gc::GcHashMap, typed::Typed, Context, Result, Thunk, Val};7use crate::{evaluate, typed::Typed, Context, Result, Thunk, Val};788/// Marker for arguments, which can be evaluated with context set to None9/// Marker for arguments, which can be evaluated with context set to None9pub trait OptionalContext {}10pub trait OptionalContext {}205}206}206impl<V, S> OptionalContext for HashMap<IStr, V, S> where V: ArgLike + OptionalContext {}207impl<V, S> OptionalContext for HashMap<IStr, V, S> where V: ArgLike + OptionalContext {}207208impl<A: ArgLike> ArgsLike for GcHashMap<IStr, A> {209 fn unnamed_len(&self) -> usize {210 self.0.unnamed_len()211 }212213 fn unnamed_iter(214 &self,215 ctx: Context,216 tailstrict: bool,217 handler: &mut dyn FnMut(usize, Thunk<Val>) -> Result<()>,218 ) -> Result<()> {219 self.0.unnamed_iter(ctx, tailstrict, handler)220 }221222 fn named_iter(223 &self,224 ctx: Context,225 tailstrict: bool,226 handler: &mut dyn FnMut(&IStr, Thunk<Val>) -> Result<()>,227 ) -> Result<()> {228 self.0.named_iter(ctx, tailstrict, handler)229 }230231 fn named_names(&self, handler: &mut dyn FnMut(&IStr)) {232 self.0.named_names(handler);233 }234235 fn is_empty(&self) -> bool {236 self.0.is_empty()237 }238}239208240macro_rules! impl_args_like {209macro_rules! impl_args_like {241 ($count:expr; $($gen:ident)*) => {210 ($count:expr; $($gen:ident)*) => {crates/jrsonnet-evaluator/src/function/builtin.rsdiffbeforeafterboth1use std::{any::Any, borrow::Cow};1use std::{any::Any, borrow::Cow};223use jrsonnet_gcmodule::Trace;3use jrsonnet_gcmodule::{cc_dyn, Trace, TraceBox};4use jrsonnet_interner::IStr;4use jrsonnet_interner::IStr;556use super::{arglike::ArgsLike, parse::parse_builtin_call, CallLocation};6use super::{arglike::ArgsLike, parse::parse_builtin_call, CallLocation};7use crate::{gc::TraceBox, tb, Context, Result, Val};7use crate::{Context, Result, Val};889/// Can't have `str` | `IStr`, because constant `BuiltinParam` causes9/// Can't have `str` | `IStr`, because constant `BuiltinParam` causes10/// `E0492: constant functions cannot refer to interior mutable data`10/// `E0492: constant functions cannot refer to interior mutable data`70 }70 }71}71}7273cc_dyn!(74 #[derive(Clone)]75 BuiltinFunc,76 Builtin,77 pub(crate) fn new() {...}78);79impl Builtin for BuiltinFunc {80 fn name(&self) -> &str {81 self.0.name()82 }8384 fn params(&self) -> &[BuiltinParam] {85 self.0.params()86 }8788 fn call(&self, ctx: Context, loc: CallLocation<'_>, args: &dyn ArgsLike) -> Result<Val> {89 self.0.call(ctx, loc, args)90 }9192 fn as_any(&self) -> &dyn Any {93 self.0.as_any()94 }95}729673/// Description of function defined by native code97/// Description of function defined by native code74///98///108 default: ParamDefault::None,132 default: ParamDefault::None,109 })133 })110 .collect(),134 .collect(),111 handler: tb!(handler),135 handler: TraceBox(Box::new(handler)),112 }136 }113 }137 }114}138}crates/jrsonnet-evaluator/src/function/mod.rsdiffbeforeafterboth13 parse::{parse_default_function_call, parse_function_call},13 parse::{parse_default_function_call, parse_function_call},14};14};15use crate::{15use crate::{16 bail, error::ErrorKind::*, evaluate, evaluate_trivial, gc::TraceBox, tb, Context,16 bail, error::ErrorKind::*, evaluate, evaluate_trivial, function::builtin::BuiltinFunc, Context,17 ContextBuilder, Result, Thunk, Val,17 ContextBuilder, Result, Thunk, Val,18};18};1919102 /// Standard library function.102 /// Standard library function.103 StaticBuiltin(#[trace(skip)] &'static dyn StaticBuiltin),103 StaticBuiltin(#[trace(skip)] &'static dyn StaticBuiltin),104 /// User-provided function.104 /// User-provided function.105 Builtin(Cc<TraceBox<dyn Builtin>>),105 Builtin(BuiltinFunc),106}106}107107108impl Debug for FuncVal {108impl Debug for FuncVal {128128129impl FuncVal {129impl FuncVal {130 pub fn builtin(builtin: impl Builtin) -> Self {130 pub fn builtin(builtin: impl Builtin) -> Self {131 Self::Builtin(Cc::new(tb!(builtin)))131 Self::Builtin(BuiltinFunc::new(builtin))132 }132 }133 pub fn static_builtin(static_builtin: &'static dyn StaticBuiltin) -> Self {133 pub fn static_builtin(static_builtin: &'static dyn StaticBuiltin) -> Self {134 Self::StaticBuiltin(static_builtin)134 Self::StaticBuiltin(static_builtin)crates/jrsonnet-evaluator/src/function/parse.rsdiffbeforeafterboth223use jrsonnet_interner::IStr;3use jrsonnet_interner::IStr;4use jrsonnet_parser::ParamsDesc;4use jrsonnet_parser::ParamsDesc;5use rustc_hash::FxHashMap;566use super::{arglike::ArgsLike, builtin::BuiltinParam};7use super::{arglike::ArgsLike, builtin::BuiltinParam};7use crate::{8use crate::{10 error::{ErrorKind::*, Result},11 error::{ErrorKind::*, Result},11 evaluate_named,12 evaluate_named,12 function::builtin::ParamDefault,13 function::builtin::ParamDefault,13 gc::GcHashMap,14 gc::WithCapacityExt as _,14 Context, Pending, Thunk, Val,15 Context, Pending, Thunk, Val,15};16};161730 tailstrict: bool,31 tailstrict: bool,31) -> Result<Context> {32) -> Result<Context> {32 let mut passed_args =33 let mut passed_args =33 GcHashMap::with_capacity(params.iter().map(|p| p.0.capacity_hint()).sum());34 FxHashMap::with_capacity(params.iter().map(|p| p.0.capacity_hint()).sum());34 if args.unnamed_len() > params.len() {35 if args.unnamed_len() > params.len() {35 bail!(TooManyArgsFunctionHas(36 bail!(TooManyArgsFunctionHas(36 params.len(),37 params.len(),72 // Some args are unset, but maybe we have defaults for them73 // Some args are unset, but maybe we have defaults for them73 // Default values should be created in newly created context74 // Default values should be created in newly created context74 let fctx = Context::new_future();75 let fctx = Context::new_future();75 let mut defaults = GcHashMap::with_capacity(76 let mut defaults = FxHashMap::with_capacity(76 params.iter().map(|p| p.0.capacity_hint()).sum::<usize>()77 params.iter().map(|p| p.0.capacity_hint()).sum::<usize>()77 - filled_named78 - filled_named78 - filled_positionals,79 - filled_positionals,220pub fn parse_default_function_call(body_ctx: Context, params: &ParamsDesc) -> Result<Context> {221pub fn parse_default_function_call(body_ctx: Context, params: &ParamsDesc) -> Result<Context> {221 let fctx = Context::new_future();222 let fctx = Context::new_future();222223223 let mut bindings = GcHashMap::with_capacity(params.iter().map(|p| p.0.capacity_hint()).sum());224 let mut bindings = FxHashMap::with_capacity(params.iter().map(|p| p.0.capacity_hint()).sum());224225225 for param in params.iter() {226 for param in params.iter() {226 if let Some(v) = ¶m.1 {227 if let Some(v) = ¶m.1 {crates/jrsonnet-evaluator/src/gc.rsdiffbeforeafterboth1/// Macros to help deal with Gc1/// Macros to help deal with Gc2use std::{2use jrsonnet_gcmodule::Trace;3 borrow::{Borrow, BorrowMut},4 collections::HashSet,5 hash::BuildHasherDefault,6 ops::{Deref, DerefMut},7};89use hashbrown::HashMap;10use jrsonnet_gcmodule::{Trace, Tracer};11use rustc_hash::{FxHashSet, FxHasher};3use rustc_hash::{FxBuildHasher, FxHashMap, FxHashSet};12413/// Replacement for box, which assumes that the underlying type is [`Trace`]14/// Used in places, where `Cc<dyn Trait>` should be used instead, but it can't, because `CoerceUnsiced` is not stable15#[derive(Debug, Clone)]16pub struct TraceBox<T: ?Sized>(pub Box<T>);5pub trait WithCapacityExt {17#[macro_export]18macro_rules! tb {19 ($v:expr) => {20 $crate::gc::TraceBox(Box::new($v))21 };22}2324impl<T: ?Sized + Trace> Trace for TraceBox<T> {25 fn trace(&self, tracer: &mut Tracer<'_>) {26 self.0.trace(tracer);27 }2829 fn is_type_tracked() -> bool {6 fn new() -> Self;30 true31 }32}3334// TODO: Replace with CoerceUnsized35impl<T: ?Sized> From<Box<T>> for TraceBox<T> {36 fn from(inner: Box<T>) -> Self {7 fn with_capacity(capacity: usize) -> Self;37 Self(inner)8}38 }39}4041impl<T: ?Sized> Deref for TraceBox<T> {9impl<V> WithCapacityExt for FxHashSet<V> {42 type Target = T;4344 fn deref(&self) -> &Self::Target {45 &self.046 }47}48impl<T: Trace + ?Sized> DerefMut for TraceBox<T> {49 fn deref_mut(&mut self) -> &mut Self::Target {50 &mut self.051 }52}5354impl<T: ?Sized> Borrow<T> for TraceBox<T> {55 fn borrow(&self) -> &T {56 &self.057 }58}5960impl<T: ?Sized> BorrowMut<T> for TraceBox<T> {61 fn borrow_mut(&mut self) -> &mut T {62 &mut self.063 }64}6566impl<T: ?Sized> AsRef<T> for TraceBox<T> {67 fn as_ref(&self) -> &T {68 &self.069 }70}7172impl<T: ?Sized> AsMut<T> for TraceBox<T> {73 fn as_mut(&mut self) -> &mut T {74 &mut self.075 }76}7778#[derive(Clone)]79pub struct GcHashSet<V>(pub FxHashSet<V>);80impl<V> GcHashSet<V> {81 pub fn new() -> Self {10 fn with_capacity(capacity: usize) -> Self {82 Self(HashSet::default())11 Self::with_capacity_and_hasher(capacity, FxBuildHasher::default())83 }12 }1384 pub fn with_capacity(capacity: usize) -> Self {14 fn new() -> Self {85 Self(FxHashSet::with_capacity_and_hasher(15 Self::with_hasher(FxBuildHasher::default())86 capacity,87 BuildHasherDefault::default(),88 ))89 }16 }90}17}91impl<V> Trace for GcHashSet<V>92where93 V: Trace,94{95 fn trace(&self, tracer: &mut Tracer<'_>) {96 for v in &self.0 {97 v.trace(tracer);98 }99 }100}101impl<V> Deref for GcHashSet<V> {102 type Target = FxHashSet<V>;103104 fn deref(&self) -> &Self::Target {105 &self.0106 }107}108impl<V> DerefMut for GcHashSet<V> {109 fn deref_mut(&mut self) -> &mut Self::Target {110 &mut self.0111 }112}113impl<V> Default for GcHashSet<V> {114 fn default() -> Self {115 Self::new()116 }117}118119#[derive(Debug)]120pub struct GcHashMap<K, V>(pub HashMap<K, V, BuildHasherDefault<FxHasher>>);121impl<K, V> GcHashMap<K, V> {18impl<K, V> WithCapacityExt for FxHashMap<K, V> {122 pub fn new() -> Self {19 fn with_capacity(capacity: usize) -> Self {123 Self(HashMap::default())20 Self::with_capacity_and_hasher(capacity, FxBuildHasher::default())124 }21 }22125 pub fn with_capacity(capacity: usize) -> Self {23 fn new() -> Self {126 Self(HashMap::with_capacity_and_hasher(24 Self::with_hasher(FxBuildHasher::default())127 capacity,128 BuildHasherDefault::default(),129 ))130 }25 }131}26}132impl<K, V> Trace for GcHashMap<K, V>133where134 K: Trace,135 V: Trace,136{137 fn trace(&self, tracer: &mut Tracer<'_>) {138 for (k, v) in &self.0 {139 k.trace(tracer);140 v.trace(tracer);141 }142 }143}144impl<K, V> Deref for GcHashMap<K, V> {145 type Target = HashMap<K, V, BuildHasherDefault<FxHasher>>;146147 fn deref(&self) -> &Self::Target {148 &self.0149 }150}151impl<K, V> DerefMut for GcHashMap<K, V> {152 fn deref_mut(&mut self) -> &mut Self::Target {153 &mut self.0154 }155}156impl<K, V> Default for GcHashMap<K, V> {157 fn default() -> Self {158 Self::new()159 }160}16127162pub fn assert_trace<T: Trace>(_v: &T) {}28pub fn assert_trace<T: Trace>(_v: &T) {}16329crates/jrsonnet-evaluator/src/import.rsdiffbeforeafterboth7};7};889use fs::File;9use fs::File;10use jrsonnet_gcmodule::Trace;10use jrsonnet_gcmodule::Acyclic;11use jrsonnet_interner::IBytes;11use jrsonnet_interner::IBytes;12use jrsonnet_parser::{SourceDirectory, SourceFifo, SourceFile, SourcePath};12use jrsonnet_parser::{SourceDirectory, SourceFifo, SourceFile, SourcePath};131317};17};181819/// Implements file resolution logic for `import` and `importStr`19/// Implements file resolution logic for `import` and `importStr`20pub trait ImportResolver: Trace {20pub trait ImportResolver: Acyclic + Any {21 /// Resolves file path, e.g. `(/home/user/manifests, b.libjsonnet)` can correspond21 /// Resolves file path, e.g. `(/home/user/manifests, b.libjsonnet)` can correspond22 /// both to `/home/user/manifests/b.libjsonnet` and to `/home/user/${vendor}/b.libjsonnet`22 /// both to `/home/user/manifests/b.libjsonnet` and to `/home/user/${vendor}/b.libjsonnet`23 /// where `${vendor}` is a library path.23 /// where `${vendor}` is a library path.40 /// this cannot be resolved using associated type, as evaluator uses object instead of generic for [`ImportResolver`]40 /// this cannot be resolved using associated type, as evaluator uses object instead of generic for [`ImportResolver`]41 fn load_file_contents(&self, resolved: &SourcePath) -> Result<Vec<u8>>;41 fn load_file_contents(&self, resolved: &SourcePath) -> Result<Vec<u8>>;4243 // For downcasts, will be removed after trait_upcasting_coercion44 // stabilization.45 fn as_any(&self) -> &dyn Any;46 fn as_any_mut(&mut self) -> &mut dyn Any;47}42}484349/// Dummy resolver, can't resolve/load any file44/// Dummy resolver, can't resolve/load any file50#[derive(Trace)]45#[derive(Acyclic)]51pub struct DummyImportResolver;46pub struct DummyImportResolver;52impl ImportResolver for DummyImportResolver {47impl ImportResolver for DummyImportResolver {53 fn load_file_contents(&self, _resolved: &SourcePath) -> Result<Vec<u8>> {48 fn load_file_contents(&self, _resolved: &SourcePath) -> Result<Vec<u8>> {54 panic!("dummy resolver can't load any file")49 panic!("dummy resolver can't load any file")55 }50 }5657 fn as_any(&self) -> &dyn Any {58 self59 }60 fn as_any_mut(&mut self) -> &mut dyn Any {61 self62 }63}51}64#[allow(clippy::use_self)]52#[allow(clippy::use_self)]65impl Default for Box<dyn ImportResolver> {53impl Default for Box<dyn ImportResolver> {69}57}705871/// File resolver, can load file from both FS and library paths59/// File resolver, can load file from both FS and library paths72#[derive(Default, Trace)]60#[derive(Default, Acyclic)]73pub struct FileImportResolver {61pub struct FileImportResolver {74 /// Library directories to search for file.62 /// Library directories to search for file.75 /// Referred to as `jpath` in original jsonnet implementation.63 /// Referred to as `jpath` in original jsonnet implementation.171 self.resolve_from(&SourcePath::default(), path)159 self.resolve_from(&SourcePath::default(), path)172 }160 }173174 fn as_any(&self) -> &dyn Any {175 self176 }177178 fn as_any_mut(&mut self) -> &mut dyn Any {179 self180 }181}161}182162crates/jrsonnet-evaluator/src/lib.rsdiffbeforeafterboth1//! jsonnet interpreter implementation1//! jsonnet interpreter implementation2#![cfg_attr(feature = "nightly", feature(thread_local, type_alias_impl_trait))]2#![cfg_attr(nightly, feature(thread_local, type_alias_impl_trait))]334// For jrsonnet-macros4// For jrsonnet-macros5extern crate self as jrsonnet_evaluator;5extern crate self as jrsonnet_evaluator;667mod arr;7mod arr;8#[cfg(feature = "async-import")]9pub mod async_import;8pub mod async_import;10mod ctx;9mod ctx;11mod dynamic;10mod dynamic;28use std::{27use std::{29 any::Any,28 any::Any,30 cell::{RefCell, RefMut},29 cell::{RefCell, RefMut},30 collections::hash_map::Entry,31 fmt::{self, Debug},31 fmt::{self, Debug},32 path::Path,32 path::Path,33 rc::Rc,33};34};343535pub use ctx::*;36pub use ctx::*;36pub use dynamic::*;37pub use dynamic::*;37pub use error::{Error, ErrorKind::*, Result, ResultExt};38pub use error::{Error, ErrorKind::*, Result, ResultExt};38pub use evaluate::*;39pub use evaluate::*;39use function::CallLocation;40use function::CallLocation;40use gc::{GcHashMap, TraceBox};41use hashbrown::hash_map::RawEntryMut;42pub use import::*;41pub use import::*;43use jrsonnet_gcmodule::{Cc, Trace};42use jrsonnet_gcmodule::{cc_dyn, Cc, Trace};44pub use jrsonnet_interner::{IBytes, IStr};43pub use jrsonnet_interner::{IBytes, IStr};45#[doc(hidden)]44#[doc(hidden)]46pub use jrsonnet_macros;45pub use jrsonnet_macros;47pub use jrsonnet_parser as parser;46pub use jrsonnet_parser as parser;48use jrsonnet_parser::{LocExpr, ParserSettings, Source, SourcePath};47use jrsonnet_parser::{LocExpr, ParserSettings, Source, SourcePath};49pub use obj::*;48pub use obj::*;49pub use rustc_hash;50use rustc_hash::FxHashMap;50use stack::check_depth;51use stack::check_depth;51pub use tla::apply_tla;52pub use tla::apply_tla;52pub use val::{Thunk, Val};53pub use val::{Thunk, Val};5455use crate::gc::WithCapacityExt as _;5657cc_dyn!(58 #[derive(Clone)]59 CcUnbound<V>,60 Unbound<Bound = V>61);536254/// Thunk without bound `super`/`this`63/// Thunk without bound `super`/`this`55/// object inheritance may be overriden multiple times, and will be fixed only on field read64/// object inheritance may be overriden multiple times, and will be fixed only on field read65#[derive(Clone, Trace)]74#[derive(Clone, Trace)]66pub enum MaybeUnbound {75pub enum MaybeUnbound {67 /// Value needs to be bound to `this`/`super`76 /// Value needs to be bound to `this`/`super`68 Unbound(Cc<TraceBox<dyn Unbound<Bound = Val>>>),77 Unbound(CcUnbound<Val>),69 /// Value is object-independent78 /// Value is object-independent70 Bound(Thunk<Val>),79 Bound(Thunk<Val>),71}80}79 /// Attach object context to value, if required88 /// Attach object context to value, if required80 pub fn evaluate(&self, sup: Option<ObjValue>, this: Option<ObjValue>) -> Result<Val> {89 pub fn evaluate(&self, sup: Option<ObjValue>, this: Option<ObjValue>) -> Result<Val> {81 match self {90 match self {82 Self::Unbound(v) => v.bind(sup, this),91 Self::Unbound(v) => v.0.bind(sup, this),83 Self::Bound(v) => Ok(v.evaluate()?),92 Self::Bound(v) => Ok(v.evaluate()?),84 }93 }85 }94 }86}95}9697cc_dyn!(CcContextInitializer, ContextInitializer);879888/// During import, this trait will be called to create initial context for file.99/// During import, this trait will be called to create initial context for file.89/// It may initialize global variables, stdlib for example.100/// It may initialize global variables, stdlib for example.215#[derive(Trace)]226#[derive(Trace)]216pub struct EvaluationStateInternals {227pub struct EvaluationStateInternals {217 /// Internal state228 /// Internal state218 file_cache: RefCell<GcHashMap<SourcePath, FileData>>,229 file_cache: RefCell<FxHashMap<SourcePath, FileData>>,219 /// Context initializer, which will be used for imports and everything230 /// Context initializer, which will be used for imports and everything220 /// [`NoopContextInitializer`] is used by default, most likely you want to have `jrsonnet-stdlib`231 /// [`NoopContextInitializer`] is used by default, most likely you want to have `jrsonnet-stdlib`221 context_initializer: TraceBox<dyn ContextInitializer>,232 context_initializer: CcContextInitializer,222 /// Used to resolve file locations/contents233 /// Used to resolve file locations/contents223 import_resolver: TraceBox<dyn ImportResolver>,234 import_resolver: Rc<dyn ImportResolver>,224}235}225236226/// Maintains stack trace and import resolution237/// Maintains stack trace and import resolution231 /// Should only be called with path retrieved from [`resolve_path`], may panic otherwise242 /// Should only be called with path retrieved from [`resolve_path`], may panic otherwise232 pub fn import_resolved_str(&self, path: SourcePath) -> Result<IStr> {243 pub fn import_resolved_str(&self, path: SourcePath) -> Result<IStr> {233 let mut file_cache = self.file_cache();244 let mut file_cache = self.file_cache();234 let mut file = file_cache.raw_entry_mut().from_key(&path);245 let mut file = file_cache.entry(path.clone());235246236 let file = match file {247 let file = match file {237 RawEntryMut::Occupied(ref mut d) => d.get_mut(),248 Entry::Occupied(ref mut d) => d.get_mut(),238 RawEntryMut::Vacant(v) => {249 Entry::Vacant(v) => {239 let data = self.import_resolver().load_file_contents(&path)?;250 let data = self.import_resolver().load_file_contents(&path)?;240 v.insert(251 v.insert(FileData::new_string(241 path.clone(),242 FileData::new_string(243 std::str::from_utf8(&data)252 std::str::from_utf8(&data)244 .map_err(|_| ImportBadFileUtf8(path.clone()))?253 .map_err(|_| ImportBadFileUtf8(path.clone()))?245 .into(),254 .into(),246 ),255 ))247 )248 .1249 }256 }250 };257 };251 Ok(file258 Ok(file255 /// Should only be called with path retrieved from [`resolve_path`], may panic otherwise262 /// Should only be called with path retrieved from [`resolve_path`], may panic otherwise256 pub fn import_resolved_bin(&self, path: SourcePath) -> Result<IBytes> {263 pub fn import_resolved_bin(&self, path: SourcePath) -> Result<IBytes> {257 let mut file_cache = self.file_cache();264 let mut file_cache = self.file_cache();258 let mut file = file_cache.raw_entry_mut().from_key(&path);265 let mut file = file_cache.entry(path.clone());259266260 let file = match file {267 let file = match file {261 RawEntryMut::Occupied(ref mut d) => d.get_mut(),268 Entry::Occupied(ref mut d) => d.get_mut(),262 RawEntryMut::Vacant(v) => {269 Entry::Vacant(v) => {263 let data = self.import_resolver().load_file_contents(&path)?;270 let data = self.import_resolver().load_file_contents(&path)?;264 v.insert(path.clone(), FileData::new_bytes(data.as_slice().into()))271 v.insert(FileData::new_bytes(data.as_slice().into()))265 .1266 }272 }267 };273 };268 if let Some(str) = &file.bytes {274 if let Some(str) = &file.bytes {282 /// Should only be called with path retrieved from [`resolve_path`], may panic otherwise288 /// Should only be called with path retrieved from [`resolve_path`], may panic otherwise283 pub fn import_resolved(&self, path: SourcePath) -> Result<Val> {289 pub fn import_resolved(&self, path: SourcePath) -> Result<Val> {284 let mut file_cache = self.file_cache();290 let mut file_cache = self.file_cache();285 let mut file = file_cache.raw_entry_mut().from_key(&path);291 let mut file = file_cache.entry(path.clone());286292287 let file = match file {293 let file = match file {288 RawEntryMut::Occupied(ref mut d) => d.get_mut(),294 Entry::Occupied(ref mut d) => d.get_mut(),289 RawEntryMut::Vacant(v) => {295 Entry::Vacant(v) => {290 let data = self.import_resolver().load_file_contents(&path)?;296 let data = self.import_resolver().load_file_contents(&path)?;291 v.insert(297 v.insert(FileData::new_string(292 path.clone(),293 FileData::new_string(294 std::str::from_utf8(&data)298 std::str::from_utf8(&data)295 .map_err(|_| ImportBadFileUtf8(path.clone()))?299 .map_err(|_| ImportBadFileUtf8(path.clone()))?296 .into(),300 .into(),297 ),301 ))298 )299 .1300 }302 }301 };303 };302 if let Some(val) = &file.evaluated {304 if let Some(val) = &file.evaluated {330 let res = evaluate(self.create_default_context(file_name), &parsed);332 let res = evaluate(self.create_default_context(file_name), &parsed);331333332 let mut file_cache = self.file_cache();334 let mut file_cache = self.file_cache();333 let mut file = file_cache.raw_entry_mut().from_key(&path);335 let mut file = file_cache.entry(path.clone());334336335 let RawEntryMut::Occupied(file) = &mut file else {337 let Entry::Occupied(file) = &mut file else {336 unreachable!("this file was just here!")338 unreachable!("this file was just here")337 };339 };338 let file = file.get_mut();340 let file = file.get_mut();339 file.evaluating = false;341 file.evaluating = false;381383382/// Internals384/// Internals383impl State {385impl State {384 fn file_cache(&self) -> RefMut<'_, GcHashMap<SourcePath, FileData>> {386 fn file_cache(&self) -> RefMut<'_, FxHashMap<SourcePath, FileData>> {385 self.0.file_cache.borrow_mut()387 self.0.file_cache.borrow_mut()386 }388 }387}389}479 &*self.0.import_resolver481 &*self.0.import_resolver480 }482 }481 pub fn context_initializer(&self) -> &dyn ContextInitializer {483 pub fn context_initializer(&self) -> &dyn ContextInitializer {482 &*self.0.context_initializer484 &*self.0.context_initializer.0483 }485 }484}486}485487497499498#[derive(Default)]500#[derive(Default)]499pub struct StateBuilder {501pub struct StateBuilder {500 import_resolver: Option<TraceBox<dyn ImportResolver>>,502 import_resolver: Option<Rc<dyn ImportResolver>>,501 context_initializer: Option<TraceBox<dyn ContextInitializer>>,503 context_initializer: Option<CcContextInitializer>,502}504}503impl StateBuilder {505impl StateBuilder {504 pub fn import_resolver(&mut self, import_resolver: impl ImportResolver) -> &mut Self {506 pub fn import_resolver(&mut self, import_resolver: impl ImportResolver) -> &mut Self {505 let _ = self.import_resolver.insert(tb!(import_resolver));507 let _ = self.import_resolver.insert(Rc::new(import_resolver));506 self508 self507 }509 }508 pub fn context_initializer(510 pub fn context_initializer(509 &mut self,511 &mut self,510 context_initializer: impl ContextInitializer,512 context_initializer: impl ContextInitializer,511 ) -> &mut Self {513 ) -> &mut Self {512 let _ = self.context_initializer.insert(tb!(context_initializer));514 let _ = self515 .context_initializer516 .insert(CcContextInitializer::new(context_initializer));513 self517 self514 }518 }515 pub fn build(mut self) -> State {519 pub fn build(mut self) -> State {516 State(Cc::new(EvaluationStateInternals {520 State(Cc::new(EvaluationStateInternals {517 file_cache: RefCell::new(GcHashMap::new()),521 file_cache: RefCell::new(FxHashMap::new()),518 context_initializer: self.context_initializer.take().unwrap_or_else(|| tb!(())),522 context_initializer: self523 .context_initializer524 .take()525 .unwrap_or_else(|| CcContextInitializer::new(())),519 import_resolver: self526 import_resolver: self520 .import_resolver527 .import_resolver521 .take()528 .take()522 .unwrap_or_else(|| tb!(DummyImportResolver)),529 .unwrap_or_else(|| Rc::new(DummyImportResolver)),523 }))530 }))524 }531 }525}532}crates/jrsonnet-evaluator/src/map.rsdiffbeforeafterboth1use jrsonnet_gcmodule::{Cc, Trace};1use jrsonnet_gcmodule::{Cc, Trace};2use jrsonnet_interner::IStr;2use jrsonnet_interner::IStr;3use rustc_hash::FxHashMap;344use crate::{GcHashMap, Thunk, Val};5use crate::{gc::WithCapacityExt as _, Thunk, Val};566#[derive(Trace)]7#[derive(Trace)]7#[trace(tracking(force))]8#[trace(tracking(force))]8pub struct LayeredHashMapInternals {9pub struct LayeredHashMapInternals {9 parent: Option<LayeredHashMap>,10 parent: Option<LayeredHashMap>,10 current: GcHashMap<IStr, Thunk<Val>>,11 current: FxHashMap<IStr, Thunk<Val>>,11}12}121313#[derive(Trace)]14#[derive(Trace)]14pub struct LayeredHashMap(Cc<LayeredHashMapInternals>);15pub struct LayeredHashMap(Cc<LayeredHashMapInternals>);151616impl LayeredHashMap {17impl LayeredHashMap {17 pub fn iter_keys(self, mut handler: impl FnMut(IStr)) {18 pub fn iter_keys(self, mut handler: impl FnMut(IStr)) {18 for (k, _) in &*self.0.current {19 for (k, _) in &self.0.current {19 handler(k.clone());20 handler(k.clone());20 }21 }21 if let Some(parent) = self.0.parent.clone() {22 if let Some(parent) = self.0.parent.clone() {22 parent.iter_keys(handler);23 parent.iter_keys(handler);23 }24 }24 }25 }252626 pub(crate) fn new(layer: GcHashMap<IStr, Thunk<Val>>) -> Self {27 pub(crate) fn new(layer: FxHashMap<IStr, Thunk<Val>>) -> Self {27 Self(Cc::new(LayeredHashMapInternals {28 Self(Cc::new(LayeredHashMapInternals {28 parent: None,29 parent: None,29 current: layer,30 current: layer,30 }))31 }))31 }32 }323333 pub fn extend(self, new_layer: GcHashMap<IStr, Thunk<Val>>) -> Self {34 pub fn extend(self, new_layer: FxHashMap<IStr, Thunk<Val>>) -> Self {34 Self(Cc::new(LayeredHashMapInternals {35 Self(Cc::new(LayeredHashMapInternals {35 parent: Some(self),36 parent: Some(self),36 current: new_layer,37 current: new_layer,64 fn default() -> Self {65 fn default() -> Self {65 Self(Cc::new(LayeredHashMapInternals {66 Self(Cc::new(LayeredHashMapInternals {66 parent: None,67 parent: None,67 current: GcHashMap::new(),68 current: FxHashMap::new(),68 }))69 }))69 }70 }70}71}crates/jrsonnet-evaluator/src/obj.rsdiffbeforeafterboth6 ptr::addr_of,6 ptr::addr_of,7};7};889use jrsonnet_gcmodule::{Cc, Trace, Weak};9use jrsonnet_gcmodule::{cc_dyn, Cc, Trace, Weak};10use jrsonnet_interner::IStr;10use jrsonnet_interner::IStr;11use jrsonnet_parser::{Span, Visibility};11use jrsonnet_parser::{Span, Visibility};12use rustc_hash::FxHashMap;12use rustc_hash::{FxHashMap, FxHashSet};131314use crate::{14use crate::{15 arr::{PickObjectKeyValues, PickObjectValues},15 arr::{PickObjectKeyValues, PickObjectValues},16 bail,16 bail,17 error::{suggest_object_fields, Error, ErrorKind::*},17 error::{suggest_object_fields, Error, ErrorKind::*},18 function::{CallLocation, FuncVal},18 function::{CallLocation, FuncVal},19 gc::{GcHashMap, GcHashSet, TraceBox},19 gc::WithCapacityExt as _,20 in_frame,20 in_frame,21 operator::evaluate_add_op,21 operator::evaluate_add_op,22 tb,23 val::ArrValue,22 val::ArrValue,24 MaybeUnbound, Result, Thunk, Unbound, Val,23 CcUnbound, MaybeUnbound, Result, Thunk, Unbound, Val,25};24};262527#[cfg(not(feature = "exp-preserve-order"))]26#[cfg(not(feature = "exp-preserve-order"))]139 pub location: Option<Span>,138 pub location: Option<Span>,140}139}141140141cc_dyn!(CcObjectAssertion, ObjectAssertion);142pub trait ObjectAssertion: Trace {142pub trait ObjectAssertion: Trace {143 fn run(&self, super_obj: Option<ObjValue>, this: Option<ObjValue>) -> Result<()>;143 fn run(&self, super_obj: Option<ObjValue>, this: Option<ObjValue>) -> Result<()>;144}144}159pub struct OopObject {159pub struct OopObject {160 sup: Option<ObjValue>,160 sup: Option<ObjValue>,161 // this: Option<ObjValue>,161 // this: Option<ObjValue>,162 assertions: Cc<Vec<TraceBox<dyn ObjectAssertion>>>,162 assertions: Cc<Vec<CcObjectAssertion>>,163 assertions_ran: RefCell<GcHashSet<ObjValue>>,163 assertions_ran: RefCell<FxHashSet<ObjValue>>,164 this_entries: Cc<GcHashMap<IStr, ObjMember>>,164 this_entries: Cc<FxHashMap<IStr, ObjMember>>,165 value_cache: RefCell<GcHashMap<(IStr, Option<WeakObjValue>), CacheValue>>,165 value_cache: RefCell<FxHashMap<(IStr, Option<WeakObjValue>), CacheValue>>,166}166}167impl Debug for OopObject {167impl Debug for OopObject {168 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {168 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {203}203}204204205#[derive(Clone, Trace)]205#[derive(Clone, Trace)]206pub struct WeakObjValue(#[trace(skip)] pub(crate) Weak<TraceBox<dyn ObjectLike>>);206pub struct WeakObjValue(#[trace(skip)] pub(crate) Weak<dyn ObjectLike>);207207208impl PartialEq for WeakObjValue {208impl PartialEq for WeakObjValue {209 fn eq(&self, other: &Self) -> bool {209 fn eq(&self, other: &Self) -> bool {220 }220 }221}221}222222223cc_dyn!(223#[allow(clippy::module_name_repetitions)]224 #[derive(Clone, Debug)]224#[derive(Clone, Trace, Debug)]225 ObjValue, ObjectLike,226 pub fn new() {...}225pub struct ObjValue(pub(crate) Cc<TraceBox<dyn ObjectLike>>);227);226228227#[derive(Debug, Trace)]229#[derive(Debug, Trace)]228struct EmptyObject;230struct EmptyObject;331}333}332334333impl ObjValue {335impl ObjValue {334 pub fn new(v: impl ObjectLike) -> Self {335 Self(Cc::new(tb!(v)))336 }337 pub fn new_empty() -> Self {336 pub fn new_empty() -> Self {338 Self::new(EmptyObject)337 Self::new(EmptyObject)339 }338 }582impl OopObject {581impl OopObject {583 pub fn new(582 pub fn new(584 sup: Option<ObjValue>,583 sup: Option<ObjValue>,585 this_entries: Cc<GcHashMap<IStr, ObjMember>>,584 this_entries: Cc<FxHashMap<IStr, ObjMember>>,586 assertions: Cc<Vec<TraceBox<dyn ObjectAssertion>>>,585 assertions: Cc<Vec<CcObjectAssertion>>,587 ) -> Self {586 ) -> Self {588 Self {587 Self {589 sup,588 sup,590 // this: None,589 // this: None,591 assertions,590 assertions,592 assertions_ran: RefCell::new(GcHashSet::new()),591 assertions_ran: RefCell::new(FxHashSet::new()),593 this_entries,592 this_entries,594 value_cache: RefCell::new(GcHashMap::new()),593 value_cache: RefCell::new(FxHashMap::new()),595 }594 }596 }595 }597596762 }761 }763 if self.assertions_ran.borrow_mut().insert(real_this.clone()) {762 if self.assertions_ran.borrow_mut().insert(real_this.clone()) {764 for assertion in self.assertions.iter() {763 for assertion in self.assertions.iter() {765 if let Err(e) = assertion.run(self.sup.clone(), Some(real_this.clone())) {764 if let Err(e) = assertion.0.run(self.sup.clone(), Some(real_this.clone())) {766 self.assertions_ran.borrow_mut().remove(&real_this);765 self.assertions_ran.borrow_mut().remove(&real_this);767 return Err(e);766 return Err(e);768 }767 }784impl Eq for ObjValue {}783impl Eq for ObjValue {}785impl Hash for ObjValue {784impl Hash for ObjValue {786 fn hash<H: Hasher>(&self, hasher: &mut H) {785 fn hash<H: Hasher>(&self, hasher: &mut H) {787 hasher.write_usize(addr_of!(*self.0) as usize);786 hasher.write_usize(addr_of!(*self.0).expose_provenance() as usize);788 }787 }789}788}790789791#[allow(clippy::module_name_repetitions)]790#[allow(clippy::module_name_repetitions)]792pub struct ObjValueBuilder {791pub struct ObjValueBuilder {793 sup: Option<ObjValue>,792 sup: Option<ObjValue>,794 map: GcHashMap<IStr, ObjMember>,793 map: FxHashMap<IStr, ObjMember>,795 assertions: Vec<TraceBox<dyn ObjectAssertion>>,794 assertions: Vec<CcObjectAssertion>,796 next_field_index: FieldIndex,795 next_field_index: FieldIndex,797}796}798impl ObjValueBuilder {797impl ObjValueBuilder {802 pub fn with_capacity(capacity: usize) -> Self {801 pub fn with_capacity(capacity: usize) -> Self {803 Self {802 Self {804 sup: None,803 sup: None,805 map: GcHashMap::with_capacity(capacity),804 map: FxHashMap::with_capacity(capacity),806 assertions: Vec::new(),805 assertions: Vec::new(),807 next_field_index: FieldIndex::default(),806 next_field_index: FieldIndex::default(),808 }807 }817 }816 }818817819 pub fn assert(&mut self, assertion: impl ObjectAssertion + 'static) -> &mut Self {818 pub fn assert(&mut self, assertion: impl ObjectAssertion + 'static) -> &mut Self {820 self.assertions.push(tb!(assertion));819 self.assertions.push(CcObjectAssertion::new(assertion));821 self820 self822 }821 }823 pub fn field(&mut self, name: impl Into<IStr>) -> ObjMemberBuilder<ValueBuilder<'_>> {822 pub fn field(&mut self, name: impl Into<IStr>) -> ObjMemberBuilder<ValueBuilder<'_>> {922 let (receiver, name, member) =921 let (receiver, name, member) =923 self.build_member(MaybeUnbound::Bound(Thunk::evaluated(value.into())));922 self.build_member(MaybeUnbound::Bound(Thunk::evaluated(value.into())));924 let entry = receiver.0.map.entry(name);923 let entry = receiver.0.map.entry(name);925 entry.insert(member);924 entry.insert_entry(member);926 }925 }927926928 /// Tries to insert value, returns an error if it was already defined927 /// Tries to insert value, returns an error if it was already defined933 self.binding(MaybeUnbound::Bound(value.into()))932 self.binding(MaybeUnbound::Bound(value.into()))934 }933 }935 pub fn bindable(self, bindable: impl Unbound<Bound = Val>) -> Result<()> {934 pub fn bindable(self, bindable: impl Unbound<Bound = Val>) -> Result<()> {936 self.binding(MaybeUnbound::Unbound(Cc::new(tb!(bindable))))935 self.binding(MaybeUnbound::Unbound(CcUnbound::new(bindable)))937 }936 }938 pub fn binding(self, binding: MaybeUnbound) -> Result<()> {937 pub fn binding(self, binding: MaybeUnbound) -> Result<()> {939 let (receiver, name, member) = self.build_member(binding);938 let (receiver, name, member) = self.build_member(binding);955 pub fn value(self, value: impl Into<Val>) {954 pub fn value(self, value: impl Into<Val>) {956 self.binding(MaybeUnbound::Bound(Thunk::evaluated(value.into())));955 self.binding(MaybeUnbound::Bound(Thunk::evaluated(value.into())));957 }956 }958 pub fn bindable(self, bindable: TraceBox<dyn Unbound<Bound = Val>>) {957 pub fn bindable(self, bindable: impl Unbound<Bound = Val>) {959 self.binding(MaybeUnbound::Unbound(Cc::new(bindable)));958 self.binding(MaybeUnbound::Unbound(CcUnbound::new(bindable)));960 }959 }961 pub fn binding(self, binding: MaybeUnbound) {960 pub fn binding(self, binding: MaybeUnbound) {962 let (receiver, name, member) = self.build_member(binding);961 let (receiver, name, member) = self.build_member(binding);crates/jrsonnet-evaluator/src/stack.rsdiffbeforeafterboth7 current_depth: Cell<usize>,7 current_depth: Cell<usize>,8}8}9910#[cfg(nightly)]11struct NightlyLocalKey<T>(pub T);10#[cfg(feature = "nightly")]12#[cfg(nightly)]13impl<T> NightlyLocalKey<T> {11#[allow(clippy::thread_local_initializer_can_be_made_const)]14 #[inline(always)]12#[thread_local]13static STACK_LIMIT: StackLimit = StackLimit {14 max_stack_size: Cell::new(200),15 fn with<U>(&self, v: impl FnOnce(&T) -> U) -> U {15 current_depth: Cell::new(0),16 v(&self.0)16};17 }18}19#[cfg(not(nightly))]17#[cfg(not(feature = "nightly"))]20type NightlyLocalKey<T> = std::thread::LocalKey<T>;2122#[cfg(nightly)]23macro_rules! const_tls {24 (const $name:ident: $t:ty = $expr:expr;) => {25 #[thread_local]26 static $name: NightlyLocalKey<$t> = NightlyLocalKey($expr);27 };28}29#[cfg(not(nightly))]30macro_rules! const_tls {31 (const $name:ident: $t:ty = $expr:expr;) => {32 thread_local! {33 static $name: $t = const { $expr };34 }35 };36}3718thread_local! {38const_tls! {19 static STACK_LIMIT: StackLimit = const {39 const STACK_LIMIT: StackLimit = StackLimit {20 StackLimit {21 max_stack_size: Cell::new(200),40 max_stack_size: Cell::new(200),22 current_depth: Cell::new(0),41 current_depth: Cell::new(0),23 }42 };24 };25}43}264427pub struct StackOverflowError;45pub struct StackOverflowError;39/// Used to implement stack depth limitation57/// Used to implement stack depth limitation40pub struct StackDepthGuard(PhantomData<()>);58pub struct StackDepthGuard(PhantomData<()>);41impl Drop for StackDepthGuard {59impl Drop for StackDepthGuard {42 #[cfg(feature = "nightly")]43 fn drop(&mut self) {44 STACK_LIMIT45 .current_depth46 .set(STACK_LIMIT.current_depth.get() - 1);47 }48 #[cfg(not(feature = "nightly"))]49 fn drop(&mut self) {60 fn drop(&mut self) {50 STACK_LIMIT.with(|limit| limit.current_depth.set(limit.current_depth.get() - 1));61 STACK_LIMIT.with(|limit| limit.current_depth.set(limit.current_depth.get() - 1))51 }62 }52}63}536454// #[cfg(feature = "nightly")]65// #[cfg(feature = "nightly")]55pub fn check_depth() -> Result<StackDepthGuard, StackOverflowError> {66pub fn check_depth() -> Result<StackDepthGuard, StackOverflowError> {56 fn internal(limit: &StackLimit) -> Result<StackDepthGuard, StackOverflowError> {67 STACK_LIMIT.with(|limit| {57 let current = limit.current_depth.get();68 let current = limit.current_depth.get();58 if current < limit.max_stack_size.get() {69 if current < limit.max_stack_size.get() {59 limit.current_depth.set(current + 1);70 limit.current_depth.set(current + 1);60 Ok(StackDepthGuard(PhantomData))71 Ok(StackDepthGuard(PhantomData))61 } else {72 } else {62 Err(StackOverflowError)73 Err(StackOverflowError)63 }74 }64 }75 })65 #[cfg(feature = "nightly")]66 {67 internal(&STACK_LIMIT)68 }69 #[cfg(not(feature = "nightly"))]70 {71 STACK_LIMIT.with(internal)72 }73}76}747775pub struct StackDepthLimitOverrideGuard {78pub struct StackDepthLimitOverrideGuard {76 old_limit: usize,79 old_limit: usize,77}80}78impl Drop for StackDepthLimitOverrideGuard {81impl Drop for StackDepthLimitOverrideGuard {79 #[cfg(feature = "nightly")]80 fn drop(&mut self) {81 STACK_LIMIT.max_stack_size.set(self.old_limit);82 }83 #[cfg(not(feature = "nightly"))]84 fn drop(&mut self) {82 fn drop(&mut self) {85 STACK_LIMIT.with(|limit| limit.max_stack_size.set(self.old_limit));83 STACK_LIMIT.with(|limit| limit.max_stack_size.set(self.old_limit));86 }84 }87}85}888689pub fn limit_stack_depth(depth_limit: usize) -> StackDepthLimitOverrideGuard {87pub fn limit_stack_depth(depth_limit: usize) -> StackDepthLimitOverrideGuard {90 fn internal(limit: &StackLimit, depth_limit: usize) -> StackDepthLimitOverrideGuard {88 STACK_LIMIT.with(|limit| {91 let old_limit = limit.max_stack_size.get();89 let old_limit = limit.max_stack_size.get();92 let current_depth = limit.current_depth.get();90 let current_depth = limit.current_depth.get();939194 limit.max_stack_size.set(current_depth + depth_limit);92 limit.max_stack_size.set(current_depth + depth_limit);95 StackDepthLimitOverrideGuard { old_limit }93 StackDepthLimitOverrideGuard { old_limit }96 }94 })97 #[cfg(feature = "nightly")]98 {99 internal(&STACK_LIMIT, depth_limit)100 }101 #[cfg(not(feature = "nightly"))]102 {103 STACK_LIMIT.with(|limit| internal(limit, depth_limit))104 }105}95}10696107/// Like [`limit_stack_depth`], but set depth is not guarded, and will be kept97/// Like [`limit_stack_depth`], but set depth is not guarded, and will be keptcrates/jrsonnet-evaluator/src/trace/mod.rsdiffbeforeafterboth1#[cfg(feature = "explaining-traces")]2use std::cell::RefCell;1use std::{3use std::{2 any::Any,4 any::Any,3 cell::RefCell,4 path::{Path, PathBuf},5 path::{Path, PathBuf},5};6};677use jrsonnet_gcmodule::Trace;8use jrsonnet_gcmodule::Trace;8use jrsonnet_parser::{CodeLocation, Source, Span};9use jrsonnet_parser::CodeLocation;10#[cfg(feature = "explaining-traces")]11use jrsonnet_parser::Span;91210use crate::{error::ErrorKind, Error};13use crate::{error::ErrorKind, Error};1114239 }242 }240}243}241242/// rustc-like trace displaying243#[cfg(feature = "explaining-traces")]244#[derive(Trace)]245pub struct ExplainingFormat {246 pub resolver: PathResolver,247 pub max_trace: usize,248}249#[cfg(feature = "explaining-traces")]250impl TraceFormat for ExplainingFormat {251 fn write_trace(252 &self,253 out: &mut dyn std::fmt::Write,254 error: &Error,255 ) -> Result<(), std::fmt::Error> {256 write!(out, "{}", error.error())?;257 if let ErrorKind::ImportSyntaxError { path, error } = error.error() {258 writeln!(out)?;259 let offset = error.location.offset;260 let location = path261 .map_source_locations(&[offset as u32])262 .into_iter()263 .next()264 .unwrap();265 let mut end_location = location;266 end_location.offset += 1;267268 self.print_snippet(269 out,270 path.code(),271 path,272 &location,273 &end_location,274 "syntax error",275 )?;276 }277 let trace = &error.trace();278 for item in &trace.0 {279 writeln!(out)?;280 let desc = &item.desc;281 if let Some(source) = &item.location {282 let start_end = source.0.map_source_locations(&[source.1, source.2]);283 self.print_snippet(284 out,285 source.0.code(),286 &source.0,287 &start_end[0],288 &start_end[1],289 desc,290 )?;291 } else {292 write!(out, "{desc}")?;293 }294 }295 Ok(())296 }297298 fn as_any(&self) -> &dyn Any {299 self300 }301302 fn as_any_mut(&mut self) -> &mut dyn Any {303 self304 }305}306307#[cfg(feature = "explaining-traces")]308impl ExplainingFormat {309 fn print_snippet(310 &self,311 out: &mut dyn std::fmt::Write,312 source: &str,313 origin: &Source,314 start: &CodeLocation,315 end: &CodeLocation,316 desc: &str,317 ) -> Result<(), std::fmt::Error> {318 use annotate_snippets::{319 // DisplayList, FormatOptions,320 AnnotationType,321 Renderer,322 Slice,323 Snippet,324 SourceAnnotation,325 };326327 let source_fragment: String = source328 .chars()329 .skip(start.line_start_offset)330 .take(end.line_end_offset - end.line_start_offset)331 .collect();332333 let origin = origin.source_path().path().map_or_else(334 || origin.source_path().to_string(),335 |r| self.resolver.resolve(r),336 );337 let snippet = Snippet {338 // opt: FormatOptions {339 // color: true,340 // ..FormatOptions::default()341 // },342 title: None,343 footer: vec![],344 slices: vec![Slice {345 source: &source_fragment,346 line_start: start.line,347 origin: Some(&origin),348 fold: false,349 annotations: vec![SourceAnnotation {350 label: desc,351 annotation_type: AnnotationType::Error,352 range: (353 start.offset - start.line_start_offset,354 (end.offset.saturating_sub(start.line_start_offset))355 .min(source_fragment.len()),356 ),357 }],358 }],359 };360361 let renderer = Renderer::styled();362 let dl = renderer.render(snippet);363 write!(out, "{dl}")?;364365 Ok(())366 }367}368244369#[cfg(feature = "explaining-traces")]245#[cfg(feature = "explaining-traces")]370#[derive(Trace)]246#[derive(Trace)]390 let offset = error.location.offset;266 let offset = error.location.offset;391 let mut builder = SnippetBuilder::new(path.code());267 let mut builder = SnippetBuilder::new(path.code());392 builder268 builder393 .error(Text::single("syntax error".chars(), Formatting::default()))269 .error(Text::fragment("syntax error", Formatting::default()))394 .range(offset..=offset)270 .range(offset..=offset)395 .build();271 .build();396 let source = builder.build();272 let source = builder.build();448 let mut builder = snippet_builder.borrow_mut();324 let mut builder = snippet_builder.borrow_mut();449 let builder = builder.as_mut().unwrap();325 let builder = builder.as_mut().unwrap();450 builder326 builder451 .note(Text::single(desc.chars(), Formatting::default()))327 .note(Text::fragment(desc, Formatting::default()))452 .range(source.1 as usize..=(source.2 as usize - 1).max(source.1 as usize))328 .range(source.1 as usize..=(source.2 as usize - 1).max(source.1 as usize))453 .build();329 .build();454 } else {330 } else {crates/jrsonnet-evaluator/src/typed/mod.rsdiffbeforeafterboth20 #[error("every failed from {0}:\n{1}")]20 #[error("every failed from {0}:\n{1}")]21 UnionFailed(ComplexValType, TypeLocErrorList),21 UnionFailed(ComplexValType, TypeLocErrorList),22 #[error(22 #[error(23 "number out of bounds: {0} not in {}..{}",23 "number out of bounds: {0} not in {start}..{end}",24 .1.map(|v|v.to_string()).unwrap_or_default(),24 start = .1.map(|v|v.to_string()).unwrap_or_default(),25 .2.map(|v|v.to_string()).unwrap_or_default(),25 end = .2.map(|v|v.to_string()).unwrap_or_default(),26 )]26 )]27 BoundsFailed(f64, Option<f64>, Option<f64>),27 BoundsFailed(f64, Option<f64>, Option<f64>),28}28}crates/jrsonnet-evaluator/src/val.rsdiffbeforeafterboth8 rc::Rc,8 rc::Rc,9};9};101011use jrsonnet_gcmodule::{Cc, Trace};11use jrsonnet_gcmodule::{Acyclic, Cc, Trace, TraceBox};12use jrsonnet_interner::IStr;12use jrsonnet_interner::IStr;13pub use jrsonnet_macros::Thunk;13pub use jrsonnet_macros::Thunk;14use jrsonnet_types::ValType;14use jrsonnet_types::ValType;15use rustc_hash::FxHashMap;15use thiserror::Error;16use thiserror::Error;161717pub use crate::arr::{ArrValue, ArrayLike};18pub use crate::arr::{ArrValue, ArrayLike};18use crate::{19use crate::{19 bail,20 bail,20 error::{Error, ErrorKind::*},21 error::{Error, ErrorKind::*},21 function::FuncVal,22 function::FuncVal,22 gc::{GcHashMap, TraceBox},23 gc::WithCapacityExt as _,23 manifest::{ManifestFormat, ToStringFormat},24 manifest::{ManifestFormat, ToStringFormat},24 tb,25 typed::BoundedUsize,25 typed::BoundedUsize,26 ObjValue, Result, Unbound, WeakObjValue,26 ObjValue, Result, Unbound, WeakObjValue,27};27};70 Self(Cc::new(RefCell::new(ThunkInner::Computed(val))))70 Self(Cc::new(RefCell::new(ThunkInner::Computed(val))))71 }71 }72 pub fn new(f: impl ThunkValue<Output = T> + 'static) -> Self {72 pub fn new(f: impl ThunkValue<Output = T> + 'static) -> Self {73 Self(Cc::new(RefCell::new(ThunkInner::Waiting(tb!(f)))))73 Self(Cc::new(RefCell::new(ThunkInner::Waiting(TraceBox(74 Box::new(f),75 )))))74 }76 }75 pub fn errored(e: Error) -> Self {77 pub fn errored(e: Error) -> Self {174 I: Unbound<Bound = T>,176 I: Unbound<Bound = T>,175 T: Trace,177 T: Trace,176{178{177 cache: Cc<RefCell<GcHashMap<CacheKey, T>>>,179 cache: Cc<RefCell<FxHashMap<CacheKey, T>>>,178 value: I,180 value: I,179}181}180impl<I: Unbound<Bound = T>, T: Trace> CachedUnbound<I, T> {182impl<I: Unbound<Bound = T>, T: Trace> CachedUnbound<I, T> {181 pub fn new(value: I) -> Self {183 pub fn new(value: I) -> Self {182 Self {184 Self {183 cache: Cc::new(RefCell::new(GcHashMap::new())),185 cache: Cc::new(RefCell::new(FxHashMap::new())),184 value,186 value,185 }187 }186 }188 }302 }304 }303}305}304306305#[derive(Debug, Clone, Trace)]307#[derive(Debug, Clone, Acyclic)]306pub enum StrValue {308pub enum StrValue {307 Flat(IStr),309 Flat(IStr),308 Tree(Rc<(StrValue, StrValue, usize)>),310 Tree(Rc<(StrValue, StrValue, usize)>),crates/jrsonnet-interner/src/lib.rsdiffbeforeafterboth9 borrow::Cow,9 borrow::Cow,10 cell::RefCell,10 cell::RefCell,11 fmt::{self, Display},11 fmt::{self, Display},12 hash::{BuildHasherDefault, Hash, Hasher},12 hash::{Hash, Hasher},13 ops::Deref,13 ops::Deref,14 str,14 str,15};15};161617use hashbrown::{hash_map::RawEntryMut, HashMap};17use hashbrown::{hash_map::RawEntryMut, HashMap};18use jrsonnet_gcmodule::Trace;18use jrsonnet_gcmodule::{Acyclic, Trace};19use rustc_hash::FxHasher;19use rustc_hash::FxBuildHasher;202021mod inner;21mod inner;22use inner::Inner;22use inner::Inner;31 false31 false32 }32 }33}33}34unsafe impl Acyclic for IStr {}343535impl IStr {36impl IStr {36 #[must_use]37 #[must_use]219 }220 }220}221}221222222type PoolMap = HashMap<Inner, (), BuildHasherDefault<FxHasher>>;223type PoolMap = HashMap<Inner, (), FxBuildHasher>;223224224thread_local! {225thread_local! {225 static POOL: RefCell<PoolMap> = RefCell::new(HashMap::with_capacity_and_hasher(200, BuildHasherDefault::default()));226 static POOL: RefCell<PoolMap> = RefCell::new(HashMap::with_capacity_and_hasher(200, FxBuildHasher::default()));226}227}227228228/// Jrsonnet golang bindings require that it is possible to move jsonnet229/// Jrsonnet golang bindings require that it is possible to move jsonnetcrates/jrsonnet-macros/src/lib.rsdiffbeforeafterboth103 syn::custom_keyword!(ok);103 syn::custom_keyword!(ok);104}104}105106struct EmptyAttr;107impl Parse for EmptyAttr {108 fn parse(_input: ParseStream) -> Result<Self> {109 Ok(Self)110 }111}112105113struct BuiltinAttrs {106struct BuiltinAttrs {114 fields: Vec<Field>,107 fields: Vec<Field>,crates/jrsonnet-parser/src/expr.rsdiffbeforeafterboth4 rc::Rc,4 rc::Rc,5};5};667use jrsonnet_gcmodule::Trace;7use jrsonnet_gcmodule::Acyclic;8use jrsonnet_interner::IStr;8use jrsonnet_interner::IStr;9910use crate::source::Source;10use crate::source::Source;111112#[derive(Debug, PartialEq, Trace)]12#[derive(Debug, PartialEq, Acyclic)]13pub enum FieldName {13pub enum FieldName {14 /// {fixed: 2}14 /// {fixed: 2}15 Fixed(IStr),15 Fixed(IStr),16 /// {["dyn"+"amic"]: 3}16 /// {["dyn"+"amic"]: 3}17 Dyn(LocExpr),17 Dyn(LocExpr),18}18}191920#[derive(Debug, Clone, Copy, PartialEq, Eq, Trace)]20#[derive(Debug, Clone, Copy, PartialEq, Eq, Acyclic)]21#[repr(u8)]21#[repr(u8)]22pub enum Visibility {22pub enum Visibility {23 /// :23 /// :34 }34 }35}35}363637#[derive(Clone, Debug, PartialEq, Trace)]37#[derive(Clone, Debug, PartialEq, Acyclic)]38pub struct AssertStmt(pub LocExpr, pub Option<LocExpr>);38pub struct AssertStmt(pub LocExpr, pub Option<LocExpr>);393940#[derive(Debug, PartialEq, Trace)]40#[derive(Debug, PartialEq, Acyclic)]41pub struct FieldMember {41pub struct FieldMember {42 pub name: FieldName,42 pub name: FieldName,43 pub plus: bool,43 pub plus: bool,46 pub value: LocExpr,46 pub value: LocExpr,47}47}484849#[derive(Debug, PartialEq, Trace)]49#[derive(Debug, PartialEq, Acyclic)]50pub enum Member {50pub enum Member {51 Field(FieldMember),51 Field(FieldMember),52 BindStmt(BindSpec),52 BindStmt(BindSpec),53 AssertStmt(AssertStmt),53 AssertStmt(AssertStmt),54}54}555556#[derive(Debug, Clone, Copy, PartialEq, Eq, Trace)]56#[derive(Debug, Clone, Copy, PartialEq, Eq, Acyclic)]57pub enum UnaryOpType {57pub enum UnaryOpType {58 Plus,58 Plus,59 Minus,59 Minus,77 }77 }78}78}797980#[derive(Debug, Clone, Copy, PartialEq, Eq, Trace)]80#[derive(Debug, Clone, Copy, PartialEq, Eq, Acyclic)]81pub enum BinaryOpType {81pub enum BinaryOpType {82 Mul,82 Mul,83 Div,83 Div,146}146}147147148/// name, default value148/// name, default value149#[derive(Debug, PartialEq, Trace)]149#[derive(Debug, PartialEq, Acyclic)]150pub struct Param(pub Destruct, pub Option<LocExpr>);150pub struct Param(pub Destruct, pub Option<LocExpr>);151151152/// Defined function parameters152/// Defined function parameters153#[derive(Debug, Clone, PartialEq, Trace)]153#[derive(Debug, Clone, PartialEq, Acyclic)]154pub struct ParamsDesc(pub Rc<Vec<Param>>);154pub struct ParamsDesc(pub Rc<Vec<Param>>);155155156impl Deref for ParamsDesc {156impl Deref for ParamsDesc {160 }160 }161}161}162162163#[derive(Debug, PartialEq, Trace)]163#[derive(Debug, PartialEq, Acyclic)]164pub struct ArgsDesc {164pub struct ArgsDesc {165 pub unnamed: Vec<LocExpr>,165 pub unnamed: Vec<LocExpr>,166 pub named: Vec<(IStr, LocExpr)>,166 pub named: Vec<(IStr, LocExpr)>,171 }171 }172}172}173173174#[derive(Debug, Clone, PartialEq, Eq, Trace)]174#[derive(Debug, Clone, PartialEq, Eq, Acyclic)]175pub enum DestructRest {175pub enum DestructRest {176 /// ...rest176 /// ...rest177 Keep(IStr),177 Keep(IStr),178 /// ...178 /// ...179 Drop,179 Drop,180}180}181181182#[derive(Debug, Clone, PartialEq, Trace)]182#[derive(Debug, Clone, PartialEq, Acyclic)]183pub enum Destruct {183pub enum Destruct {184 Full(IStr),184 Full(IStr),185 #[cfg(feature = "exp-destruct")]185 #[cfg(feature = "exp-destruct")]240 }240 }241}241}242242243#[derive(Debug, Clone, PartialEq, Trace)]243#[derive(Debug, Clone, PartialEq, Acyclic)]244pub enum BindSpec {244pub enum BindSpec {245 Field {245 Field {246 into: Destruct,246 into: Destruct,261 }261 }262}262}263263264#[derive(Debug, PartialEq, Trace)]264#[derive(Debug, PartialEq, Acyclic)]265pub struct IfSpecData(pub LocExpr);265pub struct IfSpecData(pub LocExpr);266266267#[derive(Debug, PartialEq, Trace)]267#[derive(Debug, PartialEq, Acyclic)]268pub struct ForSpecData(pub Destruct, pub LocExpr);268pub struct ForSpecData(pub Destruct, pub LocExpr);269269270#[derive(Debug, PartialEq, Trace)]270#[derive(Debug, PartialEq, Acyclic)]271pub enum CompSpec {271pub enum CompSpec {272 IfSpec(IfSpecData),272 IfSpec(IfSpecData),273 ForSpec(ForSpecData),273 ForSpec(ForSpecData),274}274}275275276#[derive(Debug, PartialEq, Trace)]276#[derive(Debug, PartialEq, Acyclic)]277pub struct ObjComp {277pub struct ObjComp {278 pub pre_locals: Vec<BindSpec>,278 pub pre_locals: Vec<BindSpec>,279 pub field: FieldMember,279 pub field: FieldMember,280 pub post_locals: Vec<BindSpec>,280 pub post_locals: Vec<BindSpec>,281 pub compspecs: Vec<CompSpec>,281 pub compspecs: Vec<CompSpec>,282}282}283283284#[derive(Debug, PartialEq, Trace)]284#[derive(Debug, PartialEq, Acyclic)]285pub enum ObjBody {285pub enum ObjBody {286 MemberList(Vec<Member>),286 MemberList(Vec<Member>),287 ObjComp(ObjComp),287 ObjComp(ObjComp),288}288}289289290#[derive(Debug, PartialEq, Eq, Clone, Copy, Trace)]290#[derive(Debug, PartialEq, Eq, Clone, Copy, Acyclic)]291pub enum LiteralType {291pub enum LiteralType {292 This,292 This,293 Super,293 Super,297 False,297 False,298}298}299299300#[derive(Debug, PartialEq, Trace)]300#[derive(Debug, PartialEq, Acyclic)]301pub struct SliceDesc {301pub struct SliceDesc {302 pub start: Option<LocExpr>,302 pub start: Option<LocExpr>,303 pub end: Option<LocExpr>,303 pub end: Option<LocExpr>,304 pub step: Option<LocExpr>,304 pub step: Option<LocExpr>,305}305}306306307/// Syntax base307/// Syntax base308#[derive(Debug, PartialEq, Trace)]308#[derive(Debug, PartialEq, Acyclic)]309pub enum Expr {309pub enum Expr {310 Literal(LiteralType),310 Literal(LiteralType),311311374 Slice(LocExpr, SliceDesc),374 Slice(LocExpr, SliceDesc),375}375}376376377#[derive(Debug, PartialEq, Trace)]377#[derive(Debug, PartialEq, Acyclic)]378pub struct IndexPart {378pub struct IndexPart {379 pub value: LocExpr,379 pub value: LocExpr,380 #[cfg(feature = "exp-null-coaelse")]380 #[cfg(feature = "exp-null-coaelse")]381 pub null_coaelse: bool,381 pub null_coaelse: bool,382}382}383383384/// file, begin offset, end offset384/// file, begin offset, end offset385#[derive(Clone, PartialEq, Eq, Trace)]385#[derive(Clone, PartialEq, Eq, Acyclic)]386#[trace(skip)]387#[repr(C)]386#[repr(C)]388pub struct Span(pub Source, pub u32, pub u32);387pub struct Span(pub Source, pub u32, pub u32);389impl Span {388impl Span {401}400}402401403/// Holds AST expression and its location in source file402/// Holds AST expression and its location in source file404#[derive(Clone, PartialEq, Trace)]403#[derive(Clone, PartialEq, Acyclic)]405pub struct LocExpr(Rc<(Expr, Span)>);404pub struct LocExpr(Rc<(Expr, Span)>);406impl LocExpr {405impl LocExpr {407 pub fn new(expr: Expr, span: Span) -> Self {406 pub fn new(expr: Expr, span: Span) -> Self {crates/jrsonnet-parser/src/source.rsdiffbeforeafterboth6 rc::Rc,6 rc::Rc,7};7};889use jrsonnet_gcmodule::{Trace, Tracer};9use jrsonnet_gcmodule::Acyclic;10use jrsonnet_interner::{IBytes, IStr};10use jrsonnet_interner::{IBytes, IStr};111112use crate::location::{location_to_offset, offset_to_location, CodeLocation};12use crate::location::{location_to_offset, offset_to_location, CodeLocation};56 impl Eq for dyn $T {}56 impl Eq for dyn $T {}57 };57 };58}58}59pub trait SourcePathT: Trace + Debug + Display {59pub trait SourcePathT: Acyclic + Debug + Display {60 /// This method should be checked by resolver before panicking with bad SourcePath input60 /// This method should be checked by resolver before panicking with bad SourcePath input61 /// if `true` - then resolver may threat this path as default, and default is usally a CWD61 /// if `true` - then resolver may threat this path as default, and default is usally a CWD62 fn is_default(&self) -> bool;62 fn is_default(&self) -> bool;79/// search location is applicable79/// search location is applicable80///80///81/// Resolver may also return custom implementations of this trait, for example it may return http url in case of remotely loaded files81/// Resolver may also return custom implementations of this trait, for example it may return http url in case of remotely loaded files82#[derive(Eq, Debug, Clone)]82#[derive(Eq, Debug, Clone, Acyclic)]83pub struct SourcePath(Rc<dyn SourcePathT>);83pub struct SourcePath(Rc<dyn SourcePathT>);84impl SourcePath {84impl SourcePath {85 pub fn new(inner: impl SourcePathT) -> Self {85 pub fn new(inner: impl SourcePathT) -> Self {106 &*self.0 == &*other.0106 &*self.0 == &*other.0107 }107 }108}108}109impl Trace for SourcePath {110 fn trace(&self, tracer: &mut Tracer) {111 (*self.0).trace(tracer)112 }113114 fn is_type_tracked() -> bool115 where116 Self: Sized,117 {118 true119 }120}121impl Display for SourcePath {109impl Display for SourcePath {122 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {110 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {123 write!(f, "{}", self.0)111 write!(f, "{}", self.0)129 }117 }130}118}131119132#[derive(Trace, Hash, PartialEq, Eq, Debug)]120#[derive(Acyclic, Hash, PartialEq, Eq, Debug)]133struct SourceDefault;121struct SourceDefault;134impl Display for SourceDefault {122impl Display for SourceDefault {135 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {123 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {151///139///152/// When `file` is being resolved from `SourceFile(a/b/c)`, it should be resolved to `SourceFile(a/b/file)`,140/// When `file` is being resolved from `SourceFile(a/b/c)`, it should be resolved to `SourceFile(a/b/file)`,153/// however if it is being resolved from `SourceDirectory(a/b/c)`, then it should be resolved to `SourceDirectory(a/b/c/file)`141/// however if it is being resolved from `SourceDirectory(a/b/c)`, then it should be resolved to `SourceDirectory(a/b/c/file)`154#[derive(Trace, Hash, PartialEq, Eq, Debug)]142#[derive(Acyclic, Hash, PartialEq, Eq, Debug)]155pub struct SourceFile(PathBuf);143pub struct SourceFile(PathBuf);156impl SourceFile {144impl SourceFile {157 pub fn new(path: PathBuf) -> Self {145 pub fn new(path: PathBuf) -> Self {179/// Represents path to the directory on the disk167/// Represents path to the directory on the disk180///168///181/// See also [`SourceFile`]169/// See also [`SourceFile`]182#[derive(Trace, Hash, PartialEq, Eq, Debug)]170#[derive(Acyclic, Hash, PartialEq, Eq, Debug)]183pub struct SourceDirectory(PathBuf);171pub struct SourceDirectory(PathBuf);184impl SourceDirectory {172impl SourceDirectory {185 pub fn new(path: PathBuf) -> Self {173 pub fn new(path: PathBuf) -> Self {208///196///209/// It is used for --ext-code=.../--tla-code=.../standard library source code by default,197/// It is used for --ext-code=.../--tla-code=.../standard library source code by default,210/// and user can construct arbitrary values by hand, without asking import resolver198/// and user can construct arbitrary values by hand, without asking import resolver211#[derive(Trace, Hash, PartialEq, Eq, Debug, Clone)]199#[derive(Acyclic, Hash, PartialEq, Eq, Debug, Clone)]212pub struct SourceVirtual(pub IStr);200pub struct SourceVirtual(pub IStr);213impl Display for SourceVirtual {201impl Display for SourceVirtual {214 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {202 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {231/// for better cross-platform support.219/// for better cross-platform support.232// PartialEq is limited to ptr equality220// PartialEq is limited to ptr equality233#[allow(clippy::derived_hash_with_manual_eq)]221#[allow(clippy::derived_hash_with_manual_eq)]234#[derive(Trace, Debug, Hash)]222#[derive(Acyclic, Debug, Hash)]235pub struct SourceFifo(pub String, pub IBytes);223pub struct SourceFifo(pub String, pub IBytes);236impl PartialEq for SourceFifo {224impl PartialEq for SourceFifo {237 fn eq(&self, other: &Self) -> bool {225 fn eq(&self, other: &Self) -> bool {258246259/// Either real file, or virtual247/// Either real file, or virtual260/// Hash of FileName always have same value as raw Path, to make it possible to use with raw_entry_mut248/// Hash of FileName always have same value as raw Path, to make it possible to use with raw_entry_mut261#[derive(Clone, PartialEq, Eq, Debug)]249#[derive(Clone, PartialEq, Eq, Debug, Acyclic)]262pub struct Source(pub Rc<(SourcePath, IStr)>);250pub struct Source(pub Rc<(SourcePath, IStr)>);263264impl Trace for Source {265 fn trace(&self, _tracer: &mut Tracer) {}266267 fn is_type_tracked() -> bool {268 false269 }270}271251272impl Source {252impl Source {273 pub fn new(path: SourcePath, code: IStr) -> Self {253 pub fn new(path: SourcePath, code: IStr) -> Self {crates/jrsonnet-rowan-parser/src/generated/syntax_kinds.rsdiffbeforeafterboth127 IDENT,127 IDENT,128 #[regex("[ \\t\\n\\r]+")]128 #[regex("[ \\t\\n\\r]+")]129 WHITESPACE,129 WHITESPACE,130 #[regex("//[^\\r\\n]*(\\r\\n|\\n)?")]130 #[regex("//[^\\r\\n]*?(\\r\\n|\\n)?")]131 SINGLE_LINE_SLASH_COMMENT,131 SINGLE_LINE_SLASH_COMMENT,132 #[regex("#[^\\r\\n]*(\\r\\n|\\n)?")]132 #[regex("#[^\\r\\n]*?(\\r\\n|\\n)?")]133 SINGLE_LINE_HASH_COMMENT,133 SINGLE_LINE_HASH_COMMENT,134 #[regex("/\\*([^*]|\\*[^/])*\\*/")]134 #[regex("/\\*([^*]|\\*[^/])*\\*/")]135 MULTI_LINE_COMMENT,135 MULTI_LINE_COMMENT,crates/jrsonnet-stdlib/src/lib.rsdiffbeforeafterboth16 trace::PathResolver,16 trace::PathResolver,17 ContextBuilder, IStr, ObjValue, ObjValueBuilder, Thunk, Val,17 ContextBuilder, IStr, ObjValue, ObjValueBuilder, Thunk, Val,18};18};19use jrsonnet_gcmodule::Trace;19use jrsonnet_gcmodule::{Acyclic, Cc, Trace};20use jrsonnet_parser::Source;20use jrsonnet_parser::Source;21pub use manifest::*;21pub use manifest::*;22pub use math::*;22pub use math::*;50mod types;50mod types;515152#[allow(clippy::too_many_lines)]52#[allow(clippy::too_many_lines)]53pub fn stdlib_uncached(settings: Rc<RefCell<Settings>>) -> ObjValue {53pub fn stdlib_uncached(settings: Cc<RefCell<Settings>>) -> ObjValue {54 let mut builder = ObjValueBuilder::new();54 let mut builder = ObjValueBuilder::new();555556 // FIXME: Use PHF56 // FIXME: Use PHF279 builder.build()279 builder.build()280}280}281281282pub trait TracePrinter {282pub trait TracePrinter: Acyclic {283 fn print_trace(&self, loc: CallLocation, value: IStr);283 fn print_trace(&self, loc: CallLocation, value: IStr);284}284}285285286#[derive(Acyclic)]286pub struct StdTracePrinter {287pub struct StdTracePrinter {287 resolver: PathResolver,288 resolver: PathResolver,288}289}309 }310 }310}311}311312313#[derive(Clone, Trace)]312pub struct Settings {314pub struct Settings {313 /// Used for `std.extVar`315 /// Used for `std.extVar`314 pub ext_vars: HashMap<IStr, TlaArg>,316 pub ext_vars: HashMap<IStr, TlaArg>,315 /// Used for `std.native`317 /// Used for `std.native`316 pub ext_natives: HashMap<IStr, FuncVal>,318 pub ext_natives: HashMap<IStr, FuncVal>,317 /// Used for `std.trace`319 /// Used for `std.trace`318 pub trace_printer: Box<dyn TracePrinter>,320 pub trace_printer: Rc<dyn TracePrinter>,319 /// Used for `std.thisFile`321 /// Used for `std.thisFile`320 pub path_resolver: PathResolver,322 pub path_resolver: PathResolver,321}323}329pub struct ContextInitializer {331pub struct ContextInitializer {330 /// std without applied thisFile overlay332 /// std without applied thisFile overlay331 stdlib_obj: ObjValue,333 stdlib_obj: ObjValue,332 settings: Rc<RefCell<Settings>>,334 settings: Cc<RefCell<Settings>>,333}335}334impl ContextInitializer {336impl ContextInitializer {335 pub fn new(resolver: PathResolver) -> Self {337 pub fn new(resolver: PathResolver) -> Self {336 let settings = Settings {338 let settings = Settings {337 ext_vars: HashMap::new(),339 ext_vars: HashMap::new(),338 ext_natives: HashMap::new(),340 ext_natives: HashMap::new(),339 trace_printer: Box::new(StdTracePrinter::new(resolver.clone())),341 trace_printer: Rc::new(StdTracePrinter::new(resolver.clone())),340 path_resolver: resolver,342 path_resolver: resolver,341 };343 };342 let settings = Rc::new(RefCell::new(settings));344 let settings = Cc::new(RefCell::new(settings));343 let stdlib_obj = stdlib_uncached(settings.clone());345 let stdlib_obj = stdlib_uncached(settings.clone());344 Self {346 Self {345 stdlib_obj,347 stdlib_obj,346 settings,348 settings,347 }349 }348 }350 }349 pub fn settings(&self) -> Ref<Settings> {351 pub fn settings(&self) -> Ref<'_, Settings> {350 self.settings.borrow()352 self.settings.borrow()351 }353 }352 pub fn settings_mut(&self) -> RefMut<Settings> {354 pub fn settings_mut(&self) -> RefMut<'_, Settings> {353 self.settings.borrow_mut()355 self.settings.borrow_mut()354 }356 }355 pub fn add_ext_var(&self, name: IStr, value: Val) {357 pub fn add_ext_var(&self, name: IStr, value: Val) {crates/jrsonnet-stdlib/src/misc.rsdiffbeforeafterboth1use std::{cell::RefCell, collections::BTreeSet, rc::Rc};1use std::{cell::RefCell, collections::BTreeSet};223use jrsonnet_evaluator::{3use jrsonnet_evaluator::{4 bail,4 bail,9 val::{equals, ArrValue},9 val::{equals, ArrValue},10 Context, Either, IStr, ObjValue, ObjValueBuilder, ResultExt, Thunk, Val,10 Context, Either, IStr, ObjValue, ObjValueBuilder, ResultExt, Thunk, Val,11};11};12use jrsonnet_gcmodule::Cc;121313use crate::{extvar_source, Settings};14use crate::{extvar_source, Settings};141547}48}484949#[builtin(fields(50#[builtin(fields(50 settings: Rc<RefCell<Settings>>,51 settings: Cc<RefCell<Settings>>,51))]52))]52pub fn builtin_ext_var(this: &builtin_ext_var, ctx: Context, x: IStr) -> Result<Val> {53pub fn builtin_ext_var(this: &builtin_ext_var, ctx: Context, x: IStr) -> Result<Val> {53 let ctx = ctx.state().create_default_context(extvar_source(&x, ""));54 let ctx = ctx.state().create_default_context(extvar_source(&x, ""));62}63}636464#[builtin(fields(65#[builtin(fields(65 settings: Rc<RefCell<Settings>>,66 settings: Cc<RefCell<Settings>>,66))]67))]67pub fn builtin_native(this: &builtin_native, x: IStr) -> Val {68pub fn builtin_native(this: &builtin_native, x: IStr) -> Val {68 this.settings69 this.settings74}75}757676#[builtin(fields(77#[builtin(fields(77 settings: Rc<RefCell<Settings>>,78 settings: Cc<RefCell<Settings>>,78))]79))]79pub fn builtin_trace(80pub fn builtin_trace(80 this: &builtin_trace,81 this: &builtin_trace,crates/jrsonnet-stdlib/src/regex.rsdiffbeforeafterboth1use std::{cell::RefCell, hash::BuildHasherDefault, num::NonZeroUsize, rc::Rc};1use std::{cell::RefCell, num::NonZeroUsize, rc::Rc};223use ::regex::Regex;3use ::regex::Regex;4use jrsonnet_evaluator::{4use jrsonnet_evaluator::{5 error::{ErrorKind::*, Result},5 error::{ErrorKind::*, Result},6 rustc_hash::FxBuildHasher,6 val::StrValue,7 val::StrValue,7 IStr, ObjValueBuilder, Val,8 IStr, ObjValueBuilder, Val,8};9};10use jrsonnet_gcmodule::Acyclic;9use jrsonnet_macros::builtin;11use jrsonnet_macros::builtin;10use lru::LruCache;12use lru::LruCache;11use rustc_hash::FxHasher;131214#[derive(Acyclic)]13pub struct RegexCacheInner {15pub struct RegexCacheInner {14 cache: RefCell<LruCache<IStr, Rc<Regex>, BuildHasherDefault<FxHasher>>>,16 cache: RefCell<LruCache<IStr, Rc<Regex>, FxBuildHasher>>,15}17}16impl Default for RegexCacheInner {18impl Default for RegexCacheInner {17 fn default() -> Self {19 fn default() -> Self {18 Self {20 Self {19 cache: RefCell::new(LruCache::with_hasher(21 cache: RefCell::new(LruCache::with_hasher(20 NonZeroUsize::new(20).unwrap(),22 NonZeroUsize::new(20).unwrap(),21 BuildHasherDefault::default(),23 FxBuildHasher::default(),22 )),24 )),23 }25 }24 }26 }flake.lockdiffbeforeafterboth1{1{2 "nodes": {2 "nodes": {3 "crane": {3 "crane": {4 "inputs": {5 "nixpkgs": [6 "nixpkgs"7 ]8 },9 "locked": {4 "locked": {10 "lastModified": 1724377159,5 "lastModified": 1770419512,11 "narHash": "sha256-ixjje1JO8ucKT41hs6n2NCde1Vc0+Zc2p2gUbJpCsMw=",12 "owner": "ipetkov",6 "owner": "ipetkov",13 "repo": "crane",7 "repo": "crane",14 "rev": "3e47b7a86c19142bd3675da49d6acef488b4dac1",8 "rev": "2510f2cbc3ccd237f700bb213756a8f35c32d8d7",15 "type": "github"9 "type": "github"16 },10 },17 "original": {11 "original": {27 ]21 ]28 },22 },29 "locked": {23 "locked": {30 "lastModified": 1722555600,24 "lastModified": 1769996383,31 "narHash": "sha256-XOQkdLafnb/p9ij77byFQjDf5m5QYl9b2REiVClC+x4=",32 "owner": "hercules-ci",25 "owner": "hercules-ci",33 "repo": "flake-parts",26 "repo": "flake-parts",34 "rev": "8471fe90ad337a8074e957b69ca4d0089218391d",27 "rev": "57928607ea566b5db3ad13af0e57e921e6b12381",35 "type": "github"28 "type": "github"36 },29 },37 "original": {30 "original": {42 },35 },43 "nixpkgs": {36 "nixpkgs": {44 "locked": {37 "locked": {45 "lastModified": 1724519568,38 "lastModified": 1770468184,46 "narHash": "sha256-CmfrenY4cEi/mIslKy8XOGdqxUUVgT6/qMzNcAN/7z8=",47 "owner": "nixos",39 "owner": "nixos",48 "repo": "nixpkgs",40 "repo": "nixpkgs",49 "rev": "eb0e6df0cdd2641ec0651cd9802ff4cff3b3e915",41 "rev": "a124a10ea33a73329c42d67f30efcdbfb60a4e04",50 "type": "github"42 "type": "github"51 },43 },52 "original": {44 "original": {53 "owner": "nixos",45 "owner": "nixos",46 "ref": "release-25.11",54 "repo": "nixpkgs",47 "repo": "nixpkgs",55 "type": "github"48 "type": "github"56 }49 }71 ]64 ]72 },65 },73 "locked": {66 "locked": {74 "lastModified": 1755743804,67 "lastModified": 1770433312,75 "narHash": "sha256-M6qT02voARH5e9eTXQBzpYIE/hAp6jPgBCyxLmw5uBM=",76 "owner": "oxalica",68 "owner": "oxalica",77 "repo": "rust-overlay",69 "repo": "rust-overlay",78 "rev": "80322e975e27d834451d6b66e63f8abae9d74bf2",70 "rev": "9922ff9f99a6436756cbe6f5d11f9c3630e58cf0",79 "type": "github"71 "type": "github"80 },72 },81 "original": {73 "original": {85 }77 }86 },78 },87 "shelly": {79 "shelly": {88 "inputs": {89 "flake-parts": [90 "flake-parts"91 ],92 "nixpkgs": [93 "nixpkgs"94 ]95 },96 "locked": {80 "locked": {97 "lastModified": 1718420551,81 "lastModified": 1756323923,98 "narHash": "sha256-NU8NBXVPj0KuY4Tl/LtZPrbX3PmmmgPuhk/1pzm9cyk=",99 "owner": "CertainLach",82 "owner": "CertainLach",100 "repo": "shelly",83 "repo": "shelly",101 "rev": "4f70221f3f9ad9058f590eefb25251b6760aaa47",84 "rev": "b5dd29a500db04f54a9f1c2bf81cdd84df8b0cd7",102 "type": "github"85 "type": "github"103 },86 },104 "original": {87 "original": {flake.nixdiffbeforeafterboth1{1{2 description = "Jrsonnet";2 description = "Jrsonnet";3 inputs = {3 inputs = {4 nixpkgs.url = "github:nixos/nixpkgs";4 nixpkgs.url = "github:nixos/nixpkgs/release-25.11";5 rust-overlay = {5 rust-overlay = {6 url = "github:oxalica/rust-overlay";6 url = "github:oxalica/rust-overlay";7 inputs.nixpkgs.follows = "nixpkgs";7 inputs.nixpkgs.follows = "nixpkgs";10 url = "github:hercules-ci/flake-parts";10 url = "github:hercules-ci/flake-parts";11 inputs.nixpkgs-lib.follows = "nixpkgs";11 inputs.nixpkgs-lib.follows = "nixpkgs";12 };12 };13 crane = {13 crane.url = "github:ipetkov/crane";14 url = "github:ipetkov/crane";15 inputs.nixpkgs.follows = "nixpkgs";16 };17 shelly = {14 shelly.url = "github:CertainLach/shelly";18 url = "github:CertainLach/shelly";19 inputs = {20 flake-parts.follows = "flake-parts";21 nixpkgs.follows = "nixpkgs";22 };23 };24 };15 };25 outputs = inputs @ {16 outputs =17 inputs@{32 }:24 }:33 flake-parts.lib.mkFlake {inherit inputs;} {25 flake-parts.lib.mkFlake { inherit inputs; } {34 imports = [shelly.flakeModule];26 imports = [ shelly.flakeModule ];35 systems = ["x86_64-linux" "aarch64-linux" "armv7l-linux" "armv6l-linux" "mingw-w64"];27 systems = inputs.nixpkgs.lib.systems.flakeExposed;36 perSystem = {28 perSystem =29 {37 config,30 config,138 packages = with pkgs;153 packages =154 with pkgs;139 [155 [140 alejandra141 cargo-edit156 cargo-edit142 cargo-asm143 cargo-outdated157 cargo-outdated144 cargo-watch158 cargo-watch145 cargo-insta159 cargo-insta160 cargo-hack146 lld161 lld147 hyperfine162 hyperfine148 graphviz163 graphviz149 ]164 ]150 ++ lib.optionals (!stdenv.isDarwin) [165 ++ lib.optionals (!stdenv.isDarwin) [151 valgrind166 valgrind152 kcachegrind153 ];167 ];154 };168 };155 };169 };resultdiffbeforeafterbothno changes
rust-toolchain.tomldiffbeforeafterboth1[toolchain]1[toolchain]2channel = "1.89.0"2channel = "1.93.0"3components = ["rustfmt", "clippy", "rust-analyzer", "rust-src"]3components = ["rustfmt", "clippy", "rust-analyzer", "rust-src"]44tests/golden/issue172.jsonnet.goldendiffbeforeafterboth1variable is not defined: b1local is not defined: b2 issue172.jsonnet:1:45-47: variable <b> access2 issue172.jsonnet:1:45-47: local <b> access3 issue172.jsonnet:1:4-10: field <value> access3 issue172.jsonnet:1:4-10: field <value> access4 elem <0> evaluation4 elem <0> evaluationtests/golden/missing_binding.jsonnet.goldendiffbeforeafterboth1variable is not defined: sta1local is not defined: sta2There is variable with similar name present: std2There is a local with similar name present: std3 missing_binding.jsonnet:1:1-5: variable <sta> access3 missing_binding.jsonnet:1:1-5: local <sta> accesstests/tests/common.rsdiffbeforeafterboth565657#[builtin]57#[builtin]58fn param_names(fun: FuncVal) -> Vec<String> {58fn param_names(fun: FuncVal) -> Vec<String> {59 match fun {59 fun.params()60 FuncVal::Id => vec!["x".to_string()],61 FuncVal::Normal(func) => func62 .params63 .iter()64 .map(|p| p.0.name().unwrap_or_else(|| "<unnamed>".into()).to_string())65 .collect(),66 FuncVal::StaticBuiltin(b) => b60 .into_iter()67 .params()68 .iter()69 .map(|p| p.name().as_str().unwrap_or("<unnamed>").to_string())61 .map(|v| v.name().as_str().unwrap_or("<unnamed>").to_owned())70 .collect(),71 FuncVal::Builtin(b) => b72 .params()73 .iter()74 .map(|p| p.name().as_str().unwrap_or("<unnamed>").to_string())75 .collect(),62 .collect()76 FuncVal::Thunk(_) => vec![],77 }78}63}796480#[derive(Trace)]65#[derive(Trace)]xtask/src/sourcegen/kinds.rsdiffbeforeafterboth158}158}159use std::{collections::HashSet, str::FromStr};159use std::{collections::HashSet, str::FromStr};160160161pub use define_kinds;162use indexmap::IndexMap;161use indexmap::IndexMap;163use proc_macro2::{Ident, TokenStream};162use proc_macro2::{Ident, TokenStream};164use quote::{format_ident, quote};163use quote::{format_ident, quote};266 error("STRING_BLOCK_MISSING_INDENT", lexer = true);265 error("STRING_BLOCK_MISSING_INDENT", lexer = true);267 lit("IDENT") => r"[_a-zA-Z][_a-zA-Z0-9]*";266 lit("IDENT") => r"[_a-zA-Z][_a-zA-Z0-9]*";268 lit("WHITESPACE") => r"[ \t\n\r]+";267 lit("WHITESPACE") => r"[ \t\n\r]+";269 lit("SINGLE_LINE_SLASH_COMMENT") => r"//[^\r\n]*(\r\n|\n)?";268 lit("SINGLE_LINE_SLASH_COMMENT") => r"//[^\r\n]*?(\r\n|\n)?";270 lit("SINGLE_LINE_HASH_COMMENT") => r"#[^\r\n]*(\r\n|\n)?";269 lit("SINGLE_LINE_HASH_COMMENT") => r"#[^\r\n]*?(\r\n|\n)?";271 lit("MULTI_LINE_COMMENT") => r"/\*([^*]|\*[^/])*\*/";270 lit("MULTI_LINE_COMMENT") => r"/\*([^*]|\*[^/])*\*/";272 error("COMMENT_TOO_SHORT") => r"/\*/";271 error("COMMENT_TOO_SHORT") => r"/\*/";273 error("COMMENT_UNTERMINATED") => r"/\*([^*/]|\*[^/])+";272 error("COMMENT_UNTERMINATED") => r"/\*([^*/]|\*[^/])+";xtask/src/sourcegen/mod.rsdiffbeforeafterboth4use ast::{lower, AstSrc};4use ast::{lower, AstSrc};5use itertools::Itertools;5use itertools::Itertools;6use kinds::{KindsSrc, TokenKind};6use kinds::{KindsSrc, TokenKind};7use proc_macro2::{Punct, Spacing, TokenStream};7use proc_macro2::{Ident, Punct, Spacing, Span, TokenStream};8use quote::{format_ident, quote};8use quote::{format_ident, quote};9use ungrammar::Grammar;9use ungrammar::Grammar;10use util::{ensure_file_contents, reformat, to_pascal_case, to_upper_snake_case};10use util::{ensure_file_contents, reformat, to_pascal_case, to_upper_snake_case};533 if "{}[]()$".contains(token) {533 if "{}[]()$".contains(token) {534 let c = token.chars().next().unwrap();534 let c = token.chars().next().unwrap();535 quote! { #c }535 quote! { #c }536 } else if token.contains('$') {536 } else if token.contains(|v| v == '$') {537 quote! { #token }537 quote! { #token }538 } else {538 } else if token.chars().all(|v| ('a'..='z').contains(&v)) {539 let i = Ident::new(&token, Span::call_site());540 quote! { #i }541 } else {539 let cs = token.chars().map(|c| Punct::new(c, Spacing::Joint));542 let cs = token.chars().map(|c| Punct::new(c, Spacing::Joint));540 quote! { #(#cs)* }543 quote! { #(#cs)* }541 }544 }