Skip to content

Commit

Permalink
Auto merge of #49051 - kennytm:rollup, r=kennytm
Browse files Browse the repository at this point in the history
Rollup of 17 pull requests

- Successful merges: #48706, #48875, #48892, #48922, #48957, #48959, #48961, #48965, #49007, #49024, #49042, #49050, #48853, #48990, #49037, #49049, #48972
- Failed merges:
  • Loading branch information
bors committed Mar 16, 2018
2 parents 3926453 + db2f0ae commit 36b6687
Show file tree
Hide file tree
Showing 120 changed files with 637 additions and 462 deletions.
43 changes: 16 additions & 27 deletions src/Cargo.lock

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

3 changes: 0 additions & 3 deletions src/bootstrap/bin/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,6 @@ fn main() {
if let Ok(s) = env::var("RUSTC_CODEGEN_UNITS") {
cmd.arg("-C").arg(format!("codegen-units={}", s));
}
if env::var("RUSTC_THINLTO").is_ok() {
cmd.arg("-Ccodegen-units=16").arg("-Zthinlto");
}

// Emit save-analysis info.
if env::var("RUSTC_SAVE_ANALYSIS") == Ok("api".to_string()) {
Expand Down
11 changes: 0 additions & 11 deletions src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -778,17 +778,6 @@ impl<'a> Builder<'a> {
if cmd != "bench" {
cargo.arg("--release");
}

if self.config.rust_codegen_units.is_none() &&
self.build.is_rust_llvm(compiler.host) &&
self.config.rust_thinlto {
cargo.env("RUSTC_THINLTO", "1");
} else if self.config.rust_codegen_units.is_none() {
// Generally, if ThinLTO has been disabled for some reason, we
// want to set the codegen units to 1. However, we shouldn't do
// this if the option was specifically set by the user.
cargo.env("RUSTC_CODEGEN_UNITS", "1");
}
}

if self.config.locked_deps {
Expand Down
5 changes: 0 additions & 5 deletions src/bootstrap/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ pub struct Config {
// rust codegen options
pub rust_optimize: bool,
pub rust_codegen_units: Option<u32>,
pub rust_thinlto: bool,
pub rust_debug_assertions: bool,
pub rust_debuginfo: bool,
pub rust_debuginfo_lines: bool,
Expand Down Expand Up @@ -270,7 +269,6 @@ impl Default for StringOrBool {
struct Rust {
optimize: Option<bool>,
codegen_units: Option<u32>,
thinlto: Option<bool>,
debug_assertions: Option<bool>,
debuginfo: Option<bool>,
debuginfo_lines: Option<bool>,
Expand Down Expand Up @@ -429,7 +427,6 @@ impl Config {

// Store off these values as options because if they're not provided
// we'll infer default values for them later
let mut thinlto = None;
let mut llvm_assertions = None;
let mut debuginfo_lines = None;
let mut debuginfo_only_std = None;
Expand Down Expand Up @@ -473,7 +470,6 @@ impl Config {
optimize = rust.optimize;
ignore_git = rust.ignore_git;
debug_jemalloc = rust.debug_jemalloc;
thinlto = rust.thinlto;
set(&mut config.rust_optimize_tests, rust.optimize_tests);
set(&mut config.rust_debuginfo_tests, rust.debuginfo_tests);
set(&mut config.codegen_tests, rust.codegen_tests);
Expand Down Expand Up @@ -561,7 +557,6 @@ impl Config {
"stable" | "beta" | "nightly" => true,
_ => false,
};
config.rust_thinlto = thinlto.unwrap_or(true);
config.rust_debuginfo_lines = debuginfo_lines.unwrap_or(default);
config.rust_debuginfo_only_std = debuginfo_only_std.unwrap_or(default);

Expand Down
1 change: 0 additions & 1 deletion src/bootstrap/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ def v(*args):
# Optimization and debugging options. These may be overridden by the release
# channel, etc.
o("optimize", "rust.optimize", "build optimized rust code")
o("thinlto", "rust.thinlto", "build Rust with ThinLTO enabled")
o("optimize-llvm", "llvm.optimize", "build optimized LLVM")
o("llvm-assertions", "llvm.assertions", "build LLVM with assertions")
o("debug-assertions", "rust.debug-assertions", "build with debugging assertions")
Expand Down
1 change: 0 additions & 1 deletion src/ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ export RUST_RELEASE_CHANNEL=nightly
if [ "$DEPLOY$DEPLOY_ALT" != "" ]; then
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --release-channel=$RUST_RELEASE_CHANNEL"
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --enable-llvm-static-stdcpp"
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --disable-thinlto"

if [ "$NO_LLVM_ASSERTIONS" = "1" ]; then
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --disable-llvm-assertions"
Expand Down
16 changes: 16 additions & 0 deletions src/doc/rustdoc/src/documentation-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,22 @@ let x = 5;

There's some subtlety though! Read on for more details.

## Passing or failing a doctest

Like regular unit tests, regular doctests are considered to "pass"
if they compile and run without panicking.
So if you want to demonstrate that some computation gives a certain result,
the `assert!` family of macros works the same as other Rust code:

```rust
let foo = "foo";

assert_eq!(foo, "foo");
```

This way, if the computation ever returns something different,
the code panics and the doctest fails.

## Pre-processing examples

In the example above, you'll note something strange: there's no `main`
Expand Down
5 changes: 0 additions & 5 deletions src/liballoc/tests/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@
// except according to those terms.

use std::borrow::Cow;
#[cfg(not(target_arch = "asmjs"))]
use std::collections::CollectionAllocErr::*;
#[cfg(not(target_arch = "asmjs"))]
use std::mem::size_of;
#[cfg(not(target_arch = "asmjs"))]
use std::{usize, isize};

pub trait IntoCow<'a, B: ?Sized> where B: ToOwned {
Expand Down Expand Up @@ -535,7 +532,6 @@ fn test_reserve_exact() {
assert!(s.capacity() >= 33)
}

#[cfg(not(target_arch = "asmjs"))]
#[test]
fn test_try_reserve() {

Expand Down Expand Up @@ -613,7 +609,6 @@ fn test_try_reserve() {

}

#[cfg(not(target_arch = "asmjs"))]
#[test]
fn test_try_reserve_exact() {

Expand Down
7 changes: 1 addition & 6 deletions src/liballoc/tests/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,8 @@

use std::borrow::Cow;
use std::mem::size_of;
use std::{usize, panic};
#[cfg(not(target_arch = "asmjs"))]
use std::isize;
use std::{usize, isize, panic};
use std::vec::{Drain, IntoIter};
#[cfg(not(target_arch = "asmjs"))]
use std::collections::CollectionAllocErr::*;

struct DropCounter<'a> {
Expand Down Expand Up @@ -994,7 +991,6 @@ fn test_reserve_exact() {
assert!(v.capacity() >= 33)
}

#[cfg(not(target_arch = "asmjs"))]
#[test]
fn test_try_reserve() {

Expand Down Expand Up @@ -1097,7 +1093,6 @@ fn test_try_reserve() {

}

#[cfg(not(target_arch = "asmjs"))]
#[test]
fn test_try_reserve_exact() {

Expand Down
8 changes: 1 addition & 7 deletions src/liballoc/tests/vec_deque.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,9 @@
use std::collections::VecDeque;
use std::fmt::Debug;
use std::collections::vec_deque::{Drain};
#[cfg(not(target_arch = "asmjs"))]
use std::collections::CollectionAllocErr::*;
#[cfg(not(target_arch = "asmjs"))]
use std::mem::size_of;
use std::isize;
#[cfg(not(target_arch = "asmjs"))]
use std::usize;
use std::{usize, isize};

use self::Taggy::*;
use self::Taggypar::*;
Expand Down Expand Up @@ -1053,7 +1049,6 @@ fn test_reserve_exact_2() {
assert!(v.capacity() >= 48)
}

#[cfg(not(target_arch = "asmjs"))]
#[test]
fn test_try_reserve() {

Expand Down Expand Up @@ -1155,7 +1150,6 @@ fn test_try_reserve() {

}

#[cfg(not(target_arch = "asmjs"))]
#[test]
fn test_try_reserve_exact() {

Expand Down
2 changes: 1 addition & 1 deletion src/libcore/iter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2605,7 +2605,7 @@ impl<I, U> DoubleEndedIterator for Flatten<I>
}
}

#[stable(feature = "fused", since = "1.26.0")]
#[unstable(feature = "iterator_flatten", issue = "48213")]
impl<I, U> FusedIterator for Flatten<I>
where I: FusedIterator, U: Iterator,
I::Item: IntoIterator<IntoIter = U, Item = U::Item> {}
Expand Down
14 changes: 10 additions & 4 deletions src/librustc/middle/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ impl<'a, 'tcx> ItemLikeVisitor<'tcx> for EntryContext<'a, 'tcx> {
}
}

pub fn find_entry_point(session: &Session, hir_map: &hir_map::Map) {
pub fn find_entry_point(session: &Session,
hir_map: &hir_map::Map,
crate_name: &str) {
let any_exe = session.crate_types.borrow().iter().any(|ty| {
*ty == config::CrateTypeExecutable
});
Expand All @@ -81,7 +83,7 @@ pub fn find_entry_point(session: &Session, hir_map: &hir_map::Map) {

hir_map.krate().visit_all_item_likes(&mut ctxt);

configure_main(&mut ctxt);
configure_main(&mut ctxt, crate_name);
}

// Beware, this is duplicated in libsyntax/entry.rs, make sure to keep
Expand Down Expand Up @@ -150,7 +152,7 @@ fn find_item(item: &Item, ctxt: &mut EntryContext, at_root: bool) {
}
}

fn configure_main(this: &mut EntryContext) {
fn configure_main(this: &mut EntryContext, crate_name: &str) {
if this.start_fn.is_some() {
*this.session.entry_fn.borrow_mut() = this.start_fn;
this.session.entry_type.set(Some(config::EntryStart));
Expand All @@ -162,7 +164,8 @@ fn configure_main(this: &mut EntryContext) {
this.session.entry_type.set(Some(config::EntryMain));
} else {
// No main function
let mut err = struct_err!(this.session, E0601, "main function not found");
let mut err = struct_err!(this.session, E0601,
"`main` function not found in crate `{}`", crate_name);
if !this.non_main_fns.is_empty() {
// There were some functions named 'main' though. Try to give the user a hint.
err.note("the main function must be defined at the crate level \
Expand All @@ -175,6 +178,9 @@ fn configure_main(this: &mut EntryContext) {
err.emit();
this.session.abort_if_errors();
} else {
if let Some(ref filename) = this.session.local_crate_source_file {
err.note(&format!("consider adding a `main` function to `{}`", filename.display()));
}
if this.session.teach(&err.get_code().unwrap()) {
err.note("If you don't know the basics of Rust, you can go look to the Rust Book \
to get started: https://doc.rust-lang.org/book/");
Expand Down
Loading

0 comments on commit 36b6687

Please sign in to comment.