diff --git a/Cargo.toml b/Cargo.toml index 93abf39708..8dfa79cbdf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,6 +21,7 @@ exclude = [ "analysis/tests", "examples", "tests", + "tools", ] [workspace.package] diff --git a/tools/README.md b/tools/README.md new file mode 100644 index 0000000000..0583551071 --- /dev/null +++ b/tools/README.md @@ -0,0 +1,20 @@ +# C2Rust CRISP tools + +- `merge_rust` +- `split_rust` +- `split_ffi_entry_points` + +## Building + +These tools rely on rust-analyzer's libraries, so they need a relatively recent version of Rust. Run `cargo build --release` in their respective directories to build them. + +## Running + +`split_rust` and `merge_rust` expect the root source file of a Rust project as their first argument, e.g. `lib.rs` or `main.rs`. + +- `merge_rust` modifies the specified codebase in-place. +- `split_rust` emits JSON on standard output. + +`split_ffi_entry_points` expects a Rust project directory (the directory containing a `Cargo.toml` file) as its only argument. + +It modifies that Rust project in-place. diff --git a/tools/merge_rust/Cargo.lock b/tools/merge_rust/Cargo.lock new file mode 100644 index 0000000000..ca20e777f6 --- /dev/null +++ b/tools/merge_rust/Cargo.lock @@ -0,0 +1,260 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "anstream" +version = "0.6.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" + +[[package]] +name = "anstyle-parse" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys", +] + +[[package]] +name = "clap" +version = "4.5.53" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9e340e012a1bf4935f5282ed1436d1489548e8f72308207ea5df0e23d2d03f8" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.5.53" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d76b5d13eaa18c901fd2f7fca939fefe3a0727a953561fefdf3b2922b8569d00" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.5.49" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a0b5487afeab2deb2ff4e03a807ad1a03ac532ff5a2cee5d86884440c7f7671" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d" + +[[package]] +name = "colorchoice" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + +[[package]] +name = "itoa" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" + +[[package]] +name = "memchr" +version = "2.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" + +[[package]] +name = "merge_rust" +version = "0.1.0" +dependencies = [ + "clap", + "proc-macro2", + "quote", + "rust_util", + "serde_json", + "syn", +] + +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + +[[package]] +name = "proc-macro2" +version = "1.0.103" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rust_util" +version = "0.1.0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "ryu" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" + +[[package]] +name = "serde" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.145" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", + "serde_core", +] + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "syn" +version = "2.0.110" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a99801b5bd34ede4cf3fc688c5919368fea4e4814a4664359503e6015b280aea" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "unicode-ident" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] diff --git a/tools/merge_rust/Cargo.toml b/tools/merge_rust/Cargo.toml new file mode 100644 index 0000000000..f6f241940d --- /dev/null +++ b/tools/merge_rust/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "merge_rust" +version = "0.1.0" +edition = "2024" + +[dependencies] +rust_util = { path = "../rust_util" } + +syn = { version = "2.0.108", features = ["full", "visit"] } +proc-macro2 = { version = "1", features = ["span-locations"] } +clap = { version = "4.5", features = ["derive"] } +quote = "1" + +serde_json = "1" diff --git a/tools/merge_rust/src/main.rs b/tools/merge_rust/src/main.rs new file mode 100644 index 0000000000..266158ddcd --- /dev/null +++ b/tools/merge_rust/src/main.rs @@ -0,0 +1,70 @@ +use clap::Parser; +use rust_util::collect::FileCollector; +use rust_util::item_span::item_spans; +use serde_json; +use std::collections::HashMap; +use std::fs::{self, File}; +use std::path::PathBuf; + +/// Merge updated item definitions into a Rust codebase. +#[derive(Parser)] +struct Args { + /// Root Rust source file to update (`lib.rs` or `main.rs`). + src_root_path: PathBuf, + /// JSON file containing mapping from Rust item paths to desired new contents. + new_snippets_file: PathBuf, +} + +fn main() { + let args = Args::parse(); + let src_root_path = args.src_root_path; + let new_snippet_json_path = args.new_snippets_file; + + let new_snippets_file = File::open(&new_snippet_json_path).unwrap(); + let new_snippets: HashMap = serde_json::from_reader(new_snippets_file).unwrap(); + + let mut fc = FileCollector::default(); + fc.parse(&src_root_path, vec![], true).unwrap(); + for &(ref file_path, ref mod_path, ref ast) in &fc.files { + eprintln!("visit {:?}", file_path); + let old_src = fs::read_to_string(file_path).unwrap(); + + let mut rewrites = Vec::new(); + for (item_path, lo, hi) in item_spans(mod_path.to_owned(), ast) { + let old_snippet = &old_src[lo..hi]; + let item_path_str = item_path.join("::"); + if let Some(new_snippet) = new_snippets.get(&item_path_str) { + if new_snippet != old_snippet { + rewrites.push((lo, hi, new_snippet)); + } + } + } + + if rewrites.len() == 0 { + continue; + } + + rewrites.sort_by_key(|&(lo, _, _)| lo); + let mut new_src = String::with_capacity(old_src.len()); + let mut pos = 0; + for &(lo, hi, new_snippet) in &rewrites { + assert!( + lo >= pos, + "overlapping rewrites: previous rewrite ended at {}, \ + but current rewrite covers {} .. {}", + pos, + lo, + hi + ); + new_src.push_str(&old_src[pos..lo]); + new_src.push_str(new_snippet); + pos = hi; + } + new_src.push_str(&old_src[pos..]); + + let tmp_path = file_path.with_extension(".new"); + fs::write(&tmp_path, &new_src).unwrap(); + fs::rename(&tmp_path, file_path).unwrap(); + eprintln!("applied {} rewrites to {:?}", rewrites.len(), file_path); + } +} diff --git a/tools/related_decls/Cargo.lock b/tools/related_decls/Cargo.lock new file mode 100644 index 0000000000..bee8145082 --- /dev/null +++ b/tools/related_decls/Cargo.lock @@ -0,0 +1,2047 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "allocator-api2" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" + +[[package]] +name = "anyhow" +version = "1.0.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" + +[[package]] +name = "arrayvec" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" + +[[package]] +name = "autocfg" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" + +[[package]] +name = "borsh" +version = "1.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad8646f98db542e39fc66e68a20b2144f6a732636df7c2354e74645faaa433ce" +dependencies = [ + "cfg_aliases", +] + +[[package]] +name = "boxcar" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36f64beae40a84da1b4b26ff2761a5b895c12adc41dc25aaee1c4f2bbfe97a6e" + +[[package]] +name = "camino" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "276a59bf2b2c967788139340c9f0c5b12d7fd6630315c15c217e559de85d2609" +dependencies = [ + "serde_core", +] + +[[package]] +name = "cargo-platform" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84982c6c0ae343635a3a4ee6dedef965513735c8b183caa7289fa6e27399ebd4" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo-util-schemas" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dc1a6f7b5651af85774ae5a34b4e8be397d9cf4bc063b7e6dbd99a841837830" +dependencies = [ + "semver", + "serde", + "serde-untagged", + "serde-value", + "thiserror", + "toml", + "unicode-xid", + "url", +] + +[[package]] +name = "cargo_metadata" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cfca2aaa699835ba88faf58a06342a314a950d2b9686165e038286c30316868" +dependencies = [ + "camino", + "cargo-platform", + "cargo-util-schemas", + "semver", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + +[[package]] +name = "chalk-derive" +version = "0.103.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb4899682de915ca7c0b025bdd0a3d34c75fe12184122fda6805a7baddaa293c" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "chalk-ir" +version = "0.103.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90a37d2ab99352b4caca135061e7b4ac67024b648c28ed0b787feec4bea4caed" +dependencies = [ + "bitflags 2.10.0", + "chalk-derive", +] + +[[package]] +name = "chalk-recursive" +version = "0.103.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c855be60e646664bc37c2496d3dc81ca5ef60520930e5e0f0057a0575aff6c19" +dependencies = [ + "chalk-derive", + "chalk-ir", + "chalk-solve", + "rustc-hash 1.1.0", + "tracing", +] + +[[package]] +name = "chalk-solve" +version = "0.103.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "477ac6cdfd2013e9f93b09b036c2b607a67b2e728f4777b8422d55a79e9e3a34" +dependencies = [ + "chalk-derive", + "chalk-ir", + "ena", + "indexmap", + "itertools 0.12.1", + "petgraph", + "rustc-hash 1.1.0", + "tracing", +] + +[[package]] +name = "countme" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7704b5fdd17b18ae31c4c1da5a2e0305a2bf17b5249300a9ee9ed7b72114c636" + +[[package]] +name = "cov-mark" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90863d8442510cddf7f46618c4f92413774635771a3e80830c8b30d183420b14" + +[[package]] +name = "crossbeam-channel" +version = "0.5.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82b8f8f868b36967f9606790d1903570de9ceaf870a7bf9fbbd3016d636a2cb2" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-queue" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f58bbc28f91df819d0aa2a2c00cd19754769c2fad90579b3592b1c9ba7a3115" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "dashmap" +version = "6.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5041cc499144891f3790297212f32a74fb938e5136a14943f338ef9e0ae276cf" +dependencies = [ + "cfg-if", + "crossbeam-utils", + "hashbrown 0.14.5", + "lock_api", + "once_cell", + "parking_lot_core", +] + +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "drop_bomb" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bda8e21c04aca2ae33ffc2fd8c23134f3cac46db123ba97bd9d3f3b8a4a85e1" + +[[package]] +name = "either" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" + +[[package]] +name = "ena" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d248bdd43ce613d87415282f69b9bb99d947d290b10962dd6c56233312c2ad5" +dependencies = [ + "log", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "erased-serde" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "259d404d09818dec19332e31d94558aeb442fea04c817006456c24b5460bbd4b" +dependencies = [ + "serde", + "serde_core", + "typeid", +] + +[[package]] +name = "fixedbitset" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" + +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "fsevent-sys" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76ee7a02da4d231650c7cea31349b889be2f45ddb3ef3032d2ec8185f6313fd2" +dependencies = [ + "libc", +] + +[[package]] +name = "fst" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ab85b9b05e3978cc9a9cf8fea7f01b494e1a09ed3037e16ba39edc7a29eb61a" + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" + +[[package]] +name = "hashbrown" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash", +] + +[[package]] +name = "hashbrown" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d" + +[[package]] +name = "hashlink" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1" +dependencies = [ + "hashbrown 0.15.5", +] + +[[package]] +name = "home" +version = "0.5.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc627f471c528ff0c4a49e1d5e60450c8f6461dd6d10ba9dcd3a61d3dff7728d" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "icu_collections" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43" +dependencies = [ + "displaydoc", + "potential_utf", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f6c8828b67bf8908d82127b2054ea1b4427ff0230ee9141c54251934ab1b599" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a" + +[[package]] +name = "icu_properties" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e93fcd3157766c0c8da2f8cff6ce651a31f0810eaa1c51ec363ef790bbb5fb99" +dependencies = [ + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02845b3647bb045f1100ecd6480ff52f34c35f82d9880e029d329c21d1054899" + +[[package]] +name = "icu_provider" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "indexmap" +version = "2.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6717a8d2a5a929a1a2eb43a12812498ed141a0bcfb7e8f7844fbdbe4303bba9f" +dependencies = [ + "equivalent", + "hashbrown 0.16.0", + "serde", + "serde_core", +] + +[[package]] +name = "inotify" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f37dccff2791ab604f9babef0ba14fbe0be30bd368dc541e2b08d07c8aa908f3" +dependencies = [ + "bitflags 2.10.0", + "inotify-sys", + "libc", +] + +[[package]] +name = "inotify-sys" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e05c02b5e89bff3b946cedeca278abc628fe811e604f027c45a8aa3cf793d0eb" +dependencies = [ + "libc", +] + +[[package]] +name = "intrusive-collections" +version = "0.9.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "189d0897e4cbe8c75efedf3502c18c887b05046e59d28404d4d8e46cbc4d1e86" +dependencies = [ + "memoffset", +] + +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" + +[[package]] +name = "jod-thread" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a037eddb7d28de1d0fc42411f501b53b75838d313908078d6698d064f3029b24" + +[[package]] +name = "kqueue" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eac30106d7dce88daf4a3fcb4879ea939476d5074a9b7ddd0fb97fa4bed5596a" +dependencies = [ + "kqueue-sys", + "libc", +] + +[[package]] +name = "kqueue-sys" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed9625ffda8729b85e45cf04090035ac368927b8cebc34898e7c120f52e4838b" +dependencies = [ + "bitflags 1.3.2", + "libc", +] + +[[package]] +name = "la-arena" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3752f229dcc5a481d60f385fa479ff46818033d881d2d801aa27dffcfb5e8306" + +[[package]] +name = "libc" +version = "0.2.177" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976" + +[[package]] +name = "line-index" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e27e0ed5a392a7f5ba0b3808a2afccff16c64933312c84b57618b49d1209bd2" +dependencies = [ + "nohash-hasher", + "text-size", +] + +[[package]] +name = "litemap" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432" + +[[package]] +name = "memchr" +version = "2.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" + +[[package]] +name = "memoffset" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" +dependencies = [ + "autocfg", +] + +[[package]] +name = "mio" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69d83b0086dc8ecf3ce9ae2874b2d1290252e2a30720bea58a5c6639b0092873" +dependencies = [ + "libc", + "log", + "wasi", + "windows-sys 0.61.2", +] + +[[package]] +name = "miow" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "536bfad37a309d62069485248eeaba1e8d9853aaf951caaeaed0585a95346f08" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "nohash-hasher" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" + +[[package]] +name = "notify" +version = "8.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d3d07927151ff8575b7087f245456e549fea62edf0ec4e565a5ee50c8402bc3" +dependencies = [ + "bitflags 2.10.0", + "fsevent-sys", + "inotify", + "kqueue", + "libc", + "log", + "mio", + "notify-types", + "walkdir", + "windows-sys 0.60.2", +] + +[[package]] +name = "notify-types" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e0826a989adedc2a244799e823aece04662b66609d96af8dff7ac6df9a8925d" + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "once_cell" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "oorandom" +version = "11.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6790f58c7ff633d8771f42965289203411a5e5c68388703c06e14f24770b41e" + +[[package]] +name = "ordered-float" +version = "2.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68f19d67e5a2795c94e73e0bb1cc1a7edeb2e28efd39e2e1c9b7a40c1108b11c" +dependencies = [ + "num-traits", +] + +[[package]] +name = "papaya" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f92dd0b07c53a0a0c764db2ace8c541dc47320dad97c2200c2a637ab9dd2328f" +dependencies = [ + "equivalent", + "seize", +] + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-link", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "perf-event" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5396562cd2eaa828445d6d34258ae21ee1eb9d40fe626ca7f51c8dccb4af9d66" +dependencies = [ + "libc", + "perf-event-open-sys", +] + +[[package]] +name = "perf-event-open-sys" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce9bedf5da2c234fdf2391ede2b90fabf585355f33100689bc364a3ea558561a" +dependencies = [ + "libc", +] + +[[package]] +name = "petgraph" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" +dependencies = [ + "fixedbitset", + "indexmap", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" + +[[package]] +name = "portable-atomic" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483" + +[[package]] +name = "potential_utf" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77" +dependencies = [ + "zerovec", +] + +[[package]] +name = "proc-macro2" +version = "1.0.101" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "ra-ap-rustc_abi" +version = "0.123.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f18c877575c259d127072e9bfc41d985202262fb4d6bfdae3d1252147c2562c2" +dependencies = [ + "bitflags 2.10.0", + "ra-ap-rustc_hashes", + "ra-ap-rustc_index", + "tracing", +] + +[[package]] +name = "ra-ap-rustc_hashes" +version = "0.123.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2439ed1df3472443133b66949f81080dff88089b42f825761455463709ee1cad" +dependencies = [ + "rustc-stable-hash", +] + +[[package]] +name = "ra-ap-rustc_index" +version = "0.123.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57a24fe0be21be1f8ebc21dcb40129214fb4cefb0f2753f3d46b6dbe656a1a45" +dependencies = [ + "ra-ap-rustc_index_macros", + "smallvec", +] + +[[package]] +name = "ra-ap-rustc_index_macros" +version = "0.123.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "844a27ddcad0116facae2df8e741fd788662cf93dc13029cd864f2b8013b81f9" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "ra-ap-rustc_lexer" +version = "0.121.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22944e31fb91e9b3e75bcbc91e37d958b8c0825a6160927f2856831d2ce83b36" +dependencies = [ + "memchr", + "unicode-properties", + "unicode-xid", +] + +[[package]] +name = "ra-ap-rustc_lexer" +version = "0.123.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b734cfcb577d09877799a22742f1bd398be6c00bc428d9de56d48d11ece5771" +dependencies = [ + "memchr", + "unicode-properties", + "unicode-xid", +] + +[[package]] +name = "ra-ap-rustc_parse_format" +version = "0.121.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81057891bc2063ad9e353f29462fbc47a0f5072560af34428ae9313aaa5e9d97" +dependencies = [ + "ra-ap-rustc_lexer 0.121.0", + "rustc-literal-escaper", +] + +[[package]] +name = "ra-ap-rustc_pattern_analysis" +version = "0.123.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b0ee1f059b9dea0818c6c7267478926eee95ba4c7dcf89c8db32fa165d3904" +dependencies = [ + "ra-ap-rustc_index", + "rustc-hash 2.1.1", + "rustc_apfloat", + "smallvec", + "tracing", +] + +[[package]] +name = "ra_ap_base_db" +version = "0.0.301" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e876bb2c3e52a8d4e6684526a2d4e81f9d028b939ee4dc5dc775fe10deb44d59" +dependencies = [ + "dashmap", + "indexmap", + "la-arena", + "ra_ap_cfg", + "ra_ap_intern", + "ra_ap_query-group-macro", + "ra_ap_span", + "ra_ap_syntax", + "ra_ap_vfs", + "rustc-hash 2.1.1", + "salsa", + "salsa-macros", + "semver", + "tracing", + "triomphe", +] + +[[package]] +name = "ra_ap_cfg" +version = "0.0.301" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a0b56eb4536ce6d2431932c4d337aeeaf7bb22c9249b38cbe80677b5881228f" +dependencies = [ + "ra_ap_intern", + "ra_ap_tt", + "rustc-hash 2.1.1", + "tracing", +] + +[[package]] +name = "ra_ap_edition" +version = "0.0.301" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bdc6cbe42c63ca78611bae82bfc8db24864f33dccc813697c5fde43a0907285" + +[[package]] +name = "ra_ap_hir" +version = "0.0.301" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebffdc134eccabc17209d7760cfff7fd12ed18ab6e21188c5e084b97aa38504c" +dependencies = [ + "arrayvec", + "either", + "indexmap", + "itertools 0.14.0", + "ra_ap_base_db", + "ra_ap_cfg", + "ra_ap_hir_def", + "ra_ap_hir_expand", + "ra_ap_hir_ty", + "ra_ap_intern", + "ra_ap_span", + "ra_ap_stdx", + "ra_ap_syntax", + "ra_ap_tt", + "rustc-hash 2.1.1", + "smallvec", + "tracing", + "triomphe", +] + +[[package]] +name = "ra_ap_hir_def" +version = "0.0.301" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81d2337ef59550392d42aa997aa1105a3d6d1c2b3a583c777786bc4a0a074fd5" +dependencies = [ + "arrayvec", + "bitflags 2.10.0", + "cov-mark", + "drop_bomb", + "either", + "fst", + "indexmap", + "itertools 0.14.0", + "la-arena", + "ra-ap-rustc_abi", + "ra-ap-rustc_parse_format", + "ra_ap_base_db", + "ra_ap_cfg", + "ra_ap_hir_expand", + "ra_ap_intern", + "ra_ap_mbe", + "ra_ap_query-group-macro", + "ra_ap_span", + "ra_ap_stdx", + "ra_ap_syntax", + "ra_ap_tt", + "rustc-hash 2.1.1", + "rustc_apfloat", + "salsa", + "salsa-macros", + "smallvec", + "text-size", + "thin-vec", + "tracing", + "triomphe", +] + +[[package]] +name = "ra_ap_hir_expand" +version = "0.0.301" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97cf8ececb2743a819d8299a408e17f164dd1a1004d65936b3d5493b55330326" +dependencies = [ + "cov-mark", + "either", + "itertools 0.14.0", + "ra_ap_base_db", + "ra_ap_cfg", + "ra_ap_intern", + "ra_ap_mbe", + "ra_ap_parser", + "ra_ap_query-group-macro", + "ra_ap_span", + "ra_ap_stdx", + "ra_ap_syntax", + "ra_ap_syntax-bridge", + "ra_ap_tt", + "rustc-hash 2.1.1", + "salsa", + "salsa-macros", + "smallvec", + "tracing", + "triomphe", +] + +[[package]] +name = "ra_ap_hir_ty" +version = "0.0.301" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc004e1099ba766a61500c27d34eb5cd336430d0a89a9620315a90d7a202a73a" +dependencies = [ + "arrayvec", + "bitflags 2.10.0", + "chalk-derive", + "chalk-ir", + "chalk-recursive", + "chalk-solve", + "cov-mark", + "either", + "ena", + "indexmap", + "itertools 0.14.0", + "la-arena", + "oorandom", + "ra-ap-rustc_abi", + "ra-ap-rustc_index", + "ra-ap-rustc_pattern_analysis", + "ra_ap_base_db", + "ra_ap_hir_def", + "ra_ap_hir_expand", + "ra_ap_intern", + "ra_ap_query-group-macro", + "ra_ap_span", + "ra_ap_stdx", + "ra_ap_syntax", + "rustc-hash 2.1.1", + "rustc_apfloat", + "salsa", + "salsa-macros", + "scoped-tls", + "smallvec", + "tracing", + "triomphe", + "typed-arena", +] + +[[package]] +name = "ra_ap_ide_db" +version = "0.0.301" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2acb572d6dbeb1c96d0339890ba91298b8f5f0ab22648da4ee2b4ab77dbc3fe" +dependencies = [ + "arrayvec", + "bitflags 2.10.0", + "cov-mark", + "crossbeam-channel", + "either", + "fst", + "indexmap", + "itertools 0.14.0", + "line-index", + "memchr", + "nohash-hasher", + "ra_ap_base_db", + "ra_ap_hir", + "ra_ap_parser", + "ra_ap_profile", + "ra_ap_query-group-macro", + "ra_ap_span", + "ra_ap_stdx", + "ra_ap_syntax", + "ra_ap_vfs", + "rayon", + "rustc-hash 2.1.1", + "salsa", + "salsa-macros", + "tracing", + "triomphe", +] + +[[package]] +name = "ra_ap_intern" +version = "0.0.301" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14586c2c4781b69fdd0c505972d9bff8c162a8740537a3ee506faff686d9a20d" +dependencies = [ + "dashmap", + "hashbrown 0.14.5", + "rustc-hash 2.1.1", + "triomphe", +] + +[[package]] +name = "ra_ap_load-cargo" +version = "0.0.301" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50ce5546b3e3414507ab4d12348d0a28748062e33a1448895c68466d0b015503" +dependencies = [ + "anyhow", + "crossbeam-channel", + "itertools 0.14.0", + "ra_ap_hir_expand", + "ra_ap_ide_db", + "ra_ap_intern", + "ra_ap_proc_macro_api", + "ra_ap_project_model", + "ra_ap_span", + "ra_ap_tt", + "ra_ap_vfs", + "ra_ap_vfs-notify", + "tracing", +] + +[[package]] +name = "ra_ap_mbe" +version = "0.0.301" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67333c6405797cb64aafb994b9a179157b30beeda2352e203e800be2b184a22d" +dependencies = [ + "arrayvec", + "cov-mark", + "ra-ap-rustc_lexer 0.123.0", + "ra_ap_intern", + "ra_ap_parser", + "ra_ap_span", + "ra_ap_stdx", + "ra_ap_syntax-bridge", + "ra_ap_tt", + "rustc-hash 2.1.1", + "smallvec", +] + +[[package]] +name = "ra_ap_parser" +version = "0.0.301" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a3b92b8b147c0826b83e70ad44e3c98e94201fc93e1f09396c43b4d7958c22a" +dependencies = [ + "drop_bomb", + "ra-ap-rustc_lexer 0.123.0", + "ra_ap_edition", + "rustc-literal-escaper", + "tracing", +] + +[[package]] +name = "ra_ap_paths" +version = "0.0.301" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4991f3d57fac0def7822bebfeb159c8d7b58c824bf82044b765c54f2c0971e2" +dependencies = [ + "camino", +] + +[[package]] +name = "ra_ap_proc_macro_api" +version = "0.0.301" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45db9e2df587d56f0738afa89fb2c100ff7c1e9cbe49e07f6a8b62342832211b" +dependencies = [ + "indexmap", + "ra_ap_intern", + "ra_ap_paths", + "ra_ap_span", + "ra_ap_stdx", + "ra_ap_tt", + "rustc-hash 2.1.1", + "serde", + "serde_derive", + "serde_json", + "tracing", +] + +[[package]] +name = "ra_ap_profile" +version = "0.0.301" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19981637b8ee4160e228c815a7fef3944b5c0555d6af41a931be92d68978bc6c" +dependencies = [ + "cfg-if", + "libc", + "perf-event", + "windows-sys 0.60.2", +] + +[[package]] +name = "ra_ap_project_model" +version = "0.0.301" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bda0769fd6ca949fdd5917acb68ddc2c143745614ddd94ef38b376838611cf8" +dependencies = [ + "anyhow", + "cargo_metadata", + "itertools 0.14.0", + "la-arena", + "ra_ap_base_db", + "ra_ap_cfg", + "ra_ap_intern", + "ra_ap_paths", + "ra_ap_span", + "ra_ap_stdx", + "ra_ap_toolchain", + "rustc-hash 2.1.1", + "semver", + "serde", + "serde_derive", + "serde_json", + "temp-dir", + "tracing", + "triomphe", +] + +[[package]] +name = "ra_ap_query-group-macro" +version = "0.0.301" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f182a4b05f004eabaa83250a5de7ea3a13a92c88f3cbe98bfa1880cd9fbce0a" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "ra_ap_span" +version = "0.0.301" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca6f9fa2de07f5cccf431674b90e82c1fe1ea2339db3b3869eec44d135de09a4" +dependencies = [ + "hashbrown 0.14.5", + "la-arena", + "ra_ap_stdx", + "ra_ap_syntax", + "ra_ap_vfs", + "rustc-hash 2.1.1", + "salsa", + "text-size", +] + +[[package]] +name = "ra_ap_stdx" +version = "0.0.301" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa770adb32896fcba934b464ac3bd179163ba2b0766e275eed5b4e262e08492b" +dependencies = [ + "crossbeam-channel", + "crossbeam-utils", + "itertools 0.14.0", + "jod-thread", + "libc", + "miow", + "tracing", + "windows-sys 0.60.2", +] + +[[package]] +name = "ra_ap_syntax" +version = "0.0.301" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e9e1393281ad5c635239d353ed3cfbf28c8d0af03d0c61a3b24b31d1143b17f" +dependencies = [ + "either", + "itertools 0.14.0", + "ra_ap_parser", + "ra_ap_stdx", + "rowan", + "rustc-hash 2.1.1", + "rustc-literal-escaper", + "smol_str", + "tracing", + "triomphe", +] + +[[package]] +name = "ra_ap_syntax-bridge" +version = "0.0.301" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "684e6ff1008ee5340335888f0453d94bb38950f110059a51f1818c7f6a56a807" +dependencies = [ + "ra_ap_intern", + "ra_ap_parser", + "ra_ap_span", + "ra_ap_stdx", + "ra_ap_syntax", + "ra_ap_tt", + "rustc-hash 2.1.1", +] + +[[package]] +name = "ra_ap_toolchain" +version = "0.0.301" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61969c5f72af03a9837e077c2d939d87a5c863623725c461777c352664a3bb03" +dependencies = [ + "camino", + "home", +] + +[[package]] +name = "ra_ap_tt" +version = "0.0.301" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb87c7b35572c18a580ea811e970b94875fad5ac7cfa8644266a59081044f959" +dependencies = [ + "arrayvec", + "ra-ap-rustc_lexer 0.123.0", + "ra_ap_intern", + "ra_ap_stdx", + "text-size", +] + +[[package]] +name = "ra_ap_vfs" +version = "0.0.301" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c174d6b9b7a7f54687df7e00c3e75ed6f082a7943a9afb1d54f33c0c12773de" +dependencies = [ + "crossbeam-channel", + "fst", + "indexmap", + "nohash-hasher", + "ra_ap_paths", + "ra_ap_stdx", + "rustc-hash 2.1.1", + "tracing", +] + +[[package]] +name = "ra_ap_vfs-notify" +version = "0.0.301" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04f6fce8d47c7ce9b8f2cd0e5a55f8fc4878d6043e61f46cde4391d3a5c6086f" +dependencies = [ + "crossbeam-channel", + "notify", + "ra_ap_paths", + "ra_ap_stdx", + "ra_ap_vfs", + "rayon", + "rustc-hash 2.1.1", + "tracing", + "walkdir", +] + +[[package]] +name = "rayon" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags 2.10.0", +] + +[[package]] +name = "rowan" +version = "0.15.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a58fa8a7ccff2aec4f39cc45bf5f985cec7125ab271cf681c279fd00192b49" +dependencies = [ + "countme", + "hashbrown 0.14.5", + "memoffset", + "rustc-hash 1.1.0", + "text-size", +] + +[[package]] +name = "rust_util" +version = "0.1.0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustc-hash" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" + +[[package]] +name = "rustc-literal-escaper" +version = "0.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab03008eb631b703dd16978282ae36c73282e7922fe101a4bd072a40ecea7b8b" + +[[package]] +name = "rustc-stable-hash" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "781442f29170c5c93b7185ad559492601acdc71d5bb0706f5868094f45cfcd08" + +[[package]] +name = "rustc_apfloat" +version = "0.2.3+llvm-462a31f5a5ab" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "486c2179b4796f65bfe2ee33679acf0927ac83ecf583ad6c91c3b4570911b9ad" +dependencies = [ + "bitflags 2.10.0", + "smallvec", +] + +[[package]] +name = "ryu" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" + +[[package]] +name = "salsa" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e235afdb8e510f38a07138fbe5a0b64691894358a9c0cbd813b1aade110efc9" +dependencies = [ + "boxcar", + "crossbeam-queue", + "crossbeam-utils", + "hashbrown 0.15.5", + "hashlink", + "indexmap", + "intrusive-collections", + "papaya", + "parking_lot", + "portable-atomic", + "rayon", + "rustc-hash 2.1.1", + "salsa-macro-rules", + "salsa-macros", + "smallvec", + "thin-vec", + "tracing", +] + +[[package]] +name = "salsa-macro-rules" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2edb86a7e9c91f6d30c9ce054312721dbe773a162db27bbfae834d16177b30ce" + +[[package]] +name = "salsa-macros" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0778d6e209051bc4e75acfe83bcd7848601ec3dbe9c3dbb982829020e9128af" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "scoped-tls" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "seize" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b55fb86dfd3a2f5f76ea78310a88f96c4ea21a3031f8d212443d56123fd0521" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "semver" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" +dependencies = [ + "serde", + "serde_core", +] + +[[package]] +name = "serde" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde-untagged" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9faf48a4a2d2693be24c6289dbe26552776eb7737074e6722891fadbe6c5058" +dependencies = [ + "erased-serde", + "serde", + "serde_core", + "typeid", +] + +[[package]] +name = "serde-value" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3a1a3341211875ef120e117ea7fd5228530ae7e7036a779fdc9117be6b3282c" +dependencies = [ + "ordered-float", + "serde", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.145" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", + "serde_core", +] + +[[package]] +name = "serde_spanned" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" +dependencies = [ + "serde", +] + +[[package]] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" + +[[package]] +name = "smol_str" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3498b0a27f93ef1402f20eefacfaa1691272ac4eca1cdc8c596cb0a245d6cbf5" +dependencies = [ + "borsh", + "serde_core", +] + +[[package]] +name = "split_ffi_entry_points" +version = "0.1.0" +dependencies = [ + "proc-macro2", + "quote", + "ra_ap_hir", + "ra_ap_ide_db", + "ra_ap_load-cargo", + "ra_ap_project_model", + "ra_ap_syntax", + "rust_util", + "syn", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "syn" +version = "2.0.108" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da58917d35242480a05c2897064da0a80589a2a0476c9a3f2fdc83b53502e917" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "synstructure" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "temp-dir" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83176759e9416cf81ee66cb6508dbfe9c96f20b8b56265a39917551c23c70964" + +[[package]] +name = "text-size" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f18aa187839b2bdb1ad2fa35ead8c4c2976b64e4363c386d45ac0f7ee85c9233" + +[[package]] +name = "thin-vec" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "144f754d318415ac792f9d69fc87abbbfc043ce2ef041c60f16ad828f638717d" + +[[package]] +name = "thiserror" +version = "2.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tinystr" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "toml" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.22.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "toml_write", + "winnow", +] + +[[package]] +name = "toml_write" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" + +[[package]] +name = "tracing" +version = "0.1.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing-core" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678" +dependencies = [ + "once_cell", +] + +[[package]] +name = "triomphe" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd69c5aa8f924c7519d6372789a74eac5b94fb0f8fcf0d4a97eb0bfc3e785f39" + +[[package]] +name = "typed-arena" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6af6ae20167a9ece4bcb41af5b80f8a1f1df981f6391189ce00fd257af04126a" + +[[package]] +name = "typeid" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc7d623258602320d5c55d1bc22793b57daff0ec7efc270ea7d55ce1d5f5471c" + +[[package]] +name = "unicode-ident" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f63a545481291138910575129486daeaf8ac54aee4387fe7906919f7830c7d9d" + +[[package]] +name = "unicode-properties" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e70f2a8b45122e719eb623c01822704c4e0907e7e426a05927e1a1cfff5b75d0" + +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + +[[package]] +name = "url" +version = "2.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08bc136a29a3d1758e07a9cca267be308aeebf5cfd5a10f3f67ab2097683ef5b" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-sys" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-targets" +version = "0.53.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" +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", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" + +[[package]] +name = "windows_i686_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" + +[[package]] +name = "windows_i686_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" + +[[package]] +name = "winnow" +version = "0.7.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21a0236b59786fed61e2a80582dd500fe61f18b5dca67a4a067d0bc9039339cf" +dependencies = [ + "memchr", +] + +[[package]] +name = "writeable" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" + +[[package]] +name = "yoke" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72d6e5c6afb84d73944e5cedb052c4680d5657337201555f9f2a16b7406d4954" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerofrom" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerotrie" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a59c17a5562d507e4b54960e8569ebee33bee890c70aa3fe7b97e85a9fd7851" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] diff --git a/tools/related_decls/Cargo.toml b/tools/related_decls/Cargo.toml new file mode 100644 index 0000000000..ecbd805879 --- /dev/null +++ b/tools/related_decls/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "related_decls" +version = "0.1.0" +edition = "2024" + +[dependencies] +rust_util = { path = "../rust_util" } + +syn = { version = "2.0.108", features = ["full", "visit-mut", "visit"] } +proc-macro2 = { version = "1", features = ["span-locations"] } +quote = "1" + +ra_ap_hir = "=0.0.301" +ra_ap_ide_db = "=0.0.301" +ra_ap_load-cargo = "=0.0.301" +ra_ap_project_model = "=0.0.301" +ra_ap_syntax = "=0.0.301" diff --git a/tools/related_decls/src/main.rs b/tools/related_decls/src/main.rs new file mode 100644 index 0000000000..c19d12ee3d --- /dev/null +++ b/tools/related_decls/src/main.rs @@ -0,0 +1,401 @@ +use proc_macro2::{Span, TokenStream}; +use quote::ToTokens; +use ra_ap_hir::Semantics; +use ra_ap_ide_db::RootDatabase; +use ra_ap_load_cargo::{self, LoadCargoConfig, ProcMacroServerChoice}; +use ra_ap_project_model::CargoConfig; +use ra_ap_syntax::SyntaxNode; +use rust_util::rewrite::{FlatTokens, OutputBuffer, TokenIndex, render_output}; +use std::env; +use std::fs; +use std::iter; +use std::mem; +use std::path::Path; +use std::str::FromStr; +use syn; +use syn::spanned::Spanned; +use syn::visit_mut::{self, VisitMut}; + +struct AddDerivedItemVisitor(F); + +impl Option> AddDerivedItemVisitor { + fn visit_items(&mut self, items: &mut Vec) { + let new_items = Vec::with_capacity(items.len()); + let old_items = mem::replace(items, new_items); + for mut item in old_items { + let derived_item = (self.0)(&mut item); + items.push(item); + if let Some(derived_item) = derived_item { + items.push(derived_item); + } + } + } +} + +impl Option> VisitMut for AddDerivedItemVisitor { + fn visit_item_mod_mut(&mut self, im: &mut syn::ItemMod) { + let items = match im.content { + Some((_, ref mut x)) => x, + None => return, + }; + self.visit_items(items); + visit_mut::visit_item_mod_mut(self, im); + } + + fn visit_file_mut(&mut self, f: &mut syn::File) { + self.visit_items(&mut f.items); + visit_mut::visit_file_mut(self, f); + } +} + +fn add_ffi_wrapper( + _db: &RootDatabase, + _sema: &Semantics, + _root: SyntaxNode, + item: &mut syn::Item, +) -> Option { + let fn_item = match *item { + syn::Item::Fn(ref mut x) => x, + _ => return None, + }; + let fn_name = fn_item.sig.ident.to_string(); + + // Example of gathering semantic information from rust-analyzer: + /* + let range = span_to_text_range(fn_item.span()); + let cover = root.covering_element(range); + // If this assert fails, we might need to look for a `FN` ancestor of `cover` instead. + debug_assert_eq!(cover.kind(), SyntaxKind::FN); + let cover = cover.into_node().unwrap(); + let f_ast = ast::Fn::cast(cover).unwrap(); + eprintln!("f_ast = {f_ast:?}"); + + let f = sema.to_fn_def(&f_ast).unwrap(); + eprintln!("f = {f:?}"); + + let attrs = f.attrs(db); + // etc... + */ + + // Walk over the attributes of `fn_item`, sorting them into attrs that should remain on the + // inner function and ones that should be moved or copied onto the newly-generated wrapper. + let mut inner_attrs = Vec::with_capacity(fn_item.attrs.len()); + let mut wrapper_attrs = Vec::new(); + let mut need_wrapper = false; + + for mut attr in mem::take(&mut fn_item.attrs) { + let mut pm = ParsedMeta::from(attr.meta); + + let mut move_to_wrapper = false; + pm.with_innermost_mut(&mut |pm| match pm { + ParsedMeta::NoMangle(..) => { + move_to_wrapper = true; + *pm = ParsedMeta::ExportName(ParsedMetaExportName { + ident: syn::Ident::new("export_name", Span::call_site()), + eq: syn::Token![=](Span::call_site()), + name: syn::LitStr::new(&fn_name, Span::call_site()), + }); + } + ParsedMeta::ExportName(..) => { + move_to_wrapper = true; + } + _ => {} + }); + + attr.meta = pm.into(); + + if move_to_wrapper { + wrapper_attrs.push(attr); + need_wrapper = true; + } else { + inner_attrs.push(attr); + } + } + + fn_item.attrs = inner_attrs; + + if !need_wrapper { + return None; + } + + let wrapper_name = format!("{fn_name}_ffi"); + let mut fn_wrapper = syn::ItemFn { + attrs: wrapper_attrs, + vis: fn_item.vis.clone(), + sig: fn_item.sig.clone(), + block: Box::new(syn::Block { + brace_token: syn::token::Brace::default(), + stmts: Vec::new(), + }), + }; + fn_wrapper.sig.ident = syn::Ident::new(&wrapper_name, Span::call_site()); + + let mut arg_exprs = Vec::new(); + for (i, arg) in fn_wrapper.sig.inputs.iter_mut().enumerate() { + let ident = match *arg { + syn::FnArg::Receiver(_) => syn::Ident::new("self", Span::call_site()), + syn::FnArg::Typed(ref mut pt) => match *pt.pat { + syn::Pat::Ident(ref pi) => pi.ident.clone(), + _ => { + let ident = syn::Ident::new(&format!("arg{i}"), Span::call_site()); + *pt.pat = syn::Pat::Ident(syn::PatIdent { + attrs: Vec::new(), + by_ref: None, + mutability: None, + ident: ident.clone(), + subpat: None, + }); + ident + } + }, + }; + let expr = syn::Expr::Path(syn::ExprPath { + attrs: Vec::new(), + qself: None, + path: syn::Path::from(ident), + }); + arg_exprs.push(expr); + } + + let wrapper_expr = syn::Expr::Call(syn::ExprCall { + attrs: Vec::new(), + func: Box::new(syn::Expr::Path(syn::ExprPath { + attrs: Vec::new(), + qself: None, + path: syn::Path::from(syn::Ident::new(&fn_name, Span::call_site())), + })), + paren_token: syn::token::Paren::default(), + args: arg_exprs.into_iter().collect(), + }); + let wrapper_stmt = syn::Stmt::Expr(wrapper_expr, None); + fn_wrapper.block.stmts.push(wrapper_stmt); + + Some(fn_wrapper.into()) +} + +/* +fn span_to_text_range(span: Span) -> TextRange { + let span_range = span.byte_range(); + let lo = TextSize::try_from(span_range.start).unwrap(); + let hi = TextSize::try_from(span_range.end).unwrap(); + TextRange::new(lo, hi) +} +*/ + +// Helpers for dealing with nested meta items in attrs, like `#[unsafe(no_mangle)]` + +#[derive(Clone)] +enum ParsedMeta { + Meta(syn::Meta), + Unsafe(Box), + NoMangle(ParsedMetaNoMangle), + ExportName(ParsedMetaExportName), +} + +#[derive(Clone)] +struct ParsedMetaUnsafe { + ident: syn::Ident, + paren: syn::token::Paren, + inner: ParsedMeta, +} + +#[derive(Clone)] +struct ParsedMetaNoMangle { + ident: syn::Ident, +} + +#[derive(Clone)] +struct ParsedMetaExportName { + ident: syn::Ident, + eq: syn::Token![=], + name: syn::LitStr, +} + +impl ParsedMeta { + pub fn parse(meta: &syn::Meta) -> syn::Result { + let ident = meta.path().require_ident()?; + let ident_str = ident.to_string(); + match ident_str.as_str() { + "unsafe" => { + let ml = meta.require_list()?; + let ident = ml.path.require_ident()?.clone(); + let paren = match ml.delimiter { + syn::MacroDelimiter::Paren(p) => p, + _ => { + return Err(syn::Error::new( + ml.delimiter.span().open(), + "expected parens", + )); + } + }; + let meta: syn::Meta = syn::parse2(ml.tokens.clone())?; + let inner = ParsedMeta::from(meta); + Ok(ParsedMeta::Unsafe(Box::new(ParsedMetaUnsafe { + ident, + paren, + inner, + }))) + } + "no_mangle" => { + let _ = meta.require_path_only()?; + let ident = ident.clone(); + Ok(ParsedMeta::NoMangle(ParsedMetaNoMangle { ident })) + } + "export_name" => { + let mnv = meta.require_name_value()?; + let ident = mnv.path.require_ident()?.clone(); + let eq = mnv.eq_token; + let expr_lit = match mnv.value { + syn::Expr::Lit(ref el) => el, + _ => return Err(syn::Error::new(mnv.value.span(), "expected Lit")), + }; + let syn::ExprLit { ref attrs, ref lit } = *expr_lit; + if attrs.len() > 0 { + return Err(syn::Error::new(expr_lit.span(), "name must not have attrs")); + } + let name = match *lit { + syn::Lit::Str(ref ls) => ls.clone(), + _ => return Err(syn::Error::new(lit.span(), "expected Str")), + }; + Ok(ParsedMeta::ExportName(ParsedMetaExportName { + ident, + eq, + name, + })) + } + _ => Ok(ParsedMeta::Meta(meta.clone())), + } + } + + pub fn with_innermost_mut(&mut self, f: &mut impl FnMut(&mut ParsedMeta)) { + match *self { + ParsedMeta::Meta(..) | ParsedMeta::NoMangle(..) | ParsedMeta::ExportName(..) => f(self), + ParsedMeta::Unsafe(ref mut pmu) => pmu.inner.with_innermost_mut(f), + } + } +} + +impl From for ParsedMeta { + fn from(meta: syn::Meta) -> ParsedMeta { + match Self::parse(&meta) { + Ok(x) => x, + Err(e) => { + eprintln!("warning: failed to parse `{}`: {e}", meta.to_token_stream()); + ParsedMeta::Meta(meta) + } + } + } +} + +impl From for syn::Meta { + fn from(pm: ParsedMeta) -> syn::Meta { + syn::parse2(pm.into_token_stream()).unwrap() + } +} + +impl ToTokens for ParsedMeta { + fn to_tokens(&self, tokens: &mut TokenStream) { + match *self { + ParsedMeta::Meta(ref x) => x.to_tokens(tokens), + ParsedMeta::Unsafe(ref x) => x.to_tokens(tokens), + ParsedMeta::NoMangle(ref x) => x.to_tokens(tokens), + ParsedMeta::ExportName(ref x) => x.to_tokens(tokens), + } + } +} + +impl ToTokens for ParsedMetaUnsafe { + fn to_tokens(&self, tokens: &mut TokenStream) { + self.ident.to_tokens(tokens); + self.paren.surround(tokens, |tokens| { + self.inner.to_tokens(tokens); + }); + } +} + +impl ToTokens for ParsedMetaNoMangle { + fn to_tokens(&self, tokens: &mut TokenStream) { + self.ident.to_tokens(tokens); + } +} + +impl ToTokens for ParsedMetaExportName { + fn to_tokens(&self, tokens: &mut TokenStream) { + self.ident.to_tokens(tokens); + self.eq.to_tokens(tokens); + self.name.to_tokens(tokens); + } +} + +fn main() { + let cargo_dir_path = env::args().nth(1).unwrap(); + let cargo_dir_path = Path::new(&cargo_dir_path); + + let cargo_config = CargoConfig::default(); + + let load_cargo_config: LoadCargoConfig = LoadCargoConfig { + load_out_dirs_from_check: true, + with_proc_macro_server: ProcMacroServerChoice::Sysroot, + prefill_caches: false, + }; + + let (db, vfs, _proc_macro_client) = ra_ap_load_cargo::load_workspace_at( + cargo_dir_path, + &cargo_config, + &load_cargo_config, + &|_msg| {}, + ) + .unwrap(); + + // Assume the first file in `vfs` is the crate root. + let (first_file_id, _) = vfs.iter().next().unwrap(); + + let sema = Semantics::new(&db); + + eprintln!("processing crate..."); + let krate = sema.first_crate(first_file_id).unwrap(); + + let mut files = Vec::new(); + for m in krate.modules(&db) { + let src = m.definition_source(&db); + let node = src.value.node(); + if let Some(editioned_file_id) = m.as_source_file_id(&db) { + sema.parse(editioned_file_id); + let file_id = editioned_file_id.file_id(&db); + let vfs_path = vfs.file_path(file_id); + if let Some(path) = vfs_path.as_path() { + files.push((path.to_path_buf(), node)); + } + } + } + + for (path, root) in files { + // Only rewrite files that are inside the provided cargo dir. If our strategy for finding + // the main crate is wrong, this will keep us from overwriting files unexpectedly. + let mut ancestors = iter::successors(Some(path.as_path()), |p| p.parent()); + if !ancestors.any(|a| a == cargo_dir_path) { + eprintln!("skip {path:?}: outside cargo dir {cargo_dir_path:?}"); + continue; + } + + let code = fs::read_to_string(&path).unwrap(); + + let ts = TokenStream::from_str(&code).unwrap(); + let orig_tokens = FlatTokens::new(ts.clone()).collect::>(); + let ti = TokenIndex::new(&orig_tokens); + + let mut ast: syn::File = syn::parse2(ts.clone()).unwrap(); + let mut v = AddDerivedItemVisitor(|i: &mut syn::Item| -> Option { + add_ffi_wrapper(&db, &sema, root.clone(), i) + }); + v.visit_file_mut(&mut ast); + + let new_ts = ast.into_token_stream(); + + let mut buf = OutputBuffer::new(); + render_output(&code, &orig_tokens, &ti, new_ts, &mut buf); + let s = buf.finish(); + fs::write(&path, &s).unwrap(); + eprintln!("wrote {:?}", path); + } +} diff --git a/tools/rust-toolchain.toml b/tools/rust-toolchain.toml new file mode 100644 index 0000000000..292fe499e3 --- /dev/null +++ b/tools/rust-toolchain.toml @@ -0,0 +1,2 @@ +[toolchain] +channel = "stable" diff --git a/tools/rust_util/Cargo.lock b/tools/rust_util/Cargo.lock new file mode 100644 index 0000000000..ea2628801a --- /dev/null +++ b/tools/rust_util/Cargo.lock @@ -0,0 +1,47 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "proc-macro2" +version = "1.0.103" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rust_util" +version = "0.1.0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "syn" +version = "2.0.110" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a99801b5bd34ede4cf3fc688c5919368fea4e4814a4664359503e6015b280aea" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "unicode-ident" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" diff --git a/tools/rust_util/Cargo.toml b/tools/rust_util/Cargo.toml new file mode 100644 index 0000000000..9622ced91f --- /dev/null +++ b/tools/rust_util/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "rust_util" +version = "0.1.0" +edition = "2024" + +[dependencies] +syn = { version = "2.0.108", features = ["full", "visit-mut", "visit"] } +proc-macro2 = { version = "1", features = ["span-locations"] } +quote = "1" diff --git a/tools/rust_util/src/collect.rs b/tools/rust_util/src/collect.rs new file mode 100644 index 0000000000..6a9e6fe179 --- /dev/null +++ b/tools/rust_util/src/collect.rs @@ -0,0 +1,117 @@ +use crate::error::Error; +use std::collections::HashSet; +use std::fs; +use std::iter; +use std::path::{Path, PathBuf}; +use syn; +use syn::ext::IdentExt; + +#[derive(Clone, Default)] +pub struct FileCollector { + /// File path, module path, and AST for each file visited so far. + pub files: Vec<(PathBuf, Vec, syn::File)>, + seen: HashSet, +} + +impl FileCollector { + pub fn parse( + &mut self, + file_path: impl AsRef, + mod_path: Vec, + is_root: bool, + ) -> Result<(), Error> { + let file_path = file_path.as_ref(); + if self.seen.contains(file_path) { + return Ok(()); + } + let src = fs::read_to_string(file_path) + .map_err(|e| Error::from(e).at(format_args!("reading {file_path:?}")))?; + let ast: syn::File = syn::parse_file(&src) + .map_err(|e| Error::from(e).at(format_args!("parsing {file_path:?}")))?; + // Set `seen` immediately, but don't add to `files` (and give up ownership) until we're + // done walking `ast`. + self.seen.insert(file_path.to_owned()); + let is_mod_rs = is_root || file_path.file_name().is_some_and(|n| n == "mod.rs"); + let base_path_storage; + let base_path = if is_mod_rs { + file_path + .parent() + .ok_or_else(|| format!("mod.rs path {file_path:?} has no parent"))? + } else { + base_path_storage = file_path.with_extension(""); + &base_path_storage + }; + self.walk_items(&ast.items, base_path, mod_path.clone(), &[])?; + self.files.push((file_path.to_owned(), mod_path, ast)); + Ok(()) + } + + fn walk_items( + &mut self, + items: &[syn::Item], + base_path: &Path, + mut mod_path: Vec, + parent_module: &[&str], + ) -> Result<(), Error> { + for item in items { + let im = match *item { + syn::Item::Mod(ref im) => im, + _ => continue, + }; + mod_path.push(im.ident.unraw().to_string()); + if let Some((_, ref inline_items)) = im.content { + let name = + path_attr_value(&im.attrs)?.unwrap_or_else(|| im.ident.unraw().to_string()); + let module = parent_module + .iter() + .copied() + .chain(iter::once(&name as &_)) + .collect::>(); + self.walk_items(inline_items, base_path, mod_path.clone(), &module)?; + } else { + let mut path = base_path.to_owned(); + for &m in parent_module { + path.push(m); + } + if let Some(attr_path) = path_attr_value(&im.attrs)? { + path.push(attr_path); + self.parse(path, mod_path.clone(), false)?; + } else { + let name = im.ident.unraw().to_string(); + // Try `foo/mod.rs` first; if it doesn't exist, try `foo.rs` instead. + path.push(name); + path.push("mod.rs"); + if !fs::exists(&path)? { + path.pop(); + path.set_extension("rs"); + } + self.parse(path, mod_path.clone(), false)?; + } + } + mod_path.pop(); + } + Ok(()) + } +} + +fn path_attr_value(attrs: &[syn::Attribute]) -> Result, Error> { + for attr in attrs { + if !attr.meta.path().is_ident("path") { + continue; + } + let mnv = match attr.meta { + syn::Meta::NameValue(ref x) => x, + _ => return Err("expected `path` attribute to have a value".into()), + }; + let el = match mnv.value { + syn::Expr::Lit(ref x) => x, + _ => return Err("expected `path` attribute value to be a literal".into()), + }; + let ls = match el.lit { + syn::Lit::Str(ref x) => x, + _ => return Err("expected `path` attribute value to be a string literal".into()), + }; + return Ok(Some(ls.value())); + } + Ok(None) +} diff --git a/tools/rust_util/src/error.rs b/tools/rust_util/src/error.rs new file mode 100644 index 0000000000..28e93187d5 --- /dev/null +++ b/tools/rust_util/src/error.rs @@ -0,0 +1,63 @@ +use std::fmt::{self, Display}; +use std::io; +use syn; + +#[derive(Debug)] +pub enum Error { + Io(io::Error), + Syn(syn::Error), + Str(String), + At(String, Box), +} + +impl From for Error { + fn from(x: io::Error) -> Error { + Error::Io(x) + } +} + +impl From for Error { + fn from(x: syn::Error) -> Error { + Error::Syn(x) + } +} + +impl From for Error { + fn from(x: String) -> Error { + Error::Str(x) + } +} + +impl From<&str> for Error { + fn from(x: &str) -> Error { + Error::Str(x.to_owned()) + } +} + +impl Error { + pub fn at(self, desc: impl Display) -> Error { + Error::At(desc.to_string(), Box::new(self)) + } +} + +impl Display for Error { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + Error::Io(x) => Display::fmt(x, f), + Error::Syn(x) => Display::fmt(x, f), + Error::Str(x) => Display::fmt(x, f), + Error::At(desc, inner) => write!(f, "{desc}: {inner}"), + } + } +} + +impl std::error::Error for Error { + fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { + match self { + Error::Io(x) => Some(x), + Error::Syn(x) => Some(x), + Error::Str(_) => None, + Error::At(_, x) => Some(x), + } + } +} diff --git a/tools/rust_util/src/item_span.rs b/tools/rust_util/src/item_span.rs new file mode 100644 index 0000000000..c840347593 --- /dev/null +++ b/tools/rust_util/src/item_span.rs @@ -0,0 +1,60 @@ +use proc_macro2::Span; +use syn; +use syn::spanned::Spanned; +use syn::visit::{self, Visit}; + +struct ItemSpanVisitor { + cur_path: Vec, + item_spans: Vec<(Vec, usize, usize)>, +} + +impl ItemSpanVisitor { + pub fn new(mod_path: Vec) -> ItemSpanVisitor { + ItemSpanVisitor { + cur_path: mod_path, + item_spans: Vec::new(), + } + } + + fn _emit(&mut self, name: String, sp: Span) { + self.enter(name, sp, |_| {}); + } + + fn enter(&mut self, name: String, sp: Span, f: impl FnOnce(&mut Self) -> R) -> R { + self.cur_path.push(name); + + let range = sp.byte_range(); + self.item_spans + .push((self.cur_path.clone(), range.start, range.end)); + let r = f(self); + + self.cur_path.pop(); + r + } +} + +impl Visit<'_> for ItemSpanVisitor { + fn visit_item(&mut self, item: &syn::Item) { + match *item { + syn::Item::Fn(ref ifn) => { + let name = ifn.sig.ident.to_string(); + self.enter(name, ifn.span(), |v| v.visit_item_fn(ifn)); + } + syn::Item::Mod(ref im) => { + let name = im.ident.to_string(); + self.enter(name, im.span(), |v| v.visit_item_mod(im)); + } + // TODO: handle other items that can contain nested items. Note that any expr or type + // can contain items, e.g. `type T = [u8; { fn f(){} 10 }];` + _ => { + visit::visit_item(self, item); + } + } + } +} + +pub fn item_spans(mod_path: Vec, ast: &syn::File) -> Vec<(Vec, usize, usize)> { + let mut v = ItemSpanVisitor::new(mod_path); + v.visit_file(ast); + v.item_spans +} diff --git a/tools/rust_util/src/lib.rs b/tools/rust_util/src/lib.rs new file mode 100644 index 0000000000..06ffc31b9e --- /dev/null +++ b/tools/rust_util/src/lib.rs @@ -0,0 +1,4 @@ +pub mod collect; +pub mod error; +pub mod item_span; +pub mod rewrite; diff --git a/tools/rust_util/src/rewrite.rs b/tools/rust_util/src/rewrite.rs new file mode 100644 index 0000000000..42a9c76bb8 --- /dev/null +++ b/tools/rust_util/src/rewrite.rs @@ -0,0 +1,239 @@ +use proc_macro2::{Delimiter, Spacing, Span, TokenStream, TokenTree}; +use std::collections::BTreeSet; + +pub struct FlatTokens { + stack: Vec<(proc_macro2::token_stream::IntoIter, Delimiter, Span)>, +} + +impl FlatTokens { + pub fn new(ts: TokenStream) -> FlatTokens { + FlatTokens { + stack: vec![(ts.into_iter(), Delimiter::None, Span::call_site())], + } + } +} + +impl Iterator for FlatTokens { + type Item = Token; + fn next(&mut self) -> Option { + while let Some(&mut (ref mut it, delim, span_close)) = self.stack.last_mut() { + match it.next() { + Some(TokenTree::Group(g)) => { + // Return the open delimiter and continue with the contents of the group. + self.stack + .push((g.stream().into_iter(), g.delimiter(), g.span_close())); + let open_ch = match g.delimiter() { + Delimiter::Parenthesis => '(', + Delimiter::Bracket => '[', + Delimiter::Brace => '{', + // Skip over `Delimiter::None`, and `continue` to try the next available + // token. + Delimiter::None => continue, + }; + let range = g.span_open().byte_range(); + return Some(Token { + text: open_ch.to_string().into(), + spacing: Spacing::Alone, + span: (range.start, range.end), + }); + } + Some(tt @ TokenTree::Ident(_)) + | Some(tt @ TokenTree::Punct(_)) + | Some(tt @ TokenTree::Literal(_)) => return Some(Token::from_token_tree(tt)), + None => { + // Pop the now-empty group and return the close delimiter. + self.stack.pop(); + let close_ch = match delim { + Delimiter::Parenthesis => ')', + Delimiter::Bracket => ']', + Delimiter::Brace => '}', + // Skip over `Delimiter::None`, and `continue` to try the next available + // token. + Delimiter::None => continue, + }; + let range = span_close.byte_range(); + return Some(Token { + text: close_ch.to_string().into(), + spacing: Spacing::Alone, + span: (range.start, range.end), + }); + } + } + } + None + } +} + +#[derive(Clone, PartialEq, Eq, Debug)] +pub struct Token { + pub text: Box, + /// Spacing, for punctuation tokens. This is `Spacing::Alone` for all non-`Punct` tokens. + pub spacing: Spacing, + pub span: (usize, usize), +} + +impl Token { + pub fn from_token_tree(tt: TokenTree) -> Token { + let text = tt.to_string().into_boxed_str(); + let spacing = match tt { + TokenTree::Punct(ref p) => p.spacing(), + _ => Spacing::Alone, + }; + let range = tt.span().byte_range(); + let start = range.start; + let end = range.end; + Token { + text, + spacing, + span: (start, end), + } + } +} + +pub struct TokenIndex<'a> { + tokens: &'a [Token], + /// Multi-map mapping `(start, end)` to indexes in `tokens` that have that span. + index: BTreeSet<((usize, usize), usize)>, +} + +impl<'a> TokenIndex<'a> { + pub fn new(tokens: &'a [Token]) -> TokenIndex<'a> { + let mut index = BTreeSet::new(); + for (i, t) in tokens.iter().enumerate() { + index.insert((t.span, i)); + } + TokenIndex { tokens, index } + } + + pub fn find<'b>(&'b self, t: &Token) -> Option { + let (start, end) = t.span; + let lo = ((start, end), 0); + let hi = ((start, end), usize::MAX); + let mut found = None; + for &(_, i) in self.index.range(lo..=hi) { + if self.tokens[i] == *t { + if found.is_none() { + found = Some(i); + } else { + // Found multiple identical tokens. This is ambiguous. + return None; + } + } + } + found + } +} + +pub struct OutputBuffer { + s: String, + /// Whether the most recently emitted chunk had `Spacing::Joint`. + prev_was_joint: bool, + /// Index in `s` of the start of the most recent line. + prev_bol: usize, +} + +impl OutputBuffer { + pub fn new() -> OutputBuffer { + OutputBuffer { + s: String::new(), + prev_was_joint: true, + prev_bol: 0, + } + } + + /// Emit a token or a group of tokens. + /// + /// This assumes that the start of `chunk` is the start of a token (not whitespace or a non-doc + /// comment) and that the end of `chunk` is the end of a token. + pub fn emit(&mut self, chunk: &str, spacing: Spacing) { + let cur_line = &self.s[self.prev_bol..]; + if self.prev_was_joint { + // No whitespace is allowed between a `Joint` token and the subsequent token. + } else { + if cur_line.contains("//") { + // Note this can throw false positives, such as if `//` appears inside a string + // literal. But it's legal to replace any `' '` with `'\n'`; `rustfmt` will fix it + // if needed. + self.s.push('\n'); + self.prev_bol = self.s.len(); + } else { + self.s.push(' '); + } + } + + // If `chunk` contains a newline, update the beginning-of-line position. + if let Some(i) = chunk.bytes().rposition(|b| b == b'\n') { + self.prev_bol = self.s.len() + i + 1; + } + + self.s.push_str(chunk); + self.prev_was_joint = matches!(spacing, Spacing::Joint); + } + + pub fn finish(self) -> String { + self.s + } +} + +pub fn render_output( + orig: &str, + orig_tokens: &[Token], + ti: &TokenIndex, + ts: TokenStream, + buf: &mut OutputBuffer, +) { + if let Some(t) = orig_tokens.get(0) { + let (start_pos, _) = t.span; + buf.emit(&orig[0..start_pos], Spacing::Joint); + } + + struct Run { + /// Byte offset of the start of the first token in the run. + start_pos: usize, + /// Index in `orig_tokens` of the last token in the run. + end_idx: usize, + } + let mut current_run: Option = None; + for t in FlatTokens::new(ts) { + // Try to continue the current run. + if let Some(ref mut run) = current_run { + if orig_tokens.get(run.end_idx + 1) == Some(&t) { + run.end_idx += 1; + continue; + } else { + // End the current run. + let end_token = &orig_tokens[run.end_idx]; + let start_pos = run.start_pos; + let (_, end_pos) = end_token.span; + buf.emit(&orig[start_pos..end_pos], end_token.spacing); + current_run = None; + } + } + + // Try to start a new run. + debug_assert!(current_run.is_none()); + if let Some(idx) = ti.find(&t) { + let (start_pos, _) = t.span; + current_run = Some(Run { + start_pos, + end_idx: idx, + }); + continue; + } + + // This token is not part of a run. Emit it directly. + buf.emit(&t.text, t.spacing); + } + + if let Some(run) = current_run { + let end_token = &orig_tokens[run.end_idx]; + let start_pos = run.start_pos; + let (_, end_pos) = end_token.span; + buf.emit(&orig[start_pos..end_pos], end_token.spacing); + } + + if let Some(t) = orig_tokens.last() { + let (_, end_pos) = t.span; + buf.emit(&orig[end_pos..orig.len()], Spacing::Joint); + } +} diff --git a/tools/split_ffi_entry_points/Cargo.lock b/tools/split_ffi_entry_points/Cargo.lock new file mode 100644 index 0000000000..d2ccfde983 --- /dev/null +++ b/tools/split_ffi_entry_points/Cargo.lock @@ -0,0 +1,2174 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "allocator-api2" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" + +[[package]] +name = "anstream" +version = "0.6.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" + +[[package]] +name = "anstyle-parse" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.61.2", +] + +[[package]] +name = "anyhow" +version = "1.0.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" + +[[package]] +name = "arrayvec" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" + +[[package]] +name = "autocfg" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" + +[[package]] +name = "borsh" +version = "1.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad8646f98db542e39fc66e68a20b2144f6a732636df7c2354e74645faaa433ce" +dependencies = [ + "cfg_aliases", +] + +[[package]] +name = "boxcar" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36f64beae40a84da1b4b26ff2761a5b895c12adc41dc25aaee1c4f2bbfe97a6e" + +[[package]] +name = "camino" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "276a59bf2b2c967788139340c9f0c5b12d7fd6630315c15c217e559de85d2609" +dependencies = [ + "serde_core", +] + +[[package]] +name = "cargo-platform" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84982c6c0ae343635a3a4ee6dedef965513735c8b183caa7289fa6e27399ebd4" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo-util-schemas" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dc1a6f7b5651af85774ae5a34b4e8be397d9cf4bc063b7e6dbd99a841837830" +dependencies = [ + "semver", + "serde", + "serde-untagged", + "serde-value", + "thiserror", + "toml", + "unicode-xid", + "url", +] + +[[package]] +name = "cargo_metadata" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cfca2aaa699835ba88faf58a06342a314a950d2b9686165e038286c30316868" +dependencies = [ + "camino", + "cargo-platform", + "cargo-util-schemas", + "semver", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + +[[package]] +name = "chalk-derive" +version = "0.103.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb4899682de915ca7c0b025bdd0a3d34c75fe12184122fda6805a7baddaa293c" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "chalk-ir" +version = "0.103.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90a37d2ab99352b4caca135061e7b4ac67024b648c28ed0b787feec4bea4caed" +dependencies = [ + "bitflags 2.10.0", + "chalk-derive", +] + +[[package]] +name = "chalk-recursive" +version = "0.103.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c855be60e646664bc37c2496d3dc81ca5ef60520930e5e0f0057a0575aff6c19" +dependencies = [ + "chalk-derive", + "chalk-ir", + "chalk-solve", + "rustc-hash 1.1.0", + "tracing", +] + +[[package]] +name = "chalk-solve" +version = "0.103.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "477ac6cdfd2013e9f93b09b036c2b607a67b2e728f4777b8422d55a79e9e3a34" +dependencies = [ + "chalk-derive", + "chalk-ir", + "ena", + "indexmap", + "itertools 0.12.1", + "petgraph", + "rustc-hash 1.1.0", + "tracing", +] + +[[package]] +name = "clap" +version = "4.5.53" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9e340e012a1bf4935f5282ed1436d1489548e8f72308207ea5df0e23d2d03f8" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.5.53" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d76b5d13eaa18c901fd2f7fca939fefe3a0727a953561fefdf3b2922b8569d00" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.5.49" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a0b5487afeab2deb2ff4e03a807ad1a03ac532ff5a2cee5d86884440c7f7671" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d" + +[[package]] +name = "colorchoice" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" + +[[package]] +name = "countme" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7704b5fdd17b18ae31c4c1da5a2e0305a2bf17b5249300a9ee9ed7b72114c636" + +[[package]] +name = "cov-mark" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90863d8442510cddf7f46618c4f92413774635771a3e80830c8b30d183420b14" + +[[package]] +name = "crossbeam-channel" +version = "0.5.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82b8f8f868b36967f9606790d1903570de9ceaf870a7bf9fbbd3016d636a2cb2" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-queue" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f58bbc28f91df819d0aa2a2c00cd19754769c2fad90579b3592b1c9ba7a3115" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "dashmap" +version = "6.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5041cc499144891f3790297212f32a74fb938e5136a14943f338ef9e0ae276cf" +dependencies = [ + "cfg-if", + "crossbeam-utils", + "hashbrown 0.14.5", + "lock_api", + "once_cell", + "parking_lot_core", +] + +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "drop_bomb" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bda8e21c04aca2ae33ffc2fd8c23134f3cac46db123ba97bd9d3f3b8a4a85e1" + +[[package]] +name = "either" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" + +[[package]] +name = "ena" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d248bdd43ce613d87415282f69b9bb99d947d290b10962dd6c56233312c2ad5" +dependencies = [ + "log", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "erased-serde" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "259d404d09818dec19332e31d94558aeb442fea04c817006456c24b5460bbd4b" +dependencies = [ + "serde", + "serde_core", + "typeid", +] + +[[package]] +name = "fixedbitset" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" + +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "fsevent-sys" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76ee7a02da4d231650c7cea31349b889be2f45ddb3ef3032d2ec8185f6313fd2" +dependencies = [ + "libc", +] + +[[package]] +name = "fst" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ab85b9b05e3978cc9a9cf8fea7f01b494e1a09ed3037e16ba39edc7a29eb61a" + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" + +[[package]] +name = "hashbrown" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash", +] + +[[package]] +name = "hashbrown" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d" + +[[package]] +name = "hashlink" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1" +dependencies = [ + "hashbrown 0.15.5", +] + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "home" +version = "0.5.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc627f471c528ff0c4a49e1d5e60450c8f6461dd6d10ba9dcd3a61d3dff7728d" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "icu_collections" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43" +dependencies = [ + "displaydoc", + "potential_utf", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f6c8828b67bf8908d82127b2054ea1b4427ff0230ee9141c54251934ab1b599" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a" + +[[package]] +name = "icu_properties" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e93fcd3157766c0c8da2f8cff6ce651a31f0810eaa1c51ec363ef790bbb5fb99" +dependencies = [ + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02845b3647bb045f1100ecd6480ff52f34c35f82d9880e029d329c21d1054899" + +[[package]] +name = "icu_provider" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "indexmap" +version = "2.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6717a8d2a5a929a1a2eb43a12812498ed141a0bcfb7e8f7844fbdbe4303bba9f" +dependencies = [ + "equivalent", + "hashbrown 0.16.0", + "serde", + "serde_core", +] + +[[package]] +name = "inotify" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f37dccff2791ab604f9babef0ba14fbe0be30bd368dc541e2b08d07c8aa908f3" +dependencies = [ + "bitflags 2.10.0", + "inotify-sys", + "libc", +] + +[[package]] +name = "inotify-sys" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e05c02b5e89bff3b946cedeca278abc628fe811e604f027c45a8aa3cf793d0eb" +dependencies = [ + "libc", +] + +[[package]] +name = "intrusive-collections" +version = "0.9.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "189d0897e4cbe8c75efedf3502c18c887b05046e59d28404d4d8e46cbc4d1e86" +dependencies = [ + "memoffset", +] + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" + +[[package]] +name = "jod-thread" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a037eddb7d28de1d0fc42411f501b53b75838d313908078d6698d064f3029b24" + +[[package]] +name = "kqueue" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eac30106d7dce88daf4a3fcb4879ea939476d5074a9b7ddd0fb97fa4bed5596a" +dependencies = [ + "kqueue-sys", + "libc", +] + +[[package]] +name = "kqueue-sys" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed9625ffda8729b85e45cf04090035ac368927b8cebc34898e7c120f52e4838b" +dependencies = [ + "bitflags 1.3.2", + "libc", +] + +[[package]] +name = "la-arena" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3752f229dcc5a481d60f385fa479ff46818033d881d2d801aa27dffcfb5e8306" + +[[package]] +name = "libc" +version = "0.2.177" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976" + +[[package]] +name = "line-index" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e27e0ed5a392a7f5ba0b3808a2afccff16c64933312c84b57618b49d1209bd2" +dependencies = [ + "nohash-hasher", + "text-size", +] + +[[package]] +name = "litemap" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432" + +[[package]] +name = "memchr" +version = "2.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" + +[[package]] +name = "memoffset" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" +dependencies = [ + "autocfg", +] + +[[package]] +name = "mio" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69d83b0086dc8ecf3ce9ae2874b2d1290252e2a30720bea58a5c6639b0092873" +dependencies = [ + "libc", + "log", + "wasi", + "windows-sys 0.61.2", +] + +[[package]] +name = "miow" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "536bfad37a309d62069485248eeaba1e8d9853aaf951caaeaed0585a95346f08" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "nohash-hasher" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" + +[[package]] +name = "notify" +version = "8.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d3d07927151ff8575b7087f245456e549fea62edf0ec4e565a5ee50c8402bc3" +dependencies = [ + "bitflags 2.10.0", + "fsevent-sys", + "inotify", + "kqueue", + "libc", + "log", + "mio", + "notify-types", + "walkdir", + "windows-sys 0.60.2", +] + +[[package]] +name = "notify-types" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e0826a989adedc2a244799e823aece04662b66609d96af8dff7ac6df9a8925d" + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "once_cell" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + +[[package]] +name = "oorandom" +version = "11.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6790f58c7ff633d8771f42965289203411a5e5c68388703c06e14f24770b41e" + +[[package]] +name = "ordered-float" +version = "2.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68f19d67e5a2795c94e73e0bb1cc1a7edeb2e28efd39e2e1c9b7a40c1108b11c" +dependencies = [ + "num-traits", +] + +[[package]] +name = "papaya" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f92dd0b07c53a0a0c764db2ace8c541dc47320dad97c2200c2a637ab9dd2328f" +dependencies = [ + "equivalent", + "seize", +] + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-link", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "perf-event" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5396562cd2eaa828445d6d34258ae21ee1eb9d40fe626ca7f51c8dccb4af9d66" +dependencies = [ + "libc", + "perf-event-open-sys", +] + +[[package]] +name = "perf-event-open-sys" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce9bedf5da2c234fdf2391ede2b90fabf585355f33100689bc364a3ea558561a" +dependencies = [ + "libc", +] + +[[package]] +name = "petgraph" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" +dependencies = [ + "fixedbitset", + "indexmap", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" + +[[package]] +name = "portable-atomic" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483" + +[[package]] +name = "potential_utf" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77" +dependencies = [ + "zerovec", +] + +[[package]] +name = "proc-macro2" +version = "1.0.101" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "ra-ap-rustc_abi" +version = "0.123.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f18c877575c259d127072e9bfc41d985202262fb4d6bfdae3d1252147c2562c2" +dependencies = [ + "bitflags 2.10.0", + "ra-ap-rustc_hashes", + "ra-ap-rustc_index", + "tracing", +] + +[[package]] +name = "ra-ap-rustc_hashes" +version = "0.123.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2439ed1df3472443133b66949f81080dff88089b42f825761455463709ee1cad" +dependencies = [ + "rustc-stable-hash", +] + +[[package]] +name = "ra-ap-rustc_index" +version = "0.123.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57a24fe0be21be1f8ebc21dcb40129214fb4cefb0f2753f3d46b6dbe656a1a45" +dependencies = [ + "ra-ap-rustc_index_macros", + "smallvec", +] + +[[package]] +name = "ra-ap-rustc_index_macros" +version = "0.123.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "844a27ddcad0116facae2df8e741fd788662cf93dc13029cd864f2b8013b81f9" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "ra-ap-rustc_lexer" +version = "0.121.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22944e31fb91e9b3e75bcbc91e37d958b8c0825a6160927f2856831d2ce83b36" +dependencies = [ + "memchr", + "unicode-properties", + "unicode-xid", +] + +[[package]] +name = "ra-ap-rustc_lexer" +version = "0.123.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b734cfcb577d09877799a22742f1bd398be6c00bc428d9de56d48d11ece5771" +dependencies = [ + "memchr", + "unicode-properties", + "unicode-xid", +] + +[[package]] +name = "ra-ap-rustc_parse_format" +version = "0.121.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81057891bc2063ad9e353f29462fbc47a0f5072560af34428ae9313aaa5e9d97" +dependencies = [ + "ra-ap-rustc_lexer 0.121.0", + "rustc-literal-escaper", +] + +[[package]] +name = "ra-ap-rustc_pattern_analysis" +version = "0.123.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b0ee1f059b9dea0818c6c7267478926eee95ba4c7dcf89c8db32fa165d3904" +dependencies = [ + "ra-ap-rustc_index", + "rustc-hash 2.1.1", + "rustc_apfloat", + "smallvec", + "tracing", +] + +[[package]] +name = "ra_ap_base_db" +version = "0.0.301" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e876bb2c3e52a8d4e6684526a2d4e81f9d028b939ee4dc5dc775fe10deb44d59" +dependencies = [ + "dashmap", + "indexmap", + "la-arena", + "ra_ap_cfg", + "ra_ap_intern", + "ra_ap_query-group-macro", + "ra_ap_span", + "ra_ap_syntax", + "ra_ap_vfs", + "rustc-hash 2.1.1", + "salsa", + "salsa-macros", + "semver", + "tracing", + "triomphe", +] + +[[package]] +name = "ra_ap_cfg" +version = "0.0.301" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a0b56eb4536ce6d2431932c4d337aeeaf7bb22c9249b38cbe80677b5881228f" +dependencies = [ + "ra_ap_intern", + "ra_ap_tt", + "rustc-hash 2.1.1", + "tracing", +] + +[[package]] +name = "ra_ap_edition" +version = "0.0.301" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bdc6cbe42c63ca78611bae82bfc8db24864f33dccc813697c5fde43a0907285" + +[[package]] +name = "ra_ap_hir" +version = "0.0.301" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebffdc134eccabc17209d7760cfff7fd12ed18ab6e21188c5e084b97aa38504c" +dependencies = [ + "arrayvec", + "either", + "indexmap", + "itertools 0.14.0", + "ra_ap_base_db", + "ra_ap_cfg", + "ra_ap_hir_def", + "ra_ap_hir_expand", + "ra_ap_hir_ty", + "ra_ap_intern", + "ra_ap_span", + "ra_ap_stdx", + "ra_ap_syntax", + "ra_ap_tt", + "rustc-hash 2.1.1", + "smallvec", + "tracing", + "triomphe", +] + +[[package]] +name = "ra_ap_hir_def" +version = "0.0.301" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81d2337ef59550392d42aa997aa1105a3d6d1c2b3a583c777786bc4a0a074fd5" +dependencies = [ + "arrayvec", + "bitflags 2.10.0", + "cov-mark", + "drop_bomb", + "either", + "fst", + "indexmap", + "itertools 0.14.0", + "la-arena", + "ra-ap-rustc_abi", + "ra-ap-rustc_parse_format", + "ra_ap_base_db", + "ra_ap_cfg", + "ra_ap_hir_expand", + "ra_ap_intern", + "ra_ap_mbe", + "ra_ap_query-group-macro", + "ra_ap_span", + "ra_ap_stdx", + "ra_ap_syntax", + "ra_ap_tt", + "rustc-hash 2.1.1", + "rustc_apfloat", + "salsa", + "salsa-macros", + "smallvec", + "text-size", + "thin-vec", + "tracing", + "triomphe", +] + +[[package]] +name = "ra_ap_hir_expand" +version = "0.0.301" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97cf8ececb2743a819d8299a408e17f164dd1a1004d65936b3d5493b55330326" +dependencies = [ + "cov-mark", + "either", + "itertools 0.14.0", + "ra_ap_base_db", + "ra_ap_cfg", + "ra_ap_intern", + "ra_ap_mbe", + "ra_ap_parser", + "ra_ap_query-group-macro", + "ra_ap_span", + "ra_ap_stdx", + "ra_ap_syntax", + "ra_ap_syntax-bridge", + "ra_ap_tt", + "rustc-hash 2.1.1", + "salsa", + "salsa-macros", + "smallvec", + "tracing", + "triomphe", +] + +[[package]] +name = "ra_ap_hir_ty" +version = "0.0.301" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc004e1099ba766a61500c27d34eb5cd336430d0a89a9620315a90d7a202a73a" +dependencies = [ + "arrayvec", + "bitflags 2.10.0", + "chalk-derive", + "chalk-ir", + "chalk-recursive", + "chalk-solve", + "cov-mark", + "either", + "ena", + "indexmap", + "itertools 0.14.0", + "la-arena", + "oorandom", + "ra-ap-rustc_abi", + "ra-ap-rustc_index", + "ra-ap-rustc_pattern_analysis", + "ra_ap_base_db", + "ra_ap_hir_def", + "ra_ap_hir_expand", + "ra_ap_intern", + "ra_ap_query-group-macro", + "ra_ap_span", + "ra_ap_stdx", + "ra_ap_syntax", + "rustc-hash 2.1.1", + "rustc_apfloat", + "salsa", + "salsa-macros", + "scoped-tls", + "smallvec", + "tracing", + "triomphe", + "typed-arena", +] + +[[package]] +name = "ra_ap_ide_db" +version = "0.0.301" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2acb572d6dbeb1c96d0339890ba91298b8f5f0ab22648da4ee2b4ab77dbc3fe" +dependencies = [ + "arrayvec", + "bitflags 2.10.0", + "cov-mark", + "crossbeam-channel", + "either", + "fst", + "indexmap", + "itertools 0.14.0", + "line-index", + "memchr", + "nohash-hasher", + "ra_ap_base_db", + "ra_ap_hir", + "ra_ap_parser", + "ra_ap_profile", + "ra_ap_query-group-macro", + "ra_ap_span", + "ra_ap_stdx", + "ra_ap_syntax", + "ra_ap_vfs", + "rayon", + "rustc-hash 2.1.1", + "salsa", + "salsa-macros", + "tracing", + "triomphe", +] + +[[package]] +name = "ra_ap_intern" +version = "0.0.301" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14586c2c4781b69fdd0c505972d9bff8c162a8740537a3ee506faff686d9a20d" +dependencies = [ + "dashmap", + "hashbrown 0.14.5", + "rustc-hash 2.1.1", + "triomphe", +] + +[[package]] +name = "ra_ap_load-cargo" +version = "0.0.301" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50ce5546b3e3414507ab4d12348d0a28748062e33a1448895c68466d0b015503" +dependencies = [ + "anyhow", + "crossbeam-channel", + "itertools 0.14.0", + "ra_ap_hir_expand", + "ra_ap_ide_db", + "ra_ap_intern", + "ra_ap_proc_macro_api", + "ra_ap_project_model", + "ra_ap_span", + "ra_ap_tt", + "ra_ap_vfs", + "ra_ap_vfs-notify", + "tracing", +] + +[[package]] +name = "ra_ap_mbe" +version = "0.0.301" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67333c6405797cb64aafb994b9a179157b30beeda2352e203e800be2b184a22d" +dependencies = [ + "arrayvec", + "cov-mark", + "ra-ap-rustc_lexer 0.123.0", + "ra_ap_intern", + "ra_ap_parser", + "ra_ap_span", + "ra_ap_stdx", + "ra_ap_syntax-bridge", + "ra_ap_tt", + "rustc-hash 2.1.1", + "smallvec", +] + +[[package]] +name = "ra_ap_parser" +version = "0.0.301" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a3b92b8b147c0826b83e70ad44e3c98e94201fc93e1f09396c43b4d7958c22a" +dependencies = [ + "drop_bomb", + "ra-ap-rustc_lexer 0.123.0", + "ra_ap_edition", + "rustc-literal-escaper", + "tracing", +] + +[[package]] +name = "ra_ap_paths" +version = "0.0.301" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4991f3d57fac0def7822bebfeb159c8d7b58c824bf82044b765c54f2c0971e2" +dependencies = [ + "camino", +] + +[[package]] +name = "ra_ap_proc_macro_api" +version = "0.0.301" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45db9e2df587d56f0738afa89fb2c100ff7c1e9cbe49e07f6a8b62342832211b" +dependencies = [ + "indexmap", + "ra_ap_intern", + "ra_ap_paths", + "ra_ap_span", + "ra_ap_stdx", + "ra_ap_tt", + "rustc-hash 2.1.1", + "serde", + "serde_derive", + "serde_json", + "tracing", +] + +[[package]] +name = "ra_ap_profile" +version = "0.0.301" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19981637b8ee4160e228c815a7fef3944b5c0555d6af41a931be92d68978bc6c" +dependencies = [ + "cfg-if", + "libc", + "perf-event", + "windows-sys 0.60.2", +] + +[[package]] +name = "ra_ap_project_model" +version = "0.0.301" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bda0769fd6ca949fdd5917acb68ddc2c143745614ddd94ef38b376838611cf8" +dependencies = [ + "anyhow", + "cargo_metadata", + "itertools 0.14.0", + "la-arena", + "ra_ap_base_db", + "ra_ap_cfg", + "ra_ap_intern", + "ra_ap_paths", + "ra_ap_span", + "ra_ap_stdx", + "ra_ap_toolchain", + "rustc-hash 2.1.1", + "semver", + "serde", + "serde_derive", + "serde_json", + "temp-dir", + "tracing", + "triomphe", +] + +[[package]] +name = "ra_ap_query-group-macro" +version = "0.0.301" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f182a4b05f004eabaa83250a5de7ea3a13a92c88f3cbe98bfa1880cd9fbce0a" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "ra_ap_span" +version = "0.0.301" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca6f9fa2de07f5cccf431674b90e82c1fe1ea2339db3b3869eec44d135de09a4" +dependencies = [ + "hashbrown 0.14.5", + "la-arena", + "ra_ap_stdx", + "ra_ap_syntax", + "ra_ap_vfs", + "rustc-hash 2.1.1", + "salsa", + "text-size", +] + +[[package]] +name = "ra_ap_stdx" +version = "0.0.301" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa770adb32896fcba934b464ac3bd179163ba2b0766e275eed5b4e262e08492b" +dependencies = [ + "crossbeam-channel", + "crossbeam-utils", + "itertools 0.14.0", + "jod-thread", + "libc", + "miow", + "tracing", + "windows-sys 0.60.2", +] + +[[package]] +name = "ra_ap_syntax" +version = "0.0.301" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e9e1393281ad5c635239d353ed3cfbf28c8d0af03d0c61a3b24b31d1143b17f" +dependencies = [ + "either", + "itertools 0.14.0", + "ra_ap_parser", + "ra_ap_stdx", + "rowan", + "rustc-hash 2.1.1", + "rustc-literal-escaper", + "smol_str", + "tracing", + "triomphe", +] + +[[package]] +name = "ra_ap_syntax-bridge" +version = "0.0.301" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "684e6ff1008ee5340335888f0453d94bb38950f110059a51f1818c7f6a56a807" +dependencies = [ + "ra_ap_intern", + "ra_ap_parser", + "ra_ap_span", + "ra_ap_stdx", + "ra_ap_syntax", + "ra_ap_tt", + "rustc-hash 2.1.1", +] + +[[package]] +name = "ra_ap_toolchain" +version = "0.0.301" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61969c5f72af03a9837e077c2d939d87a5c863623725c461777c352664a3bb03" +dependencies = [ + "camino", + "home", +] + +[[package]] +name = "ra_ap_tt" +version = "0.0.301" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb87c7b35572c18a580ea811e970b94875fad5ac7cfa8644266a59081044f959" +dependencies = [ + "arrayvec", + "ra-ap-rustc_lexer 0.123.0", + "ra_ap_intern", + "ra_ap_stdx", + "text-size", +] + +[[package]] +name = "ra_ap_vfs" +version = "0.0.301" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c174d6b9b7a7f54687df7e00c3e75ed6f082a7943a9afb1d54f33c0c12773de" +dependencies = [ + "crossbeam-channel", + "fst", + "indexmap", + "nohash-hasher", + "ra_ap_paths", + "ra_ap_stdx", + "rustc-hash 2.1.1", + "tracing", +] + +[[package]] +name = "ra_ap_vfs-notify" +version = "0.0.301" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04f6fce8d47c7ce9b8f2cd0e5a55f8fc4878d6043e61f46cde4391d3a5c6086f" +dependencies = [ + "crossbeam-channel", + "notify", + "ra_ap_paths", + "ra_ap_stdx", + "ra_ap_vfs", + "rayon", + "rustc-hash 2.1.1", + "tracing", + "walkdir", +] + +[[package]] +name = "rayon" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags 2.10.0", +] + +[[package]] +name = "rowan" +version = "0.15.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a58fa8a7ccff2aec4f39cc45bf5f985cec7125ab271cf681c279fd00192b49" +dependencies = [ + "countme", + "hashbrown 0.14.5", + "memoffset", + "rustc-hash 1.1.0", + "text-size", +] + +[[package]] +name = "rust_util" +version = "0.1.0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustc-hash" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" + +[[package]] +name = "rustc-literal-escaper" +version = "0.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab03008eb631b703dd16978282ae36c73282e7922fe101a4bd072a40ecea7b8b" + +[[package]] +name = "rustc-stable-hash" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "781442f29170c5c93b7185ad559492601acdc71d5bb0706f5868094f45cfcd08" + +[[package]] +name = "rustc_apfloat" +version = "0.2.3+llvm-462a31f5a5ab" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "486c2179b4796f65bfe2ee33679acf0927ac83ecf583ad6c91c3b4570911b9ad" +dependencies = [ + "bitflags 2.10.0", + "smallvec", +] + +[[package]] +name = "ryu" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" + +[[package]] +name = "salsa" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e235afdb8e510f38a07138fbe5a0b64691894358a9c0cbd813b1aade110efc9" +dependencies = [ + "boxcar", + "crossbeam-queue", + "crossbeam-utils", + "hashbrown 0.15.5", + "hashlink", + "indexmap", + "intrusive-collections", + "papaya", + "parking_lot", + "portable-atomic", + "rayon", + "rustc-hash 2.1.1", + "salsa-macro-rules", + "salsa-macros", + "smallvec", + "thin-vec", + "tracing", +] + +[[package]] +name = "salsa-macro-rules" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2edb86a7e9c91f6d30c9ce054312721dbe773a162db27bbfae834d16177b30ce" + +[[package]] +name = "salsa-macros" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0778d6e209051bc4e75acfe83bcd7848601ec3dbe9c3dbb982829020e9128af" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "scoped-tls" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "seize" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b55fb86dfd3a2f5f76ea78310a88f96c4ea21a3031f8d212443d56123fd0521" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "semver" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" +dependencies = [ + "serde", + "serde_core", +] + +[[package]] +name = "serde" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde-untagged" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9faf48a4a2d2693be24c6289dbe26552776eb7737074e6722891fadbe6c5058" +dependencies = [ + "erased-serde", + "serde", + "serde_core", + "typeid", +] + +[[package]] +name = "serde-value" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3a1a3341211875ef120e117ea7fd5228530ae7e7036a779fdc9117be6b3282c" +dependencies = [ + "ordered-float", + "serde", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.145" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", + "serde_core", +] + +[[package]] +name = "serde_spanned" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" +dependencies = [ + "serde", +] + +[[package]] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" + +[[package]] +name = "smol_str" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3498b0a27f93ef1402f20eefacfaa1691272ac4eca1cdc8c596cb0a245d6cbf5" +dependencies = [ + "borsh", + "serde_core", +] + +[[package]] +name = "split_ffi_entry_points" +version = "0.1.0" +dependencies = [ + "clap", + "proc-macro2", + "quote", + "ra_ap_hir", + "ra_ap_ide_db", + "ra_ap_load-cargo", + "ra_ap_project_model", + "ra_ap_syntax", + "rust_util", + "syn", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "syn" +version = "2.0.108" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da58917d35242480a05c2897064da0a80589a2a0476c9a3f2fdc83b53502e917" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "synstructure" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "temp-dir" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83176759e9416cf81ee66cb6508dbfe9c96f20b8b56265a39917551c23c70964" + +[[package]] +name = "text-size" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f18aa187839b2bdb1ad2fa35ead8c4c2976b64e4363c386d45ac0f7ee85c9233" + +[[package]] +name = "thin-vec" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "144f754d318415ac792f9d69fc87abbbfc043ce2ef041c60f16ad828f638717d" + +[[package]] +name = "thiserror" +version = "2.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tinystr" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "toml" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.22.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "toml_write", + "winnow", +] + +[[package]] +name = "toml_write" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" + +[[package]] +name = "tracing" +version = "0.1.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing-core" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678" +dependencies = [ + "once_cell", +] + +[[package]] +name = "triomphe" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd69c5aa8f924c7519d6372789a74eac5b94fb0f8fcf0d4a97eb0bfc3e785f39" + +[[package]] +name = "typed-arena" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6af6ae20167a9ece4bcb41af5b80f8a1f1df981f6391189ce00fd257af04126a" + +[[package]] +name = "typeid" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc7d623258602320d5c55d1bc22793b57daff0ec7efc270ea7d55ce1d5f5471c" + +[[package]] +name = "unicode-ident" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f63a545481291138910575129486daeaf8ac54aee4387fe7906919f7830c7d9d" + +[[package]] +name = "unicode-properties" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e70f2a8b45122e719eb623c01822704c4e0907e7e426a05927e1a1cfff5b75d0" + +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + +[[package]] +name = "url" +version = "2.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08bc136a29a3d1758e07a9cca267be308aeebf5cfd5a10f3f67ab2097683ef5b" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-sys" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-targets" +version = "0.53.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" +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", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" + +[[package]] +name = "windows_i686_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" + +[[package]] +name = "windows_i686_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" + +[[package]] +name = "winnow" +version = "0.7.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21a0236b59786fed61e2a80582dd500fe61f18b5dca67a4a067d0bc9039339cf" +dependencies = [ + "memchr", +] + +[[package]] +name = "writeable" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" + +[[package]] +name = "yoke" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72d6e5c6afb84d73944e5cedb052c4680d5657337201555f9f2a16b7406d4954" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerofrom" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerotrie" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a59c17a5562d507e4b54960e8569ebee33bee890c70aa3fe7b97e85a9fd7851" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] diff --git a/tools/split_ffi_entry_points/Cargo.toml b/tools/split_ffi_entry_points/Cargo.toml new file mode 100644 index 0000000000..3f7254b581 --- /dev/null +++ b/tools/split_ffi_entry_points/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "split_ffi_entry_points" +version = "0.1.0" +edition = "2024" + +[dependencies] +rust_util = { path = "../rust_util" } + +syn = { version = "2.0.108", features = ["full", "visit-mut", "visit"] } +proc-macro2 = { version = "1", features = ["span-locations"] } +quote = "1" +clap = { version = "4.5", features = ["derive"] } + +ra_ap_hir = "=0.0.301" +ra_ap_ide_db = "=0.0.301" +ra_ap_load-cargo = "=0.0.301" +ra_ap_project_model = "=0.0.301" +ra_ap_syntax = "=0.0.301" diff --git a/tools/split_ffi_entry_points/src/main.rs b/tools/split_ffi_entry_points/src/main.rs new file mode 100644 index 0000000000..33fed3afa6 --- /dev/null +++ b/tools/split_ffi_entry_points/src/main.rs @@ -0,0 +1,408 @@ +use clap::Parser; +use proc_macro2::{Span, TokenStream}; +use quote::ToTokens; +use ra_ap_hir::Semantics; +use ra_ap_ide_db::RootDatabase; +use ra_ap_load_cargo::{self, LoadCargoConfig, ProcMacroServerChoice}; +use ra_ap_project_model::CargoConfig; +use ra_ap_syntax::SyntaxNode; +use rust_util::rewrite::{FlatTokens, OutputBuffer, TokenIndex, render_output}; +use std::fs; +use std::iter; +use std::mem; +use std::path::{Path, PathBuf}; +use std::str::FromStr; +use syn; +use syn::spanned::Spanned; +use syn::visit_mut::{self, VisitMut}; + +struct AddDerivedItemVisitor(F); + +impl Option> AddDerivedItemVisitor { + fn visit_items(&mut self, items: &mut Vec) { + let new_items = Vec::with_capacity(items.len()); + let old_items = mem::replace(items, new_items); + for mut item in old_items { + let derived_item = (self.0)(&mut item); + items.push(item); + if let Some(derived_item) = derived_item { + items.push(derived_item); + } + } + } +} + +impl Option> VisitMut for AddDerivedItemVisitor { + fn visit_item_mod_mut(&mut self, im: &mut syn::ItemMod) { + let items = match im.content { + Some((_, ref mut x)) => x, + None => return, + }; + self.visit_items(items); + visit_mut::visit_item_mod_mut(self, im); + } + + fn visit_file_mut(&mut self, f: &mut syn::File) { + self.visit_items(&mut f.items); + visit_mut::visit_file_mut(self, f); + } +} + +fn add_ffi_wrapper( + _db: &RootDatabase, + _sema: &Semantics, + _root: SyntaxNode, + item: &mut syn::Item, +) -> Option { + let fn_item = match *item { + syn::Item::Fn(ref mut x) => x, + _ => return None, + }; + let fn_name = fn_item.sig.ident.to_string(); + + // Example of gathering semantic information from rust-analyzer: + /* + let range = span_to_text_range(fn_item.span()); + let cover = root.covering_element(range); + // If this assert fails, we might need to look for a `FN` ancestor of `cover` instead. + debug_assert_eq!(cover.kind(), SyntaxKind::FN); + let cover = cover.into_node().unwrap(); + let f_ast = ast::Fn::cast(cover).unwrap(); + eprintln!("f_ast = {f_ast:?}"); + + let f = sema.to_fn_def(&f_ast).unwrap(); + eprintln!("f = {f:?}"); + + let attrs = f.attrs(db); + // etc... + */ + + // Walk over the attributes of `fn_item`, sorting them into attrs that should remain on the + // inner function and ones that should be moved or copied onto the newly-generated wrapper. + let mut inner_attrs = Vec::with_capacity(fn_item.attrs.len()); + let mut wrapper_attrs = Vec::new(); + let mut need_wrapper = false; + + for mut attr in mem::take(&mut fn_item.attrs) { + let mut pm = ParsedMeta::from(attr.meta); + + let mut move_to_wrapper = false; + pm.with_innermost_mut(&mut |pm| match pm { + ParsedMeta::NoMangle(..) => { + move_to_wrapper = true; + *pm = ParsedMeta::ExportName(ParsedMetaExportName { + ident: syn::Ident::new("export_name", Span::call_site()), + eq: syn::Token![=](Span::call_site()), + name: syn::LitStr::new(&fn_name, Span::call_site()), + }); + } + ParsedMeta::ExportName(..) => { + move_to_wrapper = true; + } + _ => {} + }); + + attr.meta = pm.into(); + + if move_to_wrapper { + wrapper_attrs.push(attr); + need_wrapper = true; + } else { + inner_attrs.push(attr); + } + } + + fn_item.attrs = inner_attrs; + + if !need_wrapper { + return None; + } + + let wrapper_name = format!("{fn_name}_ffi"); + let mut fn_wrapper = syn::ItemFn { + attrs: wrapper_attrs, + vis: fn_item.vis.clone(), + sig: fn_item.sig.clone(), + block: Box::new(syn::Block { + brace_token: syn::token::Brace::default(), + stmts: Vec::new(), + }), + }; + fn_wrapper.sig.ident = syn::Ident::new(&wrapper_name, Span::call_site()); + + let mut arg_exprs = Vec::new(); + for (i, arg) in fn_wrapper.sig.inputs.iter_mut().enumerate() { + let ident = match *arg { + syn::FnArg::Receiver(_) => syn::Ident::new("self", Span::call_site()), + syn::FnArg::Typed(ref mut pt) => match *pt.pat { + syn::Pat::Ident(ref pi) => pi.ident.clone(), + _ => { + let ident = syn::Ident::new(&format!("arg{i}"), Span::call_site()); + *pt.pat = syn::Pat::Ident(syn::PatIdent { + attrs: Vec::new(), + by_ref: None, + mutability: None, + ident: ident.clone(), + subpat: None, + }); + ident + } + }, + }; + let expr = syn::Expr::Path(syn::ExprPath { + attrs: Vec::new(), + qself: None, + path: syn::Path::from(ident), + }); + arg_exprs.push(expr); + } + + let wrapper_expr = syn::Expr::Call(syn::ExprCall { + attrs: Vec::new(), + func: Box::new(syn::Expr::Path(syn::ExprPath { + attrs: Vec::new(), + qself: None, + path: syn::Path::from(syn::Ident::new(&fn_name, Span::call_site())), + })), + paren_token: syn::token::Paren::default(), + args: arg_exprs.into_iter().collect(), + }); + let wrapper_stmt = syn::Stmt::Expr(wrapper_expr, None); + fn_wrapper.block.stmts.push(wrapper_stmt); + + Some(fn_wrapper.into()) +} + +/* +fn span_to_text_range(span: Span) -> TextRange { + let span_range = span.byte_range(); + let lo = TextSize::try_from(span_range.start).unwrap(); + let hi = TextSize::try_from(span_range.end).unwrap(); + TextRange::new(lo, hi) +} +*/ + +// Helpers for dealing with nested meta items in attrs, like `#[unsafe(no_mangle)]` + +#[derive(Clone)] +enum ParsedMeta { + Meta(syn::Meta), + Unsafe(Box), + NoMangle(ParsedMetaNoMangle), + ExportName(ParsedMetaExportName), +} + +#[derive(Clone)] +struct ParsedMetaUnsafe { + ident: syn::Ident, + paren: syn::token::Paren, + inner: ParsedMeta, +} + +#[derive(Clone)] +struct ParsedMetaNoMangle { + ident: syn::Ident, +} + +#[derive(Clone)] +struct ParsedMetaExportName { + ident: syn::Ident, + eq: syn::Token![=], + name: syn::LitStr, +} + +impl ParsedMeta { + pub fn parse(meta: &syn::Meta) -> syn::Result { + let ident = meta.path().require_ident()?; + let ident_str = ident.to_string(); + match ident_str.as_str() { + "unsafe" => { + let ml = meta.require_list()?; + let ident = ml.path.require_ident()?.clone(); + let paren = match ml.delimiter { + syn::MacroDelimiter::Paren(p) => p, + _ => { + return Err(syn::Error::new( + ml.delimiter.span().open(), + "expected parens", + )); + } + }; + let meta: syn::Meta = syn::parse2(ml.tokens.clone())?; + let inner = ParsedMeta::from(meta); + Ok(ParsedMeta::Unsafe(Box::new(ParsedMetaUnsafe { + ident, + paren, + inner, + }))) + } + "no_mangle" => { + let _ = meta.require_path_only()?; + let ident = ident.clone(); + Ok(ParsedMeta::NoMangle(ParsedMetaNoMangle { ident })) + } + "export_name" => { + let mnv = meta.require_name_value()?; + let ident = mnv.path.require_ident()?.clone(); + let eq = mnv.eq_token; + let expr_lit = match mnv.value { + syn::Expr::Lit(ref el) => el, + _ => return Err(syn::Error::new(mnv.value.span(), "expected Lit")), + }; + let syn::ExprLit { ref attrs, ref lit } = *expr_lit; + if attrs.len() > 0 { + return Err(syn::Error::new(expr_lit.span(), "name must not have attrs")); + } + let name = match *lit { + syn::Lit::Str(ref ls) => ls.clone(), + _ => return Err(syn::Error::new(lit.span(), "expected Str")), + }; + Ok(ParsedMeta::ExportName(ParsedMetaExportName { + ident, + eq, + name, + })) + } + _ => Ok(ParsedMeta::Meta(meta.clone())), + } + } + + pub fn with_innermost_mut(&mut self, f: &mut impl FnMut(&mut ParsedMeta)) { + match *self { + ParsedMeta::Meta(..) | ParsedMeta::NoMangle(..) | ParsedMeta::ExportName(..) => f(self), + ParsedMeta::Unsafe(ref mut pmu) => pmu.inner.with_innermost_mut(f), + } + } +} + +impl From for ParsedMeta { + fn from(meta: syn::Meta) -> ParsedMeta { + match Self::parse(&meta) { + Ok(x) => x, + Err(e) => { + eprintln!("warning: failed to parse `{}`: {e}", meta.to_token_stream()); + ParsedMeta::Meta(meta) + } + } + } +} + +impl From for syn::Meta { + fn from(pm: ParsedMeta) -> syn::Meta { + syn::parse2(pm.into_token_stream()).unwrap() + } +} + +impl ToTokens for ParsedMeta { + fn to_tokens(&self, tokens: &mut TokenStream) { + match *self { + ParsedMeta::Meta(ref x) => x.to_tokens(tokens), + ParsedMeta::Unsafe(ref x) => x.to_tokens(tokens), + ParsedMeta::NoMangle(ref x) => x.to_tokens(tokens), + ParsedMeta::ExportName(ref x) => x.to_tokens(tokens), + } + } +} + +impl ToTokens for ParsedMetaUnsafe { + fn to_tokens(&self, tokens: &mut TokenStream) { + self.ident.to_tokens(tokens); + self.paren.surround(tokens, |tokens| { + self.inner.to_tokens(tokens); + }); + } +} + +impl ToTokens for ParsedMetaNoMangle { + fn to_tokens(&self, tokens: &mut TokenStream) { + self.ident.to_tokens(tokens); + } +} + +impl ToTokens for ParsedMetaExportName { + fn to_tokens(&self, tokens: &mut TokenStream) { + self.ident.to_tokens(tokens); + self.eq.to_tokens(tokens); + self.name.to_tokens(tokens); + } +} + +/// Split FFI entrypoints out of a freshly-transpiled Rust codebase. +#[derive(Parser)] +struct Args { + /// Directory of Rust project to modify. `Cargo.toml` should reside inside this directory. + cargo_dir_path: PathBuf, +} + +fn main() { + let args = Args::parse(); + let cargo_dir_path = Path::new(&args.cargo_dir_path); + + let cargo_config = CargoConfig::default(); + + let load_cargo_config: LoadCargoConfig = LoadCargoConfig { + load_out_dirs_from_check: true, + with_proc_macro_server: ProcMacroServerChoice::Sysroot, + prefill_caches: false, + }; + + let (db, vfs, _proc_macro_client) = ra_ap_load_cargo::load_workspace_at( + cargo_dir_path, + &cargo_config, + &load_cargo_config, + &|_msg| {}, + ) + .unwrap(); + + // Assume the first file in `vfs` is the crate root. + let (first_file_id, _) = vfs.iter().next().unwrap(); + + let sema = Semantics::new(&db); + + eprintln!("processing crate..."); + let krate = sema.first_crate(first_file_id).unwrap(); + + let mut files = Vec::new(); + for m in krate.modules(&db) { + let src = m.definition_source(&db); + let node = src.value.node(); + if let Some(editioned_file_id) = m.as_source_file_id(&db) { + sema.parse(editioned_file_id); + let file_id = editioned_file_id.file_id(&db); + let vfs_path = vfs.file_path(file_id); + if let Some(path) = vfs_path.as_path() { + files.push((path.to_path_buf(), node)); + } + } + } + + for (path, root) in files { + // Only rewrite files that are inside the provided cargo dir. If our strategy for finding + // the main crate is wrong, this will keep us from overwriting files unexpectedly. + let mut ancestors = iter::successors(Some(path.as_path()), |p| p.parent()); + if !ancestors.any(|a| a == cargo_dir_path) { + eprintln!("skip {path:?}: outside cargo dir {cargo_dir_path:?}"); + continue; + } + + let code = fs::read_to_string(&path).unwrap(); + + let ts = TokenStream::from_str(&code).unwrap(); + let orig_tokens = FlatTokens::new(ts.clone()).collect::>(); + let ti = TokenIndex::new(&orig_tokens); + + let mut ast: syn::File = syn::parse2(ts.clone()).unwrap(); + let mut v = AddDerivedItemVisitor(|i: &mut syn::Item| -> Option { + add_ffi_wrapper(&db, &sema, root.clone(), i) + }); + v.visit_file_mut(&mut ast); + + let new_ts = ast.into_token_stream(); + + let mut buf = OutputBuffer::new(); + render_output(&code, &orig_tokens, &ti, new_ts, &mut buf); + let s = buf.finish(); + fs::write(&path, &s).unwrap(); + eprintln!("wrote {:?}", path); + } +} diff --git a/tools/split_rust/Cargo.lock b/tools/split_rust/Cargo.lock new file mode 100644 index 0000000000..2cfed465c0 --- /dev/null +++ b/tools/split_rust/Cargo.lock @@ -0,0 +1,260 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "anstream" +version = "0.6.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" + +[[package]] +name = "anstyle-parse" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys", +] + +[[package]] +name = "clap" +version = "4.5.53" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9e340e012a1bf4935f5282ed1436d1489548e8f72308207ea5df0e23d2d03f8" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.5.53" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d76b5d13eaa18c901fd2f7fca939fefe3a0727a953561fefdf3b2922b8569d00" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.5.49" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a0b5487afeab2deb2ff4e03a807ad1a03ac532ff5a2cee5d86884440c7f7671" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d" + +[[package]] +name = "colorchoice" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + +[[package]] +name = "itoa" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" + +[[package]] +name = "memchr" +version = "2.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" + +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + +[[package]] +name = "proc-macro2" +version = "1.0.103" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rust_util" +version = "0.1.0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "ryu" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" + +[[package]] +name = "serde" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.145" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", + "serde_core", +] + +[[package]] +name = "split_rust" +version = "0.1.0" +dependencies = [ + "clap", + "proc-macro2", + "quote", + "rust_util", + "serde_json", + "syn", +] + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "syn" +version = "2.0.110" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a99801b5bd34ede4cf3fc688c5919368fea4e4814a4664359503e6015b280aea" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "unicode-ident" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] diff --git a/tools/split_rust/Cargo.toml b/tools/split_rust/Cargo.toml new file mode 100644 index 0000000000..0d102961ea --- /dev/null +++ b/tools/split_rust/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "split_rust" +version = "0.1.0" +edition = "2024" + +[dependencies] +rust_util = { path = "../rust_util" } + +syn = { version = "2.0.108", features = ["full", "visit"] } +proc-macro2 = { version = "1", features = ["span-locations"] } +quote = "1" +clap = { version = "4.5", features = ["derive"] } + +serde_json = "1" diff --git a/tools/split_rust/src/main.rs b/tools/split_rust/src/main.rs new file mode 100644 index 0000000000..206d389cad --- /dev/null +++ b/tools/split_rust/src/main.rs @@ -0,0 +1,30 @@ +use clap::Parser; +use rust_util::collect::FileCollector; +use rust_util::item_span::item_spans; +use serde_json; +use std::collections::HashMap; +use std::fs; +use std::path::PathBuf; + +/// Split a Rust codebase into a JSON map from item paths to their source text. +#[derive(Parser)] +struct Args { + /// Root Rust source file to split (`lib.rs` or `main.rs`). + src_root_path: PathBuf, +} + +fn main() { + let args = Args::parse(); + let mut fc = FileCollector::default(); + fc.parse(args.src_root_path, vec![], true).unwrap(); + let mut out = HashMap::new(); + for &(ref name, ref mod_path, ref ast) in &fc.files { + eprintln!("visit {:?}", name); + let src = fs::read_to_string(name).unwrap(); + for (item_path, lo, hi) in item_spans(mod_path.to_owned(), ast) { + let snippet = &src[lo..hi]; + out.insert(item_path.join("::"), snippet.to_owned()); + } + } + serde_json::to_writer(std::io::stdout(), &out).unwrap(); +}