Skip to content

Commit

Permalink
Check path dependencies for path, not version
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed May 1, 2024
1 parent 5764b9d commit 0f6aa49
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 38 deletions.
21 changes: 12 additions & 9 deletions src/dependencies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,15 +185,18 @@ fn build_dependencies_inner(config: &Config, info: &DependencyBuilder) -> Result
None => true,
})
.map(|dep| {
let package = metadata
.packages
.iter()
.find(|&p| p.name == dep.name && dep.req.matches(&p.version))
.expect("dependency does not exist");
(
package,
dep.rename.clone().unwrap_or_else(|| package.name.clone()),
)
for p in &metadata.packages {
if p.name != dep.name {
continue;
}
if dep.path.as_ref().is_some_and(|path| p.manifest_path.parent().unwrap() == path) || dep.req.matches(&p.version) {
return (
p,
dep.rename.clone().unwrap_or_else(|| p.name.clone()),
)
}
}
panic!("dep not found: {dep:#?}")
})
// Also expose the root crate
.chain(std::iter::once((root, root.name.clone())))
Expand Down
13 changes: 0 additions & 13 deletions tests/integrations/ui_test_dep_bug/Cargo.stderr

This file was deleted.

19 changes: 3 additions & 16 deletions tests/integrations/ui_test_dep_bug/Cargo.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,10 @@ running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished

tests/ui/basic_test.rs ... FAILED
Building dependencies ... ok
tests/ui/basic_test.rs ... ok

FAILED TEST: tests/ui/basic_test.rs
command: "<unknown>"

error: a bug in `ui_test` occurred
dependency does not exist

full stderr:

full stdout:


FAILURES:
tests/ui/basic_test.rs

test result: FAIL. 1 failed;
test result: ok. 1 passed;


running 0 tests
Expand Down

0 comments on commit 0f6aa49

Please sign in to comment.