Skip to content

Commit 051431a

Browse files
committed
---
yaml --- r: 161566 b: refs/heads/snap-stage3 c: 0fb040f h: refs/heads/master v: v3
1 parent e6b3d9c commit 051431a

File tree

270 files changed

+5809
-5128
lines changed

Some content is hidden

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

270 files changed

+5809
-5128
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 4eb72d268f337a8f117c86a2ac1b98336cab9e9d
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: f0f7a9006853902882f7475b400fc9075c798c29
4+
refs/heads/snap-stage3: 0fb040f4bd1a3bd7ee9d60dfb8445a587ef7f28e
55
refs/heads/try: 0f0d21c1eb5c7be04d323e0b06faf252ad790af6
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d

branches/snap-stage3/mk/crates.mk

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ TARGET_CRATES := libc std flate arena term \
5353
serialize getopts collections test time rand \
5454
log regex graphviz core rbml alloc rustrt \
5555
unicode
56-
HOST_CRATES := syntax rustc rustc_trans rustdoc regex_macros fmt_macros \
57-
rustc_llvm rustc_back
56+
RUSTC_CRATES := rustc rustc_typeck rustc_driver rustc_trans rustc_back rustc_llvm
57+
HOST_CRATES := syntax $(RUSTC_CRATES) rustdoc regex_macros fmt_macros
5858
CRATES := $(TARGET_CRATES) $(HOST_CRATES)
5959
TOOLS := compiletest rustdoc rustc
6060

@@ -67,12 +67,16 @@ DEPS_std := core libc rand alloc collections rustrt unicode \
6767
native:rust_builtin native:backtrace
6868
DEPS_graphviz := std
6969
DEPS_syntax := std term serialize log fmt_macros arena libc
70-
DEPS_rustc_trans := rustc rustc_back rustc_llvm libc
70+
DEPS_rustc_driver := arena flate getopts graphviz libc rustc rustc_back \
71+
rustc_typeck log syntax serialize rustc_llvm rustc_trans
72+
DEPS_rustc_trans := arena flate getopts graphviz libc rustc rustc_back \
73+
log syntax serialize rustc_llvm
74+
DEPS_rustc_typeck := rustc syntax
7175
DEPS_rustc := syntax flate arena serialize getopts rbml \
7276
time log graphviz rustc_llvm rustc_back
7377
DEPS_rustc_llvm := native:rustllvm libc std
7478
DEPS_rustc_back := std syntax rustc_llvm flate log libc
75-
DEPS_rustdoc := rustc rustc_trans native:hoedown serialize getopts \
79+
DEPS_rustdoc := rustc rustc_driver native:hoedown serialize getopts \
7680
test time
7781
DEPS_flate := std native:miniz
7882
DEPS_arena := std
@@ -94,7 +98,7 @@ DEPS_fmt_macros = std
9498

9599
TOOL_DEPS_compiletest := test getopts
96100
TOOL_DEPS_rustdoc := rustdoc
97-
TOOL_DEPS_rustc := rustc_trans
101+
TOOL_DEPS_rustc := rustc_driver
98102
TOOL_SOURCE_compiletest := $(S)src/compiletest/compiletest.rs
99103
TOOL_SOURCE_rustdoc := $(S)src/driver/driver.rs
100104
TOOL_SOURCE_rustc := $(S)src/driver/driver.rs
@@ -110,8 +114,12 @@ ONLY_RLIB_unicode := 1
110114
# You should not need to edit below this line
111115
################################################################################
112116

113-
DOC_CRATES := $(filter-out rustc, $(filter-out rustc_trans, $(filter-out syntax, $(CRATES))))
114-
COMPILER_DOC_CRATES := rustc rustc_trans syntax
117+
DOC_CRATES := $(filter-out rustc, \
118+
$(filter-out rustc_trans, \
119+
$(filter-out rustc_typeck, \
120+
$(filter-out rustc_driver, \
121+
$(filter-out syntax, $(CRATES))))))
122+
COMPILER_DOC_CRATES := rustc rustc_trans rustc_typeck rustc_driver syntax
115123

116124
# This macro creates some simple definitions for each crate being built, just
117125
# some munging of all of the parameters above.

branches/snap-stage3/mk/tests.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ $(eval $(call RUST_CRATE,coretest))
2121

2222
TEST_TARGET_CRATES = $(filter-out core unicode,$(TARGET_CRATES)) coretest
2323
TEST_DOC_CRATES = $(DOC_CRATES)
24-
TEST_HOST_CRATES = $(HOST_CRATES)
24+
TEST_HOST_CRATES = $(filter-out rustc_typeck rustc_trans,$(HOST_CRATES))
2525
TEST_CRATES = $(TEST_TARGET_CRATES) $(TEST_HOST_CRATES)
2626

2727
######################################################################

branches/snap-stage3/src/doc/guide.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2064,8 +2064,8 @@ Great! Next up: let's compare our guess to the secret guess.
20642064
## Comparing guesses
20652065

20662066
If you remember, earlier in the guide, we made a `cmp` function that compared
2067-
two numbers. Let's add that in, along with a `match` statement to compare the
2068-
guess to the secret guess:
2067+
two numbers. Let's add that in, along with a `match` statement to compare our
2068+
guess to the secret number:
20692069

20702070
```{rust,ignore}
20712071
use std::io;
@@ -2861,7 +2861,7 @@ parts of your library. The six levels are:
28612861
* experimental: This item was only recently introduced or is otherwise in a
28622862
state of flux. It may change significantly, or even be removed. No guarantee
28632863
of backwards-compatibility.
2864-
* unstable: This item is still under development, but requires more testing to
2864+
* unstable: This item is still under development and requires more testing to
28652865
be considered stable. No guarantee of backwards-compatibility.
28662866
* stable: This item is considered stable, and will not change significantly.
28672867
Guarantee of backwards-compatibility.

branches/snap-stage3/src/doc/reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ The two values of the boolean type are written `true` and `false`.
522522
### Symbols
523523

524524
```{.ebnf .gram}
525-
symbol : "::" "->"
525+
symbol : "::" | "->"
526526
| '#' | '[' | ']' | '(' | ')' | '{' | '}'
527527
| ',' | ';' ;
528528
```

branches/snap-stage3/src/driver/driver.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212
extern crate "rustdoc" as this;
1313

1414
#[cfg(rustc)]
15-
extern crate "rustc_trans" as this;
15+
extern crate "rustc_driver" as this;
1616

1717
fn main() { this::main() }

branches/snap-stage3/src/etc/gdb_rust_pretty_printing.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,21 +54,27 @@ def rust_pretty_printer_lookup_function(val):
5454
return RustStructPrinter(val, false)
5555

5656
if enum_member_count == 1:
57-
if enum_members[0].name == None:
57+
first_variant_name = enum_members[0].name
58+
if first_variant_name == None:
5859
# This is a singleton enum
5960
return rust_pretty_printer_lookup_function(val[enum_members[0]])
6061
else:
61-
assert enum_members[0].name.startswith("RUST$ENCODED$ENUM$")
62+
assert first_variant_name.startswith("RUST$ENCODED$ENUM$")
6263
# This is a space-optimized enum
63-
last_separator_index = enum_members[0].name.rfind("$")
64+
last_separator_index = first_variant_name.rfind("$")
6465
second_last_separator_index = first_variant_name.rfind("$", 0, last_separator_index)
6566
disr_field_index = first_variant_name[second_last_separator_index + 1 :
6667
last_separator_index]
6768
disr_field_index = int(disr_field_index)
6869

6970
sole_variant_val = val[enum_members[0]]
7071
disr_field = get_field_at_index(sole_variant_val, disr_field_index)
71-
discriminant = int(sole_variant_val[disr_field])
72+
discriminant = sole_variant_val[disr_field]
73+
74+
# If the discriminant field is a fat pointer we have to consider the
75+
# first word as the true discriminant
76+
if discriminant.type.code == gdb.TYPE_CODE_STRUCT:
77+
discriminant = discriminant[get_field_at_index(discriminant, 0)]
7278

7379
if discriminant == 0:
7480
null_variant_name = first_variant_name[last_separator_index + 1:]
@@ -173,7 +179,7 @@ def to_string(self):
173179

174180
class IdentityPrinter:
175181
def __init__(self, string):
176-
self.string
182+
self.string = string
177183

178184
def to_string(self):
179185
return self.string

branches/snap-stage3/src/etc/licenseck.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,8 @@
3838
"rt/isaac/randport.cpp", # public domain
3939
"rt/isaac/rand.h", # public domain
4040
"rt/isaac/standard.h", # public domain
41-
"libstd/sync/mpsc_queue.rs", # BSD
42-
"libstd/sync/spsc_queue.rs", # BSD
43-
"libstd/sync/mpmc_bounded_queue.rs", # BSD
41+
"libstd/comm/mpsc_queue.rs", # BSD
42+
"libstd/comm/spsc_queue.rs", # BSD
4443
"test/bench/shootout-binarytrees.rs", # BSD
4544
"test/bench/shootout-chameneos-redux.rs", # BSD
4645
"test/bench/shootout-fannkuch-redux.rs", # BSD

branches/snap-stage3/src/etc/lldb_rust_formatters.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,14 @@ def print_enum_val(val, internal_dict):
138138
return "<invalid enum encoding: %s>" % first_variant_name
139139

140140
# Read the discriminant
141-
disr_val = val.GetChildAtIndex(0).GetChildAtIndex(disr_field_index).GetValueAsUnsigned()
141+
disr_val = val.GetChildAtIndex(0).GetChildAtIndex(disr_field_index)
142142

143-
if disr_val == 0:
143+
# If the discriminant field is a fat pointer we have to consider the
144+
# first word as the true discriminant
145+
if disr_val.GetType().GetTypeClass() == lldb.eTypeClassStruct:
146+
disr_val = disr_val.GetChildAtIndex(0)
147+
148+
if disr_val.GetValueAsUnsigned() == 0:
144149
# Null case: Print the name of the null-variant
145150
null_variant_name = first_variant_name[last_separator_index + 1:]
146151
return null_variant_name

branches/snap-stage3/src/etc/rustup.sh

100644100755
Lines changed: 86 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ flag() {
188188
fi
189189
}
190190

191-
validate_opt () {
191+
validate_opt() {
192192
for arg in $CFG_ARGS
193193
do
194194
isArgValid=0
@@ -230,6 +230,7 @@ validate_opt () {
230230
}
231231

232232
probe_need CFG_CURL curl
233+
probe_need CFG_TAR tar
233234

234235
CFG_SRC_DIR="$(cd $(dirname $0) && pwd)/"
235236
CFG_SELF="$0"
@@ -388,89 +389,109 @@ esac
388389

389390
msg "host triple: ${HOST_TRIPLE}"
390391

391-
PACKAGE_NAME=rust-nightly
392-
PACKAGE_NAME_AND_TRIPLE="${PACKAGE_NAME}-${HOST_TRIPLE}"
393-
TARBALL_NAME="${PACKAGE_NAME_AND_TRIPLE}.tar.gz"
394-
REMOTE_TARBALL="https://static.rust-lang.org/dist/${TARBALL_NAME}"
395-
TMP_DIR="./rustup-tmp-install"
396-
LOCAL_TARBALL="${TMP_DIR}/${TARBALL_NAME}"
397-
LOCAL_INSTALL_DIR="${TMP_DIR}/${PACKAGE_NAME_AND_TRIPLE}"
398-
LOCAL_INSTALL_SCRIPT="${LOCAL_INSTALL_DIR}/install.sh"
392+
CFG_INSTALL_FLAGS=""
393+
if [ -n "${CFG_UNINSTALL}" ]
394+
then
395+
CFG_INSTALL_FLAGS="${CFG_INSTALL_FLAGS} --uninstall"
396+
fi
397+
398+
if [ -n "${CFG_PREFIX}" ]
399+
then
400+
CFG_INSTALL_FLAGS="${CFG_INSTALL_FLAGS} --prefix=${CFG_PREFIX}"
401+
fi
402+
403+
CFG_TMP_DIR="./rustup-tmp-install"
399404

405+
RUST_URL="https://static.rust-lang.org/dist"
406+
RUST_PACKAGE_NAME=rust-nightly
407+
RUST_PACKAGE_NAME_AND_TRIPLE="${RUST_PACKAGE_NAME}-${HOST_TRIPLE}"
408+
RUST_TARBALL_NAME="${RUST_PACKAGE_NAME_AND_TRIPLE}.tar.gz"
409+
RUST_LOCAL_INSTALL_DIR="${CFG_TMP_DIR}/${RUST_PACKAGE_NAME_AND_TRIPLE}"
410+
RUST_LOCAL_INSTALL_SCRIPT="${RUST_LOCAL_INSTALL_DIR}/install.sh"
411+
412+
CARGO_URL="https://static.rust-lang.org/cargo-dist"
400413
CARGO_PACKAGE_NAME=cargo-nightly
401414
CARGO_PACKAGE_NAME_AND_TRIPLE="${CARGO_PACKAGE_NAME}-${HOST_TRIPLE}"
402415
CARGO_TARBALL_NAME="${CARGO_PACKAGE_NAME_AND_TRIPLE}.tar.gz"
403-
CARGO_REMOTE_TARBALL="https://static.rust-lang.org/cargo-dist/${CARGO_TARBALL_NAME}"
404-
CARGO_LOCAL_TARBALL="${TMP_DIR}/${CARGO_TARBALL_NAME}"
405-
CARGO_LOCAL_INSTALL_DIR="${TMP_DIR}/${CARGO_PACKAGE_NAME_AND_TRIPLE}"
416+
CARGO_LOCAL_INSTALL_DIR="${CFG_TMP_DIR}/${CARGO_PACKAGE_NAME_AND_TRIPLE}"
406417
CARGO_LOCAL_INSTALL_SCRIPT="${CARGO_LOCAL_INSTALL_DIR}/install.sh"
407418

408-
rm -Rf "${TMP_DIR}"
409-
need_ok "failed to remove temporary installation directory"
419+
# Fetch the package.
420+
download_package() {
421+
remote_tarball="$1"
422+
local_tarball="$2"
410423

411-
mkdir -p "${TMP_DIR}"
412-
need_ok "failed to create create temporary installation directory"
424+
msg "Downloading ${remote_tarball} to ${local_tarball}"
413425

414-
msg "downloading rust installer"
415-
"${CFG_CURL}" "${REMOTE_TARBALL}" > "${LOCAL_TARBALL}"
416-
if [ $? -ne 0 ]
417-
then
418-
rm -Rf "${TMP_DIR}"
419-
err "failed to download installer"
420-
fi
426+
mkdir -p "${CFG_TMP_DIR}"
427+
need_ok "failed to create create download directory"
421428

422-
if [ -z "${CFG_DISABLE_CARGO}" ]; then
423-
msg "downloading cargo installer"
424-
"${CFG_CURL}" "${CARGO_REMOTE_TARBALL}" > "${CARGO_LOCAL_TARBALL}"
429+
"${CFG_CURL}" -f -o "${local_tarball}" "${remote_tarball}"
425430
if [ $? -ne 0 ]
426431
then
427-
rm -Rf "${TMP_DIR}"
428-
err "failed to download cargo installer"
432+
rm -Rf "${CFG_TMP_DIR}"
433+
err "failed to download installer"
429434
fi
430-
fi
435+
}
431436

437+
# Wrap all the commands needed to install a package.
438+
install_package() {
439+
tarball_name="$1"
440+
install_script="$2"
432441

433-
(cd "${TMP_DIR}" && tar xzf "${TARBALL_NAME}")
434-
if [ $? -ne 0 ]
435-
then
436-
rm -Rf "${TMP_DIR}"
442+
msg "Extracting ${tarball_name}"
443+
(cd "${CFG_TMP_DIR}" && "${CFG_TAR}" -xvf "${tarball_name}")
444+
if [ $? -ne 0 ]; then
445+
rm -Rf "${CFG_TMP_DIR}"
437446
err "failed to unpack installer"
438-
fi
439-
440-
MAYBE_UNINSTALL=
441-
if [ -n "${CFG_UNINSTALL}" ]
442-
then
443-
MAYBE_UNINSTALL="--uninstall"
444-
fi
445-
446-
MAYBE_PREFIX=
447-
if [ -n "${CFG_PREFIX}" ]
448-
then
449-
MAYBE_PREFIX="--prefix=${CFG_PREFIX}"
450-
fi
451-
452-
sh "${LOCAL_INSTALL_SCRIPT}" "${MAYBE_UNINSTALL}" "${MAYBE_PREFIX}"
453-
if [ $? -ne 0 ]
454-
then
455-
rm -Rf "${TMP_DIR}"
456-
err "failed to install Rust"
457-
fi
447+
fi
458448

459-
if [ -z "${CFG_DISABLE_CARGO}" ]; then
460-
(cd "${TMP_DIR}" && tar xzf "${CARGO_TARBALL_NAME}")
449+
sh "${install_script}" "${CFG_INSTALL_FLAGS}"
461450
if [ $? -ne 0 ]
462451
then
463-
rm -Rf "${TMP_DIR}"
464-
err "failed to unpack cargo installer"
452+
rm -Rf "${CFG_TMP_DIR}"
453+
err "failed to install Rust"
465454
fi
455+
}
466456

467-
sh "${CARGO_LOCAL_INSTALL_SCRIPT}" "${MAYBE_UNINSTALL}" "${MAYBE_PREFIX}"
468-
if [ $? -ne 0 ]
469-
then
470-
rm -Rf "${TMP_DIR}"
471-
err "failed to install Cargo"
457+
# It's possible that curl could be interrupted partway though downloading
458+
# `rustup.sh`, truncating the file. This could be especially bad if we were in
459+
# the middle of a line that would run "rm -rf ". To protect against this, we
460+
# wrap up the `rustup.sh` destructive functionality in this helper function,
461+
# which we call as the last thing we do. This means we will not do anything
462+
# unless we have the entire file downloaded.
463+
install_packages() {
464+
rm -Rf "${CFG_TMP_DIR}"
465+
need_ok "failed to remove temporary installation directory"
466+
467+
mkdir -p "${CFG_TMP_DIR}"
468+
need_ok "failed to create create temporary installation directory"
469+
470+
RUST_LOCAL_TARBALL="${CFG_TMP_DIR}/${RUST_TARBALL_NAME}"
471+
CARGO_LOCAL_TARBALL="${CFG_TMP_DIR}/${CARGO_TARBALL_NAME}"
472+
473+
download_package \
474+
"${RUST_URL}/${RUST_TARBALL_NAME}" \
475+
"${RUST_LOCAL_TARBALL}"
476+
477+
if [ -z "${CFG_DISABLE_CARGO}" ]; then
478+
download_package \
479+
"${CARGO_URL}/${CARGO_TARBALL_NAME}" \
480+
"${CARGO_LOCAL_TARBALL}"
472481
fi
473-
fi
474482

475-
rm -Rf "${TMP_DIR}"
476-
need_ok "couldn't rm temporary installation directory"
483+
install_package \
484+
"${RUST_TARBALL_NAME}" \
485+
"${RUST_LOCAL_INSTALL_SCRIPT}"
486+
487+
if [ -z "${CFG_DISABLE_CARGO}" ]; then
488+
install_package \
489+
"${CARGO_TARBALL_NAME}" \
490+
"${CARGO_LOCAL_INSTALL_SCRIPT}"
491+
fi
492+
493+
rm -Rf "${CFG_TMP_DIR}"
494+
need_ok "couldn't rm temporary installation directory"
495+
}
496+
497+
install_packages

branches/snap-stage3/src/libcollections/dlist.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -945,15 +945,15 @@ mod tests {
945945
let mut m = list_from(v.as_slice());
946946
m.rotate_backward(); check_links(&m);
947947
m.rotate_forward(); check_links(&m);
948-
assert_eq!(v.iter().collect::<Vec<&int>>(), m.iter().collect());
948+
assert_eq!(v.iter().collect::<Vec<&int>>(), m.iter().collect::<Vec<_>>());
949949
m.rotate_forward(); check_links(&m);
950950
m.rotate_forward(); check_links(&m);
951951
m.pop_front(); check_links(&m);
952952
m.rotate_forward(); check_links(&m);
953953
m.rotate_backward(); check_links(&m);
954954
m.push_front(9); check_links(&m);
955955
m.rotate_forward(); check_links(&m);
956-
assert_eq!(vec![3i,9,5,1,2], m.into_iter().collect());
956+
assert_eq!(vec![3i,9,5,1,2], m.into_iter().collect::<Vec<_>>());
957957
}
958958

959959
#[test]

0 commit comments

Comments
 (0)