Skip to content

Commit 6e0c5af

Browse files
committed
Auto merge of #41567 - arielb1:rollup, r=arielb1
Rollup of 9 pull requests - Successful merges: #41370, #41456, #41493, #41499, #41501, #41524, #41546, #41550, #41552 - Failed merges:
2 parents 612847b + 60837b1 commit 6e0c5af

File tree

30 files changed

+340
-90
lines changed

30 files changed

+340
-90
lines changed

src/Cargo.lock

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

src/bootstrap/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ test = false
2727
build_helper = { path = "../build_helper" }
2828
cmake = "0.1.17"
2929
filetime = "0.1"
30-
num_cpus = "0.2"
30+
num_cpus = "1.0"
3131
toml = "0.1"
3232
getopts = "0.2"
3333
rustc-serialize = "0.3"

src/bootstrap/bootstrap.py

+19-6
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,9 @@ def build_bootstrap(self):
367367
env["DYLD_LIBRARY_PATH"] = os.path.join(self.bin_root(), "lib") + \
368368
(os.pathsep + env["DYLD_LIBRARY_PATH"]) \
369369
if "DYLD_LIBRARY_PATH" in env else ""
370+
env["LIBRARY_PATH"] = os.path.join(self.bin_root(), "lib") + \
371+
(os.pathsep + env["LIBRARY_PATH"]) \
372+
if "LIBRARY_PATH" in env else ""
370373
env["PATH"] = os.path.join(self.bin_root(), "bin") + \
371374
os.pathsep + env["PATH"]
372375
if not os.path.isfile(self.cargo()):
@@ -407,7 +410,11 @@ def build_triple(self):
407410
# The goal here is to come up with the same triple as LLVM would,
408411
# at least for the subset of platforms we're willing to target.
409412
if ostype == 'Linux':
410-
ostype = 'unknown-linux-gnu'
413+
os = subprocess.check_output(['uname', '-o']).strip().decode(default_encoding)
414+
if os == 'Android':
415+
ostype = 'linux-android'
416+
else:
417+
ostype = 'unknown-linux-gnu'
411418
elif ostype == 'FreeBSD':
412419
ostype = 'unknown-freebsd'
413420
elif ostype == 'DragonFly':
@@ -464,15 +471,21 @@ def build_triple(self):
464471
cputype = 'i686'
465472
elif cputype in {'xscale', 'arm'}:
466473
cputype = 'arm'
474+
if ostype == 'linux-android':
475+
ostype = 'linux-androideabi'
467476
elif cputype == 'armv6l':
468477
cputype = 'arm'
469-
ostype += 'eabihf'
478+
if ostype == 'linux-android':
479+
ostype = 'linux-androideabi'
480+
else:
481+
ostype += 'eabihf'
470482
elif cputype in {'armv7l', 'armv8l'}:
471483
cputype = 'armv7'
472-
ostype += 'eabihf'
473-
elif cputype == 'aarch64':
474-
cputype = 'aarch64'
475-
elif cputype == 'arm64':
484+
if ostype == 'linux-android':
485+
ostype = 'linux-androideabi'
486+
else:
487+
ostype += 'eabihf'
488+
elif cputype in {'aarch64', 'arm64'}:
476489
cputype = 'aarch64'
477490
elif cputype == 'mips':
478491
if sys.byteorder == 'big':

src/bootstrap/config.toml.example

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
# support. You'll need to write a target specification at least, and most
5252
# likely, teach rustc about the C ABI of the target. Get in touch with the
5353
# Rust team and file an issue if you need assistance in porting!
54-
#targets = "X86;ARM;AArch64;Mips;PowerPC;SystemZ;JSBackend;MSP430;Sparc;NVPTX"
54+
#targets = "X86;ARM;AArch64;Mips;PowerPC;SystemZ;JSBackend;MSP430;Sparc;NVPTX;Hexagon"
5555

5656
# Cap the number of parallel linker invocations when compiling LLVM.
5757
# This can be useful when building LLVM with debug info, which significantly

src/bootstrap/dist.rs

+61-27
Original file line numberDiff line numberDiff line change
@@ -374,13 +374,11 @@ pub fn rust_src(build: &Build) {
374374

375375
println!("Dist src");
376376

377-
let name = pkgname(build, "rust-src");
378-
let image = tmpdir(build).join(format!("{}-image", name));
379-
let _ = fs::remove_dir_all(&image);
380-
381-
let dst = image.join("lib/rustlib/src");
382-
let dst_src = dst.join("rust");
383-
t!(fs::create_dir_all(&dst_src));
377+
// Make sure that the root folder of tarball has the correct name
378+
let plain_name = format!("rustc-{}-src", build.rust_package_vers());
379+
let plain_dst_src = tmpdir(build).join(&plain_name);
380+
let _ = fs::remove_dir_all(&plain_dst_src);
381+
t!(fs::create_dir_all(&plain_dst_src));
384382

385383
// This is the set of root paths which will become part of the source package
386384
let src_files = [
@@ -429,13 +427,13 @@ pub fn rust_src(build: &Build) {
429427

430428
// Copy the directories using our filter
431429
for item in &src_dirs {
432-
let dst = &dst_src.join(item);
430+
let dst = &plain_dst_src.join(item);
433431
t!(fs::create_dir(dst));
434432
cp_filtered(&build.src.join(item), dst, &filter_fn);
435433
}
436434
// Copy the files normally
437435
for item in &src_files {
438-
copy(&build.src.join(item), &dst_src.join(item));
436+
copy(&build.src.join(item), &plain_dst_src.join(item));
439437
}
440438

441439
// If we're building from git sources, we need to vendor a complete distribution.
@@ -460,10 +458,63 @@ pub fn rust_src(build: &Build) {
460458
// Vendor all Cargo dependencies
461459
let mut cmd = Command::new(&build.cargo);
462460
cmd.arg("vendor")
463-
.current_dir(&dst_src.join("src"));
461+
.current_dir(&plain_dst_src.join("src"));
464462
build.run(&mut cmd);
465463
}
466464

465+
// Create the version file
466+
write_file(&plain_dst_src.join("version"), build.rust_version().as_bytes());
467+
468+
// Create plain source tarball
469+
let tarball = rust_src_location(build);
470+
if let Some(dir) = tarball.parent() {
471+
t!(fs::create_dir_all(dir));
472+
}
473+
let mut cmd = Command::new("tar");
474+
cmd.arg("-czf").arg(sanitize_sh(&tarball))
475+
.arg(&plain_name)
476+
.current_dir(tmpdir(build));
477+
build.run(&mut cmd);
478+
479+
480+
let name = pkgname(build, "rust-src");
481+
let image = tmpdir(build).join(format!("{}-image", name));
482+
let _ = fs::remove_dir_all(&image);
483+
484+
let dst = image.join("lib/rustlib/src");
485+
let dst_src = dst.join("rust");
486+
t!(fs::create_dir_all(&dst_src));
487+
488+
// This is the reduced set of paths which will become the rust-src component
489+
// (essentially libstd and all of its path dependencies)
490+
let std_src_dirs = [
491+
"src/build_helper",
492+
"src/liballoc",
493+
"src/liballoc_jemalloc",
494+
"src/liballoc_system",
495+
"src/libcollections",
496+
"src/libcompiler_builtins",
497+
"src/libcore",
498+
"src/liblibc",
499+
"src/libpanic_abort",
500+
"src/libpanic_unwind",
501+
"src/librand",
502+
"src/librustc_asan",
503+
"src/librustc_lsan",
504+
"src/librustc_msan",
505+
"src/librustc_tsan",
506+
"src/libstd",
507+
"src/libstd_unicode",
508+
"src/libunwind",
509+
"src/rustc/libc_shim",
510+
];
511+
512+
for item in &std_src_dirs {
513+
let dst = &dst_src.join(item);
514+
t!(fs::create_dir_all(dst));
515+
cp_r(&plain_dst_src.join(item), dst);
516+
}
517+
467518
// Create source tarball in rust-installer format
468519
let mut cmd = Command::new(SH_CMD);
469520
cmd.arg(sanitize_sh(&build.src.join("src/rust-installer/gen-installer.sh")))
@@ -478,23 +529,6 @@ pub fn rust_src(build: &Build) {
478529
.arg("--legacy-manifest-dirs=rustlib,cargo");
479530
build.run(&mut cmd);
480531

481-
// Rename directory, so that root folder of tarball has the correct name
482-
let plain_name = format!("rustc-{}-src", build.rust_package_vers());
483-
let plain_dst_src = tmpdir(build).join(&plain_name);
484-
let _ = fs::remove_dir_all(&plain_dst_src);
485-
t!(fs::create_dir_all(&plain_dst_src));
486-
cp_r(&dst_src, &plain_dst_src);
487-
488-
// Create the version file
489-
write_file(&plain_dst_src.join("version"), build.rust_version().as_bytes());
490-
491-
// Create plain source tarball
492-
let mut cmd = Command::new("tar");
493-
cmd.arg("-czf").arg(sanitize_sh(&rust_src_location(build)))
494-
.arg(&plain_name)
495-
.current_dir(tmpdir(build));
496-
build.run(&mut cmd);
497-
498532
t!(fs::remove_dir_all(&image));
499533
t!(fs::remove_dir_all(&plain_dst_src));
500534
}

src/bootstrap/native.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ pub fn llvm(build: &Build, target: &str) {
8181
// NOTE: remember to also update `config.toml.example` when changing the defaults!
8282
let llvm_targets = match build.config.llvm_targets {
8383
Some(ref s) => s,
84-
None => "X86;ARM;AArch64;Mips;PowerPC;SystemZ;JSBackend;MSP430;Sparc;NVPTX",
84+
None => "X86;ARM;AArch64;Mips;PowerPC;SystemZ;JSBackend;MSP430;Sparc;NVPTX;Hexagon",
8585
};
8686

8787
let assertions = if build.config.llvm_assertions {"ON"} else {"OFF"};

src/bootstrap/util.rs

+2
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ pub fn dylib_path_var() -> &'static str {
139139
"PATH"
140140
} else if cfg!(target_os = "macos") {
141141
"DYLD_LIBRARY_PATH"
142+
} else if cfg!(target_os = "haiku") {
143+
"LIBRARY_PATH"
142144
} else {
143145
"LD_LIBRARY_PATH"
144146
}

src/libcore/iter/range.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,12 @@ macro_rules! step_impl_unsigned {
8686

8787
#[inline]
8888
fn replace_one(&mut self) -> Self {
89-
mem::replace(self, 0)
89+
mem::replace(self, 1)
9090
}
9191

9292
#[inline]
9393
fn replace_zero(&mut self) -> Self {
94-
mem::replace(self, 1)
94+
mem::replace(self, 0)
9595
}
9696

9797
#[inline]
@@ -157,12 +157,12 @@ macro_rules! step_impl_signed {
157157

158158
#[inline]
159159
fn replace_one(&mut self) -> Self {
160-
mem::replace(self, 0)
160+
mem::replace(self, 1)
161161
}
162162

163163
#[inline]
164164
fn replace_zero(&mut self) -> Self {
165-
mem::replace(self, 1)
165+
mem::replace(self, 0)
166166
}
167167

168168
#[inline]
@@ -206,12 +206,12 @@ macro_rules! step_impl_no_between {
206206

207207
#[inline]
208208
fn replace_one(&mut self) -> Self {
209-
mem::replace(self, 0)
209+
mem::replace(self, 1)
210210
}
211211

212212
#[inline]
213213
fn replace_zero(&mut self) -> Self {
214-
mem::replace(self, 1)
214+
mem::replace(self, 0)
215215
}
216216

217217
#[inline]

src/libcore/tests/iter.rs

+38
Original file line numberDiff line numberDiff line change
@@ -1082,3 +1082,41 @@ fn test_chain_fold() {
10821082
assert_eq!(&[2, 3, 1, 2, 0], &result[..]);
10831083
}
10841084

1085+
#[test]
1086+
fn test_step_replace_unsigned() {
1087+
let mut x = 4u32;
1088+
let y = x.replace_zero();
1089+
assert_eq!(x, 0);
1090+
assert_eq!(y, 4);
1091+
1092+
x = 5;
1093+
let y = x.replace_one();
1094+
assert_eq!(x, 1);
1095+
assert_eq!(y, 5);
1096+
}
1097+
1098+
#[test]
1099+
fn test_step_replace_signed() {
1100+
let mut x = 4i32;
1101+
let y = x.replace_zero();
1102+
assert_eq!(x, 0);
1103+
assert_eq!(y, 4);
1104+
1105+
x = 5;
1106+
let y = x.replace_one();
1107+
assert_eq!(x, 1);
1108+
assert_eq!(y, 5);
1109+
}
1110+
1111+
#[test]
1112+
fn test_step_replace_no_between() {
1113+
let mut x = 4u128;
1114+
let y = x.replace_zero();
1115+
assert_eq!(x, 0);
1116+
assert_eq!(y, 4);
1117+
1118+
x = 5;
1119+
let y = x.replace_one();
1120+
assert_eq!(x, 1);
1121+
assert_eq!(y, 5);
1122+
}

src/libcore/tests/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#![feature(fixed_size_array)]
2121
#![feature(flt2dec)]
2222
#![feature(fmt_internals)]
23+
#![feature(i128_type)]
2324
#![feature(iter_rfind)]
2425
#![feature(libc)]
2526
#![feature(nonzero)]
@@ -30,6 +31,7 @@
3031
#![feature(sort_internals)]
3132
#![feature(sort_unstable)]
3233
#![feature(step_by)]
34+
#![feature(step_trait)]
3335
#![feature(test)]
3436
#![feature(try_from)]
3537
#![feature(unicode)]

src/librustc_back/dynamic_lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ impl DynamicLibrary {
6868
"PATH"
6969
} else if cfg!(target_os = "macos") {
7070
"DYLD_LIBRARY_PATH"
71+
} else if cfg!(target_os = "haiku") {
72+
"LIBRARY_PATH"
7173
} else {
7274
"LD_LIBRARY_PATH"
7375
}

src/librustc_back/target/haiku_base.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ pub fn opts() -> TargetOptions {
1616
linker: "cc".to_string(),
1717
dynamic_linking: true,
1818
executables: true,
19-
has_rpath: true,
19+
has_rpath: false,
2020
target_family: Some("unix".to_string()),
2121
linker_is_gnu: true,
22+
no_integrated_as: true,
2223
.. Default::default()
2324
}
2425
}

src/librustc_data_structures/flock.rs

+1
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ mod imp {
113113
pub l_sysid: libc::c_int,
114114
}
115115

116+
pub const F_RDLCK: libc::c_short = 0x0040;
116117
pub const F_UNLCK: libc::c_short = 0x0200;
117118
pub const F_WRLCK: libc::c_short = 0x0400;
118119
pub const F_SETLK: libc::c_int = 0x0080;

0 commit comments

Comments
 (0)