Skip to content

Commit a478bce

Browse files
committed
---
yaml --- r: 162794 b: refs/heads/try c: 7c44561 h: refs/heads/master v: v3
1 parent 652cc1a commit a478bce

40 files changed

+431
-545
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 9146a919b616e39e528e4d7100d16eef52f1f852
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cafe2966770ff377aad6dd9fd808e68055587c58
5-
refs/heads/try: 361baabb07b2fb921d0f556d0787b3ea7ef86746
5+
refs/heads/try: 7c44561ad6f4651047255d0c630a0c3f80c3fdd4
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/src/etc/rustup.sh

100755100644
Lines changed: 65 additions & 86 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,7 +230,6 @@ validate_opt() {
230230
}
231231

232232
probe_need CFG_CURL curl
233-
probe_need CFG_TAR tar
234233

235234
CFG_SRC_DIR="$(cd $(dirname $0) && pwd)/"
236235
CFG_SELF="$0"
@@ -389,109 +388,89 @@ esac
389388

390389
msg "host triple: ${HOST_TRIPLE}"
391390

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"
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"
404399

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"
413400
CARGO_PACKAGE_NAME=cargo-nightly
414401
CARGO_PACKAGE_NAME_AND_TRIPLE="${CARGO_PACKAGE_NAME}-${HOST_TRIPLE}"
415402
CARGO_TARBALL_NAME="${CARGO_PACKAGE_NAME_AND_TRIPLE}.tar.gz"
416-
CARGO_LOCAL_INSTALL_DIR="${CFG_TMP_DIR}/${CARGO_PACKAGE_NAME_AND_TRIPLE}"
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}"
417406
CARGO_LOCAL_INSTALL_SCRIPT="${CARGO_LOCAL_INSTALL_DIR}/install.sh"
418407

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

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

426-
mkdir -p "${CFG_TMP_DIR}"
427-
need_ok "failed to create create download directory"
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
428421

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

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

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}"
433+
(cd "${TMP_DIR}" && tar xzf "${TARBALL_NAME}")
434+
if [ $? -ne 0 ]
435+
then
436+
rm -Rf "${TMP_DIR}"
446437
err "failed to unpack installer"
447-
fi
438+
fi
448439

449-
sh "${install_script}" "${CFG_INSTALL_FLAGS}"
450-
if [ $? -ne 0 ]
451-
then
452-
rm -Rf "${CFG_TMP_DIR}"
453-
err "failed to install Rust"
454-
fi
455-
}
440+
MAYBE_UNINSTALL=
441+
if [ -n "${CFG_UNINSTALL}" ]
442+
then
443+
MAYBE_UNINSTALL="--uninstall"
444+
fi
456445

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}"
481-
fi
446+
MAYBE_PREFIX=
447+
if [ -n "${CFG_PREFIX}" ]
448+
then
449+
MAYBE_PREFIX="--prefix=${CFG_PREFIX}"
450+
fi
482451

483-
install_package \
484-
"${RUST_TARBALL_NAME}" \
485-
"${RUST_LOCAL_INSTALL_SCRIPT}"
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
486458

487-
if [ -z "${CFG_DISABLE_CARGO}" ]; then
488-
install_package \
489-
"${CARGO_TARBALL_NAME}" \
490-
"${CARGO_LOCAL_INSTALL_SCRIPT}"
459+
if [ -z "${CFG_DISABLE_CARGO}" ]; then
460+
(cd "${TMP_DIR}" && tar xzf "${CARGO_TARBALL_NAME}")
461+
if [ $? -ne 0 ]
462+
then
463+
rm -Rf "${TMP_DIR}"
464+
err "failed to unpack cargo installer"
491465
fi
492466

493-
rm -Rf "${CFG_TMP_DIR}"
494-
need_ok "couldn't rm temporary installation directory"
495-
}
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"
472+
fi
473+
fi
496474

497-
install_packages
475+
rm -Rf "${TMP_DIR}"
476+
need_ok "couldn't rm temporary installation directory"

branches/try/src/libcore/result.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -444,14 +444,15 @@ impl<T, E> Result<T, E> {
444444
/// ignoring I/O and parse errors:
445445
///
446446
/// ```
447-
/// use std::io::IoResult;
447+
/// use std::io::{BufReader, IoResult};
448448
///
449-
/// let mut buffer = &mut b"1\n2\n3\n4\n";
449+
/// let buffer = "1\n2\n3\n4\n";
450+
/// let mut reader = BufReader::new(buffer.as_bytes());
450451
///
451452
/// let mut sum = 0;
452453
///
453-
/// while !buffer.is_empty() {
454-
/// let line: IoResult<String> = buffer.read_line();
454+
/// while !reader.eof() {
455+
/// let line: IoResult<String> = reader.read_line();
455456
/// // Convert the string line to a number using `map` and `from_str`
456457
/// let val: IoResult<int> = line.map(|line| {
457458
/// from_str::<int>(line.as_slice().trim_right()).unwrap_or(0)

branches/try/src/libgraphviz/lib.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ mod tests {
547547
use self::NodeLabels::*;
548548
use super::{Id, LabelText, LabelStr, EscStr, Labeller};
549549
use super::{Nodes, Edges, GraphWalk, render};
550-
use std::io::IoResult;
550+
use std::io::{BufReader, IoResult};
551551
use std::str;
552552

553553
/// each node is an index in a vector in the graph.
@@ -698,7 +698,8 @@ mod tests {
698698
fn test_input(g: LabelledGraph) -> IoResult<String> {
699699
let mut writer = Vec::new();
700700
render(&g, &mut writer).unwrap();
701-
(&mut writer.as_slice()).read_to_string()
701+
let mut r = BufReader::new(writer[]);
702+
r.read_to_string()
702703
}
703704

704705
// All of the tests use raw-strings as the format for the expected outputs,
@@ -810,7 +811,8 @@ r#"digraph hasse_diagram {
810811
edge(1, 3, ";"), edge(2, 3, ";" )));
811812

812813
render(&g, &mut writer).unwrap();
813-
let r = (&mut writer.as_slice()).read_to_string();
814+
let mut r = BufReader::new(writer[]);
815+
let r = r.read_to_string();
814816

815817
assert_eq!(r.unwrap().as_slice(),
816818
r#"digraph syntax_tree {

branches/try/src/librustc/lint/builtin.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use metadata::csearch;
3030
use middle::def::*;
3131
use middle::ty::{mod, Ty};
3232
use middle::typeck::astconv::ast_ty_to_ty;
33-
use middle::typeck::{mod, infer};
33+
use middle::typeck::infer;
3434
use middle::{def, pat_util, stability};
3535
use middle::const_eval::{eval_const_expr_partial, const_int, const_uint};
3636
use util::ppaux::{ty_to_string};
@@ -1589,22 +1589,22 @@ impl LintPass for Stability {
15891589
}
15901590
ast::ExprMethodCall(i, _, _) => {
15911591
span = i.span;
1592-
let method_call = typeck::MethodCall::expr(e.id);
1592+
let method_call = ty::MethodCall::expr(e.id);
15931593
match cx.tcx.method_map.borrow().get(&method_call) {
15941594
Some(method) => {
15951595
match method.origin {
1596-
typeck::MethodStatic(def_id) => {
1596+
ty::MethodStatic(def_id) => {
15971597
def_id
15981598
}
1599-
typeck::MethodStaticUnboxedClosure(def_id) => {
1599+
ty::MethodStaticUnboxedClosure(def_id) => {
16001600
def_id
16011601
}
1602-
typeck::MethodTypeParam(typeck::MethodParam {
1602+
ty::MethodTypeParam(ty::MethodParam {
16031603
ref trait_ref,
16041604
method_num: index,
16051605
..
16061606
}) |
1607-
typeck::MethodTraitObject(typeck::MethodObject {
1607+
ty::MethodTraitObject(ty::MethodObject {
16081608
ref trait_ref,
16091609
method_num: index,
16101610
..

branches/try/src/librustc/metadata/csearch.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ use middle::def;
2121
use middle::lang_items;
2222
use middle::resolve;
2323
use middle::ty;
24-
use middle::typeck;
2524
use middle::subst::VecPerParamSpace;
2625

2726
use rbml;
@@ -268,7 +267,7 @@ pub fn get_impl_trait<'tcx>(tcx: &ty::ctxt<'tcx>,
268267
// Given a def_id for an impl, return information about its vtables
269268
pub fn get_impl_vtables<'tcx>(tcx: &ty::ctxt<'tcx>,
270269
def: ast::DefId)
271-
-> typeck::vtable_res<'tcx> {
270+
-> ty::vtable_res<'tcx> {
272271
let cstore = &tcx.sess.cstore;
273272
let cdata = cstore.get_crate_data(def.krate);
274273
decoder::get_impl_vtables(&*cdata, def.node, tcx)

branches/try/src/librustc/metadata/decoder.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ use middle::resolve::{TraitItemKind, TypeTraitItemKind};
3030
use middle::subst;
3131
use middle::ty::{ImplContainer, TraitContainer};
3232
use middle::ty::{mod, Ty};
33-
use middle::typeck;
3433
use middle::astencode::vtable_decoder_helpers;
3534

3635
use std::hash::Hash;
@@ -422,7 +421,7 @@ pub fn get_impl_trait<'tcx>(cdata: Cmd,
422421
pub fn get_impl_vtables<'tcx>(cdata: Cmd,
423422
id: ast::NodeId,
424423
tcx: &ty::ctxt<'tcx>)
425-
-> typeck::vtable_res<'tcx>
424+
-> ty::vtable_res<'tcx>
426425
{
427426
let item_doc = lookup_item(id, cdata.data());
428427
let vtables_doc = reader::get_doc(item_doc, tag_item_impl_vtables);

0 commit comments

Comments
 (0)