diff --git a/libs/Cargo.lock b/libs/Cargo.lock index 0555ae213..976ca4354 100644 --- a/libs/Cargo.lock +++ b/libs/Cargo.lock @@ -84,21 +84,6 @@ dependencies = [ "as-slice", ] -[[package]] -name = "android-tzdata" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" - -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", -] - [[package]] name = "anstream" version = "0.6.15" @@ -391,9 +376,9 @@ dependencies = [ [[package]] name = "cargo-manifest" -version = "0.14.0" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7db7ad32d2729eca70d1669bae38b6a29dabc30a16f1892cc00977873f450d0a" +checksum = "03fa8484a7f2eef80e6dd2e2be90b322b9c29aeb1bbc206013d6eb2104db7241" dependencies = [ "serde", "thiserror", @@ -456,18 +441,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" -[[package]] -name = "chrono" -version = "0.4.38" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" -dependencies = [ - "android-tzdata", - "iana-time-zone", - "num-traits", - "windows-targets 0.52.6", -] - [[package]] name = "cipher" version = "0.4.4" @@ -490,9 +463,9 @@ dependencies = [ [[package]] name = "clap-stdin" -version = "0.4.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc126d12a0930c94c3548581294d5f19360ac02e408600b4d7619d7234e8b505" +checksum = "471df7896633bfc1e7d3da5b598422891e4cb8931210168ec63ea586e285803f" dependencies = [ "thiserror", ] @@ -562,7 +535,7 @@ dependencies = [ "encode_unicode", "lazy_static", "libc", - "unicode-width", + "unicode-width 0.1.14", "windows-sys 0.52.0", ] @@ -601,12 +574,6 @@ dependencies = [ "unicode-segmentation", ] -[[package]] -name = "core-foundation-sys" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" - [[package]] name = "cpufeatures" version = "0.2.14" @@ -1145,7 +1112,7 @@ dependencies = [ "fixedbitset", "guppy-workspace-hack", "indexmap", - "itertools 0.13.0", + "itertools", "nested", "once_cell", "pathdiff", @@ -1369,29 +1336,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "iana-time-zone" -version = "0.1.61" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "wasm-bindgen", - "windows-core", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" -dependencies = [ - "cc", -] - [[package]] name = "ident_case" version = "1.0.1" @@ -1464,7 +1408,7 @@ dependencies = [ "instant", "number_prefix", "portable-atomic", - "unicode-width", + "unicode-width 0.1.14", ] [[package]] @@ -1518,15 +1462,6 @@ version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" -[[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.13.0" @@ -1627,9 +1562,9 @@ dependencies = [ [[package]] name = "libsqlite3-sys" -version = "0.28.0" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c10584274047cb335c23d3e61bcef8e323adae7c5c8c760540f73610177fc3f" +checksum = "2e99fb7a497b1e3339bc746195567ed8d3e24945ecd636e3619d20b9de9e9149" dependencies = [ "cc", "pkg-config", @@ -1638,14 +1573,14 @@ dependencies = [ [[package]] name = "libtest-mimic" -version = "0.7.3" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc0bda45ed5b3a2904262c1bb91e526127aa70e7ef3758aba2ef93cf896b9b58" +checksum = "5297962ef19edda4ce33aaa484386e0a5b3d7f2f4e037cbeee00503ef6b29d33" dependencies = [ + "anstream", + "anstyle", "clap", "escape8259", - "termcolor", - "threadpool", ] [[package]] @@ -1680,7 +1615,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2752e978ffc53670f3f2e8b3ef09f348d6f7b5474a3be3f8a5befe5382e4effb" dependencies = [ "anymap2", - "itertools 0.13.0", + "itertools", "kstring", "liquid-derive", "num-traits", @@ -1708,7 +1643,7 @@ version = "0.26.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59b1a298d3d2287ee5b1e43840d885b8fdfc37d3f4e90d82aacfd04d021618da" dependencies = [ - "itertools 0.13.0", + "itertools", "liquid-core", "once_cell", "percent-encoding", @@ -1795,10 +1730,10 @@ dependencies = [ "supports-color", "supports-hyperlinks", "supports-unicode", - "terminal_size", + "terminal_size 0.3.0", "textwrap", "thiserror", - "unicode-width", + "unicode-width 0.1.14", ] [[package]] @@ -1962,11 +1897,11 @@ dependencies = [ [[package]] name = "object-pool" -version = "0.5.4" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee9a3e7196d09ec86002b939f1576e8e446d58def8fd48fe578e2c72d5328d68" +checksum = "ceffa2e6ccecd71e60a0f06b655df2c66acd1c0c892dafefc96fd49d65f71d53" dependencies = [ - "parking_lot 0.11.2", + "parking_lot 0.12.3", ] [[package]] @@ -2100,7 +2035,7 @@ dependencies = [ "hyper-util", "indexmap", "insta", - "itertools 0.12.1", + "itertools", "mime", "paste", "pavex_bp_schema", @@ -2187,7 +2122,7 @@ dependencies = [ "tracing-subscriber", "ureq", "vergen-gitcl", - "windows-sys 0.52.0", + "windows-sys 0.59.0", "xdg-home", "xz2", "zip", @@ -2241,9 +2176,9 @@ dependencies = [ "supports-color", "supports-hyperlinks", "supports-unicode", - "terminal_size", + "terminal_size 0.4.0", "textwrap", - "unicode-width", + "unicode-width 0.2.0", ] [[package]] @@ -2297,7 +2232,7 @@ dependencies = [ "fs-err", "globwalk", "guppy", - "itertools 0.12.1", + "itertools", "libtest-mimic", "miette", "num_cpus", @@ -2343,7 +2278,7 @@ dependencies = [ "fs-err", "guppy", "indexmap", - "itertools 0.12.1", + "itertools", "la-arena", "miette", "num_cpus", @@ -2712,9 +2647,9 @@ dependencies = [ [[package]] name = "r2d2_sqlite" -version = "0.24.0" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a982edf65c129796dba72f8775b292ef482b40d035e827a9825b3bc07ccc5f2" +checksum = "eb14dba8247a6a15b7fdbc7d389e2e6f03ee9f184f87117706d509c092dfe846" dependencies = [ "r2d2", "rusqlite", @@ -2921,13 +2856,12 @@ dependencies = [ [[package]] name = "reqwest-retry" -version = "0.5.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40f342894422862af74c50e1e9601cf0931accc9c6981e5eb413c46603b616b5" +checksum = "a83df1aaec00176d0fabb65dea13f832d2a446ca99107afc17c5d2d4981221d0" dependencies = [ "anyhow", "async-trait", - "chrono", "futures", "getrandom", "http", @@ -2959,12 +2893,10 @@ dependencies = [ [[package]] name = "retry-policies" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "493b4243e32d6eedd29f9a398896e35c6943a123b55eec97dcaee98310d25810" +checksum = "5875471e6cab2871bc150ecb8c727db5113c9338cc3354dc5ee3425b6aa40a1c" dependencies = [ - "anyhow", - "chrono", "rand", ] @@ -2997,9 +2929,9 @@ dependencies = [ [[package]] name = "rusqlite" -version = "0.31.0" +version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b838eba278d213a8beaf485bd313fd580ca4505a00d5871caeb1457c55322cae" +checksum = "7753b721174eb8ff87a9a0e799e2d7bc3749323e773db92e0984debb00019d6e" dependencies = [ "bitflags 2.6.0", "fallible-iterator", @@ -3033,9 +2965,9 @@ checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" [[package]] name = "rustdoc-types" -version = "0.28.1" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edcdc023d622eeec23ac48f064126eb09b69e19728308aa905bdc28b562b4319" +checksum = "d368a6e25f5445187e8f67a7ec1cdf38f6d361fb26f9476b8b5f0bd91d88fd60" dependencies = [ "serde", ] @@ -3483,6 +3415,16 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "terminal_size" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f599bd7ca042cfdf8f4512b277c02ba102247820f9d9d4a9f521f496751a6ef" +dependencies = [ + "rustix", + "windows-sys 0.59.0", +] + [[package]] name = "textwrap" version = "0.16.1" @@ -3491,7 +3433,7 @@ checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9" dependencies = [ "smawk", "unicode-linebreak", - "unicode-width", + "unicode-width 0.1.14", ] [[package]] @@ -3524,15 +3466,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "threadpool" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" -dependencies = [ - "num_cpus", -] - [[package]] name = "time" version = "0.3.36" @@ -3846,6 +3779,12 @@ version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" +[[package]] +name = "unicode-width" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd" + [[package]] name = "universal-hash" version = "0.5.1" @@ -4121,15 +4060,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "windows-core" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" -dependencies = [ - "windows-targets 0.52.6", -] - [[package]] name = "windows-registry" version = "0.2.0" diff --git a/libs/Cargo.toml b/libs/Cargo.toml index 865f75610..ce0cd76c4 100644 --- a/libs/Cargo.toml +++ b/libs/Cargo.toml @@ -16,105 +16,105 @@ license = "Apache-2.0" version = "0.1.48" [workspace.dependencies] -vergen-gitcl = { version = "1.0.0", features = ["build"] } +vergen-gitcl = { version = "1.0.1", features = ["build"] } ahash = "0.8" -anstyle = "1.0.6" -anyhow = "1.0.79" +anstyle = "1.0.8" +anyhow = "1.0.89" better-panic = "0.3.0" -bimap = "0.6.2" +bimap = "0.6.3" bincode = "1" biscotti = "0.3" -bytes = "1.5.0" +bytes = "1.7.2" camino = "1" -cargo-like-utils = "0.1.2" -cargo_metadata = "0.18.0" -cargo-manifest = "0.14.0" +cargo-like-utils = "0.1.4" +cargo_metadata = "0.18.1" +cargo-manifest = "0.15.2" clap = "4" -clap-stdin = "0.4.0" +clap-stdin = "0.5.1" config = "0.14.0" -console = "0.15.1" +console = "0.15.8" convert_case = "0.6" xxhash-rust = "0.8.12" -elsa = "1.4.0" +elsa = "1.10.0" fixedbitset = "0.4" fs-err = "2.11.0" futures-util = "0.3" globwalk = "0.9.1" guppy = "0.17" -heck = "0.5.0-rc.1" +heck = "0.5.0" hex = "0.4.3" http = "1" http-body = "1" http-body-util = "0.1" hyper = "1" hyper-util = "0.1" -include_dir = "0.7.3" +include_dir = "0.7.4" indexmap = "2" -indicatif = "0.17.7" -insta = "1.29.0" -itertools = "0.12" -jsonwebtoken = "9.0.1" +indicatif = "0.17.8" +insta = "1.40.0" +itertools = "0.13" +jsonwebtoken = "9.3.0" la-arena = "0.3" -libc = "0.2.152" -libtest-mimic = "0.7.0" -liquid = "0.26.4" -liquid-core = "0.26.4" +libc = "0.2.159" +libtest-mimic = "0.8.1" +liquid = "0.26.9" +liquid-core = "0.26.9" matchit = "0.7" miette = "7.2.0" mime = "0.3" -num_cpus = "1.15.0" -object-pool = "0.5" -once_cell = "1.19.0" +num_cpus = "1.16.0" +object-pool = "0.6" +once_cell = "1.20.2" paste = "1" path-absolutize = "3.1.1" pem = "3.0.4" percent-encoding = "2" -petgraph = { version = "0.6.2", default-features = false } +petgraph = { version = "0.6.5", default-features = false } pin-project-lite = "0.2" prettyplease = "0.2" -proc-macro2 = "1.0.40" -quote = "1.0.20" +proc-macro2 = "1.0.87" +quote = "1.0.37" r2d2 = "0.8" -r2d2_sqlite = "0.24.0" -rayon = "1.7" -redact = "0.1.9" -regex = "1.10.2" +r2d2_sqlite = "0.25.0" +rayon = "1.10" +redact = "0.1.10" +regex = "1.11.0" relative-path = "1.9" -remove_dir_all = "0.8.2" +remove_dir_all = "0.8.4" reqwest = { version = "0.12", default-features = false, features = [ "rustls-tls", ] } -reqwest-middleware = "0.3.0" -reqwest-retry = "0.5.0" -reqwest-tracing = "0.5.0" -ring = "0.17.3" +reqwest-middleware = "0.3.3" +reqwest-retry = "0.6.1" +reqwest-tracing = "0.5.3" +ring = "0.17.8" ron = "0.8" -rusqlite = "0.31" -rustdoc-types = "0.28.1" +rusqlite = "0.32" +rustdoc-types = "0.31.0" sanitize-filename = "0.5" -self-replace = "1.3.7" -semver = "1.0.21" -serde = "1.0.141" +self-replace = "1.5.0" +semver = "1.0.23" +serde = "1.0.210" serde_html_form = "0.2" -serde_json = "1.0.111" +serde_json = "1.0.128" serde_path_to_error = "0.1" serde_stacker = "0.1" sha2 = "0.10.8" -similar = "2.2.0" +similar = "2.6.0" smallvec = "1" -socket2 = "0.5.3" -supports-color = "3.0.0" +socket2 = "0.5.7" +supports-color = "3.0.1" supports-hyperlinks = "3.0.0" supports-unicode = "3.0.0" syn = "2.0" -tar = "0.4.40" -tempfile = "3.9.0" -terminal_size = "0.3" -textwrap = "0.16.0" -thiserror = "1.0.56" +tar = "0.4.42" +tempfile = "3.13.0" +terminal_size = "0.4" +textwrap = "0.16.1" +thiserror = "1.0.64" time = "0.3.36" -tokio = "1.37.0" -toml = "0.8.8" +tokio = "1.40.0" +toml = "0.8.19" toml_edit = "0.22" tracing = { version = "0.1.40", default-features = false } tracing-log = "0.2" @@ -123,15 +123,15 @@ tracing-subscriber = "0.3" trybuild = "1.0" type-safe-id = "0.3" ubyte = "0.10.4" -unicode-width = "0.1" -ureq = "2.9.1" +unicode-width = "0.2" +ureq = "2.10.1" uuid = "1" -walkdir = "2.4.0" -windows-sys = "0.52.0" -xdg-home = "1.0.0" +walkdir = "2.5.0" +windows-sys = "0.59.0" +xdg-home = "1.3.0" xz2 = "0.1.7" zip = "2" -owo-colors = "4.0.0" +owo-colors = "4.1.0" async-trait = "0.1" humantime-serde = "1" diff --git a/libs/pavex_test_runner/src/lib.rs b/libs/pavex_test_runner/src/lib.rs index b5c69879c..e814959ec 100644 --- a/libs/pavex_test_runner/src/lib.rs +++ b/libs/pavex_test_runner/src/lib.rs @@ -343,7 +343,6 @@ fn warm_up_rustdoc_cache( // lock over the target directory. println!("Pre-computing JSON documentation for relevant crates"); let crate_collection = CrateCollection::new( - runtime_directory.to_string_lossy().into_owned(), DEFAULT_DOCS_TOOLCHAIN.to_owned(), runtime_directory.to_path_buf(), )?; diff --git a/libs/pavexc/src/compiler/app.rs b/libs/pavexc/src/compiler/app.rs index 40dda4008..666d7097f 100644 --- a/libs/pavexc/src/compiler/app.rs +++ b/libs/pavexc/src/compiler/app.rs @@ -63,7 +63,6 @@ impl App { /// report all errors to the user, but it may not be able to do so in all cases. pub fn build( bp: Blueprint, - project_fingerprint: String, docs_toolchain_name: String, ) -> Result<(Self, Vec), Vec> { /// Exit early if there is at least one error. @@ -81,7 +80,6 @@ impl App { } let krate_collection = CrateCollection::new( - project_fingerprint, docs_toolchain_name, std::env::current_dir().expect("Failed to determine the current directory"), ) diff --git a/libs/pavexc/src/compiler/resolvers.rs b/libs/pavexc/src/compiler/resolvers.rs index 81a4e3b09..0aed1d339 100644 --- a/libs/pavexc/src/compiler/resolvers.rs +++ b/libs/pavexc/src/compiler/resolvers.rs @@ -30,17 +30,26 @@ pub(crate) fn resolve_type( ) -> Result { match type_ { Type::ResolvedPath(rustdoc_types::Path { id, args, name }) => { - let re_exporter_crate_name = if id.0.starts_with("0:") { - // 0 is the crate index of local types. - None - } else { - // It is not guaranteed that this type will be from a direct dependency of `used_by_package_id`. - // It might be a re-export from a transitive dependency, done by a direct dependency. - // Unfortunately, `rustdoc` does not provide the package id of the crate where the type - // was re-exported from, creating a "missing link". - // We try to infer it from the `name` property, which is usually the fully qualified - // name of the type, e.g. `std::collections::HashMap`. - name.split("::").next() + let re_exporter_crate_name = { + let mut re_exporter = None; + if let Some(krate) = krate_collection.get_crate_by_package_id(used_by_package_id) { + if let Some(item) = krate.maybe_get_type_by_local_type_id(id) { + // 0 is the crate index of local types. + if item.crate_id == 0 { + re_exporter = Some(None); + } + } + } + if re_exporter.is_none() { + // It is not guaranteed that this type will be from a direct dependency of `used_by_package_id`. + // It might be a re-export from a transitive dependency, done by a direct dependency. + // Unfortunately, `rustdoc` does not provide the package id of the crate where the type + // was re-exported from, creating a "missing link". + // We try to infer it from the `name` property, which is usually the fully qualified + // name of the type, e.g. `std::collections::HashMap`. + re_exporter = Some(name.split("::").next()); + } + re_exporter.unwrap() }; let (global_type_id, base_type) = krate_collection .get_canonical_path_by_local_type_id( @@ -226,8 +235,8 @@ pub(crate) fn resolve_type( } Type::BorrowedRef { lifetime, - mutable, type_, + is_mutable, } => { let resolved_type = resolve_type( type_, @@ -236,7 +245,7 @@ pub(crate) fn resolve_type( generic_bindings, )?; let t = TypeReference { - is_mutable: *mutable, + is_mutable: *is_mutable, lifetime: lifetime.to_owned().into(), inner: Box::new(resolved_type), }; @@ -290,7 +299,7 @@ pub(crate) fn resolve_callable( let (header, decl, fn_generics_defs, invocation_style) = match &callable_type.item.item.inner { ItemEnum::Function(f) => ( &f.header, - &f.decl, + &f.sig, &f.generics, InvocationStyle::FunctionCall, ), @@ -413,7 +422,7 @@ pub(crate) fn resolve_callable( } }; let callable = Callable { - is_async: header.async_, + is_async: header.is_async, takes_self_as_ref, output: output_type_path, path: callable_path.to_owned(), diff --git a/libs/pavexc/src/compiler/traits.rs b/libs/pavexc/src/compiler/traits.rs index 01e430974..fe98a6734 100644 --- a/libs/pavexc/src/compiler/traits.rs +++ b/libs/pavexc/src/compiler/traits.rs @@ -135,7 +135,7 @@ pub(crate) fn implements_trait( let item = type_definition_crate.get_type_by_local_type_id(impl_id); let (trait_id, implementer_type) = match &item.inner { ItemEnum::Impl(impl_) => { - if impl_.negative { + if impl_.is_negative { continue; } (impl_.trait_.as_ref().map(|p| &p.id), &impl_.for_) @@ -244,7 +244,7 @@ pub(crate) fn implements_trait( let impl_item = trait_definition_crate.get_type_by_local_type_id(impl_id); let implementer = match &impl_item.inner { ItemEnum::Impl(impl_) => { - if impl_.negative { + if impl_.is_negative { continue; } &impl_.for_ @@ -308,12 +308,12 @@ fn is_equivalent( } } Type::BorrowedRef { - mutable, + is_mutable, type_: inner_type, .. } => { if let ResolvedType::Reference(type_) = our_type { - return type_.is_mutable == *mutable + return type_.is_mutable == *is_mutable && is_equivalent( inner_type, &type_.inner, diff --git a/libs/pavexc/src/lib.rs b/libs/pavexc/src/lib.rs index 2f723b2ba..4d634ab28 100644 --- a/libs/pavexc/src/lib.rs +++ b/libs/pavexc/src/lib.rs @@ -12,4 +12,4 @@ mod utils; /// The Rust toolchain used by `pavexc` to generate JSON docs, unless /// overridden by the user. -pub static DEFAULT_DOCS_TOOLCHAIN: &str = "nightly-2024-08-12"; +pub static DEFAULT_DOCS_TOOLCHAIN: &str = "nightly-2024-10-13"; diff --git a/libs/pavexc/src/rustdoc/compute/cache.rs b/libs/pavexc/src/rustdoc/compute/cache.rs index 174b525bb..e4a550ef4 100644 --- a/libs/pavexc/src/rustdoc/compute/cache.rs +++ b/libs/pavexc/src/rustdoc/compute/cache.rs @@ -241,7 +241,7 @@ impl ToolchainCache { }; drop(guard); - let root_item_id = row.get_ref_unwrap(0).as_str()?; + let root_item_id = row.get_ref_unwrap(0).as_i64()?.try_into()?; let external_crates = row.get_ref_unwrap(1).as_bytes()?; let paths = row.get_ref_unwrap(2).as_bytes()?; let format_version = row.get_ref_unwrap(3).as_i64()?; @@ -322,7 +322,7 @@ impl ToolchainCache { "CREATE TABLE IF NOT EXISTS rustdoc_toolchain_crates_cache ( name TEXT NOT NULL, cargo_fingerprint TEXT NOT NULL, - root_item_id TEXT NOT NULL, + root_item_id INTEGER NOT NULL, external_crates BLOB NOT NULL, paths BLOB NOT NULL, format_version INTEGER NOT NULL, @@ -413,12 +413,12 @@ impl ThirdPartyCrateCache { cache_key.default_feature_is_enabled, cache_key.active_named_features ])?; - let Some(row) = rows.next()? else { + let Some(row) = rows.next().context("Failed to fetch next row")? else { return Ok(None); }; drop(guard); - let root_item_id = row.get_ref_unwrap(0).as_str()?; + let root_item_id = row.get_ref_unwrap(0).as_i64()?.try_into()?; let external_crates = row.get_ref_unwrap(1).as_bytes()?; let paths = row.get_ref_unwrap(2).as_bytes()?; let format_version = row.get_ref_unwrap(3).as_i64()?; @@ -550,7 +550,7 @@ impl ThirdPartyCrateCache { rustdoc_options TEXT NOT NULL, default_feature_is_enabled INTEGER NOT NULL, active_named_features TEXT NOT NULL, - root_item_id TEXT NOT NULL, + root_item_id INTEGER NOT NULL, external_crates BLOB NOT NULL, paths BLOB NOT NULL, format_version INTEGER NOT NULL, @@ -571,7 +571,7 @@ impl ThirdPartyCrateCache { #[derive(Debug)] /// The serialized form of a crate's documentation, as stored in the cache. pub(super) struct CachedData<'a> { - root_item_id: &'a str, + root_item_id: u32, external_crates: Cow<'a, [u8]>, paths: Cow<'a, [u8]>, format_version: i64, @@ -598,7 +598,7 @@ impl<'a> CachedData<'a> { let start = items.len(); serde_json::to_writer(&mut items, item)?; let end = items.len(); - item_id2delimiters.insert(item_id.0.as_str(), (start, end)); + item_id2delimiters.insert(item_id.0, (start, end)); } let id2public_import_paths = bincode::serialize(&krate.id2public_import_paths)?; @@ -609,7 +609,7 @@ impl<'a> CachedData<'a> { let paths = bincode::serialize(&crate_data.paths)?; Ok(CachedData { - root_item_id: crate_data.root_item_id.0.as_str(), + root_item_id: crate_data.root_item_id.0, external_crates: Cow::Owned(external_crates), paths: Cow::Owned(paths), format_version: crate_data.format_version as i64, diff --git a/libs/pavexc/src/rustdoc/compute/mod.rs b/libs/pavexc/src/rustdoc/compute/mod.rs index dc0fed2ab..bdc8846e7 100644 --- a/libs/pavexc/src/rustdoc/compute/mod.rs +++ b/libs/pavexc/src/rustdoc/compute/mod.rs @@ -206,6 +206,8 @@ fn _compute_crate_docs<'a, I>( where I: Iterator, { + let package_id_specs: Vec<_> = package_id_specs.map(|p| p.to_string()).collect(); + // TODO: check that we have the nightly toolchain available beforehand in order to return // a good error. let mut cmd = std::process::Command::new("rustup"); @@ -217,7 +219,6 @@ where .arg("--no-deps") .arg("-q") .arg("--lib"); - let package_id_specs: Vec<_> = package_id_specs.map(|p| p.to_string()).collect(); for package_id_spec in &package_id_specs { cmd.arg("-p").arg(package_id_spec); } diff --git a/libs/pavexc/src/rustdoc/queries.rs b/libs/pavexc/src/rustdoc/queries.rs index 37ae0080e..5ce1ed472 100644 --- a/libs/pavexc/src/rustdoc/queries.rs +++ b/libs/pavexc/src/rustdoc/queries.rs @@ -72,7 +72,6 @@ fn compute_package_graph(current_directory: PathBuf) -> Result Result { @@ -88,6 +87,8 @@ impl CrateCollection { .map_err(|_| anyhow!("The thread computing the package graph panicked"))? .context("Failed to compute the package graph for the current workspace")?; + // We use the path to the root manifest as a unique identifier for the project. + let project_fingerprint = package_graph.workspace().root().to_string(); Ok(Self { package_id2krate: FrozenMap::new(), package_graph, @@ -858,7 +859,7 @@ impl Crate { } pub fn get_type_by_local_type_id(&self, id: &rustdoc_types::Id) -> Cow<'_, Item> { - let type_ = self.core.krate.index.get(id); + let type_ = self.maybe_get_type_by_local_type_id(id); if type_.is_none() { panic!( "Failed to look up the type id `{}` in the rustdoc's index for package `{}`.", @@ -869,6 +870,12 @@ impl Crate { type_.unwrap() } + /// Same as `get_type_by_local_type_id`, but returns `None` instead of panicking + /// if the type is not found. + pub fn maybe_get_type_by_local_type_id(&self, id: &rustdoc_types::Id) -> Option> { + self.core.krate.index.get(id) + } + /// Types can be exposed under multiple paths. /// This method returns a "canonical" importable path—i.e. the shortest importable path /// pointing at the type you specified. @@ -940,7 +947,7 @@ fn index_local_types<'a>( )?; } } - ItemEnum::Import(i) => { + ItemEnum::Use(i) => { if let Some(imported_id) = &i.id { match krate.index.get(imported_id) { None => { @@ -968,7 +975,7 @@ fn index_local_types<'a>( } Some(imported_item) => { if let ItemEnum::Module(re_exported_module) = &imported_item.inner { - if !i.glob { + if !i.is_glob { current_path.push(&i.name); } for re_exported_item_id in &re_exported_module.items { @@ -1108,7 +1115,7 @@ impl RustdocKindExt for ItemEnum { match self { ItemEnum::Module(_) => "a module", ItemEnum::ExternCrate { .. } => "an external crate", - ItemEnum::Import(_) => "an import", + ItemEnum::Use(_) => "an import", ItemEnum::Union(_) => "a union", ItemEnum::Struct(_) => "a struct", ItemEnum::StructField(_) => "a struct field", @@ -1116,7 +1123,7 @@ impl RustdocKindExt for ItemEnum { ItemEnum::Variant(_) => "an enum variant", ItemEnum::Function(func) => { let mut func_kind = "a function"; - if let Some((param, _)) = func.decl.inputs.first() { + if let Some((param, _)) = func.sig.inputs.first() { if param == "self" { func_kind = "a method"; } @@ -1128,10 +1135,9 @@ impl RustdocKindExt for ItemEnum { ItemEnum::TraitAlias(_) => "a trait alias", ItemEnum::Impl(_) => "an impl block", ItemEnum::TypeAlias(_) => "a type alias", - ItemEnum::OpaqueTy(_) => "an opaque type", ItemEnum::Constant { .. } => "a constant", ItemEnum::Static(_) => "a static", - ItemEnum::ForeignType => "a foreign type", + ItemEnum::ExternType => "a foreign type", ItemEnum::Macro(_) => "a macro", ItemEnum::ProcMacro(_) => "a procedural macro", ItemEnum::Primitive(_) => "a primitive type", diff --git a/libs/pavexc_cli/src/main.rs b/libs/pavexc_cli/src/main.rs index d6a8aa349..209f8877d 100644 --- a/libs/pavexc_cli/src/main.rs +++ b/libs/pavexc_cli/src/main.rs @@ -321,9 +321,7 @@ fn generate( ron::de::from_reader(&file)? }; let mut reporter = DiagnosticReporter::new(color_profile); - // We use the path to the generated application crate as a fingerprint for the project. - let project_fingerprint = output.to_string_lossy().into_owned(); - let (app, issues) = match App::build(blueprint, project_fingerprint, docs_toolchain) { + let (app, issues) = match App::build(blueprint, docs_toolchain) { Ok((a, issues)) => { for e in &issues { assert_eq!(e.severity(), Some(Severity::Warning));