Skip to content

Commit 36b6687

Browse files
committed
Auto merge of #49051 - kennytm:rollup, r=kennytm
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:
2 parents 3926453 + db2f0ae commit 36b6687

File tree

120 files changed

+637
-462
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+637
-462
lines changed

src/Cargo.lock

+16-27
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/bootstrap/bin/rustc.rs

-3
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,6 @@ fn main() {
175175
if let Ok(s) = env::var("RUSTC_CODEGEN_UNITS") {
176176
cmd.arg("-C").arg(format!("codegen-units={}", s));
177177
}
178-
if env::var("RUSTC_THINLTO").is_ok() {
179-
cmd.arg("-Ccodegen-units=16").arg("-Zthinlto");
180-
}
181178

182179
// Emit save-analysis info.
183180
if env::var("RUSTC_SAVE_ANALYSIS") == Ok("api".to_string()) {

src/bootstrap/builder.rs

-11
Original file line numberDiff line numberDiff line change
@@ -778,17 +778,6 @@ impl<'a> Builder<'a> {
778778
if cmd != "bench" {
779779
cargo.arg("--release");
780780
}
781-
782-
if self.config.rust_codegen_units.is_none() &&
783-
self.build.is_rust_llvm(compiler.host) &&
784-
self.config.rust_thinlto {
785-
cargo.env("RUSTC_THINLTO", "1");
786-
} else if self.config.rust_codegen_units.is_none() {
787-
// Generally, if ThinLTO has been disabled for some reason, we
788-
// want to set the codegen units to 1. However, we shouldn't do
789-
// this if the option was specifically set by the user.
790-
cargo.env("RUSTC_CODEGEN_UNITS", "1");
791-
}
792781
}
793782

794783
if self.config.locked_deps {

src/bootstrap/config.rs

-5
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ pub struct Config {
8686
// rust codegen options
8787
pub rust_optimize: bool,
8888
pub rust_codegen_units: Option<u32>,
89-
pub rust_thinlto: bool,
9089
pub rust_debug_assertions: bool,
9190
pub rust_debuginfo: bool,
9291
pub rust_debuginfo_lines: bool,
@@ -270,7 +269,6 @@ impl Default for StringOrBool {
270269
struct Rust {
271270
optimize: Option<bool>,
272271
codegen_units: Option<u32>,
273-
thinlto: Option<bool>,
274272
debug_assertions: Option<bool>,
275273
debuginfo: Option<bool>,
276274
debuginfo_lines: Option<bool>,
@@ -429,7 +427,6 @@ impl Config {
429427

430428
// Store off these values as options because if they're not provided
431429
// we'll infer default values for them later
432-
let mut thinlto = None;
433430
let mut llvm_assertions = None;
434431
let mut debuginfo_lines = None;
435432
let mut debuginfo_only_std = None;
@@ -473,7 +470,6 @@ impl Config {
473470
optimize = rust.optimize;
474471
ignore_git = rust.ignore_git;
475472
debug_jemalloc = rust.debug_jemalloc;
476-
thinlto = rust.thinlto;
477473
set(&mut config.rust_optimize_tests, rust.optimize_tests);
478474
set(&mut config.rust_debuginfo_tests, rust.debuginfo_tests);
479475
set(&mut config.codegen_tests, rust.codegen_tests);
@@ -561,7 +557,6 @@ impl Config {
561557
"stable" | "beta" | "nightly" => true,
562558
_ => false,
563559
};
564-
config.rust_thinlto = thinlto.unwrap_or(true);
565560
config.rust_debuginfo_lines = debuginfo_lines.unwrap_or(default);
566561
config.rust_debuginfo_only_std = debuginfo_only_std.unwrap_or(default);
567562

src/bootstrap/configure.py

-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ def v(*args):
7171
# Optimization and debugging options. These may be overridden by the release
7272
# channel, etc.
7373
o("optimize", "rust.optimize", "build optimized rust code")
74-
o("thinlto", "rust.thinlto", "build Rust with ThinLTO enabled")
7574
o("optimize-llvm", "llvm.optimize", "build optimized LLVM")
7675
o("llvm-assertions", "llvm.assertions", "build LLVM with assertions")
7776
o("debug-assertions", "rust.debug-assertions", "build with debugging assertions")

src/ci/run.sh

-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ export RUST_RELEASE_CHANNEL=nightly
4646
if [ "$DEPLOY$DEPLOY_ALT" != "" ]; then
4747
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --release-channel=$RUST_RELEASE_CHANNEL"
4848
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --enable-llvm-static-stdcpp"
49-
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --disable-thinlto"
5049

5150
if [ "$NO_LLVM_ASSERTIONS" = "1" ]; then
5251
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --disable-llvm-assertions"

src/doc/rustdoc/src/documentation-tests.md

+16
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,22 @@ let x = 5;
3535

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

38+
## Passing or failing a doctest
39+
40+
Like regular unit tests, regular doctests are considered to "pass"
41+
if they compile and run without panicking.
42+
So if you want to demonstrate that some computation gives a certain result,
43+
the `assert!` family of macros works the same as other Rust code:
44+
45+
```rust
46+
let foo = "foo";
47+
48+
assert_eq!(foo, "foo");
49+
```
50+
51+
This way, if the computation ever returns something different,
52+
the code panics and the doctest fails.
53+
3854
## Pre-processing examples
3955

4056
In the example above, you'll note something strange: there's no `main`

src/liballoc/tests/string.rs

-5
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,8 @@
99
// except according to those terms.
1010

1111
use std::borrow::Cow;
12-
#[cfg(not(target_arch = "asmjs"))]
1312
use std::collections::CollectionAllocErr::*;
14-
#[cfg(not(target_arch = "asmjs"))]
1513
use std::mem::size_of;
16-
#[cfg(not(target_arch = "asmjs"))]
1714
use std::{usize, isize};
1815

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

538-
#[cfg(not(target_arch = "asmjs"))]
539535
#[test]
540536
fn test_try_reserve() {
541537

@@ -613,7 +609,6 @@ fn test_try_reserve() {
613609

614610
}
615611

616-
#[cfg(not(target_arch = "asmjs"))]
617612
#[test]
618613
fn test_try_reserve_exact() {
619614

src/liballoc/tests/vec.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,8 @@
1010

1111
use std::borrow::Cow;
1212
use std::mem::size_of;
13-
use std::{usize, panic};
14-
#[cfg(not(target_arch = "asmjs"))]
15-
use std::isize;
13+
use std::{usize, isize, panic};
1614
use std::vec::{Drain, IntoIter};
17-
#[cfg(not(target_arch = "asmjs"))]
1815
use std::collections::CollectionAllocErr::*;
1916

2017
struct DropCounter<'a> {
@@ -994,7 +991,6 @@ fn test_reserve_exact() {
994991
assert!(v.capacity() >= 33)
995992
}
996993

997-
#[cfg(not(target_arch = "asmjs"))]
998994
#[test]
999995
fn test_try_reserve() {
1000996

@@ -1097,7 +1093,6 @@ fn test_try_reserve() {
10971093

10981094
}
10991095

1100-
#[cfg(not(target_arch = "asmjs"))]
11011096
#[test]
11021097
fn test_try_reserve_exact() {
11031098

src/liballoc/tests/vec_deque.rs

+1-7
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,9 @@
1111
use std::collections::VecDeque;
1212
use std::fmt::Debug;
1313
use std::collections::vec_deque::{Drain};
14-
#[cfg(not(target_arch = "asmjs"))]
1514
use std::collections::CollectionAllocErr::*;
16-
#[cfg(not(target_arch = "asmjs"))]
1715
use std::mem::size_of;
18-
use std::isize;
19-
#[cfg(not(target_arch = "asmjs"))]
20-
use std::usize;
16+
use std::{usize, isize};
2117

2218
use self::Taggy::*;
2319
use self::Taggypar::*;
@@ -1053,7 +1049,6 @@ fn test_reserve_exact_2() {
10531049
assert!(v.capacity() >= 48)
10541050
}
10551051

1056-
#[cfg(not(target_arch = "asmjs"))]
10571052
#[test]
10581053
fn test_try_reserve() {
10591054

@@ -1155,7 +1150,6 @@ fn test_try_reserve() {
11551150

11561151
}
11571152

1158-
#[cfg(not(target_arch = "asmjs"))]
11591153
#[test]
11601154
fn test_try_reserve_exact() {
11611155

src/libcore/iter/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2605,7 +2605,7 @@ impl<I, U> DoubleEndedIterator for Flatten<I>
26052605
}
26062606
}
26072607

2608-
#[stable(feature = "fused", since = "1.26.0")]
2608+
#[unstable(feature = "iterator_flatten", issue = "48213")]
26092609
impl<I, U> FusedIterator for Flatten<I>
26102610
where I: FusedIterator, U: Iterator,
26112611
I::Item: IntoIterator<IntoIter = U, Item = U::Item> {}

src/librustc/middle/entry.rs

+10-4
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ impl<'a, 'tcx> ItemLikeVisitor<'tcx> for EntryContext<'a, 'tcx> {
5555
}
5656
}
5757

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

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

84-
configure_main(&mut ctxt);
86+
configure_main(&mut ctxt, crate_name);
8587
}
8688

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

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

0 commit comments

Comments
 (0)