-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test --doc can't find dependency of dependency with a proc macro when passing --target #4224
Comments
thanks for filing @parched ! sorry that you are running into this, and appreciate the repro case. one thing we'll need to figure out here is whether this is being caused by cargo itself or by the "rust module loader" (not sure the official term, but hopefully you get the gist) one way to figure this out might be to run sorry these aren't super clear directives, but hopefully this gives you an idea of where to start investigating and we'll take a look as well! |
Hi @ashleygwilliams, thanks for the pointers, yes it's only with
vs
So looks like cargo is passing the wrong |
Looks like there probably needs to be a similar fix like a298346 that @alexcrichton made but applied to cargo_test.rs. |
…e, r=alexcrichton Add host dependency path via -L for cargo_test. Proc-macro crates' dependencies in the host dependency directory cannot be found when running `cargo test` with the `--target {target}` flag set as reported in #4224. This adds the host dependency directory to the search path to find those missing dependencies with -L when building tests and adds a test case that fails before and passes after this patch. A new function `find_host_deps(..)` is added to accomplish this which can determine the path of the host dependencies directory from within `run_doc_tests(..)` where the missing library search path is needed. Fixes #4224 Fixes #4254 Modeled after a similar patch: a298346 **Concerns** The test case seems to require a non-local crate from crates.io to example the failure before this patch. Couldn't make it fail with simply another local subcrate, but if others think it's possible that'd be great. This means that during tests for the cargo project itself that this test case actually downloads and compiles a crate, which I don't think any other tests do and is obviously not ideal and is perhaps even unacceptable. I've used the base64 crate pretty arbitrarily, but which crate it is really doesn't matter to test the case's content. So if anyone knows a tiny or empty crate on crates.io to use instead that'd speed this up and if someone can figure out how to make it fail before this patch is applied without downloading an external crate that would help as well. Also, I'm not 100% confident about the `find_host_deps(..)` style and whether it's the best way to find the host dependencies directory with just the `TestOptions` and `Compilation` structs available since I'm new to this project. Any comments are appreciated.
I was trying to add CI to a proc macro crate of mine, but the CI passes
--target
explicitly even though it's unneeded. To my surprise the test failed https://travis-ci.org/parched/runtime-target-feature-rs/jobs/246862218I've tried to create a minimal repro below, possibly there are some extra things that aren't needed.
Cargo.toml
src/lib.rs
without explicitly passing my native target
The text was updated successfully, but these errors were encountered: