Update Makefile
This commit is contained in:
parent
6407b9405f
commit
ed6b575648
@ -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)
|
||||
|
25
mk/tests.mk
25
mk/tests.mk
@ -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
|
||||
######################################################################
|
||||
@ -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), \
|
||||
|
@ -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<T, E>`:
|
||||
|
||||
```
|
||||
```compile_fail
|
||||
use std::fs::File;
|
||||
|
||||
fn main() {
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user