Skip to content

Commit 6ae6142

Browse files
committed
---
yaml --- r: 106349 b: refs/heads/auto c: b6ea796 h: refs/heads/master i: 106347: 1cfad44 v: v3
1 parent 476b45b commit 6ae6142

File tree

190 files changed

+8587
-2555
lines changed

Some content is hidden

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

190 files changed

+8587
-2555
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: 0063504fe53d48c1c04687c8157bd7b7ef926bf1
16+
refs/heads/auto: b6ea7962f726b30ad466c6574531c24f741adbc0
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/Makefile.in

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,10 @@ include config.mk
177177

178178
# Just a few macros used everywhere
179179
include $(CFG_SRC_DIR)mk/util.mk
180-
# All crates and their dependencies
181-
include $(CFG_SRC_DIR)mk/crates.mk
182180
# Reconfiguring when the makefiles or submodules change
183181
include $(CFG_SRC_DIR)mk/reconfig.mk
182+
# All crates and their dependencies
183+
include $(CFG_SRC_DIR)mk/crates.mk
184184
# Various bits of setup, common macros, and top-level rules
185185
include $(CFG_SRC_DIR)mk/main.mk
186186
# C and assembly components that are not LLVM
@@ -232,19 +232,20 @@ ifneq ($(strip $(findstring prepare,$(MAKECMDGOALS)) \
232232
include $(CFG_SRC_DIR)mk/prepare.mk
233233
endif
234234

235-
# (Unix) Installation from the build directory
236-
ifneq ($(findstring install,$(MAKECMDGOALS)),)
237-
CFG_INFO := $(info cfg: including install rules)
238-
include $(CFG_SRC_DIR)mk/install.mk
239-
endif
240-
241235
# Source and binary distribution artifacts
242236
ifneq ($(strip $(findstring dist,$(MAKECMDGOALS)) \
237+
$(findstring install,$(MAKECMDGOALS)) \
243238
$(findstring clean,$(MAKECMDGOALS))),)
244239
CFG_INFO := $(info cfg: including dist rules)
245240
include $(CFG_SRC_DIR)mk/dist.mk
246241
endif
247242

243+
# (Unix) Installation from the build directory
244+
ifneq ($(findstring install,$(MAKECMDGOALS)),)
245+
CFG_INFO := $(info cfg: including install rules)
246+
include $(CFG_SRC_DIR)mk/install.mk
247+
endif
248+
248249
# Cleaning
249250
ifneq ($(findstring clean,$(MAKECMDGOALS)),)
250251
CFG_INFO := $(info cfg: including clean rules)

branches/auto/configure

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,7 @@ opt local-rust 0 "use an installed rustc rather than downloading a snapshot"
383383
opt pax-flags 0 "apply PaX flags to rustc binaries (required for GRSecurity/PaX-patched kernels)"
384384
opt inject-std-version 1 "inject the current compiler version of libstd into programs"
385385
opt rpath 1 "build rpaths into rustc itself"
386+
opt nightly 0 "build nightly packages"
386387
valopt prefix "/usr/local" "set installation prefix"
387388
valopt local-rust-root "/usr/local" "set prefix for local rust binary"
388389
valopt llvm-root "" "set LLVM root"
@@ -401,7 +402,8 @@ valopt infodir "${CFG_PREFIX}/share/info" "install additional info"
401402
valopt mandir "${CFG_PREFIX}/share/man" "install man pages in PATH"
402403

403404
# On windows we just store the libraries in the bin directory because
404-
# there's no rpath
405+
# there's no rpath. This is where the build system itself puts libraries;
406+
# --libdir is used to configure the installation directory.
405407
# FIXME: Thise needs to parameterized over target triples. Do it in platform.mk
406408
CFG_LIBDIR_RELATIVE=lib
407409
if [ "$CFG_OSTYPE" = "pc-mingw32" ]
@@ -410,7 +412,6 @@ then
410412
fi
411413

412414
valopt libdir "${CFG_PREFIX}/${CFG_LIBDIR_RELATIVE}" "install libraries"
413-
valopt rustlibdir "rustlib" "subdirectory name for rustc's libraries"
414415

415416
if [ $HELP -eq 1 ]
416417
then
@@ -777,10 +778,10 @@ do
777778
make_dir $h/stage$i/test
778779

779780
# target bin dir
780-
make_dir $h/stage$i/$CFG_LIBDIR_RELATIVE/$CFG_RUSTLIBDIR/$t/bin
781+
make_dir $h/stage$i/$CFG_LIBDIR_RELATIVE/rustlib/$t/bin
781782

782783
# target lib dir
783-
make_dir $h/stage$i/$CFG_LIBDIR_RELATIVE/$CFG_RUSTLIBDIR/$t/lib
784+
make_dir $h/stage$i/$CFG_LIBDIR_RELATIVE/rustlib/$t/lib
784785
done
785786
done
786787

@@ -1039,7 +1040,6 @@ putvar CFG_HOST
10391040
putvar CFG_TARGET
10401041
putvar CFG_C_COMPILER
10411042
putvar CFG_LIBDIR
1042-
putvar CFG_RUSTLIBDIR
10431043
putvar CFG_LIBDIR_RELATIVE
10441044
putvar CFG_DISABLE_MANAGE_SUBMODULES
10451045
putvar CFG_ANDROID_CROSS_PATH

branches/auto/mk/crates.mk

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,7 @@ COMPILER_DOC_CRATES := rustc syntax
105105
# $(1) is the crate to generate variables for
106106
define RUST_CRATE
107107
CRATEFILE_$(1) := $$(S)src/lib$(1)/lib.rs
108-
RSINPUTS_$(1) := $$(wildcard $$(addprefix $(S)src/lib$(1), \
109-
*.rs */*.rs */*/*.rs */*/*/*.rs))
108+
RSINPUTS_$(1) := $$(call rwildcard,$(S)src/lib$(1)/,*.rs)
110109
RUST_DEPS_$(1) := $$(filter-out native:%,$$(DEPS_$(1)))
111110
NATIVE_DEPS_$(1) := $$(patsubst native:%,%,$$(filter native:%,$$(DEPS_$(1))))
112111
endef
@@ -117,8 +116,7 @@ $(foreach crate,$(CRATES),$(eval $(call RUST_CRATE,$(crate))))
117116
#
118117
# $(1) is the crate to generate variables for
119118
define RUST_TOOL
120-
TOOL_INPUTS_$(1) := $$(wildcard $$(addprefix $$(dir $$(TOOL_SOURCE_$(1))), \
121-
*.rs */*.rs */*/*.rs */*/*/*.rs))
119+
TOOL_INPUTS_$(1) := $$(call rwildcard,$$(dir $$(TOOL_SOURCE_$(1))),*.rs)
122120
endef
123121

124122
$(foreach crate,$(TOOLS),$(eval $(call RUST_TOOL,$(crate))))

branches/auto/mk/dist.mk

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
# * dist-tar-bins - Ad-hoc Unix binary installers
2323
# * dist-docs - Stage docs for upload
2424

25-
PKG_NAME = $(CFG_PACKAGE_NAME)
25+
PKG_NAME := $(CFG_PACKAGE_NAME)
2626

2727
# License suitable for displaying in a popup
2828
LICENSE.txt: $(S)COPYRIGHT $(S)LICENSE-APACHE $(S)LICENSE-MIT
@@ -199,8 +199,10 @@ dist-install-dir-$(1): PREPARE_LIB_CMD=$(DEFAULT_PREPARE_LIB_CMD)
199199
dist-install-dir-$(1): PREPARE_MAN_CMD=$(DEFAULT_PREPARE_MAN_CMD)
200200
dist-install-dir-$(1): PREPARE_CLEAN=true
201201
dist-install-dir-$(1): prepare-base-dir-$(1)
202-
$$(Q)(cd $$(PREPARE_DEST_DIR)/ && find -type f) \
203-
> $$(PREPARE_DEST_DIR)/$$(CFG_LIBDIR_RELATIVE)/$$(CFG_RUSTLIBDIR)/manifest
202+
$$(Q)(cd $$(PREPARE_DEST_DIR)/ && find . -type f | sed 's/^\.\///') \
203+
> tmp/dist/manifest-$(1).in
204+
$$(Q)mv tmp/dist/manifest-$(1).in $$(PREPARE_DEST_DIR)/$$(CFG_LIBDIR_RELATIVE)/rustlib/manifest.in
205+
# Add remaining non-installed files
204206
$$(Q)$$(PREPARE_MAN_CMD) $$(S)COPYRIGHT $$(PREPARE_DEST_DIR)
205207
$$(Q)$$(PREPARE_MAN_CMD) $$(S)LICENSE-APACHE $$(PREPARE_DEST_DIR)
206208
$$(Q)$$(PREPARE_MAN_CMD) $$(S)LICENSE-MIT $$(PREPARE_DEST_DIR)

branches/auto/mk/install.mk

Lines changed: 9 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -8,70 +8,19 @@
88
# option. This file may not be copied, modified, or distributed
99
# except according to those terms.
1010

11-
# FIXME: Docs are currently not installed from the stageN dirs.
12-
# For consistency it might be desirable for stageN to be an exact
13-
# mirror of the installation directory structure.
1411

15-
# The stage we install from
16-
ISTAGE = $(PREPARE_STAGE)
12+
install: dist-install-dir-$(CFG_BUILD)
13+
$(Q)sh tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --prefix="$(CFG_PREFIX)" --libdir="$(CFG_LIBDIR)" --mandir="$(CFG_MANDIR)"
14+
# Remove tmp files while we can because they may have been created under sudo
15+
$(Q)rm -R tmp/dist/$(PKG_NAME)-$(CFG_BUILD)
1716

18-
$(eval $(call DEF_PREPARE,mkfile-install))
17+
uninstall: dist-install-dir-$(CFG_BUILD)
18+
$(Q)sh tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --uninstall --prefix="$(CFG_PREFIX)" --libdir="$(CFG_LIBDIR)" --mandir="$(CFG_MANDIR)"
1919

20-
install: PREPARE_HOST=$(CFG_BUILD)
21-
install: PREPARE_TARGETS=$(CFG_TARGET)
22-
install: PREPARE_DIR_CMD=$(DEFAULT_PREPARE_DIR_CMD)
23-
install: PREPARE_BIN_CMD=$(DEFAULT_PREPARE_BIN_CMD)
24-
install: PREPARE_LIB_CMD=$(DEFAULT_PREPARE_LIB_CMD)
25-
install: PREPARE_MAN_CMD=$(DEFAULT_PREPARE_MAN_CMD)
26-
install: PREPARE_SOURCE_DIR=$(PREPARE_HOST)/stage$(PREPARE_STAGE)
27-
install: PREPARE_SOURCE_BIN_DIR=$(PREPARE_SOURCE_DIR)/bin
28-
install: PREPARE_SOURCE_LIB_DIR=$(PREPARE_SOURCE_DIR)/$(CFG_LIBDIR_RELATIVE)
29-
install: PREPARE_SOURCE_MAN_DIR=$(S)/man
30-
install: PREPARE_DEST_BIN_DIR=$(DESTDIR)$(CFG_PREFIX)/bin
31-
install: PREPARE_DEST_LIB_DIR=$(DESTDIR)$(CFG_LIBDIR)
32-
install: PREPARE_DEST_MAN_DIR=$(DESTDIR)$(CFG_MANDIR)/man1
33-
install: prepare-everything-mkfile-install
34-
35-
36-
# Uninstall code
37-
38-
PREFIX_ROOT = $(CFG_PREFIX)
39-
PREFIX_BIN = $(PREFIX_ROOT)/bin
40-
PREFIX_LIB = $(CFG_LIBDIR)
41-
42-
INSTALL_TOOLS := $(PREPARE_TOOLS)
43-
44-
# Shorthand for build/stageN/bin
45-
HB = $(HBIN$(ISTAGE)_H_$(CFG_BUILD))
46-
HB2 = $(HBIN2_H_$(CFG_BUILD))
47-
# Shorthand for build/stageN/lib
48-
HL = $(HLIB$(ISTAGE)_H_$(CFG_BUILD))
49-
# Shorthand for the prefix bin directory
50-
PHB = $(PREFIX_BIN)
51-
# Shorthand for the prefix bin directory
52-
PHL = $(PREFIX_LIB)
53-
54-
HOST_LIB_FROM_HL_GLOB = \
55-
$(patsubst $(HL)/%,$(PHL)/%,$(wildcard $(HL)/$(1)))
56-
57-
uninstall: $(foreach tool,$(INSTALL_TOOLS),uninstall-tool-$(tool))
58-
$(Q)rm -Rf $(PHL)/$(CFG_RUSTLIBDIR)
59-
60-
define UNINSTALL_TOOL
61-
uninstall-tool-$(1): $$(foreach dep,$$(TOOL_DEPS_$(1)),uninstall-lib-$$(dep))
62-
$$(Q)rm -f $$(PHB)/$(1)$$(X_$$(CFG_BUILD))
63-
$$(Q)rm -f $$(CFG_MANDIR)/man1/$(1).1
64-
endef
65-
66-
$(foreach tool,$(INSTALL_TOOLS),$(eval $(call UNINSTALL_TOOL,$(tool))))
67-
68-
define UNINSTALL_LIB
69-
uninstall-lib-$(1): $$(foreach dep,$$(RUST_DEPS_$(1)),uninstall-lib-$$(dep))
70-
$$(Q)rm -f $$(call HOST_LIB_FROM_HL_GLOB,$$(call CFG_LIB_GLOB_$$(CFG_BUILD),$(1)))
71-
endef
72-
73-
$(foreach lib,$(CRATES),$(eval $(call UNINSTALL_LIB,$(lib))))
7420

21+
######################################################################
22+
# Android remote installation
23+
######################################################################
7524

7625
# Android runtime setup
7726
# FIXME: This probably belongs somewhere else

branches/auto/mk/main.mk

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
CFG_RELEASE_NUM=0.10
1717
CFG_RELEASE_LABEL=-pre
1818

19-
ifndef CFG_NIGHTLY
19+
ifndef CFG_ENABLE_NIGHTLY
2020
# This is the normal version string
2121
CFG_RELEASE=$(CFG_RELEASE_NUM)$(CFG_RELEASE_LABEL)
2222
CFG_PACKAGE_VERS=$(CFG_RELEASE)
@@ -281,7 +281,6 @@ export CFG_LLVM_ROOT
281281
export CFG_ENABLE_MINGW_CROSS
282282
export CFG_PREFIX
283283
export CFG_LIBDIR
284-
export CFG_RUSTLIBDIR
285284
export CFG_LIBDIR_RELATIVE
286285
export CFG_DISABLE_INJECT_STD_VERSION
287286

@@ -302,7 +301,7 @@ HBIN$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/bin
302301
HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(CFG_LIBDIR_RELATIVE)
303302

304303
# Destinations of artifacts for target architectures
305-
TROOT$(1)_T_$(2)_H_$(3) = $$(HLIB$(1)_H_$(3))/$$(CFG_RUSTLIBDIR)/$(2)
304+
TROOT$(1)_T_$(2)_H_$(3) = $$(HLIB$(1)_H_$(3))/rustlib/$(2)
306305
TBIN$(1)_T_$(2)_H_$(3) = $$(TROOT$(1)_T_$(2)_H_$(3))/bin
307306
TLIB$(1)_T_$(2)_H_$(3) = $$(TROOT$(1)_T_$(2)_H_$(3))/lib
308307

branches/auto/mk/prepare.mk

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ PREPARE_TOOLS = $(filter-out compiletest, $(TOOLS))
8686
define DEF_PREPARE_HOST_TOOL
8787
prepare-host-tool-$(1)-$(2)-$(3)-$(4): prepare-maybe-clean-$(4) \
8888
$$(foreach dep,$$(TOOL_DEPS_$(1)),prepare-host-lib-$$(dep)-$(2)-$(3)-$(4)) \
89+
$$(HBIN$(2)_H_$(3))/$(1)$$(X_$(3)) \
8990
prepare-host-dirs-$(4)
9091
$$(if $$(findstring $(2), $$(PREPARE_STAGE)),\
9192
$$(if $$(findstring $(3), $$(PREPARE_HOST)),\
@@ -121,8 +122,8 @@ endef
121122
# $(4) tag
122123
define DEF_PREPARE_TARGET_N
123124
# Rebind PREPARE_*_LIB_DIR to point to rustlib, then install the libs for the targets
124-
prepare-target-$(2)-host-$(3)-$(1)-$(4): PREPARE_WORKING_SOURCE_LIB_DIR=$$(PREPARE_SOURCE_LIB_DIR)/$$(CFG_RUSTLIBDIR)/$(2)/lib
125-
prepare-target-$(2)-host-$(3)-$(1)-$(4): PREPARE_WORKING_DEST_LIB_DIR=$$(PREPARE_DEST_LIB_DIR)/$$(CFG_RUSTLIBDIR)/$(2)/lib
125+
prepare-target-$(2)-host-$(3)-$(1)-$(4): PREPARE_WORKING_SOURCE_LIB_DIR=$$(PREPARE_SOURCE_LIB_DIR)/rustlib/$(2)/lib
126+
prepare-target-$(2)-host-$(3)-$(1)-$(4): PREPARE_WORKING_DEST_LIB_DIR=$$(PREPARE_DEST_LIB_DIR)/rustlib/$(2)/lib
126127
prepare-target-$(2)-host-$(3)-$(1)-$(4): prepare-maybe-clean-$(4) \
127128
$$(foreach crate,$$(TARGET_CRATES), \
128129
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(crate)) \

branches/auto/mk/rt.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ $$(LIBUV_DIR_$(1))/Release/libuv.a: $$(LIBUV_DEPS) $$(LIBUV_MAKEFILE_$(1)) \
215215
BUILDTYPE=Release \
216216
NO_LOAD="$$(LIBUV_NO_LOAD)" \
217217
V=$$(VERBOSE)
218+
$$(Q)touch $$@
218219

219220
endif
220221

branches/auto/mk/stage0.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ $(SNAPSHOT_RUSTC_POST_CLEANUP): \
1515
# Note: the variable "SNAPSHOT_FILE" is generally not set, and so
1616
# we generally only pass one argument to this script.
1717
ifdef CFG_ENABLE_LOCAL_RUST
18-
$(Q)$(S)src/etc/local_stage0.sh $(CFG_BUILD) $(CFG_LOCAL_RUST_ROOT) $(CFG_RUSTLIBDIR)
18+
$(Q)$(S)src/etc/local_stage0.sh $(CFG_BUILD) $(CFG_LOCAL_RUST_ROOT) rustlib
1919
else
2020
$(Q)$(CFG_PYTHON) $(S)src/etc/get-snapshot.py $(CFG_BUILD) $(SNAPSHOT_FILE)
2121
ifdef CFG_ENABLE_PAX_FLAGS

branches/auto/mk/target.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# This is the compile-time target-triple for the compiler. For the compiler at
1212
# runtime, this should be considered the host-triple. More explanation for why
1313
# this exists can be found on issue #2400
14-
export CFG_COMPILER
14+
export CFG_COMPILER_HOST_TRIPLE
1515

1616
# The standard libraries should be held up to a higher standard than any old
1717
# code, make sure that these common warnings are denied by default. These can
@@ -68,7 +68,7 @@ $(foreach host,$(CFG_HOST), \
6868
# $(4) is the crate name
6969
define RUST_TARGET_STAGE_N
7070

71-
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$(4): CFG_COMPILER = $(2)
71+
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$(4): CFG_COMPILER_HOST_TRIPLE = $(2)
7272
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$(4): \
7373
$$(CRATEFILE_$(4)) \
7474
$$(CRATE_FULLDEPS_$(1)_T_$(2)_H_$(3)_$(4)) \

branches/auto/mk/tests.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ ifdef CFG_WINDOWSY_$(1)
104104
stage2/$$(CFG_LIBDIR_RELATIVE), \
105105
$$(if $$(findstring stage3,$$(1)), \
106106
stage3/$$(CFG_LIBDIR_RELATIVE), \
107-
)))))/$$(CFG_RUSTLIBDIR)/$$(CFG_BUILD)/lib
107+
)))))/rustlib/$$(CFG_BUILD)/lib
108108
CFG_RUN_TEST_$(1)=$$(call CFG_RUN_$(1),$$(call CFG_TESTLIB_$(1),$$(1),$$(3)),$$(1))
109109
endif
110110

@@ -350,7 +350,7 @@ else
350350
TESTDEP_$(1)_$(2)_$(3)_$(4) = $$(RSINPUTS_$(4))
351351
endif
352352

353-
$(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2)): CFG_COMPILER = $(2)
353+
$(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2)): CFG_COMPILER_HOST_TRIPLE = $(2)
354354
$(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2)): \
355355
$$(CRATEFILE_$(4)) \
356356
$$(TESTDEP_$(1)_$(2)_$(3)_$(4))

branches/auto/src/compiletest/compiletest.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ pub mod common;
4343
pub mod errors;
4444

4545
#[start]
46-
fn start(argc: int, argv: **u8) -> int { green::start(argc, argv, main) }
46+
fn start(argc: int, argv: **u8) -> int {
47+
green::start(argc, argv, rustuv::event_loop, main)
48+
}
4749

4850
pub fn main() {
4951
let args = os::args();

branches/auto/src/doc/guide-lifetimes.md

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -559,9 +559,14 @@ points at a static constant).
559559

560560
# Named lifetimes
561561

562-
Let's look at named lifetimes in more detail. Named lifetimes allow
563-
for grouping of parameters by lifetime. For example, consider this
564-
function:
562+
Lifetimes can be named and referenced. For example, the special lifetime
563+
`'static`, which does not go out of scope, can be used to create global
564+
variables and communicate between tasks (see the manual for usecases).
565+
566+
## Parameter Lifetimes
567+
568+
Named lifetimes allow for grouping of parameters by lifetime.
569+
For example, consider this function:
565570

566571
~~~
567572
# struct Point {x: f64, y: f64}; // as before
@@ -655,6 +660,25 @@ fn select<'r, T>(shape: &Shape, threshold: f64,
655660

656661
This is equivalent to the previous definition.
657662

663+
## Labeled Control Structures
664+
665+
Named lifetime notation can also be used to control the flow of execution:
666+
667+
~~~
668+
'h: for i in range(0,10) {
669+
'g: loop {
670+
if i % 2 == 0 { continue 'h; }
671+
if i == 9 { break 'h; }
672+
break 'g;
673+
}
674+
}
675+
~~~
676+
677+
> ***Note:*** Labelled breaks are not currently supported within `while` loops.
678+
679+
Named labels are hygienic and can be used safely within macros.
680+
See the macros guide section on hygiene for more details.
681+
658682
# Conclusion
659683

660684
So there you have it: a (relatively) brief tour of the lifetime

0 commit comments

Comments
 (0)