Skip to content

Commit

Permalink
Just in case
Browse files Browse the repository at this point in the history
  • Loading branch information
Jake-Shadle committed Jan 24, 2024
1 parent 59bfbaa commit e4c3f6d
Show file tree
Hide file tree
Showing 5 changed files with 714 additions and 5 deletions.
6 changes: 4 additions & 2 deletions src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1150,7 +1150,9 @@ impl Builder {
// mean there could be a situation where a single crate _could_
// be referenced with 0.0.x versions, but...I'll fix that if
// someone reports an issue
let rdep_version = rdep.pkg.version().parse().expect("failed to parse semver");
let rdep_version: semver::Version =
rdep.pkg.version().parse().expect("failed to parse semver");
let has_prelease = !rdep_version.pre.is_empty();

let edges = rdep.dep_kinds.iter().filter_map(|dk| {
let mask = match dk.kind {
Expand Down Expand Up @@ -1182,7 +1184,7 @@ impl Builder {
// typically happens in the case of non-registry dependencies that use a pre-release
// semver, if the version _is_ a prelease it will never match the empty
// requirement
dep.req.comparators.is_empty() || dep.req.matches(&rdep_version)
(has_prelease && dep.req.comparators.is_empty()) || dep.req.matches(&rdep_version)
})
.unwrap_or_else(|| panic!("cargo metadata resolved a dependency for a dependency not specified by the crate: {rdep:?}"));

Expand Down
2 changes: 1 addition & 1 deletion tests/pid-opaque.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/pid-stable.json

Large diffs are not rendered by default.

Loading

0 comments on commit e4c3f6d

Please sign in to comment.