Skip to content

Rollup of 10 pull requests #37337

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
Oct 22, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
abc715e
run rustfmt on bootstrap/bin folder
srinivasreddy Oct 16, 2016
54e320d
run rustfmt on various folders
srinivasreddy Oct 16, 2016
7a491bb
Run rustfmt on libcore/prelude folder
srinivasreddy Oct 16, 2016
434c58e
Apply rustfmt on liballoc folder
srinivasreddy Oct 18, 2016
20bda8d
run rustfmt on graph folder
srinivasreddy Oct 19, 2016
ba70ecc
test - Add missing ! to crate_type/crate_id attributes
thepowersgang Oct 20, 2016
599ad8e
Add missing urls on Vec docs
GuillaumeGomez Oct 8, 2016
cf0fc72
TRPL: guessing game: minor clarification
vkatsikaros Oct 20, 2016
3e26a93
doc: a more simple description of Iterator::nth
tshepang Oct 20, 2016
5402271
Add an error explaination for E0182
Oct 16, 2016
e7d01cf
Add an error explaination for E0230
Oct 18, 2016
9365586
Add an error explaination for E0399
Oct 18, 2016
18f9758
Rollup merge of #37043 - GuillaumeGomez:vec_urls, r=frewsxcv
GuillaumeGomez Oct 21, 2016
88d1cbd
Rollup merge of #37209 - srinivasreddy:bootstrap_bin, r=nrc
GuillaumeGomez Oct 21, 2016
686ff0c
Rollup merge of #37211 - srinivasreddy:alt, r=nrc
GuillaumeGomez Oct 21, 2016
8133a55
Rollup merge of #37219 - srinivasreddy:prelude, r=nrc
GuillaumeGomez Oct 21, 2016
0dee00f
Rollup merge of #37244 - senior:add-error-desc-182-230-399, r=Guillau…
GuillaumeGomez Oct 21, 2016
38337c2
Rollup merge of #37253 - srinivasreddy:liballoc, r=nrc
GuillaumeGomez Oct 21, 2016
59faa20
Rollup merge of #37286 - srinivasreddy:graph, r=nrc
GuillaumeGomez Oct 21, 2016
8aa14c3
Rollup merge of #37297 - thepowersgang:fix-bad-crate-attrs, r=eddyb
GuillaumeGomez Oct 21, 2016
c3802f6
Rollup merge of #37309 - vkatsikaros:vkatsikaros/37307, r=GuillaumeGomez
GuillaumeGomez Oct 21, 2016
1c2d223
Rollup merge of #37314 - tshepang:simple, r=GuillaumeGomez
GuillaumeGomez Oct 21, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions src/bootstrap/bin/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ fn main() {
let args = env::args_os().skip(1).collect::<Vec<_>>();
// Detect whether or not we're a build script depending on whether --target
// is passed (a bit janky...)
let target = args.windows(2).find(|w| &*w[0] == "--target")
.and_then(|w| w[1].to_str());
let target = args.windows(2)
.find(|w| &*w[0] == "--target")
.and_then(|w| w[1].to_str());
let version = args.iter().find(|w| &**w == "-vV");

// Build scripts always use the snapshot compiler which is guaranteed to be
Expand All @@ -64,9 +65,10 @@ fn main() {

let mut cmd = Command::new(rustc);
cmd.args(&args)
.arg("--cfg").arg(format!("stage{}", stage))
.env(bootstrap::util::dylib_path_var(),
env::join_paths(&dylib_path).unwrap());
.arg("--cfg")
.arg(format!("stage{}", stage))
.env(bootstrap::util::dylib_path_var(),
env::join_paths(&dylib_path).unwrap());

if let Some(target) = target {
// The stage0 compiler has a special sysroot distinct from what we
Expand Down Expand Up @@ -101,9 +103,8 @@ fn main() {
// This... is a bit of a hack how we detect this. Ideally this
// information should be encoded in the crate I guess? Would likely
// require an RFC amendment to RFC 1513, however.
let is_panic_abort = args.windows(2).any(|a| {
&*a[0] == "--crate-name" && &*a[1] == "panic_abort"
});
let is_panic_abort = args.windows(2)
.any(|a| &*a[0] == "--crate-name" && &*a[1] == "panic_abort");
if is_panic_abort {
cmd.arg("-C").arg("panic=abort");
}
Expand All @@ -116,7 +117,7 @@ fn main() {
cmd.arg("-Cdebuginfo=1");
}
let debug_assertions = match env::var("RUSTC_DEBUG_ASSERTIONS") {
Ok(s) => if s == "true" {"y"} else {"n"},
Ok(s) => if s == "true" { "y" } else { "n" },
Err(..) => "n",
};
cmd.arg("-C").arg(format!("debug-assertions={}", debug_assertions));
Expand Down
10 changes: 6 additions & 4 deletions src/bootstrap/bin/rustdoc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ fn main() {

let mut cmd = Command::new(rustdoc);
cmd.args(&args)
.arg("--cfg").arg(format!("stage{}", stage))
.arg("--cfg").arg("dox")
.env(bootstrap::util::dylib_path_var(),
env::join_paths(&dylib_path).unwrap());
.arg("--cfg")
.arg(format!("stage{}", stage))
.arg("--cfg")
.arg("dox")
.env(bootstrap::util::dylib_path_var(),
env::join_paths(&dylib_path).unwrap());
std::process::exit(match cmd.status() {
Ok(s) => s.code().unwrap_or(1),
Err(e) => panic!("\n\nfailed to run {:?}: {}\n\n", cmd, e),
Expand Down
8 changes: 6 additions & 2 deletions src/build_helper/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ pub fn run_silent(cmd: &mut Command) {
};
if !status.success() {
fail(&format!("command did not execute successfully: {:?}\n\
expected success, got: {}", cmd, status));
expected success, got: {}",
cmd,
status));
}
}

Expand Down Expand Up @@ -65,7 +67,9 @@ pub fn output(cmd: &mut Command) -> String {
};
if !output.status.success() {
panic!("command did not execute successfully: {:?}\n\
expected success, got: {}", cmd, output.status);
expected success, got: {}",
cmd,
output.status);
}
String::from_utf8(output.stdout).unwrap()
}
Expand Down
2 changes: 1 addition & 1 deletion src/doc/book/guessing-game.md
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ displaying the message.
[expect]: ../std/result/enum.Result.html#method.expect
[panic]: error-handling.html

If we leave off calling this method, our program will compile, but
If we do not call `expect()`, our program will compile, but
we’ll get a warning:

```bash
Expand Down
14 changes: 3 additions & 11 deletions src/liballoc/raw_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,7 @@ impl<T> RawVec<T> {
pub fn new() -> Self {
unsafe {
// !0 is usize::MAX. This branch should be stripped at compile time.
let cap = if mem::size_of::<T>() == 0 {
!0
} else {
0
};
let cap = if mem::size_of::<T>() == 0 { !0 } else { 0 };

// heap::EMPTY doubles as "unallocated" and "zero-sized allocation"
RawVec {
Expand Down Expand Up @@ -209,11 +205,7 @@ impl<T> RawVec<T> {

let (new_cap, ptr) = if self.cap == 0 {
// skip to 4 because tiny Vec's are dumb; but not if that would cause overflow
let new_cap = if elem_size > (!0) / 8 {
1
} else {
4
};
let new_cap = if elem_size > (!0) / 8 { 1 } else { 4 };
let ptr = heap::allocate(new_cap * elem_size, align);
(new_cap, ptr)
} else {
Expand Down Expand Up @@ -347,7 +339,7 @@ impl<T> RawVec<T> {
let elem_size = mem::size_of::<T>();
// Nothing we can really do about these checks :(
let required_cap = used_cap.checked_add(needed_extra_cap)
.expect("capacity overflow");
.expect("capacity overflow");
// Cannot overflow, because `cap <= isize::MAX`, and type of `cap` is `usize`.
let double_cap = self.cap * 2;
// `double_cap` guarantees exponential growth.
Expand Down
32 changes: 14 additions & 18 deletions src/liballoc_jemalloc/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,8 @@ fn main() {
// that the feature set used by std is the same across all
// targets, which means we have to build the alloc_jemalloc crate
// for targets like emscripten, even if we don't use it.
if target.contains("rumprun") ||
target.contains("bitrig") ||
target.contains("openbsd") ||
target.contains("msvc") ||
target.contains("emscripten")
{
if target.contains("rumprun") || target.contains("bitrig") || target.contains("openbsd") ||
target.contains("msvc") || target.contains("emscripten") {
println!("cargo:rustc-cfg=dummy_jemalloc");
return;
}
Expand All @@ -64,16 +60,16 @@ fn main() {
// only msvc returns None for ar so unwrap is okay
let ar = build_helper::cc2ar(compiler.path(), &target).unwrap();
let cflags = compiler.args()
.iter()
.map(|s| s.to_str().unwrap())
.collect::<Vec<_>>()
.join(" ");
.iter()
.map(|s| s.to_str().unwrap())
.collect::<Vec<_>>()
.join(" ");

let mut stack = src_dir.join("../jemalloc")
.read_dir()
.unwrap()
.map(|e| e.unwrap())
.collect::<Vec<_>>();
.read_dir()
.unwrap()
.map(|e| e.unwrap())
.collect::<Vec<_>>();
while let Some(entry) = stack.pop() {
let path = entry.path();
if entry.file_type().unwrap().is_dir() {
Expand Down Expand Up @@ -155,10 +151,10 @@ fn main() {

run(&mut cmd);
run(Command::new("make")
.current_dir(&build_dir)
.arg("build_lib_static")
.arg("-j")
.arg(env::var("NUM_JOBS").expect("NUM_JOBS was not set")));
.current_dir(&build_dir)
.arg("build_lib_static")
.arg("-j")
.arg(env::var("NUM_JOBS").expect("NUM_JOBS was not set")));

if target.contains("windows") {
println!("cargo:rustc-link-lib=static=jemalloc");
Expand Down
6 changes: 1 addition & 5 deletions src/liballoc_system/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,7 @@ mod imp {
HEAP_REALLOC_IN_PLACE_ONLY,
ptr as LPVOID,
size as SIZE_T) as *mut u8;
if new.is_null() {
old_size
} else {
size
}
if new.is_null() { old_size } else { size }
} else {
old_size
}
Expand Down
5 changes: 2 additions & 3 deletions src/libarena/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,9 +335,8 @@ mod tests {

let arena = Wrap(TypedArena::new());

let result = arena.alloc_outer(|| {
Outer { inner: arena.alloc_inner(|| Inner { value: 10 }) }
});
let result =
arena.alloc_outer(|| Outer { inner: arena.alloc_inner(|| Inner { value: 10 }) });

assert_eq!(result.inner.value, 10);
}
Expand Down
Loading