diff --git a/mk/docs.mk b/mk/docs.mk index f76368e3d0b..7f73b99863f 100644 --- a/mk/docs.mk +++ b/mk/docs.mk @@ -62,6 +62,7 @@ RUSTBOOK = $(RPATH_VAR2_T_$(CFG_BUILD)_H_$(CFG_BUILD)) $(RUSTBOOK_EXE) # The error-index-generator executable... ERR_IDX_GEN_EXE = $(HBIN2_H_$(CFG_BUILD))/error-index-generator$(X_$(CFG_BUILD)) ERR_IDX_GEN = $(RPATH_VAR2_T_$(CFG_BUILD)_H_$(CFG_BUILD)) $(ERR_IDX_GEN_EXE) +ERR_IDX_GEN_MD = $(RPATH_VAR2_T_$(CFG_BUILD)_H_$(CFG_BUILD)) $(ERR_IDX_GEN_EXE) markdown D := $(S)src/doc @@ -217,6 +218,12 @@ doc/style/index.html: $(RUSTBOOK_EXE) $(wildcard $(S)/src/doc/style/*.md) | doc/ error-index: doc/error-index.html -doc/error-index.html: $(ERR_IDX_GEN_EXE) | doc/ +# Metadata used to generate the index is created as a side effect of +# the build so this depends on every crate being up to date. +doc/error-index.html: $(ERR_IDX_GEN_EXE) $(CSREQ$(2)_T_$(CFG_BUILD)_H_$(CFG_BUILD)) | doc/ $(Q)$(call E, error-index-generator: $@) $(Q)$(ERR_IDX_GEN) + +doc/error-index.md: $(ERR_IDX_GEN_EXE) $(CSREQ$(2)_T_$(CFG_BUILD)_H_$(CFG_BUILD)) | doc/ + $(Q)$(call E, error-index-generator: $@) + $(Q)$(ERR_IDX_GEN_MD) diff --git a/mk/tests.mk b/mk/tests.mk index 19587a28d55..2e530095cbe 100644 --- a/mk/tests.mk +++ b/mk/tests.mk @@ -298,14 +298,14 @@ check-stage$(1)-T-$(2)-H-$(3)-exec: \ check-stage$(1)-T-$(2)-H-$(3)-rfail-exec \ check-stage$(1)-T-$(2)-H-$(3)-cfail-exec \ check-stage$(1)-T-$(2)-H-$(3)-pfail-exec \ - check-stage$(1)-T-$(2)-H-$(3)-rpass-valgrind-exec \ - check-stage$(1)-T-$(2)-H-$(3)-rpass-full-exec \ - check-stage$(1)-T-$(2)-H-$(3)-rfail-full-exec \ + check-stage$(1)-T-$(2)-H-$(3)-rpass-valgrind-exec \ + check-stage$(1)-T-$(2)-H-$(3)-rpass-full-exec \ + check-stage$(1)-T-$(2)-H-$(3)-rfail-full-exec \ check-stage$(1)-T-$(2)-H-$(3)-cfail-full-exec \ check-stage$(1)-T-$(2)-H-$(3)-rmake-exec \ check-stage$(1)-T-$(2)-H-$(3)-rustdocck-exec \ - check-stage$(1)-T-$(2)-H-$(3)-crates-exec \ - check-stage$(1)-T-$(2)-H-$(3)-doc-crates-exec \ + check-stage$(1)-T-$(2)-H-$(3)-crates-exec \ + check-stage$(1)-T-$(2)-H-$(3)-doc-crates-exec \ check-stage$(1)-T-$(2)-H-$(3)-debuginfo-gdb-exec \ check-stage$(1)-T-$(2)-H-$(3)-debuginfo-lldb-exec \ check-stage$(1)-T-$(2)-H-$(3)-codegen-exec \ @@ -673,8 +673,8 @@ CTEST_DEPS_debuginfo-lldb_$(1)-T-$(2)-H-$(3) = $$(DEBUGINFO_LLDB_TESTS) \ CTEST_DEPS_codegen_$(1)-T-$(2)-H-$(3) = $$(CODEGEN_TESTS) CTEST_DEPS_codegen-units_$(1)-T-$(2)-H-$(3) = $$(CODEGEN_UNITS_TESTS) CTEST_DEPS_rustdocck_$(1)-T-$(2)-H-$(3) = $$(RUSTDOCCK_TESTS) \ - $$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) \ - $(S)src/etc/htmldocck.py + $$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) \ + $(S)src/etc/htmldocck.py endef @@ -892,6 +892,28 @@ $(foreach host,$(CFG_HOST), \ $(foreach crate,$(TEST_DOC_CRATES), \ $(eval $(call DEF_CRATE_DOC_TEST,$(stage),$(target),$(host),$(crate))))))) +define DEF_DOC_TEST_ERROR_INDEX + +check-stage$(1)-T-$(2)-H-$(3)-doc-error-index-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-error-index) + +ifeq ($(2),$$(CFG_BUILD)) +$$(call TEST_OK_FILE,$(1),$(2),$(3),doc-error-index): \ + $$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \ + doc/error-index.md + $$(Q)touch $$@.start_time + $$(RUSTDOC_$(1)_T_$(2)_H_$(3)) --test doc/error-index.md + $$(Q)touch -r $$@.start_time $$@ && rm $$@.start_time +else +$$(call TEST_OK_FILE,$(1),$(2),$(3),doc-error-index): + $$(Q)touch $$@ +endif +endef + +$(foreach host,$(CFG_HOST), \ + $(foreach target,$(CFG_TARGET), \ + $(foreach stage,$(STAGES), \ + $(eval $(call DEF_DOC_TEST_ERROR_INDEX,$(stage),$(target),$(host)))))) + ###################################################################### # Shortcut rules ###################################################################### @@ -901,7 +923,7 @@ TEST_GROUPS = \ $(foreach crate,$(TEST_CRATES),$(crate)) \ $(foreach crate,$(TEST_DOC_CRATES),doc-crate-$(crate)) \ rpass \ - rpass-valgrind \ + rpass-valgrind \ rpass-full \ rfail-full \ cfail-full \ @@ -918,7 +940,7 @@ TEST_GROUPS = \ $(foreach docname,$(DOC_NAMES),doc-$(docname)) \ pretty \ pretty-rpass \ - pretty-rpass-valgrind \ + pretty-rpass-valgrind \ pretty-rpass-full \ pretty-rfail-full \ pretty-rfail \ @@ -987,7 +1009,8 @@ define DEF_CHECK_DOC_FOR_STAGE check-stage$(1)-docs: $$(foreach docname,$$(DOC_NAMES), \ check-stage$(1)-T-$$(CFG_BUILD)-H-$$(CFG_BUILD)-doc-$$(docname)) \ $$(foreach crate,$$(TEST_DOC_CRATES), \ - check-stage$(1)-T-$$(CFG_BUILD)-H-$$(CFG_BUILD)-doc-crate-$$(crate)) + check-stage$(1)-T-$$(CFG_BUILD)-H-$$(CFG_BUILD)-doc-crate-$$(crate)) \ + check-stage$(1)-T-$$(CFG_BUILD)-H-$$(CFG_BUILD)-doc-error-index-exec endef $(foreach stage,$(STAGES), \ diff --git a/src/librustc/diagnostics.rs b/src/librustc/diagnostics.rs index a2b85ef831b..8a9ef666b83 100644 --- a/src/librustc/diagnostics.rs +++ b/src/librustc/diagnostics.rs @@ -131,8 +131,8 @@ String to be moved into a variable called `s`. let x = Some("s".to_string()); match x { - op_string @ Some(s) => {} - None => {} + op_string @ Some(s) => {}, + None => {}, } ``` @@ -145,10 +145,10 @@ name is bound by move in a pattern, it should also be moved to wherever it is referenced in the pattern guard code. Doing so however would prevent the name from being available in the body of the match arm. Consider the following: -``` +```compile_fail match Some("hi".to_string()) { - Some(s) if s.len() == 0 => // use s. - _ => {} + Some(s) if s.len() == 0 => {}, // use s. + _ => {}, } ``` @@ -159,11 +159,11 @@ therefore become unavailable in the body of the arm. Although this example seems innocuous, the problem is most clear when considering functions that take their argument by value. -``` +```compile_fail match Some("hi".to_string()) { Some(s) if { drop(s); false } => (), - Some(s) => // use s. - _ => {} + Some(s) => {}, // use s. + _ => {}, } ``` @@ -1645,7 +1645,7 @@ let x: i32 = "I am not a number!"; Another situation in which this occurs is when you attempt to use the `try!` macro inside a function that does not return a `Result`: -``` +```compile_fail use std::fs::File; fn main() { diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs index 5c79e9a4ec5..0ff6dcccde6 100644 --- a/src/librustc_typeck/diagnostics.rs +++ b/src/librustc_typeck/diagnostics.rs @@ -1406,7 +1406,7 @@ fn main() { To solve this situation, constrain the type of the variable. Examples: -``` +```no_run #![allow(unused_variables)] fn some_func(x: &u32) { diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index e919911e6fd..f7a56dd582f 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -579,7 +579,7 @@ mod tests { t("rust", false, false, false, true, false, false); t("sh", false, false, false, false, false, false); t("ignore", false, false, true, true, false, false); - t("should_panic", true, false, false, true, false, false); + t("should_panic", true, true, false, true, false, false); t("no_run", false, true, false, true, false, false); t("test_harness", false, false, false, true, true, false); t("compile_fail", false, false, false, true, false, true);