Skip to content

Commit d5e3164

Browse files
committed
Auto merge of #48113 - kennytm:rollup, r=kennytm
Rollup of 16 pull requests - Successful merges: #47790, #47835, #47854, #48015, #48047, #48051, #48058, #48059, #48064, #48078, #48080, #48086, #48098, #48101, #48107, #48100 - Failed merges:
2 parents 39abcc0 + 8550ac8 commit d5e3164

File tree

41 files changed

+360
-518
lines changed

Some content is hidden

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

41 files changed

+360
-518
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

+22-5
Original file line numberDiff line numberDiff line change
@@ -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/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/doc/nomicon

src/doc/reference

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/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.

src/libcore/sync/atomic.rs

+46
Original file line numberDiff line numberDiff line change
@@ -945,6 +945,7 @@ macro_rules! atomic_int {
945945
$stable_debug:meta,
946946
$stable_access:meta,
947947
$stable_from:meta,
948+
$stable_nand:meta,
948949
$s_int_type:expr, $int_ref:expr,
949950
$int_type:ident $atomic_type:ident $atomic_init:ident) => {
950951
/// An integer type which can be safely shared between threads.
@@ -1325,6 +1326,29 @@ macro_rules! atomic_int {
13251326
unsafe { atomic_and(self.v.get(), val, order) }
13261327
}
13271328

1329+
/// Bitwise "nand" with the current value.
1330+
///
1331+
/// Performs a bitwise "nand" operation on the current value and the argument `val`, and
1332+
/// sets the new value to the result.
1333+
///
1334+
/// Returns the previous value.
1335+
///
1336+
/// # Examples
1337+
///
1338+
/// ```
1339+
/// #![feature(atomic_nand)]
1340+
///
1341+
/// use std::sync::atomic::{AtomicIsize, Ordering};
1342+
///
1343+
/// let foo = AtomicIsize::new(0xf731);
1344+
/// assert_eq!(foo.fetch_nand(0x137f, Ordering::SeqCst), 0xf731);
1345+
/// assert_eq!(foo.load(Ordering::SeqCst), !(0xf731 & 0x137f));
1346+
#[inline]
1347+
#[$stable_nand]
1348+
pub fn fetch_nand(&self, val: $int_type, order: Ordering) -> $int_type {
1349+
unsafe { atomic_nand(self.v.get(), val, order) }
1350+
}
1351+
13281352
/// Bitwise "or" with the current value.
13291353
///
13301354
/// Performs a bitwise "or" operation on the current value and the argument `val`, and
@@ -1377,6 +1401,7 @@ atomic_int! {
13771401
unstable(feature = "integer_atomics", issue = "32976"),
13781402
unstable(feature = "integer_atomics", issue = "32976"),
13791403
unstable(feature = "integer_atomics", issue = "32976"),
1404+
unstable(feature = "atomic_nand", issue = "13226"),
13801405
"i8", "../../../std/primitive.i8.html",
13811406
i8 AtomicI8 ATOMIC_I8_INIT
13821407
}
@@ -1387,6 +1412,7 @@ atomic_int! {
13871412
unstable(feature = "integer_atomics", issue = "32976"),
13881413
unstable(feature = "integer_atomics", issue = "32976"),
13891414
unstable(feature = "integer_atomics", issue = "32976"),
1415+
unstable(feature = "atomic_nand", issue = "13226"),
13901416
"u8", "../../../std/primitive.u8.html",
13911417
u8 AtomicU8 ATOMIC_U8_INIT
13921418
}
@@ -1397,6 +1423,7 @@ atomic_int! {
13971423
unstable(feature = "integer_atomics", issue = "32976"),
13981424
unstable(feature = "integer_atomics", issue = "32976"),
13991425
unstable(feature = "integer_atomics", issue = "32976"),
1426+
unstable(feature = "atomic_nand", issue = "13226"),
14001427
"i16", "../../../std/primitive.i16.html",
14011428
i16 AtomicI16 ATOMIC_I16_INIT
14021429
}
@@ -1407,6 +1434,7 @@ atomic_int! {
14071434
unstable(feature = "integer_atomics", issue = "32976"),
14081435
unstable(feature = "integer_atomics", issue = "32976"),
14091436
unstable(feature = "integer_atomics", issue = "32976"),
1437+
unstable(feature = "atomic_nand", issue = "13226"),
14101438
"u16", "../../../std/primitive.u16.html",
14111439
u16 AtomicU16 ATOMIC_U16_INIT
14121440
}
@@ -1417,6 +1445,7 @@ atomic_int! {
14171445
unstable(feature = "integer_atomics", issue = "32976"),
14181446
unstable(feature = "integer_atomics", issue = "32976"),
14191447
unstable(feature = "integer_atomics", issue = "32976"),
1448+
unstable(feature = "atomic_nand", issue = "13226"),
14201449
"i32", "../../../std/primitive.i32.html",
14211450
i32 AtomicI32 ATOMIC_I32_INIT
14221451
}
@@ -1427,6 +1456,7 @@ atomic_int! {
14271456
unstable(feature = "integer_atomics", issue = "32976"),
14281457
unstable(feature = "integer_atomics", issue = "32976"),
14291458
unstable(feature = "integer_atomics", issue = "32976"),
1459+
unstable(feature = "atomic_nand", issue = "13226"),
14301460
"u32", "../../../std/primitive.u32.html",
14311461
u32 AtomicU32 ATOMIC_U32_INIT
14321462
}
@@ -1437,6 +1467,7 @@ atomic_int! {
14371467
unstable(feature = "integer_atomics", issue = "32976"),
14381468
unstable(feature = "integer_atomics", issue = "32976"),
14391469
unstable(feature = "integer_atomics", issue = "32976"),
1470+
unstable(feature = "atomic_nand", issue = "13226"),
14401471
"i64", "../../../std/primitive.i64.html",
14411472
i64 AtomicI64 ATOMIC_I64_INIT
14421473
}
@@ -1447,6 +1478,7 @@ atomic_int! {
14471478
unstable(feature = "integer_atomics", issue = "32976"),
14481479
unstable(feature = "integer_atomics", issue = "32976"),
14491480
unstable(feature = "integer_atomics", issue = "32976"),
1481+
unstable(feature = "atomic_nand", issue = "13226"),
14501482
"u64", "../../../std/primitive.u64.html",
14511483
u64 AtomicU64 ATOMIC_U64_INIT
14521484
}
@@ -1457,6 +1489,7 @@ atomic_int!{
14571489
stable(feature = "atomic_debug", since = "1.3.0"),
14581490
stable(feature = "atomic_access", since = "1.15.0"),
14591491
stable(feature = "atomic_from", since = "1.23.0"),
1492+
unstable(feature = "atomic_nand", issue = "13226"),
14601493
"isize", "../../../std/primitive.isize.html",
14611494
isize AtomicIsize ATOMIC_ISIZE_INIT
14621495
}
@@ -1467,6 +1500,7 @@ atomic_int!{
14671500
stable(feature = "atomic_debug", since = "1.3.0"),
14681501
stable(feature = "atomic_access", since = "1.15.0"),
14691502
stable(feature = "atomic_from", since = "1.23.0"),
1503+
unstable(feature = "atomic_nand", issue = "13226"),
14701504
"usize", "../../../std/primitive.usize.html",
14711505
usize AtomicUsize ATOMIC_USIZE_INIT
14721506
}
@@ -1609,6 +1643,18 @@ unsafe fn atomic_and<T>(dst: *mut T, val: T, order: Ordering) -> T {
16091643
}
16101644
}
16111645

1646+
#[inline]
1647+
unsafe fn atomic_nand<T>(dst: *mut T, val: T, order: Ordering) -> T {
1648+
match order {
1649+
Acquire => intrinsics::atomic_nand_acq(dst, val),
1650+
Release => intrinsics::atomic_nand_rel(dst, val),
1651+
AcqRel => intrinsics::atomic_nand_acqrel(dst, val),
1652+
Relaxed => intrinsics::atomic_nand_relaxed(dst, val),
1653+
SeqCst => intrinsics::atomic_nand(dst, val),
1654+
__Nonexhaustive => panic!("invalid memory ordering"),
1655+
}
1656+
}
1657+
16121658
#[inline]
16131659
unsafe fn atomic_or<T>(dst: *mut T, val: T, order: Ordering) -> T {
16141660
match order {

0 commit comments

Comments
 (0)