Skip to content

Commit c5aa5a5

Browse files
chore: Fix CI checks
1 parent d0d6ec6 commit c5aa5a5

File tree

8 files changed

+40
-28
lines changed

8 files changed

+40
-28
lines changed

Cargo.lock

Lines changed: 7 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

compiler/pavex_rustdoc_types/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ serde_derive = {version="1.0.186"}
1212
rustc-hash = {version="2", optional=true}
1313
bincode = "2"
1414
rkyv = { version = "0.8", default-features = false, features = ["std"] }
15+
px_workspace_hack = { version = "0.1", path = "../../px_workspace_hack" }
1516

1617
[features]
1718
default = []

compiler/pavex_rustdoc_types/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,6 @@ pub enum Attribute {
362362
rkyv::Deserialize,
363363
)]
364364
#[rkyv(derive(Debug))]
365-
366365
/// The contents of a `#[repr(...)]` attribute.
367366
///
368367
/// Used in [`Attribute::Repr`].
@@ -375,7 +374,7 @@ pub struct AttributeRepr {
375374
/// Alignment in bytes, if explicitly specified by `#[repr(packed(...)]]`.
376375
pub packed: Option<u64>,
377376

378-
/// The integer type for an enum descriminant, if explicitly specified.
377+
/// The integer type for an enum discriminant, if explicitly specified.
379378
///
380379
/// e.g. `"i32"`, for `#[repr(C, i32)]`
381380
pub int: Option<String>,

compiler/pavex_test_runner/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ fn warm_up_rustdoc_cache(
446446
.iter()
447447
.filter(|p| {
448448
!(
449-
// Avoid computing JOSN docs for:
449+
// Avoid computing JSON docs for:
450450
// - Generated code
451451
p.name().starts_with("application_")
452452
// - Integration test crates

compiler/pavexc/src/rustdoc/queries.rs

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::borrow::Cow;
22
use std::cmp::Ordering;
33
use std::collections::BTreeSet;
4-
use std::sync::Arc;
4+
use std::sync::{Arc, RwLock};
55

66
use ahash::{HashMap, HashSet, HashSetExt};
77
use anyhow::{Context, anyhow};
@@ -181,8 +181,8 @@ impl CrateCollection {
181181
cache: &RustdocGlobalFsCache,
182182
diagnostic_sink: &DiagnosticSink,
183183
) -> (PackageId, Option<Crate>) {
184-
let cache_key = RustdocCacheKey::new(&package_id, &package_graph);
185-
match cache.get(&cache_key, &package_graph) {
184+
let cache_key = RustdocCacheKey::new(&package_id, package_graph);
185+
match cache.get(&cache_key, package_graph) {
186186
Ok(None) => (package_id, None),
187187
Ok(Some(entry)) => (
188188
package_id.clone(),
@@ -212,7 +212,7 @@ impl CrateCollection {
212212
let sink = &self.diagnostic_sink;
213213
let tracing_span = Span::current();
214214
let map_op =
215-
move |id| tracing_span.in_scope(|| get_if_cached(id, &package_graph, cache, &sink));
215+
move |id| tracing_span.in_scope(|| get_if_cached(id, package_graph, cache, sink));
216216

217217
let mut to_be_computed = vec![];
218218

@@ -262,11 +262,11 @@ impl CrateCollection {
262262
.par_iter()
263263
.filter_map(|(package_id, krate, cache_indexes)| {
264264
let data = if *cache_indexes {
265-
CacheEntry::new(&krate)
265+
CacheEntry::new(krate)
266266
} else {
267-
CacheEntry::raw(&krate)
267+
CacheEntry::raw(krate)
268268
};
269-
let cache_key = RustdocCacheKey::new(&package_id, package_graph);
269+
let cache_key = RustdocCacheKey::new(package_id, package_graph);
270270
match data {
271271
Ok(v) => Some((package_id, (cache_key, v))),
272272
Err(e) => {
@@ -660,8 +660,15 @@ pub struct Crate {
660660
/// An internal cache to avoid traversing the package graph every time we need to
661661
/// translate a crate id into a package id via [`Self::compute_package_id_for_crate_id`]
662662
/// or [`Self::compute_package_id_for_crate_id_with_hint`].
663-
pub(super) crate_id2package_id:
664-
Arc<std::sync::RwLock<HashMap<(u32, Option<String>), PackageId>>>,
663+
pub(super) crate_id2package_id: Arc<RwLock<HashMap<CrateIdNeedle, PackageId>>>,
664+
}
665+
666+
/// The information used by [`Self::compute_package_id_for_crate_id_with_hint`] to
667+
/// map a `crate_id` to a `package_id`.
668+
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
669+
pub struct CrateIdNeedle {
670+
crate_id: u32,
671+
maybe_dependent_crate_name: Option<String>,
665672
}
666673

667674
#[derive(Debug, Clone)]
@@ -1350,13 +1357,12 @@ impl Crate {
13501357
collection: &CrateCollection,
13511358
maybe_dependent_crate_name: Option<&str>,
13521359
) -> Result<PackageId, anyhow::Error> {
1360+
let needle = CrateIdNeedle {
1361+
crate_id,
1362+
maybe_dependent_crate_name: maybe_dependent_crate_name.map(|s| s.to_owned()),
1363+
};
13531364
// Check the cache first.
1354-
if let Some(package_id) = self
1355-
.crate_id2package_id
1356-
.read()
1357-
.unwrap()
1358-
.get(&(crate_id, maybe_dependent_crate_name.map(|s| s.to_owned())))
1359-
{
1365+
if let Some(package_id) = self.crate_id2package_id.read().unwrap().get(&needle) {
13601366
return Ok(package_id.to_owned());
13611367
}
13621368

@@ -1369,10 +1375,10 @@ impl Crate {
13691375

13701376
// If successful, cache the outcome.
13711377
if let Ok(outcome) = &outcome {
1372-
self.crate_id2package_id.write().unwrap().insert(
1373-
(crate_id, maybe_dependent_crate_name.map(|s| s.to_owned())),
1374-
outcome.to_owned(),
1375-
);
1378+
self.crate_id2package_id
1379+
.write()
1380+
.unwrap()
1381+
.insert(needle, outcome.to_owned());
13761382
}
13771383
outcome
13781384
}

deny.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ ignore = [
1616
# is available. The risk is acceptable for server-side usage where timing
1717
# attacks are difficult to execute.
1818
"RUSTSEC-2023-0071",
19+
# `bincode` is unmaintained, but otherwise perfectly functional.
20+
"RUSTSEC-2025-0141"
1921
]
2022

2123
[licenses]

px_workspace_hack/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ license.workspace = true
2020
ahash = { version = "0.8" }
2121
aho-corasick = { version = "1" }
2222
base64 = { version = "0.22" }
23+
bincode = { version = "2", features = ["serde"] }
2324
byteorder = { version = "1" }
2425
clap = { version = "4", features = ["derive", "env"] }
2526
clap_builder = { version = "4", default-features = false, features = ["color", "env", "help", "std", "suggestions", "usage"] }
@@ -99,6 +100,7 @@ zeroize = { version = "1" }
99100
ahash = { version = "0.8" }
100101
aho-corasick = { version = "1" }
101102
base64 = { version = "0.22" }
103+
bincode = { version = "2", features = ["serde"] }
102104
byteorder = { version = "1" }
103105
clap = { version = "4", features = ["derive", "env"] }
104106
clap_builder = { version = "4", default-features = false, features = ["color", "env", "help", "std", "suggestions", "usage"] }

typos.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[default]
2-
extend-words = { befores = "befores" }
2+
extend-words = { befores = "befores", bimap = "bimap" }
33
extend-ignore-words-re = ["\\b[a-zA-Z]{2}\\b"]
44

55
[files]

0 commit comments

Comments
 (0)