File tree Expand file tree Collapse file tree 1 file changed +70
-0
lines changed Expand file tree Collapse file tree 1 file changed +70
-0
lines changed Original file line number Diff line number Diff line change @@ -21,3 +21,73 @@ Now the commands specified in [Readme.md](../Readme.md) can be executed targetin
2121cargo run -- build crate --local /path/to/source/target/package/your_crate_name-version/
2222```
2323
24+ ## Full MWE
25+ To showcase when such problems can occur, take a look at the following example.
26+ ### Structure
27+ ``` bash
28+ $ tree
29+ .
30+ ├── Cargo.toml
31+ ├── my_lib
32+ │ ├── Cargo.toml
33+ │ └── src
34+ │ └── lib.rs
35+ └── README.md
36+
37+ 3 directories, 4 files
38+ ```
39+ The actual contents of ` my_lib ` do not matter, only the two configuration files.
40+ ```
41+ $ cat Cargo.toml
42+ [workspace]
43+ members = [
44+ "my_lib",
45+ ]
46+
47+ [workspace.package]
48+ version = "0.1.0"
49+ ```
50+ and
51+ ``` bash
52+ $ cat my_lib/Cargo.toml
53+ [package]
54+ name = " my_lib"
55+ version.workspace = true
56+
57+ [dependencies]
58+ ```
59+
60+ ### Building
61+
62+ The build command
63+ ``` bash
64+ cargo run -- build crate -l path/to/docs_rs_workspace_package/my_lib
65+ ```
66+ fails with
67+ ``` bash
68+ Error: Building documentation failed
69+
70+ Caused by:
71+ Building documentation failed
72+
73+ Caused by:
74+ invalid Cargo.toml syntax
75+ ```
76+ which makes sense due to
77+ ``` toml
78+ version.workspace = true
79+ ```
80+
81+ ### Fix
82+ However when running the following sequence of commands
83+ ``` bash
84+ # Run this in the directory of docs_rs_workspace_package
85+ cargo package -p my_lib
86+ ```
87+ and then building again
88+ ``` bash
89+ # Run this from the docs.rs repo
90+ cargo run -- build crate -l path/to/docs_rs_workspace_package/target/package/my_lib-0.1.0
91+ ```
92+ then the build succeeds.
93+
You can’t perform that action at this time.
0 commit comments