@@ -104,8 +104,8 @@ Guidelines use active voice.
104
104
- [ ] Cargo.toml includes all common metadata ([ C-METADATA] )
105
105
- authors, description, license, homepage, documentation, repository,
106
106
readme, keywords, categories
107
- - [ ] Crate sets html_root_url attribute "https://docs.rs/$crate/$version " ([ C-HTML-ROOT] )
108
107
- [ ] Cargo.toml documentation key points to "https://docs.rs/$crate " ([ C-DOCS-RS] )
108
+ - [ ] Crate sets html_root_url attribute "https://docs.rs/$crate/$version " ([ C-HTML-ROOT] )
109
109
- [ ] Release notes document all significant changes ([ C-RELNOTES] )
110
110
- ** Predictability** * (crate enables legible code that acts how it looks)*
111
111
- [ ] Smart pointers do not add inherent methods ([ C-SMART-PTR] )
@@ -1050,15 +1050,6 @@ all the things"].
1050
1050
- ` keywords `
1051
1051
- ` categories `
1052
1052
1053
- [ C-HTML-ROOT ] : #c-html-root
1054
- <a id =" c-html-root " ></a >
1055
- ### Crate sets html_root_url attribute (C-HTML-ROOT)
1056
-
1057
- It should point to ` "https://docs.rs/$crate/$version" ` .
1058
-
1059
- Cargo.toml should contain a note next to the version to remember to bump the
1060
- ` html_root_url ` when bumping the crate version.
1061
-
1062
1053
[ C-DOCS-RS ] : #c-docs-rs
1063
1054
<a id =" c-docs-rs " ></a >
1064
1055
### Cargo.toml documentation key points to docs.rs (C-DOCS-RS)
@@ -1078,6 +1069,35 @@ but should be considered carefully.
1078
1069
1079
1070
[ docs.rs ] : https://docs.rs
1080
1071
1072
+ [ C-HTML-ROOT ] : #c-html-root
1073
+ <a id =" c-html-root " ></a >
1074
+ ### Crate sets html_root_url attribute (C-HTML-ROOT)
1075
+
1076
+ It should point to ` "https://docs.rs/$crate/$version" ` , assuming the crate
1077
+ uses docs.rs for it's primary API documentation.
1078
+
1079
+ The ` html_root_url ` attribute tells rustdoc how to create URLs to
1080
+ items in the crate when compiling downstream crates. Without it, links
1081
+ in the documentation of crates that depend on your crate will be
1082
+ incorrect.
1083
+
1084
+ It generally looks something like:
1085
+
1086
+ ``` rust
1087
+ #![doc(html_root_url = " https://docs.rs/log/0.3.8" )]
1088
+ ```
1089
+
1090
+ Because this URL contains an exact version number, it must be kept in
1091
+ sync with the version number in ` Cargo.toml ` . Unfortunately there is
1092
+ no mechanism in Rust today to eliminate this duplication, so
1093
+ the current recommendation is to add a comment to the ` Cargo.toml `
1094
+ version key reminding yourself to keep the two updated together,
1095
+ like:
1096
+
1097
+ ``` toml
1098
+ version = " 0.3.8" # remember to update html_root_url
1099
+ ```
1100
+
1081
1101
[ C-RELNOTES ] : #c-relnotes
1082
1102
<a id =" c-relnotes " ></a >
1083
1103
### Release notes document all significant changes (C-RELNOTES)
0 commit comments