Skip to content

Commit

Permalink
Auto merge of #39353 - alexcrichton:rollup, r=alexcrichton
Browse files Browse the repository at this point in the history
Rollup of 21 pull requests

- Successful merges: #38617, #39284, #39285, #39290, #39302, #39305, #39306, #39307, #39311, #39313, #39314, #39321, #39325, #39332, #39335, #39344, #39345, #39346, #39348, #39350, #39351
- Failed merges:
  • Loading branch information
bors committed Jan 28, 2017
2 parents 154c202 + 1767d97 commit 0f8a296
Show file tree
Hide file tree
Showing 62 changed files with 782 additions and 447 deletions.
6 changes: 4 additions & 2 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ Brian Anderson <banderson@mozilla.com> <andersrb@gmail.com>
Brian Dawn <brian.t.dawn@gmail.com>
Brian Leibig <brian@brianleibig.com> Brian Leibig <brian.leibig@gmail.com>
Carl-Anton Ingmarsson <mail@carlanton.se> <ca.ingmarsson@gmail.com>
Carol (Nichols || Goulding) <carol.nichols@gmail.com> Carol Nichols <carol.nichols@gmail.com>
Carol (Nichols || Goulding) <carol.nichols@gmail.com> Carol Nichols <cnichols@thinkthroughmath.com>
Carol (Nichols || Goulding) <carol.nichols@gmail.com>
Carol (Nichols || Goulding) <cnichols@thinkthroughmath.com>
Carol Willing <carolcode@willingconsulting.com>
Chris C Cerami <chrisccerami@users.noreply.github.com> Chris C Cerami <chrisccerami@gmail.com>
Chris Pressey <cpressey@gmail.com>
Expand All @@ -53,6 +53,7 @@ Clark Gaebel <cg.wowus.cg@gmail.com> <cgaebel@mozilla.com>
Clinton Ryan <clint.ryan3@gmail.com>
Corey Farwell <coreyf+rust@rwell.org> Corey Farwell <coreyf@rwell.org>
Corey Richardson <corey@octayn.net> Elaine "See More" Nemo <corey@octayn.net>
Cyryl Płotnicki <cyplo@cyplo.net>
Damien Schoof <damien.schoof@gmail.com>
Daniel Ramos <dan@daramos.com>
David Klein <david.klein@baesystemsdetica.com>
Expand Down Expand Up @@ -102,6 +103,7 @@ Jason Toffaletti <toffaletti@gmail.com> Jason Toffaletti <jason@topsy.com>
Jauhien Piatlicki <jauhien@gentoo.org> Jauhien Piatlicki <jpiatlicki@zertisa.com>
Jay True <glacjay@gmail.com>
Jeremy Letang <letang.jeremy@gmail.com>
Jethro Beekman <github@jbeekman.nl>
Jihyun Yu <j.yu@navercorp.com> <yjh0502@gmail.com>
Jihyun Yu <j.yu@navercorp.com> jihyun <jihyun@nablecomm.com>
Jihyun Yu <j.yu@navercorp.com> Jihyun Yu <jihyun@nclab.kaist.ac.kr>
Expand Down
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ before_deploy:
- mkdir -p deploy/$TRAVIS_COMMIT
- >
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
cp build/dist/*.tar.gz deploy/$TRAVIS_COMMIT;
cp -r build/dist deploy/$TRAVIS_COMMIT;
else
cp obj/build/dist/*.tar.gz deploy/$TRAVIS_COMMIT;
cp -r obj/build/dist deploy/$TRAVIS_COMMIT;
fi
deploy:
Expand Down
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ branches:
before_deploy:
- ps: |
New-Item -Path deploy -ItemType directory
Get-ChildItem -Path build\dist -Filter '*.tar.gz' | Move-Item -Destination deploy
Get-ChildItem -Path build\dist | Move-Item -Destination deploy
Get-ChildItem -Path deploy | Foreach-Object {
Push-AppveyorArtifact $_.FullName -FileName ${env:APPVEYOR_REPO_COMMIT}/$_
}
Expand All @@ -151,7 +151,7 @@ deploy:
bucket: rust-lang-ci
set_public: true
region: us-east-1
artifact: /.*\.tar.gz/
artifact: /.*/
folder: rustc-builds
on:
branch: auto
Expand Down
8 changes: 8 additions & 0 deletions src/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ members = [
"tools/linkchecker",
"tools/rustbook",
"tools/tidy",
"tools/build-manifest",
]

# Curiously, compiletest will segfault if compiled with opt-level=3 on 64-bit
Expand Down
19 changes: 19 additions & 0 deletions src/bootstrap/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ pub struct Config {
pub cargo: Option<PathBuf>,
pub local_rebuild: bool,

// dist misc
pub dist_sign_folder: Option<PathBuf>,
pub dist_upload_addr: Option<String>,
pub dist_gpg_password_file: Option<PathBuf>,

// libstd features
pub debug_jemalloc: bool,
pub use_jemalloc: bool,
Expand Down Expand Up @@ -123,6 +128,7 @@ struct TomlConfig {
llvm: Option<Llvm>,
rust: Option<Rust>,
target: Option<HashMap<String, TomlTarget>>,
dist: Option<Dist>,
}

/// TOML representation of various global build decisions.
Expand Down Expand Up @@ -166,6 +172,13 @@ struct Llvm {
targets: Option<String>,
}

#[derive(RustcDecodable, Default, Clone)]
struct Dist {
sign_folder: Option<String>,
gpg_password_file: Option<String>,
upload_addr: Option<String>,
}

#[derive(RustcDecodable)]
enum StringOrBool {
String(String),
Expand Down Expand Up @@ -352,6 +365,12 @@ impl Config {
}
}

if let Some(ref t) = toml.dist {
config.dist_sign_folder = t.sign_folder.clone().map(PathBuf::from);
config.dist_gpg_password_file = t.gpg_password_file.clone().map(PathBuf::from);
config.dist_upload_addr = t.upload_addr.clone();
}

return config
}

Expand Down
30 changes: 30 additions & 0 deletions src/bootstrap/config.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -242,3 +242,33 @@
# that this option only makes sense for MUSL targets that produce statically
# linked binaries
#musl-root = "..."

# =============================================================================
# Distribution options
#
# These options are related to distribution, mostly for the Rust project itself.
# You probably won't need to concern yourself with any of these options
# =============================================================================
[dist]

# This is the folder of artifacts that the build system will sign. All files in
# this directory will be signed with the default gpg key using the system `gpg`
# binary. The `asc` and `sha256` files will all be output into the standard dist
# output folder (currently `build/dist`)
#
# This folder should be populated ahead of time before the build system is
# invoked.
#sign-folder = "path/to/folder/to/sign"

# This is a file which contains the password of the default gpg key. This will
# be passed to `gpg` down the road when signing all files in `sign-folder`
# above. This should be stored in plaintext.
#gpg-password-file = "path/to/gpg/password"

# The remote address that all artifacts will eventually be uploaded to. The
# build system generates manifests which will point to these urls, and for the
# manifests to be correct they'll have to have the right URLs encoded.
#
# Note that this address should not contain a trailing slash as file names will
# be appended to it.
#upload-addr = "https://example.com/folder"
33 changes: 32 additions & 1 deletion src/bootstrap/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use std::env;
use std::fs::{self, File};
use std::io::{Read, Write};
use std::path::{PathBuf, Path};
use std::process::Command;
use std::process::{Command, Stdio};

use build_helper::output;

Expand Down Expand Up @@ -876,3 +876,34 @@ fn add_env(build: &Build, cmd: &mut Command, target: &str) {
cmd.env("CFG_PLATFORM", "x86");
}
}

pub fn hash_and_sign(build: &Build) {
let compiler = Compiler::new(0, &build.config.build);
let mut cmd = build.tool_cmd(&compiler, "build-manifest");
let sign = build.config.dist_sign_folder.as_ref().unwrap_or_else(|| {
panic!("\n\nfailed to specify `dist.sign-folder` in `config.toml`\n\n")
});
let addr = build.config.dist_upload_addr.as_ref().unwrap_or_else(|| {
panic!("\n\nfailed to specify `dist.upload-addr` in `config.toml`\n\n")
});
let file = build.config.dist_gpg_password_file.as_ref().unwrap_or_else(|| {
panic!("\n\nfailed to specify `dist.gpg-password-file` in `config.toml`\n\n")
});
let mut pass = String::new();
t!(t!(File::open(&file)).read_to_string(&mut pass));

let today = output(Command::new("date").arg("+%Y-%m-%d"));

cmd.arg(sign);
cmd.arg(distdir(build));
cmd.arg(today.trim());
cmd.arg(package_vers(build));
cmd.arg(addr);

t!(fs::create_dir_all(distdir(build)));

let mut child = t!(cmd.stdin(Stdio::piped()).spawn());
t!(child.stdin.take().unwrap().write_all(pass.as_bytes()));
let status = t!(child.wait());
assert!(status.success());
}
10 changes: 10 additions & 0 deletions src/bootstrap/step.rs
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,9 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules {
rules.build("tool-compiletest", "src/tools/compiletest")
.dep(|s| s.name("libtest"))
.run(move |s| compile::tool(build, s.stage, s.target, "compiletest"));
rules.build("tool-build-manifest", "src/tools/build-manifest")
.dep(|s| s.name("libstd"))
.run(move |s| compile::tool(build, s.stage, s.target, "build-manifest"));

// ========================================================================
// Documentation targets
Expand Down Expand Up @@ -633,6 +636,13 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules {
.dep(|d| d.name("dist-cargo"))
.run(move |s| dist::extended(build, s.stage, s.target));

rules.dist("dist-sign", "hash-and-sign")
.host(true)
.only_build(true)
.only_host_build(true)
.dep(move |s| s.name("tool-build-manifest").target(&build.config.build).stage(0))
.run(move |_| dist::hash_and_sign(build));

rules.verify();
return rules;
}
Expand Down
2 changes: 1 addition & 1 deletion src/doc/book/ffi.md
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ Please note that [`catch_unwind()`] will only catch unwinding panics, not
those who abort the process. See the documentation of [`catch_unwind()`]
for more information.

[`catch_unwind()`]: https://doc.rust-lang.org/std/panic/fn.catch_unwind.html
[`catch_unwind()`]: ../std/panic/fn.catch_unwind.html

# Representing opaque structs

Expand Down
6 changes: 3 additions & 3 deletions src/doc/nomicon/destructors.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ this is totally fine.
For instance, a custom implementation of `Box` might write `Drop` like this:

```rust
#![feature(alloc, heap_api, drop_in_place, unique)]
#![feature(alloc, heap_api, unique)]

extern crate alloc;

Expand Down Expand Up @@ -57,7 +57,7 @@ use-after-free the `ptr` because when drop exits, it becomes inaccessible.
However this wouldn't work:

```rust
#![feature(alloc, heap_api, drop_in_place, unique)]
#![feature(alloc, heap_api, unique)]

extern crate alloc;

Expand Down Expand Up @@ -135,7 +135,7 @@ The classic safe solution to overriding recursive drop and allowing moving out
of Self during `drop` is to use an Option:

```rust
#![feature(alloc, heap_api, drop_in_place, unique)]
#![feature(alloc, heap_api, unique)]

extern crate alloc;

Expand Down
2 changes: 1 addition & 1 deletion src/liballoc/arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const MAX_REFCOUNT: usize = (isize::MAX) as usize;
/// as long as `T` implements [`Send`] and [`Sync`][sync]. The disadvantage is
/// that atomic operations are more expensive than ordinary memory accesses.
/// If you are not sharing reference-counted values between threads, consider
/// using [`rc::Rc`] for lower overhead. [`Rc`] is a safe default, because
/// using [`rc::Rc`][`Rc`] for lower overhead. [`Rc`] is a safe default, because
/// the compiler will catch any attempt to send an [`Rc`] between threads.
/// However, a library might choose `Arc` in order to give library consumers
/// more flexibility.
Expand Down
2 changes: 2 additions & 0 deletions src/libcollections/enum_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
reason = "matches collection reform specification, \
waiting for dust to settle",
issue = "37966")]
#![rustc_deprecated(since = "1.16.0", reason = "long since replaced")]
#![allow(deprecated)]

use core::marker;
use core::fmt;
Expand Down
1 change: 1 addition & 0 deletions src/libcollections/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ pub use btree_set::BTreeSet;
#[doc(no_inline)]
pub use linked_list::LinkedList;
#[doc(no_inline)]
#[allow(deprecated)]
pub use enum_set::EnumSet;
#[doc(no_inline)]
pub use vec_deque::VecDeque;
Expand Down
4 changes: 2 additions & 2 deletions src/libcollections/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ impl<T> [T] {
core_slice::SliceExt::swap(self, a, b)
}

/// Reverse the order of elements in a slice, in place.
/// Reverses the order of elements in a slice, in place.
///
/// # Example
///
Expand Down Expand Up @@ -1062,7 +1062,7 @@ impl<T> [T] {
core_slice::SliceExt::binary_search_by_key(self, b, f)
}

/// This is equivalent to `self.sort_by(|a, b| a.cmp(b))`.
/// Sorts the slice.
///
/// This sort is stable (i.e. does not reorder equal elements) and `O(n log n)` worst-case.
///
Expand Down
10 changes: 2 additions & 8 deletions src/libcollections/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1607,7 +1607,6 @@ impl str {
/// Basic usage:
///
/// ```
/// # #![feature(str_replacen)]
/// let s = "foo foo 123 foo";
/// assert_eq!("new new 123 foo", s.replacen("foo", "new", 2));
/// assert_eq!("faa fao 123 foo", s.replacen('o', "a", 3));
Expand All @@ -1617,13 +1616,10 @@ impl str {
/// When the pattern doesn't match:
///
/// ```
/// # #![feature(str_replacen)]
/// let s = "this is old";
/// assert_eq!(s, s.replacen("cookie monster", "little lamb", 10));
/// ```
#[unstable(feature = "str_replacen",
issue = "36436",
reason = "only need to replace first N matches")]
#[stable(feature = "str_replacen", since = "1.16.0")]
pub fn replacen<'a, P: Pattern<'a>>(&'a self, pat: P, to: &str, count: usize) -> String {
// Hope to reduce the times of re-allocation
let mut result = String::with_capacity(32);
Expand Down Expand Up @@ -1795,11 +1791,9 @@ impl str {
/// Basic usage:
///
/// ```
/// #![feature(repeat_str)]
///
/// assert_eq!("abc".repeat(4), String::from("abcabcabcabc"));
/// ```
#[unstable(feature = "repeat_str", issue = "37079")]
#[stable(feature = "repeat_str", since = "1.16.0")]
pub fn repeat(&self, n: usize) -> String {
let mut s = String::with_capacity(self.len() * n);
s.extend((0..n).map(|_| self));
Expand Down
9 changes: 2 additions & 7 deletions src/libcollections/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1166,18 +1166,14 @@ impl String {
/// Basic usage:
///
/// ```
/// #![feature(insert_str)]
///
/// let mut s = String::from("bar");
///
/// s.insert_str(0, "foo");
///
/// assert_eq!("foobar", s);
/// ```
#[inline]
#[unstable(feature = "insert_str",
reason = "recent addition",
issue = "35553")]
#[stable(feature = "insert_str", since = "1.16.0")]
pub fn insert_str(&mut self, idx: usize, string: &str) {
assert!(self.is_char_boundary(idx));

Expand Down Expand Up @@ -1270,7 +1266,6 @@ impl String {
/// # Examples
///
/// ```
/// # #![feature(string_split_off)]
/// # fn main() {
/// let mut hello = String::from("Hello, World!");
/// let world = hello.split_off(7);
Expand All @@ -1279,7 +1274,7 @@ impl String {
/// # }
/// ```
#[inline]
#[unstable(feature = "string_split_off", issue = "38080")]
#[stable(feature = "string_split_off", since = "1.16.0")]
pub fn split_off(&mut self, mid: usize) -> String {
assert!(self.is_char_boundary(mid));
let other = self.vec.split_off(mid);
Expand Down
Loading

0 comments on commit 0f8a296

Please sign in to comment.