Skip to content

Commit ed276ca

Browse files
committed
mk: Stop documenating non-facade crates
This commit ceases documentation-by-default of crates such as `term`, `serialize`, and `alloc`. Crates like `term` and `rand` have duplicates on `crates.io` and the search index entries generated in the local tree end up only leading to confusion. Crates like the entire compiler infrastructure, `flate`, or `rbml` don't need to be documented in such a prominent location. This change also means that doc tests will no longer be run for crates beyond the facade (e.g. `serialize` or `term`), but there were very few doc tests in there to begin with. Closes #22168
1 parent 2b9076e commit ed276ca

File tree

3 files changed

+12
-37
lines changed

3 files changed

+12
-37
lines changed

mk/crates.mk

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -118,42 +118,13 @@ ONLY_RLIB_collections := 1
118118
ONLY_RLIB_unicode := 1
119119
ONLY_RLIB_rustc_bitflags := 1
120120

121+
# Documented-by-default crates
122+
DOC_CRATES := std alloc collections core libc unicode
123+
121124
################################################################################
122125
# You should not need to edit below this line
123126
################################################################################
124127

125-
# On channels where the only usable crate is std, only build documentation for
126-
# std. This keeps distributions small and doesn't clutter up the API docs with
127-
# confusing internal details from the crates behind the facade.
128-
#
129-
# (Disabled while cmr figures out how to change rustdoc to make reexports work
130-
# slightly nicer. Otherwise, all cross-crate links to Vec will go to
131-
# libcollections, breaking them, and [src] links for anything reexported will
132-
# not work.)
133-
134-
#ifeq ($(CFG_RELEASE_CHANNEL),stable)
135-
#DOC_CRATES := std
136-
#else
137-
#ifeq ($(CFG_RELEASE_CHANNEL),beta)
138-
#DOC_CRATES := std
139-
#else
140-
DOC_CRATES := $(filter-out rustc, \
141-
$(filter-out rustc_trans, \
142-
$(filter-out rustc_typeck, \
143-
$(filter-out rustc_borrowck, \
144-
$(filter-out rustc_resolve, \
145-
$(filter-out rustc_driver, \
146-
$(filter-out rustc_privacy, \
147-
$(filter-out rustc_lint, \
148-
$(filter-out log, \
149-
$(filter-out getopts, \
150-
$(filter-out syntax, $(CRATES))))))))))))
151-
#endif
152-
#endif
153-
COMPILER_DOC_CRATES := rustc rustc_trans rustc_borrowck rustc_resolve \
154-
rustc_typeck rustc_driver syntax rustc_privacy \
155-
rustc_lint
156-
157128
# This macro creates some simple definitions for each crate being built, just
158129
# some munging of all of the parameters above.
159130
#

mk/docs.mk

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,18 +250,20 @@ endif
250250
doc/$(1)/:
251251
$$(Q)mkdir -p $$@
252252

253-
$(2) += doc/$(1)/index.html
254253
doc/$(1)/index.html: CFG_COMPILER_HOST_TRIPLE = $(CFG_TARGET)
255254
doc/$(1)/index.html: $$(LIB_DOC_DEP_$(1)) doc/$(1)/
256255
@$$(call E, rustdoc: $$@)
257256
$$(Q)CFG_LLVM_LINKAGE_FILE=$$(LLVM_LINKAGE_PATH_$(CFG_BUILD)) \
258257
$$(RUSTDOC) --cfg dox --cfg stage2 $$(RUSTFLAGS_$(1)) $$<
259258
endef
260259

261-
$(foreach crate,$(DOC_CRATES),$(eval $(call DEF_LIB_DOC,$(crate),DOC_TARGETS)))
260+
$(foreach crate,$(CRATES),$(eval $(call DEF_LIB_DOC,$(crate))))
262261

262+
COMPILER_DOC_TARGETS := $(CRATES:%=doc/%/index.html)
263263
ifdef CFG_COMPILER_DOCS
264-
$(foreach crate,$(COMPILER_DOC_CRATES),$(eval $(call DEF_LIB_DOC,$(crate),COMPILER_DOC_TARGETS)))
264+
DOC_TARGETS += $(COMPILER_DOC_TARGETS)
265+
else
266+
DOC_TARGETS += $(DOC_CRATES:%=doc/%/index.html)
265267
endif
266268

267269
ifdef CFG_DISABLE_DOCS

mk/tests.mk

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@ $(eval $(call RUST_CRATE,coretest))
2222
DEPS_collectionstest :=
2323
$(eval $(call RUST_CRATE,collectionstest))
2424

25-
TEST_TARGET_CRATES = $(filter-out core unicode,$(TARGET_CRATES)) collectionstest coretest
25+
TEST_TARGET_CRATES = $(filter-out core unicode,$(TARGET_CRATES)) \
26+
collectionstest coretest
2627
TEST_DOC_CRATES = $(DOC_CRATES)
27-
TEST_HOST_CRATES = $(filter-out rustc_typeck rustc_borrowck rustc_resolve rustc_trans rustc_lint,\
28+
TEST_HOST_CRATES = $(filter-out rustc_typeck rustc_borrowck rustc_resolve \
29+
rustc_trans rustc_lint,\
2830
$(HOST_CRATES))
2931
TEST_CRATES = $(TEST_TARGET_CRATES) $(TEST_HOST_CRATES)
3032

0 commit comments

Comments
 (0)