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:
This commit is contained in:
commit
6e0c5af9de
6
src/Cargo.lock
generated
6
src/Cargo.lock
generated
@ -78,7 +78,7 @@ dependencies = [
|
||||
"gcc 0.3.45 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num_cpus 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num_cpus 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"toml 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
@ -299,7 +299,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "num_cpus"
|
||||
version = "0.2.13"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -1004,7 +1004,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
"checksum mdbook 0.0.19 (registry+https://github.com/rust-lang/crates.io-index)" = "2598843aeda0c5bb2e8e4d714564f1c3fc40f7844157e34563bf96ae3866b56e"
|
||||
"checksum memchr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1dbccc0e46f1ea47b9f17e6d67c5a96bd27030519c519c9c91327e31275a47b4"
|
||||
"checksum num-traits 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)" = "e1cbfa3781f3fe73dc05321bed52a06d2d491eaa764c52335cf4399f046ece99"
|
||||
"checksum num_cpus 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "cee7e88156f3f9e19bdd598f8d6c9db7bf4078f99f8381f43a55b09648d1a6e3"
|
||||
"checksum num_cpus 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca313f1862c7ec3e0dfe8ace9fa91b1d9cb5c84ace3d00f5ec4216238e93c167"
|
||||
"checksum open 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3478ed1686bd1300c8a981a940abc92b06fac9cbef747f4c668d4e032ff7b842"
|
||||
"checksum pest 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0a6dda33d67c26f0aac90d324ab2eb7239c819fc7b2552fe9faa4fe88441edc8"
|
||||
"checksum pulldown-cmark 0.0.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9ab1e588ef8efd702c7ed9d2bd774db5e6f4d878bb5a1a9f371828fbdff6973"
|
||||
|
@ -27,7 +27,7 @@ test = false
|
||||
build_helper = { path = "../build_helper" }
|
||||
cmake = "0.1.17"
|
||||
filetime = "0.1"
|
||||
num_cpus = "0.2"
|
||||
num_cpus = "1.0"
|
||||
toml = "0.1"
|
||||
getopts = "0.2"
|
||||
rustc-serialize = "0.3"
|
||||
|
@ -367,6 +367,9 @@ class RustBuild(object):
|
||||
env["DYLD_LIBRARY_PATH"] = os.path.join(self.bin_root(), "lib") + \
|
||||
(os.pathsep + env["DYLD_LIBRARY_PATH"]) \
|
||||
if "DYLD_LIBRARY_PATH" in env else ""
|
||||
env["LIBRARY_PATH"] = os.path.join(self.bin_root(), "lib") + \
|
||||
(os.pathsep + env["LIBRARY_PATH"]) \
|
||||
if "LIBRARY_PATH" in env else ""
|
||||
env["PATH"] = os.path.join(self.bin_root(), "bin") + \
|
||||
os.pathsep + env["PATH"]
|
||||
if not os.path.isfile(self.cargo()):
|
||||
@ -407,7 +410,11 @@ class RustBuild(object):
|
||||
# The goal here is to come up with the same triple as LLVM would,
|
||||
# at least for the subset of platforms we're willing to target.
|
||||
if ostype == 'Linux':
|
||||
ostype = 'unknown-linux-gnu'
|
||||
os = subprocess.check_output(['uname', '-o']).strip().decode(default_encoding)
|
||||
if os == 'Android':
|
||||
ostype = 'linux-android'
|
||||
else:
|
||||
ostype = 'unknown-linux-gnu'
|
||||
elif ostype == 'FreeBSD':
|
||||
ostype = 'unknown-freebsd'
|
||||
elif ostype == 'DragonFly':
|
||||
@ -464,15 +471,21 @@ class RustBuild(object):
|
||||
cputype = 'i686'
|
||||
elif cputype in {'xscale', 'arm'}:
|
||||
cputype = 'arm'
|
||||
if ostype == 'linux-android':
|
||||
ostype = 'linux-androideabi'
|
||||
elif cputype == 'armv6l':
|
||||
cputype = 'arm'
|
||||
ostype += 'eabihf'
|
||||
if ostype == 'linux-android':
|
||||
ostype = 'linux-androideabi'
|
||||
else:
|
||||
ostype += 'eabihf'
|
||||
elif cputype in {'armv7l', 'armv8l'}:
|
||||
cputype = 'armv7'
|
||||
ostype += 'eabihf'
|
||||
elif cputype == 'aarch64':
|
||||
cputype = 'aarch64'
|
||||
elif cputype == 'arm64':
|
||||
if ostype == 'linux-android':
|
||||
ostype = 'linux-androideabi'
|
||||
else:
|
||||
ostype += 'eabihf'
|
||||
elif cputype in {'aarch64', 'arm64'}:
|
||||
cputype = 'aarch64'
|
||||
elif cputype == 'mips':
|
||||
if sys.byteorder == 'big':
|
||||
|
@ -51,7 +51,7 @@
|
||||
# support. You'll need to write a target specification at least, and most
|
||||
# likely, teach rustc about the C ABI of the target. Get in touch with the
|
||||
# Rust team and file an issue if you need assistance in porting!
|
||||
#targets = "X86;ARM;AArch64;Mips;PowerPC;SystemZ;JSBackend;MSP430;Sparc;NVPTX"
|
||||
#targets = "X86;ARM;AArch64;Mips;PowerPC;SystemZ;JSBackend;MSP430;Sparc;NVPTX;Hexagon"
|
||||
|
||||
# Cap the number of parallel linker invocations when compiling LLVM.
|
||||
# This can be useful when building LLVM with debug info, which significantly
|
||||
|
@ -374,13 +374,11 @@ pub fn rust_src(build: &Build) {
|
||||
|
||||
println!("Dist src");
|
||||
|
||||
let name = pkgname(build, "rust-src");
|
||||
let image = tmpdir(build).join(format!("{}-image", name));
|
||||
let _ = fs::remove_dir_all(&image);
|
||||
|
||||
let dst = image.join("lib/rustlib/src");
|
||||
let dst_src = dst.join("rust");
|
||||
t!(fs::create_dir_all(&dst_src));
|
||||
// Make sure that the root folder of tarball has the correct name
|
||||
let plain_name = format!("rustc-{}-src", build.rust_package_vers());
|
||||
let plain_dst_src = tmpdir(build).join(&plain_name);
|
||||
let _ = fs::remove_dir_all(&plain_dst_src);
|
||||
t!(fs::create_dir_all(&plain_dst_src));
|
||||
|
||||
// This is the set of root paths which will become part of the source package
|
||||
let src_files = [
|
||||
@ -429,13 +427,13 @@ pub fn rust_src(build: &Build) {
|
||||
|
||||
// Copy the directories using our filter
|
||||
for item in &src_dirs {
|
||||
let dst = &dst_src.join(item);
|
||||
let dst = &plain_dst_src.join(item);
|
||||
t!(fs::create_dir(dst));
|
||||
cp_filtered(&build.src.join(item), dst, &filter_fn);
|
||||
}
|
||||
// Copy the files normally
|
||||
for item in &src_files {
|
||||
copy(&build.src.join(item), &dst_src.join(item));
|
||||
copy(&build.src.join(item), &plain_dst_src.join(item));
|
||||
}
|
||||
|
||||
// If we're building from git sources, we need to vendor a complete distribution.
|
||||
@ -460,10 +458,63 @@ pub fn rust_src(build: &Build) {
|
||||
// Vendor all Cargo dependencies
|
||||
let mut cmd = Command::new(&build.cargo);
|
||||
cmd.arg("vendor")
|
||||
.current_dir(&dst_src.join("src"));
|
||||
.current_dir(&plain_dst_src.join("src"));
|
||||
build.run(&mut cmd);
|
||||
}
|
||||
|
||||
// Create the version file
|
||||
write_file(&plain_dst_src.join("version"), build.rust_version().as_bytes());
|
||||
|
||||
// Create plain source tarball
|
||||
let tarball = rust_src_location(build);
|
||||
if let Some(dir) = tarball.parent() {
|
||||
t!(fs::create_dir_all(dir));
|
||||
}
|
||||
let mut cmd = Command::new("tar");
|
||||
cmd.arg("-czf").arg(sanitize_sh(&tarball))
|
||||
.arg(&plain_name)
|
||||
.current_dir(tmpdir(build));
|
||||
build.run(&mut cmd);
|
||||
|
||||
|
||||
let name = pkgname(build, "rust-src");
|
||||
let image = tmpdir(build).join(format!("{}-image", name));
|
||||
let _ = fs::remove_dir_all(&image);
|
||||
|
||||
let dst = image.join("lib/rustlib/src");
|
||||
let dst_src = dst.join("rust");
|
||||
t!(fs::create_dir_all(&dst_src));
|
||||
|
||||
// This is the reduced set of paths which will become the rust-src component
|
||||
// (essentially libstd and all of its path dependencies)
|
||||
let std_src_dirs = [
|
||||
"src/build_helper",
|
||||
"src/liballoc",
|
||||
"src/liballoc_jemalloc",
|
||||
"src/liballoc_system",
|
||||
"src/libcollections",
|
||||
"src/libcompiler_builtins",
|
||||
"src/libcore",
|
||||
"src/liblibc",
|
||||
"src/libpanic_abort",
|
||||
"src/libpanic_unwind",
|
||||
"src/librand",
|
||||
"src/librustc_asan",
|
||||
"src/librustc_lsan",
|
||||
"src/librustc_msan",
|
||||
"src/librustc_tsan",
|
||||
"src/libstd",
|
||||
"src/libstd_unicode",
|
||||
"src/libunwind",
|
||||
"src/rustc/libc_shim",
|
||||
];
|
||||
|
||||
for item in &std_src_dirs {
|
||||
let dst = &dst_src.join(item);
|
||||
t!(fs::create_dir_all(dst));
|
||||
cp_r(&plain_dst_src.join(item), dst);
|
||||
}
|
||||
|
||||
// Create source tarball in rust-installer format
|
||||
let mut cmd = Command::new(SH_CMD);
|
||||
cmd.arg(sanitize_sh(&build.src.join("src/rust-installer/gen-installer.sh")))
|
||||
@ -478,23 +529,6 @@ pub fn rust_src(build: &Build) {
|
||||
.arg("--legacy-manifest-dirs=rustlib,cargo");
|
||||
build.run(&mut cmd);
|
||||
|
||||
// Rename directory, so that root folder of tarball has the correct name
|
||||
let plain_name = format!("rustc-{}-src", build.rust_package_vers());
|
||||
let plain_dst_src = tmpdir(build).join(&plain_name);
|
||||
let _ = fs::remove_dir_all(&plain_dst_src);
|
||||
t!(fs::create_dir_all(&plain_dst_src));
|
||||
cp_r(&dst_src, &plain_dst_src);
|
||||
|
||||
// Create the version file
|
||||
write_file(&plain_dst_src.join("version"), build.rust_version().as_bytes());
|
||||
|
||||
// Create plain source tarball
|
||||
let mut cmd = Command::new("tar");
|
||||
cmd.arg("-czf").arg(sanitize_sh(&rust_src_location(build)))
|
||||
.arg(&plain_name)
|
||||
.current_dir(tmpdir(build));
|
||||
build.run(&mut cmd);
|
||||
|
||||
t!(fs::remove_dir_all(&image));
|
||||
t!(fs::remove_dir_all(&plain_dst_src));
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ pub fn llvm(build: &Build, target: &str) {
|
||||
// NOTE: remember to also update `config.toml.example` when changing the defaults!
|
||||
let llvm_targets = match build.config.llvm_targets {
|
||||
Some(ref s) => s,
|
||||
None => "X86;ARM;AArch64;Mips;PowerPC;SystemZ;JSBackend;MSP430;Sparc;NVPTX",
|
||||
None => "X86;ARM;AArch64;Mips;PowerPC;SystemZ;JSBackend;MSP430;Sparc;NVPTX;Hexagon",
|
||||
};
|
||||
|
||||
let assertions = if build.config.llvm_assertions {"ON"} else {"OFF"};
|
||||
|
@ -139,6 +139,8 @@ pub fn dylib_path_var() -> &'static str {
|
||||
"PATH"
|
||||
} else if cfg!(target_os = "macos") {
|
||||
"DYLD_LIBRARY_PATH"
|
||||
} else if cfg!(target_os = "haiku") {
|
||||
"LIBRARY_PATH"
|
||||
} else {
|
||||
"LD_LIBRARY_PATH"
|
||||
}
|
||||
|
@ -86,12 +86,12 @@ macro_rules! step_impl_unsigned {
|
||||
|
||||
#[inline]
|
||||
fn replace_one(&mut self) -> Self {
|
||||
mem::replace(self, 0)
|
||||
mem::replace(self, 1)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn replace_zero(&mut self) -> Self {
|
||||
mem::replace(self, 1)
|
||||
mem::replace(self, 0)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@ -157,12 +157,12 @@ macro_rules! step_impl_signed {
|
||||
|
||||
#[inline]
|
||||
fn replace_one(&mut self) -> Self {
|
||||
mem::replace(self, 0)
|
||||
mem::replace(self, 1)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn replace_zero(&mut self) -> Self {
|
||||
mem::replace(self, 1)
|
||||
mem::replace(self, 0)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@ -206,12 +206,12 @@ macro_rules! step_impl_no_between {
|
||||
|
||||
#[inline]
|
||||
fn replace_one(&mut self) -> Self {
|
||||
mem::replace(self, 0)
|
||||
mem::replace(self, 1)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn replace_zero(&mut self) -> Self {
|
||||
mem::replace(self, 1)
|
||||
mem::replace(self, 0)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
@ -1082,3 +1082,41 @@ fn test_chain_fold() {
|
||||
assert_eq!(&[2, 3, 1, 2, 0], &result[..]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_step_replace_unsigned() {
|
||||
let mut x = 4u32;
|
||||
let y = x.replace_zero();
|
||||
assert_eq!(x, 0);
|
||||
assert_eq!(y, 4);
|
||||
|
||||
x = 5;
|
||||
let y = x.replace_one();
|
||||
assert_eq!(x, 1);
|
||||
assert_eq!(y, 5);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_step_replace_signed() {
|
||||
let mut x = 4i32;
|
||||
let y = x.replace_zero();
|
||||
assert_eq!(x, 0);
|
||||
assert_eq!(y, 4);
|
||||
|
||||
x = 5;
|
||||
let y = x.replace_one();
|
||||
assert_eq!(x, 1);
|
||||
assert_eq!(y, 5);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_step_replace_no_between() {
|
||||
let mut x = 4u128;
|
||||
let y = x.replace_zero();
|
||||
assert_eq!(x, 0);
|
||||
assert_eq!(y, 4);
|
||||
|
||||
x = 5;
|
||||
let y = x.replace_one();
|
||||
assert_eq!(x, 1);
|
||||
assert_eq!(y, 5);
|
||||
}
|
@ -20,6 +20,7 @@
|
||||
#![feature(fixed_size_array)]
|
||||
#![feature(flt2dec)]
|
||||
#![feature(fmt_internals)]
|
||||
#![feature(i128_type)]
|
||||
#![feature(iter_rfind)]
|
||||
#![feature(libc)]
|
||||
#![feature(nonzero)]
|
||||
@ -30,6 +31,7 @@
|
||||
#![feature(sort_internals)]
|
||||
#![feature(sort_unstable)]
|
||||
#![feature(step_by)]
|
||||
#![feature(step_trait)]
|
||||
#![feature(test)]
|
||||
#![feature(try_from)]
|
||||
#![feature(unicode)]
|
||||
|
@ -68,6 +68,8 @@ impl DynamicLibrary {
|
||||
"PATH"
|
||||
} else if cfg!(target_os = "macos") {
|
||||
"DYLD_LIBRARY_PATH"
|
||||
} else if cfg!(target_os = "haiku") {
|
||||
"LIBRARY_PATH"
|
||||
} else {
|
||||
"LD_LIBRARY_PATH"
|
||||
}
|
||||
|
@ -16,9 +16,10 @@ pub fn opts() -> TargetOptions {
|
||||
linker: "cc".to_string(),
|
||||
dynamic_linking: true,
|
||||
executables: true,
|
||||
has_rpath: true,
|
||||
has_rpath: false,
|
||||
target_family: Some("unix".to_string()),
|
||||
linker_is_gnu: true,
|
||||
no_integrated_as: true,
|
||||
.. Default::default()
|
||||
}
|
||||
}
|
||||
|
@ -113,6 +113,7 @@ mod imp {
|
||||
pub l_sysid: libc::c_int,
|
||||
}
|
||||
|
||||
pub const F_RDLCK: libc::c_short = 0x0040;
|
||||
pub const F_UNLCK: libc::c_short = 0x0200;
|
||||
pub const F_WRLCK: libc::c_short = 0x0400;
|
||||
pub const F_SETLK: libc::c_int = 0x0080;
|
||||
|
@ -17,30 +17,24 @@ use std::path::{PathBuf, Path};
|
||||
|
||||
use build_helper::output;
|
||||
|
||||
fn detect_llvm_link(llvm_config: &Path) -> (&'static str, Option<&'static str>) {
|
||||
let mut version_cmd = Command::new(llvm_config);
|
||||
version_cmd.arg("--version");
|
||||
let version_output = output(&mut version_cmd);
|
||||
let mut parts = version_output.split('.').take(2)
|
||||
.filter_map(|s| s.parse::<u32>().ok());
|
||||
if let (Some(major), Some(minor)) = (parts.next(), parts.next()) {
|
||||
if major > 3 || (major == 3 && minor >= 9) {
|
||||
// Force the link mode we want, preferring static by default, but
|
||||
// possibly overridden by `configure --enable-llvm-link-shared`.
|
||||
if env::var_os("LLVM_LINK_SHARED").is_some() {
|
||||
return ("dylib", Some("--link-shared"));
|
||||
} else {
|
||||
return ("static", Some("--link-static"));
|
||||
}
|
||||
} else if major == 3 && minor == 8 {
|
||||
// Find out LLVM's default linking mode.
|
||||
let mut mode_cmd = Command::new(llvm_config);
|
||||
mode_cmd.arg("--shared-mode");
|
||||
if output(&mut mode_cmd).trim() == "shared" {
|
||||
return ("dylib", None);
|
||||
} else {
|
||||
return ("static", None);
|
||||
}
|
||||
fn detect_llvm_link(major: u32, minor: u32, llvm_config: &Path)
|
||||
-> (&'static str, Option<&'static str>) {
|
||||
if major > 3 || (major == 3 && minor >= 9) {
|
||||
// Force the link mode we want, preferring static by default, but
|
||||
// possibly overridden by `configure --enable-llvm-link-shared`.
|
||||
if env::var_os("LLVM_LINK_SHARED").is_some() {
|
||||
return ("dylib", Some("--link-shared"));
|
||||
} else {
|
||||
return ("static", Some("--link-static"));
|
||||
}
|
||||
} else if major == 3 && minor == 8 {
|
||||
// Find out LLVM's default linking mode.
|
||||
let mut mode_cmd = Command::new(llvm_config);
|
||||
mode_cmd.arg("--shared-mode");
|
||||
if output(&mut mode_cmd).trim() == "shared" {
|
||||
return ("dylib", None);
|
||||
} else {
|
||||
return ("static", None);
|
||||
}
|
||||
}
|
||||
("static", None)
|
||||
@ -92,9 +86,25 @@ fn main() {
|
||||
let host = env::var("HOST").expect("HOST was not set");
|
||||
let is_crossed = target != host;
|
||||
|
||||
let optional_components =
|
||||
["x86", "arm", "aarch64", "mips", "powerpc", "pnacl", "systemz", "jsbackend", "msp430",
|
||||
"sparc", "nvptx"];
|
||||
let mut optional_components =
|
||||
vec!["x86", "arm", "aarch64", "mips", "powerpc", "pnacl",
|
||||
"systemz", "jsbackend", "msp430", "sparc", "nvptx"];
|
||||
|
||||
let mut version_cmd = Command::new(&llvm_config);
|
||||
version_cmd.arg("--version");
|
||||
let version_output = output(&mut version_cmd);
|
||||
let mut parts = version_output.split('.').take(2)
|
||||
.filter_map(|s| s.parse::<u32>().ok());
|
||||
let (major, minor) =
|
||||
if let (Some(major), Some(minor)) = (parts.next(), parts.next()) {
|
||||
(major, minor)
|
||||
} else {
|
||||
(3, 7)
|
||||
};
|
||||
|
||||
if major > 3 {
|
||||
optional_components.push("hexagon");
|
||||
}
|
||||
|
||||
// FIXME: surely we don't need all these components, right? Stuff like mcjit
|
||||
// or interpreter the compiler itself never uses.
|
||||
@ -158,7 +168,7 @@ fn main() {
|
||||
.cpp_link_stdlib(None) // we handle this below
|
||||
.compile("librustllvm.a");
|
||||
|
||||
let (llvm_kind, llvm_link_arg) = detect_llvm_link(&llvm_config);
|
||||
let (llvm_kind, llvm_link_arg) = detect_llvm_link(major, minor, &llvm_config);
|
||||
|
||||
// Link in all LLVM libraries, if we're uwring the "wrong" llvm-config then
|
||||
// we don't pick up system libs because unfortunately they're for the host
|
||||
|
@ -382,6 +382,12 @@ pub fn initialize_available_targets() {
|
||||
LLVMInitializeNVPTXTarget,
|
||||
LLVMInitializeNVPTXTargetMC,
|
||||
LLVMInitializeNVPTXAsmPrinter);
|
||||
init_target!(llvm_component = "hexagon",
|
||||
LLVMInitializeHexagonTargetInfo,
|
||||
LLVMInitializeHexagonTarget,
|
||||
LLVMInitializeHexagonTargetMC,
|
||||
LLVMInitializeHexagonAsmPrinter,
|
||||
LLVMInitializeHexagonAsmParser);
|
||||
}
|
||||
|
||||
pub fn last_error() -> Option<String> {
|
||||
|
@ -29,6 +29,7 @@ use cabi_sparc;
|
||||
use cabi_sparc64;
|
||||
use cabi_nvptx;
|
||||
use cabi_nvptx64;
|
||||
use cabi_hexagon;
|
||||
use machine::llalign_of_min;
|
||||
use type_::Type;
|
||||
use type_of;
|
||||
@ -896,6 +897,7 @@ impl<'a, 'tcx> FnType<'tcx> {
|
||||
"sparc64" => cabi_sparc64::compute_abi_info(ccx, self),
|
||||
"nvptx" => cabi_nvptx::compute_abi_info(ccx, self),
|
||||
"nvptx64" => cabi_nvptx64::compute_abi_info(ccx, self),
|
||||
"hexagon" => cabi_hexagon::compute_abi_info(ccx, self),
|
||||
a => ccx.sess().fatal(&format!("unrecognized arch \"{}\" in target specification", a))
|
||||
}
|
||||
|
||||
|
43
src/librustc_trans/cabi_hexagon.rs
Normal file
43
src/librustc_trans/cabi_hexagon.rs
Normal file
@ -0,0 +1,43 @@
|
||||
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![allow(non_upper_case_globals)]
|
||||
|
||||
use abi::{FnType, ArgType, LayoutExt};
|
||||
use context::CrateContext;
|
||||
|
||||
fn classify_ret_ty<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, ret: &mut ArgType<'tcx>) {
|
||||
if ret.layout.is_aggregate() && ret.layout.size(ccx).bits() > 64 {
|
||||
ret.make_indirect(ccx);
|
||||
} else {
|
||||
ret.extend_integer_width_to(32);
|
||||
}
|
||||
}
|
||||
|
||||
fn classify_arg_ty<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, arg: &mut ArgType<'tcx>) {
|
||||
if arg.layout.is_aggregate() && arg.layout.size(ccx).bits() > 64 {
|
||||
arg.make_indirect(ccx);
|
||||
} else {
|
||||
arg.extend_integer_width_to(32);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn compute_abi_info<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, fty: &mut FnType<'tcx>) {
|
||||
if !fty.ret.is_ignore() {
|
||||
classify_ret_ty(ccx, &mut fty.ret);
|
||||
}
|
||||
|
||||
for arg in &mut fty.args {
|
||||
if arg.is_ignore() {
|
||||
continue;
|
||||
}
|
||||
classify_arg_ty(ccx, arg);
|
||||
}
|
||||
}
|
@ -97,6 +97,7 @@ mod builder;
|
||||
mod cabi_aarch64;
|
||||
mod cabi_arm;
|
||||
mod cabi_asmjs;
|
||||
mod cabi_hexagon;
|
||||
mod cabi_mips;
|
||||
mod cabi_mips64;
|
||||
mod cabi_msp430;
|
||||
|
@ -177,6 +177,13 @@ impl TcpStream {
|
||||
///
|
||||
/// [`Shutdown`]: ../../std/net/enum.Shutdown.html
|
||||
///
|
||||
/// # Platform-specific behavior
|
||||
///
|
||||
/// Calling this function multiple times may result in different behavior,
|
||||
/// depending on the operating system. On Linux, the second call will
|
||||
/// return `Ok(())`, but on macOS, it will return `ErrorKind::NotConnected`.
|
||||
/// This may change in the future.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```no_run
|
||||
|
@ -57,9 +57,11 @@ use tokenstream::{self, Delimited, ThinTokenStream, TokenTree, TokenStream};
|
||||
use symbol::{Symbol, keywords};
|
||||
use util::ThinVec;
|
||||
|
||||
use std::cmp;
|
||||
use std::collections::HashSet;
|
||||
use std::{cmp, mem, slice};
|
||||
use std::mem;
|
||||
use std::path::{self, Path, PathBuf};
|
||||
use std::slice;
|
||||
|
||||
bitflags! {
|
||||
flags Restrictions: u8 {
|
||||
@ -5363,24 +5365,25 @@ impl<'a> Parser<'a> {
|
||||
}
|
||||
let mut err = self.diagnostic().struct_span_err(id_sp,
|
||||
"cannot declare a new module at this location");
|
||||
let this_module = match self.directory.path.file_name() {
|
||||
Some(file_name) => file_name.to_str().unwrap().to_owned(),
|
||||
None => self.root_module_name.as_ref().unwrap().clone(),
|
||||
};
|
||||
err.span_note(id_sp,
|
||||
&format!("maybe move this module `{0}` to its own directory \
|
||||
via `{0}{1}mod.rs`",
|
||||
this_module,
|
||||
path::MAIN_SEPARATOR));
|
||||
if id_sp != syntax_pos::DUMMY_SP {
|
||||
let src_path = PathBuf::from(self.sess.codemap().span_to_filename(id_sp));
|
||||
if let Some(stem) = src_path.file_stem() {
|
||||
let mut dest_path = src_path.clone();
|
||||
dest_path.set_file_name(stem);
|
||||
dest_path.push("mod.rs");
|
||||
err.span_note(id_sp,
|
||||
&format!("maybe move this module `{}` to its own \
|
||||
directory via `{}`", src_path.to_string_lossy(),
|
||||
dest_path.to_string_lossy()));
|
||||
}
|
||||
}
|
||||
if paths.path_exists {
|
||||
err.span_note(id_sp,
|
||||
&format!("... or maybe `use` the module `{}` instead \
|
||||
of possibly redeclaring it",
|
||||
paths.name));
|
||||
Err(err)
|
||||
} else {
|
||||
Err(err)
|
||||
}
|
||||
Err(err)
|
||||
} else {
|
||||
paths.result.map_err(|err| self.span_fatal_err(id_sp, err))
|
||||
}
|
||||
|
@ -39,5 +39,7 @@ fn main() {
|
||||
println!("cargo:rustc-link-lib=static-nobundle=pthread");
|
||||
} else if target.contains("fuchsia") {
|
||||
println!("cargo:rustc-link-lib=unwind");
|
||||
} else if target.contains("haiku") {
|
||||
println!("cargo:rustc-link-lib=gcc_s");
|
||||
}
|
||||
}
|
||||
|
2
src/llvm
2
src/llvm
@ -1 +1 @@
|
||||
Subproject commit a884d21cc5f0b23a1693d1e872fd8998a4fdd17f
|
||||
Subproject commit 878af191434cd716eeb13c2be7a2b1e21abf2749
|
@ -147,6 +147,12 @@ extern "C" void LLVMRustAddPass(LLVMPassManagerRef PMR, LLVMPassRef RustPass) {
|
||||
#define SUBTARGET_SPARC
|
||||
#endif
|
||||
|
||||
#ifdef LLVM_COMPONENT_HEXAGON
|
||||
#define SUBTARGET_HEXAGON SUBTARGET(Hexagon)
|
||||
#else
|
||||
#define SUBTARGET_HEXAGON
|
||||
#endif
|
||||
|
||||
#define GEN_SUBTARGETS \
|
||||
SUBTARGET_X86 \
|
||||
SUBTARGET_ARM \
|
||||
@ -155,7 +161,8 @@ extern "C" void LLVMRustAddPass(LLVMPassManagerRef PMR, LLVMPassRef RustPass) {
|
||||
SUBTARGET_PPC \
|
||||
SUBTARGET_SYSTEMZ \
|
||||
SUBTARGET_MSP430 \
|
||||
SUBTARGET_SPARC
|
||||
SUBTARGET_SPARC \
|
||||
SUBTARGET_HEXAGON
|
||||
|
||||
#define SUBTARGET(x) \
|
||||
namespace llvm { \
|
||||
|
@ -1,4 +1,4 @@
|
||||
# If this file is modified, then llvm will be (optionally) cleaned and then rebuilt.
|
||||
# The actual contents of this file do not matter, but to trigger a change on the
|
||||
# build bots then the contents should be changed so git updates the mtime.
|
||||
2017-03-23
|
||||
2017-04-25
|
||||
|
18
src/test/run-pass/issue-33287.rs
Normal file
18
src/test/run-pass/issue-33287.rs
Normal file
@ -0,0 +1,18 @@
|
||||
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
const A: [u32; 1] = [0];
|
||||
|
||||
fn test() {
|
||||
let range = A[1]..;
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
|
11
src/test/ui/invalid-module-declaration/auxiliary/foo/bar.rs
Normal file
11
src/test/ui/invalid-module-declaration/auxiliary/foo/bar.rs
Normal file
@ -0,0 +1,11 @@
|
||||
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
pub mod baz;
|
11
src/test/ui/invalid-module-declaration/auxiliary/foo/mod.rs
Normal file
11
src/test/ui/invalid-module-declaration/auxiliary/foo/mod.rs
Normal file
@ -0,0 +1,11 @@
|
||||
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
pub mod bar;
|
@ -0,0 +1,20 @@
|
||||
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// ignore-tidy-linelength
|
||||
|
||||
// error-pattern: cannot declare a new module at this location
|
||||
// error-pattern: maybe move this module
|
||||
|
||||
mod auxiliary {
|
||||
mod foo;
|
||||
}
|
||||
|
||||
fn main() {}
|
@ -0,0 +1,14 @@
|
||||
error: cannot declare a new module at this location
|
||||
--> $DIR/auxiliary/foo/bar.rs:11:9
|
||||
|
|
||||
11 | pub mod baz;
|
||||
| ^^^
|
||||
|
|
||||
note: maybe move this module `$DIR/auxiliary/foo/bar.rs` to its own directory via `$DIR/auxiliary/foo/bar/mod.rs`
|
||||
--> $DIR/auxiliary/foo/bar.rs:11:9
|
||||
|
|
||||
11 | pub mod baz;
|
||||
| ^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -20,6 +20,8 @@ pub fn dylib_env_var() -> &'static str {
|
||||
"PATH"
|
||||
} else if cfg!(target_os = "macos") {
|
||||
"DYLD_LIBRARY_PATH"
|
||||
} else if cfg!(target_os = "haiku") {
|
||||
"LIBRARY_PATH"
|
||||
} else {
|
||||
"LD_LIBRARY_PATH"
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user