-
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
dependency error when building external dependency from github #7964
Comments
Thanks for the report! This is an expected error message, however, due to how Cargo works and treat sources. It sounds like what you want, however, is to override a dependency rather than add a dependency. |
but override dependency simply not work. i have to override dependencies of the dependency,which is not reasonable. |
Sorry I'm not entirely sure I understand what you mean. If the actix project is using |
if i dont patch the last 3 deps, it will not build. is this expected behavior? since the last 3 deps are actix-web's internal deps and has been patched inside the cargo.toml file of actix-web, i dont think i should bother to patch them one more time. [patch.crates-io] |
actix-http = "2.0.0-alpha.1" It should have: actix-http = {version="2.0.0-alpha.1", path="../actix-http"} This would allow the project to remove the It is known that managing a large number of inter-dependent crates in a workspace can be cumbersome (see #6126 and #3931). |
not sure about all the detail. but it used to work well and breaks when i did a daily update of rust. so there must be some change in cargo, since actix-web has no commit records for days then. now it seems that i have to copy part of actix-web's [path] table into my own workspace, for those deps used only by actix-web itself. |
Problem
actix-web has a patched dependency of actix-http in [path.crates-io] and it is ok to build inside actix-web source tree. but it failed when build outside of actix-web source tree as a dependency to my soure code. in such case, cargo introduced two different version of actix-http to cause an error to build.
Steps
[dependencies]
actix-rt = "*"
actix-web = { git = "https://github.com/actix/actix-web" }
PS C:\my-server> cargo build
Compiling actix-web v2.0.0 (C:\git\actix-web)
error[E0308]: mismatched types
--> C:\git\actix-web\src\test.rs:928:9
|
928 | connect.await.map(|(_, framed)| framed)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct
actix_http::ws::codec::Codec
, found a different structactix_http::ws::codec::Codec
|= note: expected enum
std::result::Result<actix_codec::framed::Framed<_, actix_http::ws::codec::Codec>, _>
found enum
std::result::Result<actix_codec::framed::Framed<awc::connect::BoxedSocket, actix_http::ws::codec::Codec>, _>
= note: perhaps two different versions of crate
actix_http
are being used?error: aborting due to previous error
For more information about this error, try
rustc --explain E0308
.error: could not compile
actix-web
.Possible Solution(s)
seems like cargo got different dependency when building a external lib outside of the source tree of the lib. it might ignored [path.crates_io].
Notes
Output of
cargo version
:cargo 1.43.0-nightly (bda5051 2020-03-02)
The text was updated successfully, but these errors were encountered: