Skip to content

Commit 4e2d858

Browse files
committed
---
yaml --- r: 124921 b: refs/heads/master c: 221c28a h: refs/heads/master i: 124919: 635668e v: v3
1 parent 8c265df commit 4e2d858

File tree

350 files changed

+8988
-2942
lines changed

Some content is hidden

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

350 files changed

+8988
-2942
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 3419e20f3b0800d40a4e33d47da7051d142e62ce
2+
refs/heads/master: 221c28a08858f07cb3bb830834afd071fec840da
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 9fc8394d3bce22ab483f98842434c84c396212ae
55
refs/heads/try: ac70b438a8382389c9c9b59c66b14774bff46e10

trunk/Makefile.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ ifneq ($(strip $(findstring check,$(MAKECMDGOALS)) \
216216
$(findstring tidy,$(MAKECMDGOALS))),)
217217
CFG_INFO := $(info cfg: including test rules)
218218
include $(CFG_SRC_DIR)mk/tests.mk
219+
include $(CFG_SRC_DIR)mk/grammar.mk
219220
endif
220221

221222
# Performance and benchmarking

trunk/configure

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,8 @@ opt rpath 0 "build rpaths into rustc itself"
422422
opt nightly 0 "build nightly packages"
423423
opt verify-install 1 "verify installed binaries work"
424424
opt jemalloc 1 "build liballoc with jemalloc"
425+
# This is used by the automation to produce single-target nightlies
426+
opt dist-host-only 0 "only install bins for the host architecture"
425427
valopt prefix "/usr/local" "set installation prefix"
426428
valopt local-rust-root "/usr/local" "set prefix for local rust binary"
427429
valopt llvm-root "" "set LLVM root"
@@ -493,6 +495,9 @@ probe CFG_VALGRIND valgrind
493495
probe CFG_PERF perf
494496
probe CFG_ISCC iscc
495497
probe CFG_LLNEXTGEN LLnextgen
498+
probe CFG_JAVAC javac
499+
probe CFG_ANTLR4 antlr4
500+
probe CFG_GRUN grun
496501
probe CFG_PANDOC pandoc
497502
probe CFG_PDFLATEX pdflatex
498503
probe CFG_XELATEX xelatex

trunk/mk/dist.mk

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ define DEF_OSX_PKG
156156
$$(eval $$(call DEF_PREPARE,osx-$(1)))
157157

158158
dist-prepare-osx-$(1): PREPARE_HOST=$(1)
159-
dist-prepare-osx-$(1): PREPARE_TARGETS=$(1)
159+
dist-prepare-osx-$(1): PREPARE_TARGETS=$(2)
160160
dist-prepare-osx-$(1): PREPARE_DEST_DIR=tmp/dist/pkgroot-$(1)
161161
dist-prepare-osx-$(1): PREPARE_DIR_CMD=$(DEFAULT_PREPARE_DIR_CMD)
162162
dist-prepare-osx-$(1): PREPARE_BIN_CMD=$(DEFAULT_PREPARE_BIN_CMD)
@@ -187,7 +187,11 @@ tmp/dist/pkgres-$(1)/%: $(S)src/etc/pkg/%
187187

188188
endef
189189

190-
$(foreach host,$(CFG_HOST),$(eval $(call DEF_OSX_PKG,$(host))))
190+
ifneq ($(CFG_ENABLE_DIST_HOST_ONLY),)
191+
$(foreach host,$(CFG_HOST),$(eval $(call DEF_OSX_PKG,$(host),$(host))))
192+
else
193+
$(foreach host,$(CFG_HOST),$(eval $(call DEF_OSX_PKG,$(host),$(TARGET))))
194+
endif
191195

192196
dist-osx: $(foreach host,$(CFG_HOST),dist/$(PKG_NAME)-$(host).pkg)
193197

@@ -205,17 +209,19 @@ distcheck-osx: dist-osx
205209
# Unix binary installer tarballs
206210
######################################################################
207211

208-
define DEF_PREPARE_DIST_DIR
209-
210-
dist-install-dir-$(1)$(3): PREPARE_HOST=$(1)
211-
dist-install-dir-$(1)$(3): PREPARE_TARGETS=$(2)
212-
dist-install-dir-$(1)$(3): PREPARE_DEST_DIR=tmp/dist/$$(PKG_NAME)-$(1)
213-
dist-install-dir-$(1)$(3): PREPARE_DIR_CMD=$(DEFAULT_PREPARE_DIR_CMD)
214-
dist-install-dir-$(1)$(3): PREPARE_BIN_CMD=$(DEFAULT_PREPARE_BIN_CMD)
215-
dist-install-dir-$(1)$(3): PREPARE_LIB_CMD=$(DEFAULT_PREPARE_LIB_CMD)
216-
dist-install-dir-$(1)$(3): PREPARE_MAN_CMD=$(DEFAULT_PREPARE_MAN_CMD)
217-
dist-install-dir-$(1)$(3): PREPARE_CLEAN=true
218-
dist-install-dir-$(1)$(3): prepare-base-dir-$(1) docs compiler-docs
212+
define DEF_INSTALLER
213+
214+
$$(eval $$(call DEF_PREPARE,dir-$(1)))
215+
216+
dist-install-dir-$(1): PREPARE_HOST=$(1)
217+
dist-install-dir-$(1): PREPARE_TARGETS=$(2)
218+
dist-install-dir-$(1): PREPARE_DEST_DIR=tmp/dist/$$(PKG_NAME)-$(1)
219+
dist-install-dir-$(1): PREPARE_DIR_CMD=$(DEFAULT_PREPARE_DIR_CMD)
220+
dist-install-dir-$(1): PREPARE_BIN_CMD=$(DEFAULT_PREPARE_BIN_CMD)
221+
dist-install-dir-$(1): PREPARE_LIB_CMD=$(DEFAULT_PREPARE_LIB_CMD)
222+
dist-install-dir-$(1): PREPARE_MAN_CMD=$(DEFAULT_PREPARE_MAN_CMD)
223+
dist-install-dir-$(1): PREPARE_CLEAN=true
224+
dist-install-dir-$(1): prepare-base-dir-$(1) docs compiler-docs
219225
$$(Q)(cd $$(PREPARE_DEST_DIR)/ && find . -type f | sed 's/^\.\///') \
220226
> tmp/dist/manifest-$(1).in
221227
$$(Q)mv tmp/dist/manifest-$(1).in $$(PREPARE_DEST_DIR)/$$(CFG_LIBDIR_RELATIVE)/rustlib/manifest.in
@@ -227,24 +233,19 @@ dist-install-dir-$(1)$(3): prepare-base-dir-$(1) docs compiler-docs
227233
$$(Q)cp -r doc $$(PREPARE_DEST_DIR)
228234
$$(Q)$$(PREPARE_BIN_CMD) $$(S)src/etc/install.sh $$(PREPARE_DEST_DIR)
229235

230-
endef
231-
232-
define DEF_INSTALLER
233-
234-
$$(eval $$(call DEF_PREPARE,dir-$(1)))
235-
236-
$$(eval $$(call DEF_PREPARE_DIST_DIR,$(1),$(1),))
237-
238-
$$(eval $$(call DEF_PREPARE_DIST_DIR,$(1),$(CFG_TARGET),-with-target-libs))
239-
240236
dist/$$(PKG_NAME)-$(1).tar.gz: dist-install-dir-$(1)
241237
@$(call E, build: $$@)
242238
$$(Q)tar -czf dist/$$(PKG_NAME)-$(1).tar.gz -C tmp/dist $$(PKG_NAME)-$(1)
243239

244240
endef
245241

242+
ifneq ($(CFG_ENABLE_DIST_HOST_ONLY),)
243+
$(foreach host,$(CFG_HOST),\
244+
$(eval $(call DEF_INSTALLER,$(host),$(host))))
245+
else
246246
$(foreach host,$(CFG_HOST),\
247-
$(eval $(call DEF_INSTALLER,$(host))))
247+
$(eval $(call DEF_INSTALLER,$(host),$(CFG_TARGET))))
248+
endif
248249

249250
dist-install-dirs: $(foreach host,$(CFG_HOST),dist-install-dir-$(host))
250251

trunk/mk/docs.mk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ DOCS := index intro tutorial guide guide-ffi guide-macros guide-lifetimes \
3030
guide-tasks guide-container guide-pointers guide-testing \
3131
guide-runtime complement-bugreport \
3232
complement-lang-faq complement-design-faq complement-project-faq rust \
33-
rustdoc guide-unsafe
33+
rustdoc guide-unsafe guide-strings
3434

3535
PDF_DOCS := tutorial rust
3636

@@ -112,8 +112,8 @@ HTML_DEPS += doc/version_info.html
112112
doc/version_info.html: $(D)/version_info.html.template $(MKFILE_DEPS) \
113113
$(wildcard $(D)/*.*) | doc/
114114
@$(call E, version-info: $@)
115-
$(Q)sed -e "s/VERSION/$(CFG_RELEASE)/; s/SHORT_HASH/$(shell echo \
116-
$(CFG_VER_HASH) | head -c 8)/;\
115+
$(Q)sed -e "s/VERSION/$(CFG_RELEASE)/; s/SHORT_HASH/$(\
116+
CFG_SHORT_VER_HASH)/;\
117117
s/STAMP/$(CFG_VER_HASH)/;" $< >$@
118118

119119
GENERATED += doc/version.tex doc/version_info.html

trunk/mk/grammar.mk

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
# file at the top-level directory of this distribution and at
3+
# http://rust-lang.org/COPYRIGHT.
4+
#
5+
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
# option. This file may not be copied, modified, or distributed
9+
# except according to those terms.
10+
11+
BG = $(CFG_BUILD_DIR)/grammar/
12+
SG = $(S)src/grammar/
13+
B = $(CFG_BUILD_DIR)/$(CFG_BUILD)/stage2/
14+
L = $(B)lib/rustlib/$(CFG_BUILD)/lib
15+
LD = $(CFG_BUILD)/stage2/lib/rustlib/$(CFG_BUILD)/lib/
16+
RUSTC = $(B)bin/rustc
17+
18+
# Run the reference lexer against libsyntax and compare the tokens and spans.
19+
# If "// ignore-lexer-test" is present in the file, it will be ignored.
20+
#
21+
# $(1) is the file to test.
22+
define LEXER_TEST
23+
grep "// ignore-lexer-test" $(1) ; \
24+
if [ $$? -eq 1 ]; then \
25+
CLASSPATH=$(B)grammar $(CFG_GRUN) RustLexer tokens -tokens < $(1) \
26+
| $(B)grammar/verify $(1) ; \
27+
fi
28+
endef
29+
30+
$(BG):
31+
$(Q)mkdir -p $(BG)
32+
33+
$(BG)RustLexer.class: $(SG)RustLexer.g4
34+
$(Q)$(CFG_ANTLR4) -o $(B)grammar $(SG)RustLexer.g4
35+
$(Q)$(CFG_JAVAC) -d $(BG) $(BG)RustLexer.java
36+
37+
$(BG)verify: $(SG)verify.rs rustc-stage2-H-$(CFG_BUILD) $(LD)stamp.regex_macros $(LD)stamp.rustc
38+
$(Q)$(RUSTC) -O --out-dir $(BG) -L $(L) $(SG)verify.rs
39+
40+
check-lexer: $(BG) $(BG)RustLexer.class $(BG)verify
41+
ifdef CFG_JAVAC
42+
ifdef CFG_ANTLR4
43+
ifdef CFG_GRUN
44+
$(info Verifying libsyntax against the reference lexer ...)
45+
$(Q)$(SG)check.sh $(S) "$(BG)" \
46+
"$(CFG_GRUN)" "$(BG)verify" "$(BG)RustLexer.tokens"
47+
else
48+
$(info grun not available, skipping lexer test...)
49+
endif
50+
else
51+
$(info antlr4 not available, skipping lexer test...)
52+
endif
53+
else
54+
$(info javac not available, skipping lexer test...)
55+
endif

trunk/mk/install.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ else
1414
MAYBE_DISABLE_VERIFY=
1515
endif
1616

17-
install: dist-install-dir-$(CFG_BUILD)-with-target-libs | tmp/empty_dir
17+
install: dist-install-dir-$(CFG_BUILD) | tmp/empty_dir
1818
$(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" "$(MAYBE_DISABLE_VERIFY)"
1919
# Remove tmp files while we can because they may have been created under sudo
2020
$(Q)rm -R tmp/dist
2121

22-
uninstall: dist-install-dir-$(CFG_BUILD)-with-target-libs | tmp/empty_dir
22+
uninstall: dist-install-dir-$(CFG_BUILD) | tmp/empty_dir
2323
$(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --uninstall --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)"
2424
# Remove tmp files while we can because they may have been created under sudo
2525
$(Q)rm -R tmp/dist

trunk/mk/main.mk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ ifneq ($(wildcard $(subst $(SPACE),\$(SPACE),$(CFG_GIT))),)
4646
ifneq ($(wildcard $(subst $(SPACE),\$(SPACE),$(CFG_GIT_DIR))),)
4747
CFG_VER_DATE = $(shell git --git-dir='$(CFG_GIT_DIR)' log -1 --pretty=format:'%ci')
4848
CFG_VER_HASH = $(shell git --git-dir='$(CFG_GIT_DIR)' rev-parse HEAD)
49-
CFG_VERSION += ($(CFG_VER_HASH) $(CFG_VER_DATE))
49+
CFG_SHORT_VER_HASH = $(shell git --git-dir='$(CFG_GIT_DIR)' rev-parse --short=9 HEAD)
50+
CFG_VERSION += ($(CFG_SHORT_VER_HASH) $(CFG_VER_DATE))
5051
endif
5152
endif
5253

trunk/mk/tests.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,8 @@ check-docs: cleantestlibs cleantmptestlogs check-stage2-docs
192192
# NOTE: Remove after reprogramming windows bots
193193
check-fast: check-lite
194194

195+
check-syntax: check-lexer
196+
195197
.PHONY: cleantmptestlogs cleantestlibs
196198

197199
cleantmptestlogs:

trunk/src/compiletest/runtest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1178,7 +1178,7 @@ fn make_run_args(config: &Config, props: &TestProps, testfile: &Path) ->
11781178
// Add the arguments in the run_flags directive
11791179
args.push_all_move(split_maybe_args(&props.run_flags));
11801180

1181-
let prog = args.shift().unwrap();
1181+
let prog = args.remove(0).unwrap();
11821182
return ProcArgs {
11831183
prog: prog,
11841184
args: args,

trunk/src/doc/guide-strings.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
% The Strings Guide
22

3-
# Strings
4-
53
Strings are an important concept to master in any programming language. If you
64
come from a managed language background, you may be surprised at the complexity
75
of string handling in a systems programming language. Efficient access and
@@ -14,7 +12,7 @@ Additionally, strings are not null-terminated and can contain null bytes.
1412

1513
Rust has two main types of strings: `&str` and `String`.
1614

17-
## &str
15+
# &str
1816

1917
The first kind is a `&str`. This is pronounced a 'string slice.' String literals
2018
are of the type `&str`:
@@ -38,7 +36,7 @@ Like vector slices, string slices are simply a pointer plus a length. This
3836
means that they're a 'view' into an already-allocated string, such as a
3937
`&'static str` or a `String`.
4038

41-
## String
39+
# String
4240

4341
A `String` is a heap-allocated string. This string is growable, and is also
4442
guaranteed to be UTF-8.
@@ -73,9 +71,9 @@ let x: &[u8] = &[b'a', b'b'];
7371
let stack_str: &str = str::from_utf8(x).unwrap();
7472
```
7573

76-
## Best Practices
74+
# Best Practices
7775

78-
### `String` vs. `&str`
76+
## `String` vs. `&str`
7977

8078
In general, you should prefer `String` when you need ownership, and `&str` when
8179
you just need to borrow a string. This is very similar to using `Vec<T>` vs. `&[T]`,
@@ -98,7 +96,7 @@ need, and it can make your lifetimes more complex. Furthermore, you can pass
9896
either kind of string into `foo` by using `.as_slice()` on any `String` you
9997
need to pass in, so the `&str` version is more flexible.
10098

101-
### Comparisons
99+
## Comparisons
102100

103101
To compare a String to a constant string, prefer `as_slice()`...
104102

@@ -123,7 +121,7 @@ fn compare(string: String) {
123121
Converting a `String` to a `&str` is cheap, but converting the `&str` to a
124122
`String` involves an allocation.
125123

126-
## Other Documentation
124+
# Other Documentation
127125

128126
* [the `&str` API documentation](/std/str/index.html)
129127
* [the `String` API documentation](std/string/index.html)

0 commit comments

Comments
 (0)