Skip to content

Commit 45fba43

Browse files
committed
Auto merge of #48113 - kennytm:rollup, r=kennytm
Rollup of 20 pull requests - Successful merges: #47790, #47835, #47854, #48015, #48047, #48051, #48058, #48059, #48064, #48078, #48080, #48086, #48098, #48101, #48107, #48100, #48085, #48120, #48124, #47547 - Failed merges:
2 parents 39abcc0 + 4a82718 commit 45fba43

File tree

55 files changed

+399
-534
lines changed

Some content is hidden

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

55 files changed

+399
-534
lines changed

config.toml.example

+4
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@
151151
# default.
152152
#extended = false
153153

154+
# Installs choosen set of extended tools if enables. By default builds all.
155+
# If choosen tool failed to build the installation fails.
156+
#tools = ["cargo", "rls", "rustfmt", "analysis", "src"]
157+
154158
# Verbosity level: 0 == not verbose, 1 == verbose, 2 == very verbose
155159
#verbose = 0
156160

src/bootstrap/builder.rs

+23-6
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ impl<'a> Builder<'a> {
570570
// build scripts in that situation.
571571
//
572572
// If LLVM support is disabled we need to use the snapshot compiler to compile
573-
// build scripts, as the new compiler doesnt support executables.
573+
// build scripts, as the new compiler doesn't support executables.
574574
if mode == Mode::Libstd || !self.build.config.llvm_enabled {
575575
cargo.env("RUSTC_SNAPSHOT", &self.initial_rustc)
576576
.env("RUSTC_SNAPSHOT_LIBDIR", self.rustc_snapshot_libdir());
@@ -600,9 +600,25 @@ impl<'a> Builder<'a> {
600600
//
601601
// FIXME: the guard against msvc shouldn't need to be here
602602
if !target.contains("msvc") {
603-
let cc = self.cc(target);
604-
cargo.env(format!("CC_{}", target), cc)
605-
.env("CC", cc);
603+
let ccache = self.config.ccache.as_ref();
604+
let ccacheify = |s: &Path| {
605+
let ccache = match ccache {
606+
Some(ref s) => s,
607+
None => return s.display().to_string(),
608+
};
609+
// FIXME: the cc-rs crate only recognizes the literal strings
610+
// `ccache` and `sccache` when doing caching compilations, so we
611+
// mirror that here. It should probably be fixed upstream to
612+
// accept a new env var or otherwise work with custom ccache
613+
// vars.
614+
match &ccache[..] {
615+
"ccache" | "sccache" => format!("{} {}", ccache, s.display()),
616+
_ => s.display().to_string(),
617+
}
618+
};
619+
let cc = ccacheify(&self.cc(target));
620+
cargo.env(format!("CC_{}", target), &cc)
621+
.env("CC", &cc);
606622

607623
let cflags = self.cflags(target).join(" ");
608624
cargo.env(format!("CFLAGS_{}", target), cflags.clone())
@@ -617,8 +633,9 @@ impl<'a> Builder<'a> {
617633
}
618634

619635
if let Ok(cxx) = self.cxx(target) {
620-
cargo.env(format!("CXX_{}", target), cxx)
621-
.env("CXX", cxx)
636+
let cxx = ccacheify(&cxx);
637+
cargo.env(format!("CXX_{}", target), &cxx)
638+
.env("CXX", &cxx)
622639
.env(format!("CXXFLAGS_{}", target), cflags.clone())
623640
.env("CXXFLAGS", cflags);
624641
}

src/bootstrap/config.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
//! This module implements parsing `config.toml` configuration files to tweak
1414
//! how the build runs.
1515
16-
use std::collections::HashMap;
16+
use std::collections::{HashMap, HashSet};
1717
use std::env;
1818
use std::fs::File;
1919
use std::io::prelude::*;
@@ -52,6 +52,7 @@ pub struct Config {
5252
pub target_config: HashMap<Interned<String>, Target>,
5353
pub full_bootstrap: bool,
5454
pub extended: bool,
55+
pub tools: Option<HashSet<String>>,
5556
pub sanitizers: bool,
5657
pub profiler: bool,
5758
pub ignore_git: bool,
@@ -191,6 +192,7 @@ struct Build {
191192
python: Option<String>,
192193
full_bootstrap: Option<bool>,
193194
extended: Option<bool>,
195+
tools: Option<HashSet<String>>,
194196
verbose: Option<usize>,
195197
sanitizers: Option<bool>,
196198
profiler: Option<bool>,
@@ -395,6 +397,7 @@ impl Config {
395397
set(&mut config.vendor, build.vendor);
396398
set(&mut config.full_bootstrap, build.full_bootstrap);
397399
set(&mut config.extended, build.extended);
400+
config.tools = build.tools;
398401
set(&mut config.verbose, build.verbose);
399402
set(&mut config.sanitizers, build.sanitizers);
400403
set(&mut config.profiler, build.profiler);

src/bootstrap/configure.py

+1
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ def v(*args):
144144
o("full-bootstrap", "build.full-bootstrap", "build three compilers instead of two")
145145
o("extended", "build.extended", "build an extended rust tool set")
146146

147+
v("tools", "build.tools", "List of extended tools will be installed")
147148
v("build", "build.build", "GNUs ./configure syntax LLVM build triple")
148149
v("host", None, "GNUs ./configure syntax LLVM host triples")
149150
v("target", None, "GNUs ./configure syntax LLVM target triples")

src/bootstrap/dist.rs

+7
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ use channel;
3131
use util::{cp_r, libdir, is_dylib, cp_filtered, copy, replace_in_file};
3232
use builder::{Builder, RunConfig, ShouldRun, Step};
3333
use compile;
34+
use native;
3435
use tool::{self, Tool};
3536
use cache::{INTERNER, Interned};
3637
use time;
@@ -898,6 +899,12 @@ impl Step for PlainSourceTarball {
898899
.arg("--vers").arg(CARGO_VENDOR_VERSION)
899900
.arg("cargo-vendor")
900901
.env("RUSTC", &build.initial_rustc);
902+
if let Some(dir) = build.openssl_install_dir(build.config.build) {
903+
builder.ensure(native::Openssl {
904+
target: build.config.build,
905+
});
906+
cmd.env("OPENSSL_DIR", dir);
907+
}
901908
build.run(&mut cmd);
902909
}
903910

src/bootstrap/install.rs

+23-7
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ use dist::{self, pkgname, sanitize_sh, tmpdir};
2222

2323
use builder::{Builder, RunConfig, ShouldRun, Step};
2424
use cache::Interned;
25+
use config::Config;
2526

2627
pub fn install_docs(builder: &Builder, stage: u32, host: Interned<String>) {
2728
install_sh(builder, "docs", "rust-docs", stage, Some(host));
@@ -144,6 +145,19 @@ macro_rules! install {
144145
pub host: Interned<String>,
145146
}
146147

148+
impl $name {
149+
#[allow(dead_code)]
150+
fn should_build(config: &Config) -> bool {
151+
config.extended && config.tools.as_ref()
152+
.map_or(true, |t| t.contains($path))
153+
}
154+
155+
#[allow(dead_code)]
156+
fn should_install(builder: &Builder) -> bool {
157+
builder.config.tools.as_ref().map_or(false, |t| t.contains($path))
158+
}
159+
}
160+
147161
impl Step for $name {
148162
type Output = ();
149163
const DEFAULT: bool = true;
@@ -185,32 +199,34 @@ install!((self, builder, _config),
185199
install_std(builder, self.stage, *target);
186200
}
187201
};
188-
Cargo, "cargo", _config.extended, only_hosts: true, {
202+
Cargo, "cargo", Self::should_build(_config), only_hosts: true, {
189203
builder.ensure(dist::Cargo { stage: self.stage, target: self.target });
190204
install_cargo(builder, self.stage, self.target);
191205
};
192-
Rls, "rls", _config.extended, only_hosts: true, {
193-
if builder.ensure(dist::Rls { stage: self.stage, target: self.target }).is_some() {
206+
Rls, "rls", Self::should_build(_config), only_hosts: true, {
207+
if builder.ensure(dist::Rls { stage: self.stage, target: self.target }).is_some() ||
208+
Self::should_install(builder) {
194209
install_rls(builder, self.stage, self.target);
195210
} else {
196211
println!("skipping Install RLS stage{} ({})", self.stage, self.target);
197212
}
198213
};
199-
Rustfmt, "rustfmt", _config.extended, only_hosts: true, {
200-
if builder.ensure(dist::Rustfmt { stage: self.stage, target: self.target }).is_some() {
214+
Rustfmt, "rustfmt", Self::should_build(_config), only_hosts: true, {
215+
if builder.ensure(dist::Rustfmt { stage: self.stage, target: self.target }).is_some() ||
216+
Self::should_install(builder) {
201217
install_rustfmt(builder, self.stage, self.target);
202218
} else {
203219
println!("skipping Install Rustfmt stage{} ({})", self.stage, self.target);
204220
}
205221
};
206-
Analysis, "analysis", _config.extended, only_hosts: false, {
222+
Analysis, "analysis", Self::should_build(_config), only_hosts: false, {
207223
builder.ensure(dist::Analysis {
208224
compiler: builder.compiler(self.stage, self.host),
209225
target: self.target
210226
});
211227
install_analysis(builder, self.stage, self.target);
212228
};
213-
Src, "src", _config.extended, only_hosts: true, {
229+
Src, "src", Self::should_build(_config) , only_hosts: true, {
214230
builder.ensure(dist::Src);
215231
install_src(builder, self.stage);
216232
}, ONLY_BUILD;

src/bootstrap/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ impl Build {
666666
}
667667
}
668668

669-
/// Returns the path to the linker for the given target if it needs to be overriden.
669+
/// Returns the path to the linker for the given target if it needs to be overridden.
670670
fn linker(&self, target: Interned<String>) -> Option<&Path> {
671671
if let Some(linker) = self.config.target_config.get(&target)
672672
.and_then(|c| c.linker.as_ref()) {

src/bootstrap/test.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,7 @@ impl Step for Compiletest {
902902
}
903903
}
904904
if suite == "run-make" && !build.config.llvm_enabled {
905-
println!("Ignoring run-make test suite as they generally dont work without LLVM");
905+
println!("Ignoring run-make test suite as they generally don't work without LLVM");
906906
return;
907907
}
908908

src/ci/docker/dist-i686-linux/Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ ENV RUST_CONFIGURE_ARGS \
8686
--enable-extended \
8787
--enable-sanitizers \
8888
--enable-profiler \
89-
--enable-emscripten
89+
--enable-emscripten \
90+
--build=i686-unknown-linux-gnu
9091
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
9192

9293
# This is the only builder which will create source tarballs

src/ci/docker/dist-x86_64-netbsd/build-netbsd-toolchain.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ cd usr/src
5454
# The options, in order, do the following
5555
# * this is an unprivileged build
5656
# * output to a predictable location
57-
# * disable various uneeded stuff
57+
# * disable various unneeded stuff
5858
MKUNPRIVED=yes TOOLDIR=/x-tools/x86_64-unknown-netbsd \
5959
MKSHARE=no MKDOC=no MKHTML=no MKINFO=no MKKMOD=no MKLINT=no MKMAN=no MKNLS=no MKPROFILE=no \
6060
hide_output ./build.sh -j10 -m amd64 tools

src/dlmalloc

src/doc/nomicon

src/doc/reference

src/etc/installer/msi/rust.wxs

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<!-- Upgrade code should be different for each platform -->
1919
<?if $(sys.BUILDARCH)="x64" ?>
2020
<?if $(env.CFG_ABI)="GNU" ?>
21-
<!-- UpgradeCode shoud stay the same for all MSI versions in channel -->
21+
<!-- UpgradeCode should stay the same for all MSI versions in channel -->
2222
<?if $(env.CFG_CHANNEL)="stable" ?>
2323
<?define UpgradeCode="B440B077-F8D1-4730-8E1D-D6D37702B4CE" ?>
2424
<?elseif $(env.CFG_CHANNEL)="beta" ?>
@@ -129,7 +129,7 @@
129129

130130
<!-- Path of cmd.exe for the shortcut -->
131131
<Property Id="SHORTCUTTARGET" Value="%windir%\System32\cmd.exe" />
132-
<!-- Microsoft Installer will resolve any Enviroment Variables in the working directory at install time -->
132+
<!-- Microsoft Installer will resolve any Environment Variables in the working directory at install time -->
133133
<Property Id="SHORTCUTWKDIR" Value="%SystemDrive%\" />
134134

135135
<InstallUISequence>

src/etc/platform-intrinsics/generator.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ def parse_args():
591591
The X86 architecture is specified as multiple files (for the different
592592
instruction sets that x86 supports). To generate the compiler
593593
definitions one needs to pass the script a "platform information file"
594-
(with the -i flag) next to the files of the different intruction sets.
594+
(with the -i flag) next to the files of the different instruction sets.
595595
For example, to generate the X86 compiler-definitions for SSE4.2, just:
596596
597597
python generator.py --format compiler-defs -i x86/info.json sse42.json

src/etc/test-float-parse/runtests.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
(as a fraction, using the ``fractions`` module).
4242
4343
Given an input string and the corresponding float computed via Rust, simply
44-
decode the float into f * 2^k (for intergers f, k) and the ULP.
44+
decode the float into f * 2^k (for integers f, k) and the ULP.
4545
We can now easily compute the error and check if it is within 0.5 ULP as it
4646
should be. Zero and infinites are handled similarly:
4747

src/libbacktrace/ltmain.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ func_mkdir_p ()
487487
# While some portion of DIR does not yet exist...
488488
while test ! -d "$my_directory_path"; do
489489
# ...make a list in topmost first order. Use a colon delimited
490-
# list incase some portion of path contains whitespace.
490+
# list in case some portion of path contains whitespace.
491491
my_dir_list="$my_directory_path:$my_dir_list"
492492

493493
# If the last portion added has no slash in it, the list is done

src/libbacktrace/macho.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ macho_get_commands (struct backtrace_state *state, int descriptor,
327327
goto end;
328328
file_header_view_valid = 1;
329329

330-
// The endianess of the slice may be different than the fat image
330+
// The endianness of the slice may be different than the fat image
331331
switch (*(uint32_t *) file_header_view.data)
332332
{
333333
case MH_MAGIC:

src/libcore/char.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ impl From<u8> for char {
211211

212212
/// An error which can be returned when parsing a char.
213213
#[stable(feature = "char_from_str", since = "1.20.0")]
214-
#[derive(Clone, Debug)]
214+
#[derive(Clone, Debug, PartialEq, Eq)]
215215
pub struct ParseCharError {
216216
kind: CharErrorKind,
217217
}

src/libcore/iter/iterator.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1431,6 +1431,10 @@ pub trait Iterator {
14311431
/// Folding is useful whenever you have a collection of something, and want
14321432
/// to produce a single value from it.
14331433
///
1434+
/// Note: `fold()`, and similar methods that traverse the entire iterator,
1435+
/// may not terminate for infinite iterators, even on traits for which a
1436+
/// result is determinable in finite time.
1437+
///
14341438
/// # Examples
14351439
///
14361440
/// Basic usage:

src/libcore/iter/mod.rs

+14
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,21 @@
298298
//!
299299
//! This will print the numbers `0` through `4`, each on their own line.
300300
//!
301+
//! Bear in mind that methods on infinite iterators, even those for which a
302+
//! result can be determined mathematically in finite time, may not terminate.
303+
//! Specifically, methods such as [`min`], which in the general case require
304+
//! traversing every element in the iterator, are likely not to return
305+
//! successfully for any infinite iterators.
306+
//!
307+
//! ```no_run
308+
//! let ones = std::iter::repeat(1);
309+
//! let least = ones.min().unwrap(); // Oh no! An infinite loop!
310+
//! // `ones.min()` causes an infinite loop, so we won't reach this point!
311+
//! println!("The smallest number one is {}.", least);
312+
//! ```
313+
//!
301314
//! [`take`]: trait.Iterator.html#method.take
315+
//! [`min`]: trait.Iterator.html#method.min
302316
303317
#![stable(feature = "rust1", since = "1.0.0")]
304318

src/libcore/macros.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ macro_rules! debug_assert_ne {
327327
/// }
328328
/// }
329329
///
330-
/// // The prefered method of quick returning Errors
330+
/// // The preferred method of quick returning Errors
331331
/// fn write_to_file_question() -> Result<(), MyError> {
332332
/// let mut file = File::create("my_best_friends.txt")?;
333333
/// file.write_all(b"This is a list of my best friends.")?;

src/libcore/ops/arith.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ add_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
181181
/// ```
182182
#[lang = "sub"]
183183
#[stable(feature = "rust1", since = "1.0.0")]
184-
#[rustc_on_unimplemented(message="cannot substract `{RHS}` from `{Self}`",
184+
#[rustc_on_unimplemented(message="cannot subtract `{RHS}` from `{Self}`",
185185
label="no implementation for `{Self} - {RHS}`")]
186186
pub trait Sub<RHS=Self> {
187187
/// The resulting type after applying the `-` operator.
@@ -716,7 +716,7 @@ add_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
716716
/// ```
717717
#[lang = "sub_assign"]
718718
#[stable(feature = "op_assign_traits", since = "1.8.0")]
719-
#[rustc_on_unimplemented(message="cannot substract-assign `{Rhs}` from `{Self}`",
719+
#[rustc_on_unimplemented(message="cannot subtract-assign `{Rhs}` from `{Self}`",
720720
label="no implementation for `{Self} -= {Rhs}`")]
721721
pub trait SubAssign<Rhs=Self> {
722722
/// Performs the `-=` operation.

0 commit comments

Comments
 (0)