Skip to content

Commit dc8e3f0

Browse files
committed
---
yaml --- r: 274413 b: refs/heads/stable c: 9a07087 h: refs/heads/master i: 274411: f2f3410
1 parent 361cc76 commit dc8e3f0

File tree

119 files changed

+2511
-89601
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+2511
-89601
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: c0221c8897db309a79990367476177b1230bb264
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: c78bf9d90cd6e29d04d0572c0c0371dd1f60702a
32+
refs/heads/stable: 9a07087bc5533f4dc7318ea15d9fb4822c0ba67b
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

branches/stable/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ and documentation.
99

1010
Read ["Installing Rust"] from [The Book].
1111

12-
["Installing Rust"]: https://doc.rust-lang.org/book/installing-rust.html
12+
["Installing Rust"]: https://doc.rust-lang.org/book/getting-started.html#installing-rust
1313
[The Book]: https://doc.rust-lang.org/book/index.html
1414

1515
## Building from Source

branches/stable/RELEASES.md

Lines changed: 352 additions & 0 deletions
Large diffs are not rendered by default.

branches/stable/configure

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -334,14 +334,6 @@ enable_if_not_disabled() {
334334
fi
335335
}
336336

337-
to_llvm_triple() {
338-
case $1 in
339-
i686-w64-mingw32) echo i686-pc-windows-gnu ;;
340-
x86_64-w64-mingw32) echo x86_64-pc-windows-gnu ;;
341-
*) echo $1 ;;
342-
esac
343-
}
344-
345337
to_gnu_triple() {
346338
case $1 in
347339
i686-pc-windows-gnu) echo i686-w64-mingw32 ;;
@@ -646,12 +638,6 @@ valopt_nosave host "${CFG_BUILD}" "GNUs ./configure syntax LLVM host triples"
646638
valopt_nosave target "${CFG_HOST}" "GNUs ./configure syntax LLVM target triples"
647639
valopt_nosave mandir "${CFG_PREFIX}/share/man" "install man pages in PATH"
648640

649-
# Temporarily support old triples until buildbots get updated
650-
CFG_BUILD=$(to_llvm_triple $CFG_BUILD)
651-
putvar CFG_BUILD # Yes, this creates a duplicate entry, but the last one wins.
652-
CFG_HOST=$(to_llvm_triple $CFG_HOST)
653-
CFG_TARGET=$(to_llvm_triple $CFG_TARGET)
654-
655641
# On Windows this determines root of the subtree for target libraries.
656642
# Host runtime libs always go to 'bin'.
657643
valopt libdir "${CFG_PREFIX}/lib" "install libraries"

branches/stable/mk/cfg/armv7-unknown-linux-gnueabihf.mk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# armv7-unknown-linux-gnueabihf configuration
2-
CROSS_PREFIX_armv7-unknown-linux-gnueabihf=armv7-unknown-linux-gnueabihf-
2+
CROSS_PREFIX_armv7-unknown-linux-gnueabihf=arm-linux-gnueabihf-
33
CC_armv7-unknown-linux-gnueabihf=gcc
44
CXX_armv7-unknown-linux-gnueabihf=g++
55
CPP_armv7-unknown-linux-gnueabihf=gcc -E
@@ -8,8 +8,8 @@ CFG_LIB_NAME_armv7-unknown-linux-gnueabihf=lib$(1).so
88
CFG_STATIC_LIB_NAME_armv7-unknown-linux-gnueabihf=lib$(1).a
99
CFG_LIB_GLOB_armv7-unknown-linux-gnueabihf=lib$(1)-*.so
1010
CFG_LIB_DSYM_GLOB_armv7-unknown-linux-gnueabihf=lib$(1)-*.dylib.dSYM
11-
CFG_JEMALLOC_CFLAGS_armv7-unknown-linux-gnueabihf := -D__arm__ $(CFLAGS)
12-
CFG_GCCISH_CFLAGS_armv7-unknown-linux-gnueabihf := -Wall -g -fPIC -D__arm__ $(CFLAGS)
11+
CFG_JEMALLOC_CFLAGS_armv7-unknown-linux-gnueabihf := -D__arm__ $(CFLAGS) -march=armv7
12+
CFG_GCCISH_CFLAGS_armv7-unknown-linux-gnueabihf := -Wall -g -fPIC -D__arm__ $(CFLAGS) -march=armv7
1313
CFG_GCCISH_CXXFLAGS_armv7-unknown-linux-gnueabihf := -fno-rtti $(CXXFLAGS)
1414
CFG_GCCISH_LINK_FLAGS_armv7-unknown-linux-gnueabihf := -shared -fPIC -g
1515
CFG_GCCISH_DEF_FLAG_armv7-unknown-linux-gnueabihf := -Wl,--export-dynamic,--dynamic-list=

branches/stable/mk/cfg/armv7s-apple-ios.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ CFG_LIB_GLOB_armv7s-apple-ios = lib$(1)-*.a
1414
CFG_INSTALL_ONLY_RLIB_armv7s-apple-ios = 1
1515
CFG_STATIC_LIB_NAME_armv7s-apple-ios=lib$(1).a
1616
CFG_LIB_DSYM_GLOB_armv7s-apple-ios = lib$(1)-*.a.dSYM
17-
CFG_JEMALLOC_CFLAGS_armv7s-apple-ios := -arch armv7s -mfpu=vfp4 $(CFG_IOS_SDK_FLAGS_armv7s-apple-ios)
18-
CFG_GCCISH_CFLAGS_armv7s-apple-ios := -Wall -Werror -g -fPIC $(CFG_IOS_SDK_FLAGS_armv7s-apple-ios) -mfpu=vfp4 -arch armv7s
17+
CFG_JEMALLOC_CFLAGS_armv7s-apple-ios := -arch armv7s $(CFG_IOS_SDK_FLAGS_armv7s-apple-ios)
18+
CFG_GCCISH_CFLAGS_armv7s-apple-ios := -Wall -Werror -g -fPIC $(CFG_IOS_SDK_FLAGS_armv7s-apple-ios) -arch armv7s
1919
CFG_GCCISH_CXXFLAGS_armv7s-apple-ios := -fno-rtti $(CFG_IOS_SDK_FLAGS_armv7s-apple-ios) -I$(CFG_IOS_SDK_armv7s-apple-ios)/usr/include/c++/4.2.1
2020
CFG_GCCISH_LINK_FLAGS_armv7s-apple-ios := -lpthread -syslibroot $(CFG_IOS_SDK_armv7s-apple-ios) -Wl,-no_compact_unwind
2121
CFG_GCCISH_DEF_FLAG_armv7s-apple-ios := -Wl,-exported_symbols_list,

branches/stable/mk/cfg/powerpc64-unknown-linux-gnu.mk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# powerpc64-unknown-linux-gnu configuration
2-
CROSS_PREFIX_powerpc64-unknown-linux-gnu=powerpc64-linux-gnu-
2+
CROSS_PREFIX_powerpc64-unknown-linux-gnu=powerpc-linux-gnu-
33
CC_powerpc64-unknown-linux-gnu=$(CC)
44
CXX_powerpc64-unknown-linux-gnu=$(CXX)
55
CPP_powerpc64-unknown-linux-gnu=$(CPP)
@@ -8,6 +8,7 @@ CFG_LIB_NAME_powerpc64-unknown-linux-gnu=lib$(1).so
88
CFG_STATIC_LIB_NAME_powerpc64-unknown-linux-gnu=lib$(1).a
99
CFG_LIB_GLOB_powerpc64-unknown-linux-gnu=lib$(1)-*.so
1010
CFG_LIB_DSYM_GLOB_powerpc64-unknown-linux-gnu=lib$(1)-*.dylib.dSYM
11+
CFG_JEMALLOC_CFLAGS_powerpc64-unknown-linux-gnu := -m64
1112
CFG_CFLAGS_powerpc64-unknown-linux-gnu := -m64 $(CFLAGS)
1213
CFG_GCCISH_CFLAGS_powerpc64-unknown-linux-gnu := -Wall -Werror -g -fPIC -m64 $(CFLAGS)
1314
CFG_GCCISH_CXXFLAGS_powerpc64-unknown-linux-gnu := -fno-rtti $(CXXFLAGS)

branches/stable/mk/tests.mk

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ ifdef CHECK_IGNORED
4545
TESTARGS += --ignored
4646
endif
4747

48-
# Arguments to the cfail/rfail/rpass/bench tests
48+
# Arguments to the cfail/rfail/rpass tests
4949
ifdef CFG_VALGRIND
5050
CTEST_RUNTOOL = --runtool "$(CFG_VALGRIND)"
5151
endif
@@ -306,7 +306,6 @@ check-stage$(1)-T-$(2)-H-$(3)-exec: \
306306
check-stage$(1)-T-$(2)-H-$(3)-rustdocck-exec \
307307
check-stage$(1)-T-$(2)-H-$(3)-crates-exec \
308308
check-stage$(1)-T-$(2)-H-$(3)-doc-crates-exec \
309-
check-stage$(1)-T-$(2)-H-$(3)-bench-exec \
310309
check-stage$(1)-T-$(2)-H-$(3)-debuginfo-gdb-exec \
311310
check-stage$(1)-T-$(2)-H-$(3)-debuginfo-lldb-exec \
312311
check-stage$(1)-T-$(2)-H-$(3)-codegen-exec \
@@ -344,7 +343,6 @@ check-stage$(1)-T-$(2)-H-$(3)-pretty-exec: \
344343
check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass-full-exec \
345344
check-stage$(1)-T-$(2)-H-$(3)-pretty-rfail-exec \
346345
check-stage$(1)-T-$(2)-H-$(3)-pretty-rfail-full-exec \
347-
check-stage$(1)-T-$(2)-H-$(3)-pretty-bench-exec \
348346
check-stage$(1)-T-$(2)-H-$(3)-pretty-pretty-exec
349347

350348
endef
@@ -468,7 +466,6 @@ CFAIL_FULL_RS := $(wildcard $(S)src/test/compile-fail-fulldeps/*.rs)
468466
RFAIL_RS := $(wildcard $(S)src/test/run-fail/*.rs)
469467
CFAIL_RS := $(wildcard $(S)src/test/compile-fail/*.rs)
470468
PFAIL_RS := $(wildcard $(S)src/test/parse-fail/*.rs)
471-
BENCH_RS := $(wildcard $(S)src/test/bench/*.rs)
472469
PRETTY_RS := $(wildcard $(S)src/test/pretty/*.rs)
473470
DEBUGINFO_GDB_RS := $(wildcard $(S)src/test/debuginfo/*.rs)
474471
DEBUGINFO_LLDB_RS := $(wildcard $(S)src/test/debuginfo/*.rs)
@@ -485,7 +482,6 @@ CFAIL_FULL_TESTS := $(CFAIL_FULL_RS)
485482
RFAIL_TESTS := $(RFAIL_RS)
486483
CFAIL_TESTS := $(CFAIL_RS)
487484
PFAIL_TESTS := $(PFAIL_RS)
488-
BENCH_TESTS := $(BENCH_RS)
489485
PRETTY_TESTS := $(PRETTY_RS)
490486
DEBUGINFO_GDB_TESTS := $(DEBUGINFO_GDB_RS)
491487
DEBUGINFO_LLDB_TESTS := $(DEBUGINFO_LLDB_RS)
@@ -533,11 +529,6 @@ CTEST_BUILD_BASE_pfail = parse-fail
533529
CTEST_MODE_pfail = parse-fail
534530
CTEST_RUNTOOL_pfail = $(CTEST_RUNTOOL)
535531

536-
CTEST_SRC_BASE_bench = bench
537-
CTEST_BUILD_BASE_bench = bench
538-
CTEST_MODE_bench = run-pass
539-
CTEST_RUNTOOL_bench = $(CTEST_RUNTOOL)
540-
541532
CTEST_SRC_BASE_debuginfo-gdb = debuginfo
542533
CTEST_BUILD_BASE_debuginfo-gdb = debuginfo-gdb
543534
CTEST_MODE_debuginfo-gdb = debuginfo-gdb
@@ -612,7 +603,7 @@ TEST_SREQ$(1)_T_$(2)_H_$(3) = \
612603
$$(HBIN$(1)_H_$(3))/compiletest$$(X_$(3)) \
613604
$$(SREQ$(1)_T_$(2)_H_$(3))
614605

615-
# Rules for the cfail/rfail/rpass/bench test runner
606+
# Rules for the cfail/rfail/rpass test runner
616607

617608
# The tests select when to use debug configuration on their own;
618609
# remove directive, if present, from CFG_RUSTC_FLAGS (issue #7898).
@@ -675,7 +666,6 @@ CTEST_DEPS_cfail-full_$(1)-T-$(2)-H-$(3) = $$(CFAIL_FULL_TESTS) $$(CSREQ$(1)_T_$
675666
CTEST_DEPS_rfail_$(1)-T-$(2)-H-$(3) = $$(RFAIL_TESTS)
676667
CTEST_DEPS_cfail_$(1)-T-$(2)-H-$(3) = $$(CFAIL_TESTS)
677668
CTEST_DEPS_pfail_$(1)-T-$(2)-H-$(3) = $$(PFAIL_TESTS)
678-
CTEST_DEPS_bench_$(1)-T-$(2)-H-$(3) = $$(BENCH_TESTS)
679669
CTEST_DEPS_debuginfo-gdb_$(1)-T-$(2)-H-$(3) = $$(DEBUGINFO_GDB_TESTS)
680670
CTEST_DEPS_debuginfo-lldb_$(1)-T-$(2)-H-$(3) = $$(DEBUGINFO_LLDB_TESTS) \
681671
$(S)src/etc/lldb_batchmode.py \
@@ -748,7 +738,7 @@ endif
748738
endef
749739

750740
CTEST_NAMES = rpass rpass-valgrind rpass-full rfail-full cfail-full rfail cfail pfail \
751-
bench debuginfo-gdb debuginfo-lldb codegen codegen-units rustdocck
741+
debuginfo-gdb debuginfo-lldb codegen codegen-units rustdocck
752742

753743
$(foreach host,$(CFG_HOST), \
754744
$(eval $(foreach target,$(CFG_TARGET), \
@@ -757,20 +747,18 @@ $(foreach host,$(CFG_HOST), \
757747
$(eval $(call DEF_RUN_COMPILETEST,$(stage),$(target),$(host),$(name))))))))))
758748

759749
PRETTY_NAMES = pretty-rpass pretty-rpass-valgrind pretty-rpass-full pretty-rfail-full pretty-rfail \
760-
pretty-bench pretty-pretty
750+
pretty-pretty
761751
PRETTY_DEPS_pretty-rpass = $(RPASS_TESTS)
762752
PRETTY_DEPS_pretty-rpass-valgrind = $(RPASS_VALGRIND_TESTS)
763753
PRETTY_DEPS_pretty-rpass-full = $(RPASS_FULL_TESTS)
764754
PRETTY_DEPS_pretty-rfail-full = $(RFAIL_FULL_TESTS)
765755
PRETTY_DEPS_pretty-rfail = $(RFAIL_TESTS)
766-
PRETTY_DEPS_pretty-bench = $(BENCH_TESTS)
767756
PRETTY_DEPS_pretty-pretty = $(PRETTY_TESTS)
768757
PRETTY_DIRNAME_pretty-rpass = run-pass
769758
PRETTY_DIRNAME_pretty-rpass-valgrind = run-pass-valgrind
770759
PRETTY_DIRNAME_pretty-rpass-full = run-pass-fulldeps
771760
PRETTY_DIRNAME_pretty-rfail-full = run-fail-fulldeps
772761
PRETTY_DIRNAME_pretty-rfail = run-fail
773-
PRETTY_DIRNAME_pretty-bench = bench
774762
PRETTY_DIRNAME_pretty-pretty = pretty
775763

776764
define DEF_PRETTY_FULLDEPS
@@ -920,7 +908,6 @@ TEST_GROUPS = \
920908
rfail \
921909
cfail \
922910
pfail \
923-
bench \
924911
rmake \
925912
rustdocck \
926913
debuginfo-gdb \
@@ -935,7 +922,6 @@ TEST_GROUPS = \
935922
pretty-rpass-full \
936923
pretty-rfail-full \
937924
pretty-rfail \
938-
pretty-bench \
939925
pretty-pretty \
940926
$(NULL)
941927

@@ -1039,6 +1025,8 @@ $(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok: \
10391025
export INCLUDE := $$(CFG_MSVC_INCLUDE_PATH_$$(HOST_$(3)))
10401026
$(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok: \
10411027
export LIB := $$(CFG_MSVC_LIB_PATH_$$(HOST_$(3)))
1028+
$(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok: \
1029+
export MSVC_LIB := "$$(CFG_MSVC_LIB_$$(HOST_$(3)))"
10421030
$(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok: \
10431031
$(S)src/test/run-make/%/Makefile \
10441032
$$(CSREQ$(1)_T_$(2)_H_$(3))

branches/stable/src/compiletest/runtest.rs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -929,6 +929,13 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError>,
929929
format!("{}:{}:", testfile.display(), ee.line)
930930
}).collect::<Vec<String>>();
931931

932+
let (expect_help, expect_note) =
933+
expected_errors.iter()
934+
.fold((false, false),
935+
|(acc_help, acc_note), ee|
936+
(acc_help || ee.kind == "help:", acc_note ||
937+
ee.kind == "note:"));
938+
932939
fn prefix_matches(line: &str, prefix: &str) -> bool {
933940
use std::ascii::AsciiExt;
934941
// On windows just translate all '\' path separators to '/'
@@ -992,8 +999,8 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError>,
992999
was_expected = true;
9931000
}
9941001

995-
if !was_expected && is_compiler_error_or_warning(line) {
996-
fatal_proc_rec(&format!("unexpected compiler error or warning: '{}'",
1002+
if !was_expected && is_unexpected_compiler_message(line, expect_help, expect_note) {
1003+
fatal_proc_rec(&format!("unexpected compiler message: '{}'",
9971004
line),
9981005
proc_res);
9991006
}
@@ -1009,16 +1016,15 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError>,
10091016
}
10101017
}
10111018

1012-
fn is_compiler_error_or_warning(line: &str) -> bool {
1019+
fn is_unexpected_compiler_message(line: &str, expect_help: bool, expect_note: bool) -> bool {
10131020
let mut c = Path::new(line).components();
10141021
let line = match c.next() {
10151022
Some(Component::Prefix(_)) => c.as_path().to_str().unwrap(),
10161023
_ => line,
10171024
};
10181025

10191026
let mut i = 0;
1020-
return
1021-
scan_until_char(line, ':', &mut i) &&
1027+
return scan_until_char(line, ':', &mut i) &&
10221028
scan_char(line, ':', &mut i) &&
10231029
scan_integer(line, &mut i) &&
10241030
scan_char(line, ':', &mut i) &&
@@ -1030,7 +1036,10 @@ fn is_compiler_error_or_warning(line: &str) -> bool {
10301036
scan_integer(line, &mut i) &&
10311037
scan_char(line, ' ', &mut i) &&
10321038
(scan_string(line, "error", &mut i) ||
1033-
scan_string(line, "warning", &mut i));
1039+
scan_string(line, "warning", &mut i) ||
1040+
(expect_help && scan_string(line, "help", &mut i)) ||
1041+
(expect_note && scan_string(line, "note", &mut i))
1042+
);
10341043
}
10351044

10361045
fn scan_until_char(haystack: &str, needle: char, idx: &mut usize) -> bool {

branches/stable/src/doc/book/error-handling.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,8 @@ fn map<F, T, A>(option: Option<T>, f: F) -> Option<A> where F: FnOnce(T) -> A {
265265
```
266266

267267
Indeed, `map` is [defined as a method][2] on `Option<T>` in the standard library.
268+
As a method, it has a slighly different signature: methods take `self`, `&self`,
269+
or `&mut self` as their first argument.
268270

269271
Armed with our new combinator, we can rewrite our `extension_explicit` method
270272
to get rid of the case analysis:
@@ -294,6 +296,9 @@ fn unwrap_or<T>(option: Option<T>, default: T) -> T {
294296
}
295297
```
296298

299+
Like with `map` above, the standard library implementation is a method instead
300+
of a free function.
301+
297302
The trick here is that the default value must have the same type as the value
298303
that might be inside the `Option<T>`. Using it is dead simple in our case:
299304

branches/stable/src/doc/book/guessing-game.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ displaying the message.
279279
[expect]: ../std/option/enum.Option.html#method.expect
280280
[panic]: error-handling.html
281281

282-
If we leave off calling these two methods, our program will compile, but
282+
If we leave off calling this method, our program will compile, but
283283
we’ll get a warning:
284284

285285
```bash
@@ -680,7 +680,7 @@ fn main() {
680680
}
681681
```
682682
683-
The new three lines:
683+
The new two lines:
684684
685685
```rust,ignore
686686
let guess: u32 = guess.trim().parse()

branches/stable/src/doc/book/testing.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Cargo will automatically generate a simple test when you make a new project.
2424
Here's the contents of `src/lib.rs`:
2525

2626
```rust
27+
# fn main() {}
2728
#[test]
2829
fn it_works() {
2930
}
@@ -75,6 +76,7 @@ So why does our do-nothing test pass? Any test which doesn't `panic!` passes,
7576
and any test that does `panic!` fails. Let's make our test fail:
7677

7778
```rust
79+
# fn main() {}
7880
#[test]
7981
fn it_works() {
8082
assert!(false);
@@ -145,6 +147,7 @@ This is useful if you want to integrate `cargo test` into other tooling.
145147
We can invert our test's failure with another attribute: `should_panic`:
146148

147149
```rust
150+
# fn main() {}
148151
#[test]
149152
#[should_panic]
150153
fn it_works() {
@@ -175,6 +178,7 @@ Rust provides another macro, `assert_eq!`, that compares two arguments for
175178
equality:
176179

177180
```rust
181+
# fn main() {}
178182
#[test]
179183
#[should_panic]
180184
fn it_works() {
@@ -209,6 +213,7 @@ make sure that the failure message contains the provided text. A safer version
209213
of the example above would be:
210214

211215
```rust
216+
# fn main() {}
212217
#[test]
213218
#[should_panic(expected = "assertion failed")]
214219
fn it_works() {
@@ -219,6 +224,7 @@ fn it_works() {
219224
That's all there is to the basics! Let's write one 'real' test:
220225

221226
```rust,ignore
227+
# fn main() {}
222228
pub fn add_two(a: i32) -> i32 {
223229
a + 2
224230
}
@@ -238,6 +244,7 @@ Sometimes a few specific tests can be very time-consuming to execute. These
238244
can be disabled by default by using the `ignore` attribute:
239245

240246
```rust
247+
# fn main() {}
241248
#[test]
242249
fn it_works() {
243250
assert_eq!(4, add_two(2));
@@ -299,6 +306,7 @@ missing the `tests` module. The idiomatic way of writing our example
299306
looks like this:
300307

301308
```rust,ignore
309+
# fn main() {}
302310
pub fn add_two(a: i32) -> i32 {
303311
a + 2
304312
}
@@ -327,6 +335,7 @@ a large module, and so this is a common use of globs. Let's change our
327335
`src/lib.rs` to make use of it:
328336

329337
```rust,ignore
338+
# fn main() {}
330339
pub fn add_two(a: i32) -> i32 {
331340
a + 2
332341
}
@@ -377,6 +386,7 @@ put a `tests/lib.rs` file inside, with this as its contents:
377386
```rust,ignore
378387
extern crate adder;
379388
389+
# fn main() {}
380390
#[test]
381391
fn it_works() {
382392
assert_eq!(4, adder::add_two(2));
@@ -432,6 +442,7 @@ running examples in your documentation (**note:** this only works in library
432442
crates, not binary crates). Here's a fleshed-out `src/lib.rs` with examples:
433443

434444
```rust,ignore
445+
# fn main() {}
435446
//! The `adder` crate provides functions that add numbers to other numbers.
436447
//!
437448
//! # Examples

0 commit comments

Comments
 (0)