From 51a2e2fd826c82252d101ad1e1904319699e417e Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 13 Feb 2017 19:50:54 +0100 Subject: [PATCH 01/13] Allow more Cell methods for non-Copy types Contributes to #39264 --- src/libcore/cell.rs | 120 ++++++++++++++++++++++---------------------- 1 file changed, 60 insertions(+), 60 deletions(-) diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs index ab44342ebf02f..1570428cf18b4 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -212,66 +212,6 @@ impl Cell { pub fn get(&self) -> T { unsafe{ *self.value.get() } } - - /// Returns a reference to the underlying `UnsafeCell`. - /// - /// # Examples - /// - /// ``` - /// #![feature(as_unsafe_cell)] - /// - /// use std::cell::Cell; - /// - /// let c = Cell::new(5); - /// - /// let uc = c.as_unsafe_cell(); - /// ``` - #[inline] - #[unstable(feature = "as_unsafe_cell", issue = "27708")] - #[rustc_deprecated(since = "1.12.0", reason = "renamed to as_ptr")] - pub fn as_unsafe_cell(&self) -> &UnsafeCell { - &self.value - } - - /// Returns a raw pointer to the underlying data in this cell. - /// - /// # Examples - /// - /// ``` - /// use std::cell::Cell; - /// - /// let c = Cell::new(5); - /// - /// let ptr = c.as_ptr(); - /// ``` - #[inline] - #[stable(feature = "cell_as_ptr", since = "1.12.0")] - pub fn as_ptr(&self) -> *mut T { - self.value.get() - } - - /// Returns a mutable reference to the underlying data. - /// - /// This call borrows `Cell` mutably (at compile-time) which guarantees - /// that we possess the only reference. - /// - /// # Examples - /// - /// ``` - /// use std::cell::Cell; - /// - /// let mut c = Cell::new(5); - /// *c.get_mut() += 1; - /// - /// assert_eq!(c.get(), 6); - /// ``` - #[inline] - #[stable(feature = "cell_get_mut", since = "1.11.0")] - pub fn get_mut(&mut self) -> &mut T { - unsafe { - &mut *self.value.get() - } - } } #[stable(feature = "rust1", since = "1.0.0")] @@ -369,6 +309,66 @@ impl Cell { } } + /// Returns a reference to the underlying `UnsafeCell`. + /// + /// # Examples + /// + /// ``` + /// #![feature(as_unsafe_cell)] + /// + /// use std::cell::Cell; + /// + /// let c = Cell::new(5); + /// + /// let uc = c.as_unsafe_cell(); + /// ``` + #[inline] + #[unstable(feature = "as_unsafe_cell", issue = "27708")] + #[rustc_deprecated(since = "1.12.0", reason = "renamed to as_ptr")] + pub fn as_unsafe_cell(&self) -> &UnsafeCell { + &self.value + } + + /// Returns a raw pointer to the underlying data in this cell. + /// + /// # Examples + /// + /// ``` + /// use std::cell::Cell; + /// + /// let c = Cell::new(5); + /// + /// let ptr = c.as_ptr(); + /// ``` + #[inline] + #[stable(feature = "cell_as_ptr", since = "1.12.0")] + pub fn as_ptr(&self) -> *mut T { + self.value.get() + } + + /// Returns a mutable reference to the underlying data. + /// + /// This call borrows `Cell` mutably (at compile-time) which guarantees + /// that we possess the only reference. + /// + /// # Examples + /// + /// ``` + /// use std::cell::Cell; + /// + /// let mut c = Cell::new(5); + /// *c.get_mut() += 1; + /// + /// assert_eq!(c.get(), 6); + /// ``` + #[inline] + #[stable(feature = "cell_get_mut", since = "1.11.0")] + pub fn get_mut(&mut self) -> &mut T { + unsafe { + &mut *self.value.get() + } + } + /// Sets the contained value. /// /// # Examples From 044ed10fee3351da2315d5d8e26949929ad918ce Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Tue, 14 Feb 2017 09:46:03 +0100 Subject: [PATCH 02/13] Remove Copy bound from some Cell trait impls Contributes to #39264 --- src/libcore/cell.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs index 1570428cf18b4..2b4ce3a35fcca 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -229,7 +229,7 @@ impl Clone for Cell { } #[stable(feature = "rust1", since = "1.0.0")] -impl Default for Cell { +impl Default for Cell { /// Creates a `Cell`, with the `Default` value for T. #[inline] fn default() -> Cell { @@ -285,7 +285,7 @@ impl Ord for Cell { } #[stable(feature = "cell_from", since = "1.12.0")] -impl From for Cell { +impl From for Cell { fn from(t: T) -> Cell { Cell::new(t) } From ca54fc76ae3045917273c5c102f5d9e0e99deb7e Mon Sep 17 00:00:00 2001 From: Sebastian Waisbrot Date: Tue, 14 Feb 2017 01:32:05 -0300 Subject: [PATCH 03/13] Show five traits implementation in help when there are exactly five --- src/librustc/traits/error_reporting.rs | 9 ++-- .../issue-39802-show-5-trait-impls.rs | 37 ++++++++++++++++ .../issue-39802-show-5-trait-impls.stderr | 43 +++++++++++++++++++ 3 files changed, 86 insertions(+), 3 deletions(-) create mode 100644 src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.rs create mode 100644 src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.stderr diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs index 024c14ce9d922..70ca5fe83a932 100644 --- a/src/librustc/traits/error_reporting.rs +++ b/src/librustc/traits/error_reporting.rs @@ -36,7 +36,6 @@ use ty::fold::TypeFolder; use ty::subst::Subst; use util::nodemap::{FxHashMap, FxHashSet}; -use std::cmp; use std::fmt; use syntax::ast; use hir::{intravisit, Local, Pat}; @@ -392,12 +391,16 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { return; } - let end = cmp::min(4, impl_candidates.len()); + let end = if impl_candidates.len() <= 5 { + impl_candidates.len() + } else { + 4 + }; err.help(&format!("the following implementations were found:{}{}", &impl_candidates[0..end].iter().map(|candidate| { format!("\n {:?}", candidate) }).collect::(), - if impl_candidates.len() > 4 { + if impl_candidates.len() > 5 { format!("\nand {} others", impl_candidates.len() - 4) } else { "".to_owned() diff --git a/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.rs b/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.rs new file mode 100644 index 0000000000000..68b1f79c89bbe --- /dev/null +++ b/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.rs @@ -0,0 +1,37 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +trait Foo { + fn bar(&self){} +} + +impl Foo for i8 {} +impl Foo for i8 {} +impl Foo for i8 {} +impl Foo for i8 {} +impl Foo for i8 {} + +impl Foo for u8 {} +impl Foo for u8 {} +impl Foo for u8 {} +impl Foo for u8 {} + +impl Foo for bool {} +impl Foo for bool {} +impl Foo for bool {} +impl Foo for bool {} +impl Foo for bool {} +impl Foo for bool {} + +fn main() { + Foo::::bar(&1i8); + Foo::::bar(&1u8); + Foo::::bar(&true); +} diff --git a/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.stderr b/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.stderr new file mode 100644 index 0000000000000..4ea4adfcfe0fc --- /dev/null +++ b/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.stderr @@ -0,0 +1,43 @@ +error[E0277]: the trait bound `i8: Foo` is not satisfied + --> $DIR/issue-39802-show-5-trait-impls.rs:34:5 + | +34 | Foo::::bar(&1i8); + | ^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `i8` + | + = help: the following implementations were found: + > + > + > + > + > + = note: required by `Foo::bar` + +error[E0277]: the trait bound `u8: Foo` is not satisfied + --> $DIR/issue-39802-show-5-trait-impls.rs:35:5 + | +35 | Foo::::bar(&1u8); + | ^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `u8` + | + = help: the following implementations were found: + > + > + > + > + = note: required by `Foo::bar` + +error[E0277]: the trait bound `bool: Foo` is not satisfied + --> $DIR/issue-39802-show-5-trait-impls.rs:36:5 + | +36 | Foo::::bar(&true); + | ^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `bool` + | + = help: the following implementations were found: + > + > + > + > + and 2 others + = note: required by `Foo::bar` + +error: aborting due to 3 previous errors + From e3384e08ca9d9596c4b2658f50865c59537169b0 Mon Sep 17 00:00:00 2001 From: Alex Burka Date: Tue, 14 Feb 2017 23:07:51 -0500 Subject: [PATCH 04/13] fix types in to_owned doctest --- src/libcollections/borrow.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libcollections/borrow.rs b/src/libcollections/borrow.rs index e5bcf0d8e8179..65056121f05a0 100644 --- a/src/libcollections/borrow.rs +++ b/src/libcollections/borrow.rs @@ -52,11 +52,11 @@ pub trait ToOwned { /// Basic usage: /// /// ``` - /// let s = "a"; // &str - /// let ss = s.to_owned(); // String + /// let s: &str = "a"; + /// let ss: String = s.to_owned(); /// - /// let v = &[1, 2]; // slice - /// let vv = v.to_owned(); // Vec + /// let v: &[i32] = &[1, 2]; + /// let vv: Vec = v.to_owned(); /// ``` #[stable(feature = "rust1", since = "1.0.0")] fn to_owned(&self) -> Self::Owned; From 5156dedec88a94191eec9e629c93c8e58b71f44f Mon Sep 17 00:00:00 2001 From: king6cong Date: Wed, 15 Feb 2017 14:52:13 +0800 Subject: [PATCH 05/13] make doc consistent with var name --- src/libstd/collections/hash/map.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index ffb7a1a1fc15f..e67b6060b9a3b 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -437,7 +437,7 @@ fn pop_internal(starting_bucket: FullBucketMut) -> (K, V) { /// Perform robin hood bucket stealing at the given `bucket`. You must /// also pass that bucket's displacement so we don't have to recalculate it. /// -/// `hash`, `k`, and `v` are the elements to "robin hood" into the hashtable. +/// `hash`, `key`, and `val` are the elements to "robin hood" into the hashtable. fn robin_hood<'a, K: 'a, V: 'a>(bucket: FullBucketMut<'a, K, V>, mut displacement: usize, mut hash: SafeHash, From a8b7b28babdb49387eb56626b8359d7295515775 Mon Sep 17 00:00:00 2001 From: Andrew Gaspar Date: Wed, 15 Feb 2017 01:51:19 -0800 Subject: [PATCH 06/13] Vec, LinkedList, VecDeque, String, and Option NatVis visualizations --- src/etc/natvis/libcollections.natvis | 56 ++++++++++++++++++++++++++++ src/etc/natvis/libcore.natvis | 39 +++++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100644 src/etc/natvis/libcollections.natvis create mode 100644 src/etc/natvis/libcore.natvis diff --git a/src/etc/natvis/libcollections.natvis b/src/etc/natvis/libcollections.natvis new file mode 100644 index 0000000000000..821c52361f868 --- /dev/null +++ b/src/etc/natvis/libcollections.natvis @@ -0,0 +1,56 @@ + + + +    {{ size={len} }} +     + len + buf.cap + + len + buf.ptr.pointer.__0 + +     +   + + {{ size={tail <= head ? head - tail : buf.cap - tail + head} }} + + tail <= head ? head - tail : buf.cap - tail + head + buf.cap + + + + tail <= head ? head - tail : buf.cap - tail + head + + + + + buf.ptr.pointer.__0 + i + i = (i + 1 == buf.cap ? 0 : i + 1) + + + + + + {{ size={len} }} + + + len + *(collections::linked_list::Node<$T1> **)&head + *(collections::linked_list::Node<$T1> **)&next + element + + + + + {*(char**)this,[vec.len]} + *(char**)this,[vec.len] + + vec.len + vec.buf.cap + + vec.len + *(char**)this + + + + \ No newline at end of file diff --git a/src/etc/natvis/libcore.natvis b/src/etc/natvis/libcore.natvis new file mode 100644 index 0000000000000..37d64be1ce963 --- /dev/null +++ b/src/etc/natvis/libcore.natvis @@ -0,0 +1,39 @@ + + + + {{ Unique {*pointer.__0} }} + + pointer.__0 + + + + {{ Shared {*pointer.__0} }} + + pointer.__0 + + + + {{ None }} + {{ Some {__0} }} + + (ULONG)(RUST$ENUM$DISR != 0) + __0 + + (ULONG)(RUST$ENUM$DISR != 0) + &__0 + + + + + {{ None }} + {{ Some {($T1 *)this} }} + + (ULONG)(*(PVOID *)this != nullptr) + ($T1 *)this + + (ULONG)(*(PVOID *)this != nullptr) + ($T1 *)this + + + + \ No newline at end of file From 938fed7f0f28b68a16d8938221d1bc59e697ffa1 Mon Sep 17 00:00:00 2001 From: Luxko Date: Wed, 15 Feb 2017 03:53:27 -0600 Subject: [PATCH 07/13] Update procedural-macros.md Fix typo --- src/doc/book/src/procedural-macros.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/book/src/procedural-macros.md b/src/doc/book/src/procedural-macros.md index d286c3b7bdc63..6c4700f9305ca 100644 --- a/src/doc/book/src/procedural-macros.md +++ b/src/doc/book/src/procedural-macros.md @@ -99,7 +99,7 @@ created, we'll add it to our toml: hello-world-derive = { path = "hello-world-derive" } ``` -As for our the source of our `hello-world-derive` crate, here's an example: +As for the source of our `hello-world-derive` crate, here's an example: ```rust,ignore extern crate proc_macro; From b82131332706e5b39cb12186ce7ff6c682281464 Mon Sep 17 00:00:00 2001 From: king6cong Date: Wed, 15 Feb 2017 18:38:34 +0800 Subject: [PATCH 08/13] sys/mod doc update and mod import order adjust --- src/libstd/sys/mod.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/libstd/sys/mod.rs b/src/libstd/sys/mod.rs index 14da376efa998..ef4dc365dbef8 100644 --- a/src/libstd/sys/mod.rs +++ b/src/libstd/sys/mod.rs @@ -13,11 +13,11 @@ //! The `std::sys` module is the abstracted interface through which //! `std` talks to the underlying operating system. It has different //! implementations for different operating system families, today -//! just Unix and Windows. +//! just Unix and Windows, and initial support for Redox. //! //! The centralization of platform-specific code in this module is //! enforced by the "platform abstraction layer" tidy script in -//! `tools/tidy/pal.rs`. +//! `tools/tidy/src/pal.rs`. //! //! This module is closely related to the platform-independent system //! integration code in `std::sys_common`. See that module's @@ -34,10 +34,6 @@ pub use self::imp::*; -#[cfg(target_os = "redox")] -#[path = "redox/mod.rs"] -mod imp; - #[cfg(unix)] #[path = "unix/mod.rs"] mod imp; @@ -45,3 +41,7 @@ mod imp; #[cfg(windows)] #[path = "windows/mod.rs"] mod imp; + +#[cfg(target_os = "redox")] +#[path = "redox/mod.rs"] +mod imp; From 577497b541110f814c8385eff86a2d2e4b935585 Mon Sep 17 00:00:00 2001 From: Dmitry Guzeev Date: Wed, 15 Feb 2017 15:13:31 +0300 Subject: [PATCH 09/13] Fix typo --- src/grammar/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/grammar/README.md b/src/grammar/README.md index cd2dd38de36aa..83808108ff832 100644 --- a/src/grammar/README.md +++ b/src/grammar/README.md @@ -8,7 +8,7 @@ The build of the rust part is included with `make tidy` and can be run with `mak # Manual build -To use manually, assuming antlr4 ist installed at `/usr/share/java/antlr-complete.jar`: +To use manually, assuming antlr4 is installed at `/usr/share/java/antlr-complete.jar`: ``` antlr4 RustLexer.g4 @@ -20,8 +20,8 @@ for file in ../*/**.rs; do done ``` -Note That the `../*/**.rs` glob will match every `*.rs` file in the above -directory and all of its recursive children. This is a zsh extension. +Note that the `../*/**.rs` glob will match every `*.rs` file in the above +directory and all of its recursive children. This is a Zsh extension. ## Cleanup From b6a161833289d402986164912aeb9d005857675d Mon Sep 17 00:00:00 2001 From: Michal Nazarewicz Date: Mon, 13 Feb 2017 02:09:24 +0100 Subject: [PATCH 10/13] =?UTF-8?q?book:=20don=E2=80=99t=20use=20GNU=20exten?= =?UTF-8?q?sions=20in=20the=20example=20unnecessarily?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The use of a GNU C extension for bloc expressions is immaterial to the actual problem with C macros that the section tries to show so don’t use it and instead use a plain C way of writing the macro. --- src/doc/book/src/macros.md | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/doc/book/src/macros.md b/src/doc/book/src/macros.md index 3ccbeb05f01db..ae1e1c65dd225 100644 --- a/src/doc/book/src/macros.md +++ b/src/doc/book/src/macros.md @@ -261,36 +261,34 @@ The metavariable `$x` is parsed as a single expression node, and keeps its place in the syntax tree even after substitution. Another common problem in macro systems is ‘variable capture’. Here’s a C -macro, using [a GNU C extension] to emulate Rust’s expression blocks. - -[a GNU C extension]: https://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html +macro using a block with multiple statements. ```text -#define LOG(msg) ({ \ +#define LOG(msg) do { \ int state = get_log_state(); \ if (state > 0) { \ printf("log(%d): %s\n", state, msg); \ } \ -}) +} while (0) ``` Here’s a simple use case that goes terribly wrong: ```text const char *state = "reticulating splines"; -LOG(state) +LOG(state); ``` This expands to ```text const char *state = "reticulating splines"; -{ +do { int state = get_log_state(); if (state > 0) { printf("log(%d): %s\n", state, state); } -} +} while (0); ``` The second variable named `state` shadows the first one. This is a problem From cf20d8e23cb590ab405476ce0ad184d9856be9cd Mon Sep 17 00:00:00 2001 From: Colm Seale Date: Wed, 15 Feb 2017 01:18:11 +0000 Subject: [PATCH 11/13] static recursion test added to compile-fail test suite Issue #39059 r? @est31 --- .../feature-gate-static_recursion.rs | 49 +++++++++++++++++++ src/tools/tidy/src/features.rs | 2 +- 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 src/test/compile-fail/feature-gate-static_recursion.rs diff --git a/src/test/compile-fail/feature-gate-static_recursion.rs b/src/test/compile-fail/feature-gate-static_recursion.rs new file mode 100644 index 0000000000000..bd20c891d8ed3 --- /dev/null +++ b/src/test/compile-fail/feature-gate-static_recursion.rs @@ -0,0 +1,49 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +static mut S: *const u8 = unsafe { &S as *const *const u8 as *const u8 }; +//~^ ERROR recursive static (see issue #29719) + +struct StaticDoubleLinked { + prev: &'static StaticDoubleLinked, + next: &'static StaticDoubleLinked, + data: i32, + head: bool, +} + +static L1: StaticDoubleLinked = StaticDoubleLinked{prev: &L3, next: &L2, data: 1, head: true}; +//~^ ERROR recursive static (see issue #29719) +//~^^ ERROR recursive static (see issue #29719) +//~^^^ ERROR recursive static (see issue #29719) +static L2: StaticDoubleLinked = StaticDoubleLinked{prev: &L1, next: &L3, data: 2, head: false}; +static L3: StaticDoubleLinked = StaticDoubleLinked{prev: &L2, next: &L1, data: 3, head: false}; + + +pub fn main() { + unsafe { assert_eq!(S, *(S as *const *const u8)); } + + let mut test_vec = Vec::new(); + let mut cur = &L1; + loop { + test_vec.push(cur.data); + cur = cur.next; + if cur.head { break } + } + assert_eq!(&test_vec, &[1,2,3]); + + let mut test_vec = Vec::new(); + let mut cur = &L1; + loop { + cur = cur.prev; + test_vec.push(cur.data); + if cur.head { break } + } + assert_eq!(&test_vec, &[3,2,1]); +} diff --git a/src/tools/tidy/src/features.rs b/src/tools/tidy/src/features.rs index cb6e73237d5eb..13f272517b1fd 100644 --- a/src/tools/tidy/src/features.rs +++ b/src/tools/tidy/src/features.rs @@ -166,7 +166,7 @@ pub fn check(path: &Path, bad: &mut bool) { // FIXME get this whitelist empty. let whitelist = vec![ - "abi_ptx", "simd", "static_recursion", + "abi_ptx", "simd", "cfg_target_has_atomic", "unboxed_closures", "stmt_expr_attributes", "cfg_target_thread_local", "unwind_attributes", From 087c2337c156af2f7e408145737b2415e66693da Mon Sep 17 00:00:00 2001 From: Shawn Walker-Salas Date: Wed, 15 Feb 2017 12:51:26 -0800 Subject: [PATCH 12/13] use bash when invoking dist shell scripts on solaris Partially fixes #25845 --- src/bootstrap/dist.rs | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index 52a7c63c9045f..319c61ece29bd 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -26,6 +26,12 @@ use std::process::{Command, Stdio}; use build_helper::output; +#[cfg(not(target_os = "solaris"))] +const SH_CMD: &'static str = "sh"; +// On Solaris, sh is the historical bourne shell, not a POSIX shell, or bash. +#[cfg(target_os = "solaris")] +const SH_CMD: &'static str = "bash"; + use {Build, Compiler, Mode}; use util::{cp_r, libdir, is_dylib, cp_filtered, copy}; @@ -69,7 +75,7 @@ pub fn docs(build: &Build, stage: u32, host: &str) { let src = build.out.join(host).join("doc"); cp_r(&src, &dst); - let mut cmd = Command::new("sh"); + let mut cmd = Command::new(SH_CMD); cmd.arg(sanitize_sh(&build.src.join("src/rust-installer/gen-installer.sh"))) .arg("--product-name=Rust-Documentation") .arg("--rel-manifest-dir=rustlib") @@ -119,7 +125,7 @@ pub fn mingw(build: &Build, host: &str) { .arg(host); build.run(&mut cmd); - let mut cmd = Command::new("sh"); + let mut cmd = Command::new(SH_CMD); cmd.arg(sanitize_sh(&build.src.join("src/rust-installer/gen-installer.sh"))) .arg("--product-name=Rust-MinGW") .arg("--rel-manifest-dir=rustlib") @@ -185,7 +191,7 @@ pub fn rustc(build: &Build, stage: u32, host: &str) { } // Finally, wrap everything up in a nice tarball! - let mut cmd = Command::new("sh"); + let mut cmd = Command::new(SH_CMD); cmd.arg(sanitize_sh(&build.src.join("src/rust-installer/gen-installer.sh"))) .arg("--product-name=Rust") .arg("--rel-manifest-dir=rustlib") @@ -290,7 +296,7 @@ pub fn std(build: &Build, compiler: &Compiler, target: &str) { let src = build.sysroot(compiler).join("lib/rustlib"); cp_r(&src.join(target), &dst); - let mut cmd = Command::new("sh"); + let mut cmd = Command::new(SH_CMD); cmd.arg(sanitize_sh(&build.src.join("src/rust-installer/gen-installer.sh"))) .arg("--product-name=Rust") .arg("--rel-manifest-dir=rustlib") @@ -343,9 +349,10 @@ pub fn analysis(build: &Build, compiler: &Compiler, target: &str) { let image_src = src.join("save-analysis"); let dst = image.join("lib/rustlib").join(target).join("analysis"); t!(fs::create_dir_all(&dst)); + println!("image_src: {:?}, dst: {:?}", image_src, dst); cp_r(&image_src, &dst); - let mut cmd = Command::new("sh"); + let mut cmd = Command::new(SH_CMD); cmd.arg(sanitize_sh(&build.src.join("src/rust-installer/gen-installer.sh"))) .arg("--product-name=Rust") .arg("--rel-manifest-dir=rustlib") @@ -452,7 +459,7 @@ pub fn rust_src(build: &Build) { build.run(&mut cmd); // Create source tarball in rust-installer format - let mut cmd = Command::new("sh"); + let mut cmd = Command::new(SH_CMD); cmd.arg(sanitize_sh(&build.src.join("src/rust-installer/gen-installer.sh"))) .arg("--product-name=Rust") .arg("--rel-manifest-dir=rustlib") @@ -610,7 +617,7 @@ pub fn extended(build: &Build, stage: u32, target: &str) { input_tarballs.push_str(&sanitize_sh(&mingw_installer)); } - let mut cmd = Command::new("sh"); + let mut cmd = Command::new(SH_CMD); cmd.arg(sanitize_sh(&build.src.join("src/rust-installer/combine-installers.sh"))) .arg("--product-name=Rust") .arg("--rel-manifest-dir=rustlib") From d5a4db3c16c5fa203f03b7f0b9c7f85d17e8b8ad Mon Sep 17 00:00:00 2001 From: Peter Atashian Date: Wed, 15 Feb 2017 17:31:51 -0500 Subject: [PATCH 13/13] Fix parameter to GetUserProfileDirectoryW --- src/libstd/sys/windows/c.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libstd/sys/windows/c.rs b/src/libstd/sys/windows/c.rs index e5010ca356449..4daab31c28f49 100644 --- a/src/libstd/sys/windows/c.rs +++ b/src/libstd/sys/windows/c.rs @@ -912,7 +912,7 @@ extern "system" { pub fn Sleep(dwMilliseconds: DWORD); pub fn GetProcessId(handle: HANDLE) -> DWORD; pub fn GetUserProfileDirectoryW(hToken: HANDLE, - lpProfileDir: LPCWSTR, + lpProfileDir: LPWSTR, lpcchSize: *mut DWORD) -> BOOL; pub fn SetHandleInformation(hObject: HANDLE, dwMask: DWORD,