Crate name
protoc-plugin-by-closure
Build failure link
https://docs.rs/crate/protoc-plugin-by-closure/0.1.6/builds/1612629
Additional details
Hello! First of all, thanks for fixing #2542 ! Thanks to this fix, I could go deeper why my crate does not build in docs.rs.
I think I found the reason, but this might be not trivial...
Background
My relatively simple crate fails to build in docs.rs.
My crate has one special thing: Using cargo's unstable feature "Artifact dependencies" in my Cargo.toml.
You don't need to know the detail about this feature. Just please remember that by enabling this feature, Cargo.toml accepts a new attribute artifact = ... in the dependencies:
[dependencies]
bar = { version = "1.0", artifact = "staticlib" }
Of course, without explicitly enabling the feature by cargo command flag (-Z bindeps), this Cargo.toml fails to compile.
docs.rs document says we can add the cargo command line flags using [package.metadata.docs.rs] table's cargo-args = ... field in my Cargo.toml, but it turned out this is not enough.
My investigation
(In my understanding) When docs.rs builds a crate, it invokes many cargo command internally, and there are 2 ways to do this:
- Explicitly invoking the
cargo command using a ::rustwide::cmd::Command struct constructed by RustwideBuilder::prepare_command() function.
- Implicit
cargo invocations done in Rustwide library code. For example, when Rustwide is preparing for the build command, it is running cargo fetch command internally.
The problem is the second case. In this case, our custom cargo command line param -Z bindeps is not passed, and it seems to be no way to do so.
This is resulting in my crate's build error even though I'm setting the cargo-args flag in my Cargo.toml.
Unresolved questions
There are another way to specify the unstable cargo flag: Using the .cargo/config.toml file. My crate contains this file too, but it seems to be ignored when Rustwide is running cargo commands. Why?
Crate name
protoc-plugin-by-closure
Build failure link
https://docs.rs/crate/protoc-plugin-by-closure/0.1.6/builds/1612629
Additional details
Hello! First of all, thanks for fixing #2542 ! Thanks to this fix, I could go deeper why my crate does not build in docs.rs.
I think I found the reason, but this might be not trivial...
Background
My relatively simple crate fails to build in docs.rs.
My crate has one special thing: Using cargo's unstable feature "Artifact dependencies" in my
Cargo.toml.You don't need to know the detail about this feature. Just please remember that by enabling this feature,
Cargo.tomlaccepts a new attributeartifact = ...in the dependencies:Of course, without explicitly enabling the feature by
cargocommand flag (-Z bindeps), thisCargo.tomlfails to compile.docs.rs document says we can add the
cargocommand line flags using[package.metadata.docs.rs]table'scargo-args = ...field in myCargo.toml, but it turned out this is not enough.My investigation
(In my understanding) When docs.rs builds a crate, it invokes many
cargocommand internally, and there are 2 ways to do this:cargocommand using a::rustwide::cmd::Commandstruct constructed byRustwideBuilder::prepare_command()function.cargoinvocations done in Rustwide library code. For example, when Rustwide is preparing for the build command, it is runningcargo fetchcommand internally.The problem is the second case. In this case, our custom
cargocommand line param-Z bindepsis not passed, and it seems to be no way to do so.This is resulting in my crate's build error even though I'm setting the
cargo-argsflag in myCargo.toml.Unresolved questions
There are another way to specify the unstable
cargoflag: Using the.cargo/config.tomlfile. My crate contains this file too, but it seems to be ignored when Rustwide is runningcargocommands. Why?