diff --git a/.gitignore b/.gitignore index c7e883b..6332738 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ target/ data_*_flex.json data_*_haveranswer.f64 .direnv/ +result diff --git a/.woodpecker/.all-checks-complete.yml b/.woodpecker/all-checks-complete.yaml similarity index 100% rename from .woodpecker/.all-checks-complete.yml rename to .woodpecker/all-checks-complete.yaml diff --git a/.woodpecker/.build.yml b/.woodpecker/build.yaml similarity index 100% rename from .woodpecker/.build.yml rename to .woodpecker/build.yaml diff --git a/Cargo.lock b/Cargo.lock index 6add846..6334da5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,61 +1,62 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "anstream" -version = "0.3.2" +version = "0.6.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163" +checksum = "3ae563653d1938f79b1ab1b5e668c87c76a9930414574a6583a7b7e11a8e6192" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", "anstyle-wincon", "colorchoice", - "is-terminal", + "is_terminal_polyfill", "utf8parse", ] [[package]] name = "anstyle" -version = "1.0.0" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d" +checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd" [[package]] name = "anstyle-parse" -version = "0.2.0" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e765fd216e48e067936442276d1d57399e37bce53c264d6fefbe298080cb57ee" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.0.0" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" +checksum = "9e231f6134f61b71076a3eab506c379d4f36122f2af15a9ff04415ea4c3339e2" dependencies = [ "windows-sys", ] [[package]] name = "anstyle-wincon" -version = "1.0.1" +version = "3.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188" +checksum = "3e0633414522a32ffaac8ac6cc8f748e090c5717661fddeea04219e2344f5f2a" dependencies = [ "anstyle", + "once_cell_polyfill", "windows-sys", ] [[package]] name = "arbitrary" -version = "1.3.0" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2d098ff73c1ca148721f37baad5ea6a465a13f9573aba8641fbbbae8164a54e" +checksum = "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1" dependencies = [ "derive_arbitrary", ] @@ -69,59 +70,45 @@ dependencies = [ "arbitrary", ] -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - [[package]] name = "byteorder" -version = "1.4.3" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" - -[[package]] -name = "cc" -version = "1.0.79" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "cfg-if" -version = "1.0.0" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" [[package]] name = "clap" -version = "4.3.1" +version = "4.5.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4ed2379f8603fa2b7509891660e802b88c70a79a6427a70abb5968054de2c28" +checksum = "7eac00902d9d136acd712710d71823fb8ac8004ca445a89e73a41d45aa712931" dependencies = [ "clap_builder", "clap_derive", - "once_cell", ] [[package]] name = "clap_builder" -version = "4.3.1" +version = "4.5.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72394f3339a76daf211e57d4bcb374410f3965dcc606dd0e03738c7888766980" +checksum = "2ad9bbf750e73b5884fb8a211a9424a1906c1e156724260fdae972f31d70e1d6" dependencies = [ "anstream", "anstyle", - "bitflags", "clap_lex", "strsim", ] [[package]] name = "clap_derive" -version = "4.3.1" +version = "4.5.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59e9ef9a08ee1c0e1f2e162121665ac45ac3783b0f897db7244ae75ad9a8f65b" +checksum = "bbfd7eae0b0f1a6e63d4b13c9c478de77c2eb546fba158ad50b4203dc24b9f9c" dependencies = [ "heck", "proc-macro2", @@ -131,57 +118,36 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.5.0" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" +checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675" [[package]] name = "colorchoice" -version = "1.0.0" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" [[package]] name = "const_panic" -version = "0.2.8" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6051f239ecec86fde3410901ab7860d458d160371533842974fc61f96d15879b" +checksum = "bb8a602185c3c95b52f86dc78e55a6df9a287a7a93ddbcf012509930880cf879" dependencies = [ "typewit", ] [[package]] name = "derive_arbitrary" -version = "1.3.1" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53e0efad4403bfc52dc201159c4b842a246a14b98c64b55dfd0f2d89729dfeb8" +checksum = "1e567bd82dcff979e4b03460c307b3cdc9e96fde3d73bed1496d2bc75d9dd62a" dependencies = [ "proc-macro2", "quote", "syn", ] -[[package]] -name = "errno" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" -dependencies = [ - "errno-dragonfly", - "libc", - "windows-sys", -] - -[[package]] -name = "errno-dragonfly" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", - "libc", -] - [[package]] name = "generator" version = "0.1.0" @@ -195,9 +161,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.9" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" dependencies = [ "cfg-if", "libc", @@ -221,38 +187,15 @@ dependencies = [ [[package]] name = "heck" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] -name = "hermit-abi" -version = "0.3.1" +name = "is_terminal_polyfill" +version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" - -[[package]] -name = "io-lifetimes" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" -dependencies = [ - "hermit-abi", - "libc", - "windows-sys", -] - -[[package]] -name = "is-terminal" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" -dependencies = [ - "hermit-abi", - "io-lifetimes", - "rustix", - "windows-sys", -] +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" [[package]] name = "json" @@ -260,21 +203,15 @@ version = "0.1.0" [[package]] name = "libc" -version = "0.2.144" +version = "0.2.175" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1" - -[[package]] -name = "linux-raw-sys" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" +checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543" [[package]] name = "memchr" -version = "2.5.0" +version = "2.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "minimal-lexical" @@ -293,31 +230,34 @@ dependencies = [ ] [[package]] -name = "once_cell" -version = "1.17.2" +name = "once_cell_polyfill" +version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9670a07f94779e00908f3e686eab508878ebb390ba6e604d3a284c00e8d0487b" +checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad" [[package]] name = "ppv-lite86" -version = "0.2.17" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] [[package]] name = "proc-macro2" -version = "1.0.59" +version = "1.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6aeca18b86b413c660b781aa319e4e2648a3e6f9eadc9b47e9038e6fe9f3451b" +checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.28" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" dependencies = [ "proc-macro2", ] @@ -352,20 +292,6 @@ dependencies = [ "getrandom", ] -[[package]] -name = "rustix" -version = "0.37.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acf8729d8542766f1b2cf77eb034d52f40d375bb8b615d0b147089946e16613d" -dependencies = [ - "bitflags", - "errno", - "io-lifetimes", - "libc", - "linux-raw-sys", - "windows-sys", -] - [[package]] name = "sim-wrapper" version = "0.1.0" @@ -386,15 +312,15 @@ dependencies = [ [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" -version = "2.0.18" +version = "2.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e" +checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" dependencies = [ "proc-macro2", "quote", @@ -403,15 +329,15 @@ dependencies = [ [[package]] name = "typewit" -version = "1.3.0" +version = "1.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c52b4cb7830f995903b2fcff3f523d21efc1c11f6c1596dd544b7925a64ff56" +checksum = "4c98488b93df24b7c794d6a58c4198d7a2abde676324beaca84f7fb5b39c0811" [[package]] name = "unicode-ident" -version = "1.0.9" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" [[package]] name = "utf8-read" @@ -421,34 +347,42 @@ checksum = "fb566ac06e11c3f13872ebcb0e72ea5f97f0f65a16f45048d0adea21edc28018" [[package]] name = "utf8parse" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" +version = "0.11.1+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "windows-link" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" [[package]] name = "windows-sys" -version = "0.48.0" +version = "0.60.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" dependencies = [ "windows-targets", ] [[package]] name = "windows-targets" -version = "0.48.0" +version = "0.53.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" +checksum = "d5fe6031c4041849d7c496a8ded650796e7b6ecc19df1a431c1a363342e5dc91" dependencies = [ + "windows-link", "windows_aarch64_gnullvm", "windows_aarch64_msvc", "windows_i686_gnu", + "windows_i686_gnullvm", "windows_i686_msvc", "windows_x86_64_gnu", "windows_x86_64_gnullvm", @@ -457,42 +391,68 @@ dependencies = [ [[package]] name = "windows_aarch64_gnullvm" -version = "0.48.0" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" +checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" [[package]] name = "windows_aarch64_msvc" -version = "0.48.0" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" +checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" [[package]] name = "windows_i686_gnu" -version = "0.48.0" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" +checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" [[package]] name = "windows_i686_msvc" -version = "0.48.0" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" +checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" [[package]] name = "windows_x86_64_gnu" -version = "0.48.0" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" +checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" [[package]] name = "windows_x86_64_gnullvm" -version = "0.48.0" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" +checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" [[package]] name = "windows_x86_64_msvc" -version = "0.48.0" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" +checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" + +[[package]] +name = "zerocopy" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] diff --git a/Cargo.toml b/Cargo.toml index 7c96621..6ee5110 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,6 +7,13 @@ members = [ "json", "haversine-app" ] +resolver = "3" + +[workspace.package] +edition = "2024" + +[workspace.metadata.crane] +name = "performance_aware_programming" [profile.release] lto = true diff --git a/flake.lock b/flake.lock index f3f7ab2..a73111f 100644 --- a/flake.lock +++ b/flake.lock @@ -1,44 +1,30 @@ { "nodes": { - "crate2nix": { - "flake": false, + "crane": { "locked": { - "lastModified": 1678820090, - "narHash": "sha256-4FFeonajXNqiSP0PqUlC1wmTyPC8SX6SthEvgRjMupw=", - "owner": "kolloch", - "repo": "crate2nix", - "rev": "4fd826e37bec90dfe26ca16cb6e632c617cc7c0d", + "lastModified": 1757183466, + "narHash": "sha256-kTdCCMuRE+/HNHES5JYsbRHmgtr+l9mOtf5dpcMppVc=", + "owner": "ipetkov", + "repo": "crane", + "rev": "d599ae4847e7f87603e7082d73ca673aa93c916d", "type": "github" }, "original": { - "owner": "kolloch", - "repo": "crate2nix", - "type": "github" - } - }, - "flake-compat": { - "flake": false, - "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", + "owner": "ipetkov", + "repo": "crane", "type": "github" } }, "flake-utils": { + "inputs": { + "systems": "systems" + }, "locked": { - "lastModified": 1659877975, - "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", "owner": "numtide", "repo": "flake-utils", - "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", "type": "github" }, "original": { @@ -49,11 +35,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1679705136, - "narHash": "sha256-MDlZUR7wJ3PlPtqwwoGQr3euNOe0vdSSteVVOef7tBY=", + "lastModified": 1757068644, + "narHash": "sha256-NOrUtIhTkIIumj1E/Rsv1J37Yi3xGStISEo8tZm3KW4=", "owner": "nixos", "repo": "nixpkgs", - "rev": "8f40f2f90b9c9032d1b824442cfbbe0dbabd0dbd", + "rev": "8eb28adfa3dc4de28e792e3bf49fcf9007ca8ac9", "type": "github" }, "original": { @@ -63,42 +49,26 @@ "type": "github" } }, - "nixpkgs_2": { - "locked": { - "lastModified": 1679734080, - "narHash": "sha256-z846xfGLlon6t9lqUzlNtBOmsgQLQIZvR6Lt2dImk1M=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "dbf5322e93bcc6cfc52268367a8ad21c09d76fea", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, "root": { "inputs": { - "crate2nix": "crate2nix", - "flake-compat": "flake-compat", + "crane": "crane", + "flake-utils": "flake-utils", "nixpkgs": "nixpkgs", - "rust-overlay": "rust-overlay", - "utils": "utils" + "rust-overlay": "rust-overlay" } }, "rust-overlay": { "inputs": { - "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs_2" + "nixpkgs": [ + "nixpkgs" + ] }, "locked": { - "lastModified": 1679106165, - "narHash": "sha256-03Opt2yu4E/AIFjvlgib0/nhMn6B4B/t/nvwS2bzOGw=", + "lastModified": 1757298987, + "narHash": "sha256-yuFSw6fpfjPtVMmym51ozHYpJQ7SzVOTkk7tUv2JA0U=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "7313c06ac334d6262ddfe30a38b3abc3da6bd565", + "rev": "cfd63776bde44438ff2936f0c9194c79dd407a5f", "type": "github" }, "original": { @@ -107,18 +77,18 @@ "type": "github" } }, - "utils": { + "systems": { "locked": { - "lastModified": 1678901627, - "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6", + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", "type": "github" }, "original": { - "owner": "numtide", - "repo": "flake-utils", + "owner": "nix-systems", + "repo": "default", "type": "github" } } diff --git a/flake.nix b/flake.nix index 6d3ae8d..1e831af 100644 --- a/flake.nix +++ b/flake.nix @@ -2,110 +2,121 @@ description = "Coursework for Performance-Aware Programming"; inputs = { + self.submodules = true; nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; - utils.url = "github:numtide/flake-utils"; - rust-overlay.url = "github:oxalica/rust-overlay"; - crate2nix = { - url = "github:kolloch/crate2nix"; - flake = false; - }; - flake-compat = { - url = "github:edolstra/flake-compat"; - flake = false; + flake-utils.url = "github:numtide/flake-utils"; + rust-overlay = { + url = "github:oxalica/rust-overlay"; + inputs.nixpkgs.follows = "nixpkgs"; }; + crane.url = "github:ipetkov/crane"; }; - outputs = { - self, - nixpkgs, - utils, - rust-overlay, - crate2nix, - ... - }: let - name = "sim-wrapper"; - in - utils.lib.eachDefaultSystem - ( - system: let - # Imports + outputs = { self, nixpkgs, flake-utils, rust-overlay, crane }: + flake-utils.lib.eachDefaultSystem (system: + let pkgs = import nixpkgs { inherit system; - overlays = [ - rust-overlay.overlays.default - (self: super: { - # Because rust-overlay bundles multiple rust packages into one - # derivation, specify that mega-bundle here, so that crate2nix - # will use them automatically. - rustc = self.rust-bin.nightly.latest.default; - cargo = self.rust-bin.nightly.latest.default; - }) + overlays = [ (import rust-overlay) ]; + }; + + rustToolchain = pkgs.rust-bin.nightly.latest.default; + + craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchain; + + # Common build inputs for all derivations + commonArgs = { + version = "0.1.0"; # Set explicitly to avoid warnings + src = pkgs.lib.cleanSourceWith { + src = ./.; + name = "source"; + filter = path: type: (builtins.match ".*json$" path != null || pkgs.lib.hasInfix "/computer_enhance" path || craneLib.filterCargoSources path type); + }; + strictDeps = true; + + buildInputs = [ + pkgs.openssl + ]; + + nativeBuildInputs = [ + pkgs.pkg-config ]; }; - inherit - (import "${crate2nix}/tools.nix" {inherit pkgs;}) - generatedCargoNix - ; - # Create the cargo2nix project - project = - pkgs.callPackage - (generatedCargoNix { - inherit name; - src = ./.; - }) - { - # Individual crate overrides go here - # Example: https://github.com/balsoft/simple-osd-daemons/blob/6f85144934c0c1382c7a4d3a2bbb80106776e270/flake.nix#L28-L50 - defaultCrateOverrides = - pkgs.defaultCrateOverrides - // { - # The app crate itself is overriden here. Typically we - # configure non-Rust dependencies (see below) here. - ${name} = oldAttrs: - { - inherit buildInputs nativeBuildInputs; - } - // buildEnvVars; - }; + # Build just the cargo dependencies + cargoArtifacts = craneLib.buildDepsOnly commonArgs; + + # Build the actual package + sim-wrapper = craneLib.buildPackage (commonArgs // { + inherit cargoArtifacts; + }); + in + { + packages = { + default = sim-wrapper; + sim-wrapper = sim-wrapper; + }; + + apps = { + default = { + type = "app"; + program = "${sim-wrapper}/bin/sim_wrapper"; # Note: hyphens become underscores in binary names + meta = sim-wrapper.meta; + }; + sim-wrapper = { + type = "app"; + program = "${sim-wrapper}/bin/sim_wrapper"; + meta = sim-wrapper.meta; + }; + }; + + devShells = { + default = craneLib.devShell { + # Inherit the build inputs from commonArgs + buildInputs = commonArgs.buildInputs; + nativeBuildInputs = commonArgs.nativeBuildInputs; + + # Additional dev tools + packages = [ + rustToolchain + pkgs.rust-analyzer + ]; + + RUST_SRC_PATH = "${rustToolchain}/lib/rustlib/src/rust/library"; }; - # Configuration for the non-Rust dependencies - buildInputs = with pkgs; [openssl.dev]; - nativeBuildInputs = with pkgs; [rustc cargo pkgconfig]; - buildEnvVars = { - PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig"; - }; - in rec { - packages.${name} = project.workspaceMembers.${name}.build; + ci = pkgs.mkShell { + buildInputs = commonArgs.buildInputs ++ [ + pkgs.nodePackages.markdown-link-check + pkgs.nixpkgs-fmt + rustToolchain + ]; - # `nix build` - defaultPackage = packages.${name}; + nativeBuildInputs = commonArgs.nativeBuildInputs; - # `nix run` - apps.${name} = utils.lib.mkApp { - inherit name; - drv = packages.${name}; + RUST_SRC_PATH = "${rustToolchain}/lib/rustlib/src/rust/library"; + }; }; - defaultApp = apps.${name}; - # `nix develop` - devShells = { - ci = - pkgs.mkShell { - inherit nativeBuildInputs; - buildInputs = [pkgs.nodePackages.markdown-link-check pkgs.alejandra] ++ buildInputs; - RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}"; - } - // buildEnvVars; - default = - pkgs.mkShell - { - inherit buildInputs nativeBuildInputs; - RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}"; - } - // buildEnvVars; + # Optional: add checks for CI + checks = { + inherit sim-wrapper; + + # Run cargo fmt check + fmt = craneLib.cargoFmt { + inherit (commonArgs) src; + }; + + # Run clippy + clippy = craneLib.cargoClippy (commonArgs // { + inherit cargoArtifacts; + cargoClippyExtraArgs = "--all-targets -- --deny warnings"; + }); + + # Run tests + tests = craneLib.cargoTest (commonArgs // { + inherit cargoArtifacts; + }); }; - } - ); + }); } diff --git a/generator/Cargo.toml b/generator/Cargo.toml index 01406a2..6ff6979 100644 --- a/generator/Cargo.toml +++ b/generator/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "generator" version = "0.1.0" -edition = "2021" +edition.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/generator/src/main.rs b/generator/src/main.rs index 64531bd..4ecaab0 100644 --- a/generator/src/main.rs +++ b/generator/src/main.rs @@ -1,5 +1,5 @@ use byteorder::{BigEndian, ByteOrder}; -use clap::{builder::PossibleValue, Parser, ValueEnum}; +use clap::{Parser, ValueEnum, builder::PossibleValue}; use haversine::haversine::{CoordinatePair, HaversineData}; use haversine::{distance, earth}; use json::json_object::JsonValue; @@ -149,11 +149,7 @@ where let x1 = range.sample(rng); let x2 = range.sample(rng); - if x1 < x2 { - (x1, x2) - } else { - (x2, x1) - } + if x1 < x2 { (x1, x2) } else { (x2, x1) } } fn sample_point(rng: &mut R, x_range: D1, y_range: D2) -> CoordinatePair diff --git a/haversine-app/Cargo.toml b/haversine-app/Cargo.toml index 5cddd49..8491899 100644 --- a/haversine-app/Cargo.toml +++ b/haversine-app/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "haversine-app" version = "0.1.0" -edition = "2021" +edition.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/haversine-app/src/main.rs b/haversine-app/src/main.rs index beab1f8..a034f1c 100644 --- a/haversine-app/src/main.rs +++ b/haversine-app/src/main.rs @@ -82,7 +82,10 @@ fn haversine_sum(v: &[CoordinatePair], reference: &[f64]) -> f64 { for (count, pair) in v.iter().enumerate() { let computed = distance::naive(pair, earth::RADIUS); if computed != reference[count] { - println!("Different! At index {}, received pair: {:?}, computed distance {computed}, expected {}", count, pair, reference[count]) + println!( + "Different! At index {}, received pair: {:?}, computed distance {computed}, expected {}", + count, pair, reference[count] + ) } answer = ((1.0 - (1.0 / (count as f64 + 1.0))) * answer) + (computed / (count as f64 + 1.0)); diff --git a/haversine/Cargo.toml b/haversine/Cargo.toml index 7239e6b..06f41f4 100644 --- a/haversine/Cargo.toml +++ b/haversine/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "haversine" version = "0.1.0" -edition = "2021" +edition.workspace = true [lib] diff --git a/json/Cargo.toml b/json/Cargo.toml index 0d9e09d..40daec2 100644 --- a/json/Cargo.toml +++ b/json/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "json" version = "0.1.0" -edition = "2021" +edition.workspace = true [lib] diff --git a/sim-wrapper/Cargo.toml b/sim-wrapper/Cargo.toml index 3c1ae1e..6f0655b 100644 --- a/sim-wrapper/Cargo.toml +++ b/sim-wrapper/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "sim-wrapper" version = "0.1.0" -edition = "2021" +edition.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/sim-wrapper/src/main.rs b/sim-wrapper/src/main.rs index 22bd0cd..358f8c6 100644 --- a/sim-wrapper/src/main.rs +++ b/sim-wrapper/src/main.rs @@ -90,12 +90,18 @@ fn verify_consistency(pre_compiled: &Vec, asm: &str) { let disassembled = Program::of_bytes(pre_compiled.iter().cloned()); if disassembled != compiled { - println!("Disassembled and compiled versions do not produce the same bytes. From disassembly:\n{}\nFrom assembling the input asm:\n{}", disassembled, compiled); + println!( + "Disassembled and compiled versions do not produce the same bytes. From disassembly:\n{}\nFrom assembling the input asm:\n{}", + disassembled, compiled + ); std::process::exit(3) } if !program_equal_ignoring_labels(&disassembled, &compiled) { - println!("Program failed to disassemble back to the compiled version. Compiled:\n{}\nDisassembled again:\n{}", compiled, disassembled); + println!( + "Program failed to disassemble back to the compiled version. Compiled:\n{}\nDisassembled again:\n{}", + compiled, disassembled + ); std::process::exit(4) } diff --git a/sim_8086/Cargo.toml b/sim_8086/Cargo.toml index cce1205..e13e4c2 100644 --- a/sim_8086/Cargo.toml +++ b/sim_8086/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "sim_8086" version = "0.1.0" -edition = "2021" +edition.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/sim_8086/src/assembly.rs b/sim_8086/src/assembly.rs index c2b1e29..e21f71b 100644 --- a/sim_8086/src/assembly.rs +++ b/sim_8086/src/assembly.rs @@ -1,4 +1,5 @@ use nom::{ + IResult, branch::alt, bytes::complete::{is_not, tag}, character::complete::{ @@ -8,7 +9,6 @@ use nom::{ error::FromExternalError, multi::{many0, many1}, sequence::{delimited, preceded, separated_pair, terminated, tuple}, - IResult, }; use crate::boolean_instruction::{ diff --git a/sim_8086/tests/test_program.rs b/sim_8086/tests/test_program.rs index 7b04d47..ae66621 100644 --- a/sim_8086/tests/test_program.rs +++ b/sim_8086/tests/test_program.rs @@ -119,8 +119,7 @@ mod test_program { { println!( "Different instruction. From disassembly: {dis} ({:?}). From our compilation: {compiled} ({:?}).", - dis_bytes, - compiled_bytes + dis_bytes, compiled_bytes ); is_different = true; } @@ -143,7 +142,9 @@ mod test_program { } if is_different { - panic!("Disassembling input bytecode produced a different program from compiling the input asm.") + panic!( + "Disassembling input bytecode produced a different program from compiling the input asm." + ) } }