Skip to content

Commit 058ed2b

Browse files
authored
Rollup merge of rust-lang#136396 - aDotInTheVoid:crate-isnt-package-whyyy, r=GuillaumeGomez
rustdoc-json-types: Document that crate name isn't package name. This wasn't clear from the docs before: https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/.E2.9C.94.20Getting.20external.20crate.20names.20as.20defined. CC `@kpreid` r? `@GuillaumeGomez`
2 parents 9830837 + 510de59 commit 058ed2b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/rustdoc-json-types/lib.rs

+7
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,13 @@ pub struct Crate {
6161
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
6262
pub struct ExternalCrate {
6363
/// The name of the crate.
64+
///
65+
/// Note: This is the [*crate* name][crate-name], which may not be the same as the
66+
/// [*package* name][package-name]. For example, for <https://crates.io/crates/regex-syntax>,
67+
/// this field will be `regex_syntax` (which uses an `_`, not a `-`).
68+
///
69+
/// [crate-name]: https://doc.rust-lang.org/stable/cargo/reference/cargo-targets.html#the-name-field
70+
/// [package-name]: https://doc.rust-lang.org/stable/cargo/reference/manifest.html#the-name-field
6471
pub name: String,
6572
/// The root URL at which the crate's documentation lives.
6673
pub html_root_url: Option<String>,

0 commit comments

Comments
 (0)