-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Open
Labels
A-examplesArea: example targetsArea: example targetsC-bugCategory: bugCategory: bugCommand-docS-triageStatus: This issue is waiting on initial triage.Status: This issue is waiting on initial triage.
Description
I tried to have cargo doc make documentation for the examples in my crate. I expected that adding doc=true
to an example declared in my cargo.toml
makes this happen. Instead, cargo doc fails and cannot find the library that the examples are in.
In my example below, cargo run --example one
runs successfully but cargo doc
fails with
error[E0463]: can't find crate for `test_doc`
--> examples/one.rs:1:1
|
1 | extern crate test_doc;
| ^^^^^^^^^^^^^^^^^^^^^^ can't find crate
error: Could not document `test_doc`.
Code:
test_doc/examples/one.rs
extern crate test_doc;
fn main() {
test_doc::hello();
}
test_doc/src/lib.rs
pub fn hello() {
println!("hello world");
}
test_doc/Cargo.toml
[package]
name = "test_doc"
version = "0.1.0"
[[example]]
name = "one"
doc = true
Metadata
Metadata
Assignees
Labels
A-examplesArea: example targetsArea: example targetsC-bugCategory: bugCategory: bugCommand-docS-triageStatus: This issue is waiting on initial triage.Status: This issue is waiting on initial triage.