# 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
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)
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 \
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
$(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
######################################################################
$(foreach crate,$(TEST_CRATES),$(crate)) \
$(foreach crate,$(TEST_DOC_CRATES),doc-crate-$(crate)) \
rpass \
- rpass-valgrind \
+ rpass-valgrind \
rpass-full \
rfail-full \
cfail-full \
$(foreach docname,$(DOC_NAMES),doc-$(docname)) \
pretty \
pretty-rpass \
- pretty-rpass-valgrind \
+ pretty-rpass-valgrind \
pretty-rpass-full \
pretty-rfail-full \
pretty-rfail \
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), \
let x = Some("s".to_string());
match x {
- op_string @ Some(s) => {}
- None => {}
+ op_string @ Some(s) => {},
+ None => {},
}
```
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.
+ _ => {},
}
```
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.
+ _ => {},
}
```
Another situation in which this occurs is when you attempt to use the `try!`
macro inside a function that does not return a `Result<T, E>`:
-```
+```compile_fail
use std::fs::File;
fn main() {
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);