diff options
Diffstat (limited to 'src')
39 files changed, 73 insertions, 775 deletions
diff --git a/src/Cargo.lock b/src/Cargo.lock index 155c69eb8a2..6d814619eb6 100644 --- a/src/Cargo.lock +++ b/src/Cargo.lock @@ -99,6 +99,7 @@ name = "compiletest" version = "0.0.0" dependencies = [ "env_logger 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", ] diff --git a/src/bootstrap/channel.rs b/src/bootstrap/channel.rs index 585d9f51b92..81e745bc76c 100644 --- a/src/bootstrap/channel.rs +++ b/src/bootstrap/channel.rs @@ -15,55 +15,45 @@ //! `package_vers`, and otherwise indicating to the compiler what it should //! print out as part of its version information. -use std::fs::File; -use std::io::prelude::*; use std::process::Command; use build_helper::output; use Build; -pub fn collect(build: &mut Build) { - // Currently the canonical source for the release number (e.g. 1.10.0) and - // the prerelease version (e.g. `.1`) is in `mk/main.mk`. We "parse" that - // here to learn about those numbers. - let mut main_mk = String::new(); - t!(t!(File::open(build.src.join("mk/main.mk"))).read_to_string(&mut main_mk)); - let mut release_num = ""; - let mut prerelease_version = ""; - for line in main_mk.lines() { - if line.starts_with("CFG_RELEASE_NUM") { - release_num = line.split('=').skip(1).next().unwrap().trim(); - } - if line.starts_with("CFG_PRERELEASE_VERSION") { - prerelease_version = line.split('=').skip(1).next().unwrap().trim(); - } - } +// The version number +const CFG_RELEASE_NUM: &'static str = "1.17.0"; + +// An optional number to put after the label, e.g. '.2' -> '-beta.2' +// Be sure to make this starts with a dot to conform to semver pre-release +// versions (section 9) +const CFG_PRERELEASE_VERSION: &'static str = ".1"; - build.release_num = release_num.to_string(); - build.prerelease_version = release_num.to_string(); +pub fn collect(build: &mut Build) { + build.release_num = CFG_RELEASE_NUM.to_string(); + build.prerelease_version = CFG_RELEASE_NUM.to_string(); // Depending on the channel, passed in `./configure --release-channel`, // determine various properties of the build. match &build.config.channel[..] { "stable" => { - build.release = release_num.to_string(); + build.release = CFG_RELEASE_NUM.to_string(); build.package_vers = build.release.clone(); build.unstable_features = false; } "beta" => { - build.release = format!("{}-beta{}", release_num, - prerelease_version); + build.release = format!("{}-beta{}", CFG_RELEASE_NUM, + CFG_PRERELEASE_VERSION); build.package_vers = "beta".to_string(); build.unstable_features = false; } "nightly" => { - build.release = format!("{}-nightly", release_num); + build.release = format!("{}-nightly", CFG_RELEASE_NUM); build.package_vers = "nightly".to_string(); build.unstable_features = true; } _ => { - build.release = format!("{}-dev", release_num); + build.release = format!("{}-dev", CFG_RELEASE_NUM); build.package_vers = build.release.clone(); build.unstable_features = true; } diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index 9327cc0cf7f..1c3901bf2a1 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -381,13 +381,11 @@ pub fn rust_src(build: &Build) { "README.md", "RELEASES.md", "configure", - "Makefile.in", "x.py", ]; let src_dirs = [ "man", "src", - "mk" ]; let filter_fn = move |path: &Path| { diff --git a/src/bootstrap/mk/Makefile.in b/src/bootstrap/mk/Makefile.in index d6f6a7772c9..536095503e0 100644 --- a/src/bootstrap/mk/Makefile.in +++ b/src/bootstrap/mk/Makefile.in @@ -9,11 +9,12 @@ # except according to those terms. include config.mk -include $(CFG_SRC_DIR)mk/util.mk ifdef VERBOSE +Q := BOOTSTRAP_ARGS := -v else +Q := @ BOOTSTRAP_ARGS := endif diff --git a/src/ci/docker/x86_64-gnu-make/Dockerfile b/src/ci/docker/x86_64-gnu-make/Dockerfile deleted file mode 100644 index c6071d704f5..00000000000 --- a/src/ci/docker/x86_64-gnu-make/Dockerfile +++ /dev/null @@ -1,26 +0,0 @@ -FROM ubuntu:16.04 - -RUN apt-get update && apt-get install -y --no-install-recommends \ - g++ \ - make \ - file \ - curl \ - ca-certificates \ - python2.7 \ - git \ - cmake \ - sudo \ - gdb \ - xz-utils - -ENV SCCACHE_DIGEST=7237e38e029342fa27b7ac25412cb9d52554008b12389727320bd533fd7f05b6a96d55485f305caf95e5c8f5f97c3313e10012ccad3e752aba2518f3522ba783 -RUN curl -L https://api.pub.build.mozilla.org/tooltool/sha512/$SCCACHE_DIGEST | \ - tar xJf - -C /usr/local/bin --strip-components=1 - -RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \ - dpkg -i dumb-init_*.deb && \ - rm dumb-init_*.deb -ENTRYPOINT ["/usr/bin/dumb-init", "--"] - -ENV RUST_CONFIGURE_ARGS --build=x86_64-unknown-linux-gnu --disable-rustbuild -ENV RUST_CHECK_TARGET check diff --git a/src/etc/Dockerfile b/src/etc/Dockerfile deleted file mode 100644 index 83d54789ff3..00000000000 --- a/src/etc/Dockerfile +++ /dev/null @@ -1,27 +0,0 @@ -FROM ubuntu:xenial - -# curl -# Download stage0, see src/bootstrap/bootstrap.py -# g++ -# Compile LLVM binding in src/rustllvm -# gdb -# Used to run tests in src/test/debuginfo -# git -# Get commit hash and commit date in version string -# make -# Run build scripts in mk -# libedit-dev zlib1g-dev -# LLVM dependencies as packaged in Ubuntu -# (They are optional, but Ubuntu package enables them) -# llvm-3.7-dev (installed by llvm-3.7-tools) -# LLVM -# llvm-3.7-tools -# FileCheck is used to run tests in src/test/codegen - -RUN apt-get update && apt-get -y install \ - curl g++ gdb git make \ - libedit-dev zlib1g-dev \ - llvm-3.7-tools cmake - -RUN mkdir /build -WORKDIR /build diff --git a/src/etc/apple-darwin.supp b/src/etc/apple-darwin.supp deleted file mode 100644 index 50e30caa2b3..00000000000 --- a/src/etc/apple-darwin.supp +++ /dev/null @@ -1,75 +0,0 @@ -{ - osx-frameworks.rs-fails-otherwise-1 - Memcheck:Leak - match-leak-kinds: definite,possible - fun:malloc - ... - fun:__CFInitialize - ... -} - -{ - osx-frameworks.rs-fails-otherwise-2 - Memcheck:Leak - match-leak-kinds: possible - fun:malloc_zone_calloc - ... - fun:__CFInitialize - fun:_ZN16ImageLoaderMachO11doImageInitERKN11ImageLoader11LinkContextE -} - -{ - osx-frameworks.rs-fails-otherwise-3 - Memcheck:Leak - match-leak-kinds: possible - fun:realloc - ... - fun:_read_images - fun:map_images_nolock - ... - fun:_ZN4dyldL18notifyBatchPartialE17dyld_image_statesbPFPKcS0_jPK15dyld_image_infoE - fun:_ZN4dyld36registerImageStateBatchChangeHandlerE17dyld_image_statesPFPKcS0_jPK15dyld_image_infoE - fun:dyld_register_image_state_change_handler - fun:_objc_init - fun:_os_object_init -} - -{ - osx-frameworks.rs-fails-otherwise-4 - Memcheck:Leak - match-leak-kinds: definite,possible - fun:calloc - ... - fun:__CFInitialize - fun:_ZN16ImageLoaderMachO11doImageInitERKN11ImageLoader11LinkContextE - fun:_ZN16ImageLoaderMachO16doInitializationERKN11ImageLoader11LinkContextE - fun:_ZN11ImageLoader23recursiveInitializationERKNS_11LinkContextEjRNS_21InitializerTimingListERNS_15UninitedUpwardsE -} - -{ - osx-frameworks.rs-fails-otherwise-5 - Memcheck:Leak - match-leak-kinds: definite,possible - fun:malloc_zone_malloc - ... - fun:__CFInitialize - ... -} - -{ - fails-since-xcode-7.2 - Memcheck:Leak - match-leak-kinds: possible - fun:malloc_zone_malloc - fun:_objc_copyClassNamesForImage - fun:_ZL9protocolsv - fun:_Z9readClassP10objc_classbb - fun:gc_init - fun:_ZL33objc_initializeClassPair_internalP10objc_classPKcS0_S0_ - fun:layout_string_create - fun:_ZL12realizeClassP10objc_class - fun:_ZL22copySwiftV1MangledNamePKcb - fun:_ZL22copySwiftV1MangledNamePKcb - fun:_ZL22copySwiftV1MangledNamePKcb - fun:_ZL22copySwiftV1MangledNamePKcb -} diff --git a/src/etc/check-sanitycheck.py b/src/etc/check-sanitycheck.py deleted file mode 100644 index 0e103fbcffb..00000000000 --- a/src/etc/check-sanitycheck.py +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2012-2014 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. - -import os -import subprocess -import sys -import functools - -STATUS = 0 - -def error_unless_permitted(env_var, message): - global STATUS - if not os.getenv(env_var): - sys.stderr.write(message) - STATUS = 1 - -def only_on(platforms): - def decorator(func): - @functools.wraps(func) - def inner(): - if any(map(lambda x: sys.platform.startswith(x), platforms)): - func() - return inner - return decorator - -@only_on(['linux', 'darwin', 'freebsd', 'openbsd']) -def check_rlimit_core(): - import resource - soft, hard = resource.getrlimit(resource.RLIMIT_CORE) - if soft > 0: - error_unless_permitted('ALLOW_NONZERO_RLIMIT_CORE', """\ -RLIMIT_CORE is set to a nonzero value (%d). During debuginfo, the test suite -will segfault many rustc's, creating many potentially large core files. -set ALLOW_NONZERO_RLIMIT_CORE to ignore this warning -""" % (soft)) - -@only_on(['win32']) -def check_console_code_page(): - if '65001' not in subprocess.check_output(['cmd', '/c', 'chcp']): - sys.stderr.write('Warning: the console output code page is not UTF-8, \ -some tests may fail. Use `cmd /c "chcp 65001"` to setup UTF-8 code page.\n') - -def main(): - check_console_code_page() - check_rlimit_core() - -if __name__ == '__main__': - main() - sys.exit(STATUS) diff --git a/src/etc/check-summary.py b/src/etc/check-summary.py deleted file mode 100755 index 9312b685c14..00000000000 --- a/src/etc/check-summary.py +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2012-2014 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. - -import glob -import sys - -if __name__ == '__main__': - summaries = [] - - def summarise(fname): - summary = {} - with open(fname) as fd: - for line in fd: - splitline = line.strip().split(' ') - if len(splitline) == 1: - continue - status = splitline[0] - test = splitline[-1] - # track bench runs - if splitline[1] == 'ns/iter': - status = 'bench' - if status not in summary: - summary[status] = [] - summary[status].append(test) - summaries.append((fname, summary)) - - def count(t): - return sum(map(lambda f: len(f[1].get(t, [])), summaries)) - - logfiles = sys.argv[1:] - for files in map(glob.glob, logfiles): - map(summarise, files) - ok = count('ok') - failed = count('failed') - ignored = count('ignored') - measured = count('bench') - print("summary of %d test runs: %d passed; %d failed; %d ignored; %d measured" % - (len(logfiles), ok, failed, ignored, measured)) - print("") - - if failed > 0: - print("failed tests:") - for f, s in summaries: - failures = s.get('failed', []) - if len(failures) > 0: - print(" %s:" % (f)) - for test in failures: - print(" %s" % (test)) diff --git a/src/etc/get-stage0.py b/src/etc/get-stage0.py deleted file mode 100644 index 127251cc802..00000000000 --- a/src/etc/get-stage0.py +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env python -# -# 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. - -import os -import sys - -path = os.path.abspath(os.path.join(os.path.dirname(__file__), "../bootstrap")) -sys.path.append(path) - -import bootstrap - -def main(triple): - src_root = os.path.abspath(os.path.join(os.path.dirname(__file__), "../..")) - data = bootstrap.stage0_data(src_root) - - channel, date = data['rustc'].split('-', 1) - - dl_dir = 'dl' - if not os.path.exists(dl_dir): - os.makedirs(dl_dir) - - filename = 'rustc-{}-{}.tar.gz'.format(channel, triple) - url = 'https://static.rust-lang.org/dist/{}/{}'.format(date, filename) - dst = dl_dir + '/' + filename - bootstrap.get(url, dst) - - stage0_dst = triple + '/stage0' - if os.path.exists(stage0_dst): - for root, _, files in os.walk(stage0_dst): - for f in files: - os.unlink(os.path.join(root, f)) - else: - os.makedirs(stage0_dst) - bootstrap.unpack(dst, stage0_dst, match='rustc', verbose=True) - -if __name__ == '__main__': - main(sys.argv[1]) diff --git a/src/etc/local_stage0.sh b/src/etc/local_stage0.sh deleted file mode 100755 index ee77206640e..00000000000 --- a/src/etc/local_stage0.sh +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/sh -# Copyright 2014-2015 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. - -TARG_DIR=$1 -PREFIX=$2 -RUSTLIBDIR=$3 - -LIB_DIR=lib -LIB_PREFIX=lib - -OS=`uname -s` -case $OS in - ("Linux"|"FreeBSD"|"DragonFly"|"Bitrig"|"OpenBSD"|"SunOS"|"Haiku") - BIN_SUF= - LIB_SUF=.so - ;; - ("Darwin") - BIN_SUF= - LIB_SUF=.dylib - ;; - (*) - BIN_SUF=.exe - LIB_SUF=.dll - LIB_DIR=bin - LIB_PREFIX= - ;; -esac - -if [ -z $PREFIX ]; then - echo "No local rust specified." - exit 1 -fi - -if [ ! -e ${PREFIX}/bin/rustc${BIN_SUF} ]; then - echo "No local rust installed at ${PREFIX}" - exit 1 -fi - -if [ -z $TARG_DIR ]; then - echo "No target directory specified." - exit 1 -fi - -case "$TARG_DIR" in ---print-rustc-release) - # not actually copying to TARG_DIR, just print the local rustc version and exit - ${PREFIX}/bin/rustc${BIN_SUF} --version --verbose | sed -ne 's/^release: //p' -;; -*) - -cp ${PREFIX}/bin/rustc${BIN_SUF} ${TARG_DIR}/stage0/bin/ -cp ${PREFIX}/${LIB_DIR}/${RUSTLIBDIR}/${TARG_DIR}/${LIB_DIR}/* ${TARG_DIR}/stage0/${LIB_DIR}/ -cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}arena*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/ -cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}extra*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/ -cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}rust*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/ -cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}std*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/ -cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}syntax*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/ -cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}flate*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/ -cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}fmt_macros*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/ -cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}getopts*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/ -cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}graphviz*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/ -cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}log*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/ -cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}rbml*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/ -cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}serialize*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/ -cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}term*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/ -cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}proc_macro*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/ - -# do not fail if one of the above fails, as all we need is a working rustc! -exit 0 - -esac diff --git a/src/etc/mklldeps.py b/src/etc/mklldeps.py deleted file mode 100644 index 24b007576aa..00000000000 --- a/src/etc/mklldeps.py +++ /dev/null @@ -1,113 +0,0 @@ -# Copyright 2013-2014 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. - -import os -import sys -import subprocess - -f = open(sys.argv[1], 'wb') - -components = sys.argv[2].split() # splits on whitespace -enable_static = sys.argv[3] -llvm_config = sys.argv[4] -stdcpp_name = sys.argv[5] -use_libcpp = sys.argv[6] - -f.write("""// Copyright 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. - -// WARNING: THIS IS A GENERATED FILE, DO NOT MODIFY -// take a look at src/etc/mklldeps.py if you're interested -""") - - -def run(args): - proc = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - out, err = proc.communicate() - - if err: - print("failed to run llvm_config: args = `{}`".format(args)) - print(err) - sys.exit(1) - return out - -def runErr(args): - proc = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - out, err = proc.communicate() - - if err: - return False, out - else: - return True, out - -f.write("\n") - -args = [llvm_config, '--shared-mode'] -args.extend(components) -llvm_shared, out = runErr(args) -if llvm_shared: - llvm_shared = 'shared' in out - -# LLVM libs -args = [llvm_config, '--libs', '--system-libs'] -args.extend(components) -out = run(args) -for lib in out.strip().replace("\n", ' ').split(' '): - if len(lib) == 0: - continue - # in some cases we get extra spaces in between libs so ignore those - if len(lib) == 1 and lib == ' ': - continue - # not all libs strictly follow -lfoo, on Bitrig, there is -pthread - if lib[0:2] == '-l': - lib = lib.strip()[2:] - elif lib[0] == '-': - lib = lib.strip()[1:] - # If this actually points at a literal file then we're on MSVC which now - # prints full paths, so get just the name of the library and strip off the - # trailing ".lib" - elif os.path.exists(lib): - lib = os.path.basename(lib)[:-4] - elif lib[-4:] == '.lib': - lib = lib[:-4] - f.write("#[link(name = \"" + lib + "\"") - if not llvm_shared and 'LLVM' in lib: - f.write(", kind = \"static\"") - f.write(")]\n") - -# LLVM ldflags -out = run([llvm_config, '--ldflags']) -for lib in out.strip().split(' '): - if lib[:2] == "-l": - f.write("#[link(name = \"" + lib[2:] + "\")]\n") - -# C++ runtime library -out = run([llvm_config, '--cxxflags']) -if enable_static == '1': - assert('stdlib=libc++' not in out) - f.write("#[link(name = \"" + stdcpp_name + "\", kind = \"static\")]\n") -else: - # Note that we use `cfg_attr` here because on MSVC the C++ standard library - # is not c++ or stdc++, but rather the linker takes care of linking the - # right standard library. - if use_libcpp != "0" or 'stdlib=libc++' in out: - f.write("#[cfg_attr(not(target_env = \"msvc\"), link(name = \"c++\"))]\n") - else: - f.write("#[cfg_attr(not(target_env = \"msvc\"), link(name = \"" + stdcpp_name + "\"))]\n") - -# Attach everything to an extern block -f.write("extern {}\n") diff --git a/src/etc/x86.supp b/src/etc/x86.supp deleted file mode 100644 index 6e409af79ae..00000000000 --- a/src/etc/x86.supp +++ /dev/null @@ -1,65 +0,0 @@ -{ - goddammit-llvm-why-u-no-valgrind - Memcheck:Cond - fun:* - ... -} - -{ - down-with-thread-dtors.rs-fails-otherwise-1 - Memcheck:Addr1 - ... - fun:tlv_finalize - fun:_pthread_tsd_cleanup - fun:_pthread_exit - ... - fun:_pthread_start - fun:thread_start -} - -{ - down-with-thread-dtors.rs-fails-otherwise-2 - Memcheck:Addr2 - ... - fun:tlv_finalize - fun:_pthread_tsd_cleanup - fun:_pthread_exit - ... - fun:_pthread_start - fun:thread_start -} - -{ - down-with-thread-dtors.rs-fails-otherwise-3 - Memcheck:Addr4 - ... - fun:tlv_finalize - fun:_pthread_tsd_cleanup - fun:_pthread_exit - ... - fun:_pthread_start - fun:thread_start -} - -{ - down-with-thread-dtors.rs-fails-otherwise-4 - Memcheck:Addr8 - ... - fun:tlv_finalize - fun:_pthread_tsd_cleanup - fun:_pthread_exit - ... - fun:_pthread_start - fun:thread_start -} - -{ - down-with-thread-dtors.rs-fails-otherwise-5 - Memcheck:Leak - match-leak-kinds: definite - fun:malloc - fun:tlv_allocate_and_initialize_for_key - fun:tlv_get_addr - ... - fun:start -} diff --git a/src/liballoc_jemalloc/build.rs b/src/liballoc_jemalloc/build.rs index cb7852995f3..a3402bf3994 100644 --- a/src/liballoc_jemalloc/build.rs +++ b/src/liballoc_jemalloc/build.rs @@ -21,7 +21,6 @@ use std::process::Command; use build_helper::{run, rerun_if_changed_anything_in_dir, up_to_date}; fn main() { - println!("cargo:rustc-cfg=cargobuild"); println!("cargo:rerun-if-changed=build.rs"); // FIXME: This is a hack to support building targets that don't diff --git a/src/liballoc_jemalloc/lib.rs b/src/liballoc_jemalloc/lib.rs index fc8a5455d1d..8d81a09f5af 100644 --- a/src/liballoc_jemalloc/lib.rs +++ b/src/liballoc_jemalloc/lib.rs @@ -30,22 +30,6 @@ pub use imp::*; mod imp { use libc::{c_int, c_void, size_t}; - // Linkage directives to pull in jemalloc and its dependencies. - // - // On some platforms we need to be sure to link in `pthread` which jemalloc - // depends on, and specifically on android we need to also link to libgcc. - // Currently jemalloc is compiled with gcc which will generate calls to - // intrinsics that are libgcc specific (e.g. those intrinsics aren't present in - // libcompiler-rt), so link that in to get that support. - #[link(name = "jemalloc", kind = "static")] - #[cfg_attr(target_os = "android", link(name = "gcc"))] - #[cfg_attr(all(not(windows), - not(target_os = "android"), - not(target_env = "musl")), - link(name = "pthread"))] - #[cfg(not(cargobuild))] - extern "C" {} - // Note that the symbols here are prefixed by default on OSX and Windows (we // don't explicitly request it), and on Android and DragonFly we explicitly // request it as unprefixing cause segfaults (mismatches in allocators). diff --git a/src/libflate/build.rs b/src/libflate/build.rs index 245c705dfcc..12016980a2c 100644 --- a/src/libflate/build.rs +++ b/src/libflate/build.rs @@ -11,7 +11,6 @@ extern crate gcc; fn main() { - println!("cargo:rustc-cfg=cargobuild"); gcc::Config::new() .file("../rt/miniz.c") .compile("libminiz.a"); diff --git a/src/libflate/lib.rs b/src/libflate/lib.rs index 8365e9db2a9..dedec7b1609 100644 --- a/src/libflate/lib.rs +++ b/src/libflate/lib.rs @@ -74,10 +74,6 @@ impl Drop for Bytes { } } -#[link(name = "miniz", kind = "static")] -#[cfg(not(cargobuild))] -extern "C" {} - extern "C" { /// Raw miniz compression function. fn tdefl_compress_mem_to_heap(psrc_buf: *const c_void, diff --git a/src/libpanic_unwind/gcc.rs b/src/libpanic_unwind/gcc.rs index e8b3a9a42c2..84abc6bc4a5 100644 --- a/src/libpanic_unwind/gcc.rs +++ b/src/libpanic_unwind/gcc.rs @@ -301,10 +301,6 @@ unsafe extern "C" fn rust_eh_unwind_resume(panic_ctx: *mut u8) -> ! { // with any GCC runtime. #[cfg(all(target_os="windows", target_arch = "x86", target_env="gnu"))] pub mod eh_frame_registry { - #[link(name = "gcc_eh")] - #[cfg(not(cargobuild))] - extern "C" {} - extern "C" { fn __register_frame_info(eh_frame_begin: *const u8, object: *mut u8); fn __deregister_frame_info(eh_frame_begin: *const u8, object: *mut u8); diff --git a/src/librustc_llvm/build.rs b/src/librustc_llvm/build.rs index 2ee4cc49435..c74a9308e4e 100644 --- a/src/librustc_llvm/build.rs +++ b/src/librustc_llvm/build.rs @@ -47,8 +47,6 @@ fn detect_llvm_link(llvm_config: &Path) -> (&'static str, Option<&'static str>) } fn main() { - println!("cargo:rustc-cfg=cargobuild"); - let target = env::var("TARGET").expect("TARGET was not set"); let llvm_config = env::var_os("LLVM_CONFIG") .map(PathBuf::from) diff --git a/src/librustc_llvm/lib.rs b/src/librustc_llvm/lib.rs index b1615b9e38b..f300bf16145 100644 --- a/src/librustc_llvm/lib.rs +++ b/src/librustc_llvm/lib.rs @@ -422,13 +422,3 @@ impl Drop for OperandBundleDef { } } } - -// The module containing the native LLVM dependencies, generated by the build system -// Note that this must come after the rustllvm extern declaration so that -// parts of LLVM that rustllvm depends on aren't thrown away by the linker. -// Works to the above fix for #15460 to ensure LLVM dependencies that -// are only used by rustllvm don't get stripped by the linker. -#[cfg(not(cargobuild))] -mod llvmdeps { - include! { env!("CFG_LLVM_LINKAGE_FILE") } -} diff --git a/src/librustdoc/build.rs b/src/librustdoc/build.rs index 171954f325a..fcb7af11dce 100644 --- a/src/librustdoc/build.rs +++ b/src/librustdoc/build.rs @@ -11,7 +11,6 @@ extern crate gcc; fn main() { - println!("cargo:rustc-cfg=cargobuild"); let mut cfg = gcc::Config::new(); cfg.file("../rt/hoedown/src/autolink.c") .file("../rt/hoedown/src/buffer.c") diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index e8ff8930bdd..a0f4a3a8743 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -162,11 +162,6 @@ struct hoedown_buffer { unit: libc::size_t, } -// hoedown FFI -#[link(name = "hoedown", kind = "static")] -#[cfg(not(cargobuild))] -extern {} - extern { fn hoedown_html_renderer_new(render_flags: libc::c_uint, nesting_level: libc::c_int) diff --git a/src/libstd/build.rs b/src/libstd/build.rs index a0844821709..0fca374f6e6 100644 --- a/src/libstd/build.rs +++ b/src/libstd/build.rs @@ -21,7 +21,6 @@ use std::process::Command; use build_helper::{run, rerun_if_changed_anything_in_dir, up_to_date}; fn main() { - println!("cargo:rustc-cfg=cargobuild"); println!("cargo:rerun-if-changed=build.rs"); let target = env::var("TARGET").expect("TARGET was not set"); diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 1f3526e1a09..3a552c060a9 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -464,9 +464,6 @@ mod panicking; mod rand; mod memchr; -// This module just defines per-platform native library dependencies -mod rtdeps; - // The runtime entry point and a few unstable public functions used by the // compiler pub mod rt; diff --git a/src/libstd/panicking.rs b/src/libstd/panicking.rs index e5edea241e1..d76e8816ca4 100644 --- a/src/libstd/panicking.rs +++ b/src/libstd/panicking.rs @@ -311,12 +311,12 @@ impl<'a> Location<'a> { } fn default_hook(info: &PanicInfo) { - #[cfg(any(not(cargobuild), feature = "backtrace"))] + #[cfg(feature = "backtrace")] use sys_common::backtrace; // If this is a double panic, make sure that we print a backtrace // for this panic. Otherwise only print it if logging is enabled. - #[cfg(any(not(cargobuild), feature = "backtrace"))] + #[cfg(feature = "backtrace")] let log_backtrace = { let panics = update_panic_count(0); @@ -341,7 +341,7 @@ fn default_hook(info: &PanicInfo) { let _ = writeln!(err, "thread '{}' panicked at '{}', {}:{}", name, msg, file, line); - #[cfg(any(not(cargobuild), feature = "backtrace"))] + #[cfg(feature = "backtrace")] { use sync::atomic::{AtomicBool, Ordering}; diff --git a/src/libstd/rtdeps.rs b/src/libstd/rtdeps.rs deleted file mode 100644 index 5dc6ee2bc8c..00000000000 --- a/src/libstd/rtdeps.rs +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2013-2015 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. - -//! This module contains the linkage attributes to all runtime dependencies of -//! the standard library This varies per-platform, but these libraries are -//! necessary for running libstd. - -#![cfg(not(cargobuild))] - -// LLVM implements the `frem` instruction as a call to `fmod`, which lives in -// libm. Hence, we must explicitly link to it. -// -// On Linux, librt and libdl are indirect dependencies via std, -// and binutils 2.22+ won't add them automatically -#[cfg(all(target_os = "linux", not(target_env = "musl")))] -#[link(name = "dl")] -#[link(name = "pthread")] -extern {} - -#[cfg(target_os = "android")] -#[link(name = "dl")] -#[link(name = "log")] -extern {} - -#[cfg(target_os = "freebsd")] -#[link(name = "execinfo")] -#[link(name = "pthread")] -extern {} - -#[cfg(any(target_os = "dragonfly", - target_os = "bitrig", - target_os = "netbsd", - target_os = "openbsd"))] -#[link(name = "pthread")] -extern {} - -#[cfg(target_os = "solaris")] -#[link(name = "socket")] -#[link(name = "posix4")] -#[link(name = "pthread")] -extern {} - -// For PNaCl targets, nacl_io is a Pepper wrapper for some IO functions -// missing (ie always error) in Newlib. -#[cfg(all(target_os = "nacl", not(test)))] -#[link(name = "nacl_io", kind = "static")] -#[link(name = "c++", kind = "static")] // for `nacl_io` and EH. -#[link(name = "pthread", kind = "static")] -extern {} - -#[cfg(target_os = "macos")] -#[link(name = "System")] -extern {} - -#[cfg(target_os = "ios")] -#[link(name = "System")] -extern {} - -#[cfg(target_os = "haiku")] -#[link(name = "network")] -extern {} diff --git a/src/libstd/sys/unix/args.rs b/src/libstd/sys/unix/args.rs index 0f447ff4ec4..6e35a472792 100644 --- a/src/libstd/sys/unix/args.rs +++ b/src/libstd/sys/unix/args.rs @@ -189,11 +189,6 @@ mod imp { fn objc_msgSend_ul(obj: NsId, sel: Sel, ...) -> NsId; } - #[link(name = "Foundation", kind = "framework")] - #[link(name = "objc")] - #[cfg(not(cargobuild))] - extern {} - type Sel = *const libc::c_void; type NsId = *const libc::c_void; diff --git a/src/libstd/sys/unix/mod.rs b/src/libstd/sys/unix/mod.rs index fd7dc17cccd..c57751a01d7 100644 --- a/src/libstd/sys/unix/mod.rs +++ b/src/libstd/sys/unix/mod.rs @@ -33,7 +33,7 @@ pub mod weak; pub mod args; pub mod android; -#[cfg(any(not(cargobuild), feature = "backtrace"))] +#[cfg(feature = "backtrace")] pub mod backtrace; pub mod condvar; pub mod env; diff --git a/src/libstd/sys/unix/rand.rs b/src/libstd/sys/unix/rand.rs index 9b1cf6ffd0e..77ebad4e344 100644 --- a/src/libstd/sys/unix/rand.rs +++ b/src/libstd/sys/unix/rand.rs @@ -257,10 +257,6 @@ mod imp { #[allow(non_upper_case_globals)] const kSecRandomDefault: *const SecRandom = ptr::null(); - #[link(name = "Security", kind = "framework")] - #[cfg(not(cargobuild))] - extern {} - extern { fn SecRandomCopyBytes(rnd: *const SecRandom, count: size_t, bytes: *mut u8) -> c_int; diff --git a/src/libstd/sys/windows/c.rs b/src/libstd/sys/windows/c.rs index 850d6f49612..e5010ca3564 100644 --- a/src/libstd/sys/windows/c.rs +++ b/src/libstd/sys/windows/c.rs @@ -833,13 +833,6 @@ pub struct CONSOLE_READCONSOLE_CONTROL { } pub type PCONSOLE_READCONSOLE_CONTROL = *mut CONSOLE_READCONSOLE_CONTROL; -#[link(name = "ws2_32")] -#[link(name = "userenv")] -#[link(name = "shell32")] -#[link(name = "advapi32")] -#[cfg(not(cargobuild))] -extern {} - extern "system" { pub fn WSAStartup(wVersionRequested: WORD, lpWSAData: LPWSADATA) -> c_int; diff --git a/src/libstd/sys_common/gnu/libbacktrace.rs b/src/libstd/sys_common/gnu/libbacktrace.rs index d464a13ad1d..0bdbeddb112 100644 --- a/src/libstd/sys_common/gnu/libbacktrace.rs +++ b/src/libstd/sys_common/gnu/libbacktrace.rs @@ -39,9 +39,6 @@ pub fn print(w: &mut Write, idx: isize, addr: *mut libc::c_void, msg: *const libc::c_char, errnum: libc::c_int); enum backtrace_state {} - #[link(name = "backtrace", kind = "static")] - #[cfg(all(not(test), not(cargobuild)))] - extern {} extern { fn backtrace_create_state(filename: *const libc::c_char, diff --git a/src/libstd/sys_common/mod.rs b/src/libstd/sys_common/mod.rs index 634d6258885..d4d3365dc01 100644 --- a/src/libstd/sys_common/mod.rs +++ b/src/libstd/sys_common/mod.rs @@ -29,7 +29,7 @@ use sync::Once; use sys; pub mod at_exit_imp; -#[cfg(any(not(cargobuild), feature = "backtrace"))] +#[cfg(feature = "backtrace")] pub mod backtrace; pub mod condvar; pub mod io; @@ -50,7 +50,7 @@ pub use sys::net; #[cfg(not(target_os = "redox"))] pub mod net; -#[cfg(any(not(cargobuild), feature = "backtrace"))] +#[cfg(feature = "backtrace")] #[cfg(any(all(unix, not(any(target_os = "macos", target_os = "ios", target_os = "emscripten"))), all(windows, target_env = "gnu")))] pub mod gnu; diff --git a/src/libunwind/build.rs b/src/libunwind/build.rs index db41a368a16..f18b694d3d0 100644 --- a/src/libunwind/build.rs +++ b/src/libunwind/build.rs @@ -11,8 +11,6 @@ use std::env; fn main() { - println!("cargo:rustc-cfg=cargobuild"); - let target = env::var("TARGET").expect("TARGET was not set"); if target.contains("linux") { diff --git a/src/libunwind/libunwind.rs b/src/libunwind/libunwind.rs index 269c2d65b63..7fb58373251 100644 --- a/src/libunwind/libunwind.rs +++ b/src/libunwind/libunwind.rs @@ -240,34 +240,3 @@ if #[cfg(not(all(target_os = "ios", target_arch = "arm")))] { } } } // cfg_if! - -#[cfg_attr(any(all(target_os = "linux", not(target_env = "musl")), - target_os = "freebsd", - target_os = "solaris", - target_os = "haiku", - all(target_os = "linux", - target_env = "musl", - not(target_arch = "x86"), - not(target_arch = "x86_64"))), - link(name = "gcc_s"))] -#[cfg_attr(all(target_os = "linux", - target_env = "musl", - any(target_arch = "x86", target_arch = "x86_64"), - not(test)), - link(name = "unwind", kind = "static"))] -#[cfg_attr(target_os = "fuchsia", - link(name = "unwind"))] -#[cfg_attr(any(target_os = "android", target_os = "openbsd"), - link(name = "gcc"))] -#[cfg_attr(all(target_os = "netbsd", not(target_vendor = "rumprun")), - link(name = "gcc"))] -#[cfg_attr(all(target_os = "netbsd", target_vendor = "rumprun"), - link(name = "unwind"))] -#[cfg_attr(target_os = "dragonfly", - link(name = "gcc_pic"))] -#[cfg_attr(target_os = "bitrig", - link(name = "c++abi"))] -#[cfg_attr(all(target_os = "windows", target_env = "gnu"), - link(name = "gcc_eh"))] -#[cfg(not(cargobuild))] -extern "C" {} diff --git a/src/tools/compiletest/Cargo.toml b/src/tools/compiletest/Cargo.toml index 2982f29f931..1fc98a78a7c 100644 --- a/src/tools/compiletest/Cargo.toml +++ b/src/tools/compiletest/Cargo.toml @@ -2,9 +2,9 @@ authors = ["The Rust Project Developers"] name = "compiletest" version = "0.0.0" -build = "build.rs" [dependencies] log = "0.3" env_logger = { version = "0.3.5", default-features = false } rustc-serialize = "0.3" +filetime = "0.1" diff --git a/src/tools/compiletest/build.rs b/src/tools/compiletest/build.rs deleted file mode 100644 index d5164b9b759..00000000000 --- a/src/tools/compiletest/build.rs +++ /dev/null @@ -1,13 +0,0 @@ -// 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. - -fn main() { - println!("cargo:rustc-cfg=cargobuild"); -} diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index 71d8d62c75b..522cd222c26 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -25,6 +25,7 @@ use extract_gdb_version; pub struct EarlyProps { pub ignore: bool, pub should_fail: bool, + pub aux: Vec<String>, } impl EarlyProps { @@ -32,6 +33,7 @@ impl EarlyProps { let mut props = EarlyProps { ignore: false, should_fail: false, + aux: Vec::new(), }; iter_header(testfile, @@ -50,6 +52,10 @@ impl EarlyProps { ignore_lldb(config, ln) || ignore_llvm(config, ln); + if let Some(s) = parse_aux_build(ln) { + props.aux.push(s); + } + props.should_fail = props.should_fail || parse_name_directive(ln, "should-fail"); }); diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs index 40ba66a15d5..5a97f7e3ee9 100644 --- a/src/tools/compiletest/src/main.rs +++ b/src/tools/compiletest/src/main.rs @@ -21,17 +21,11 @@ extern crate libc; extern crate test; extern crate getopts; - -#[cfg(cargobuild)] extern crate rustc_serialize; -#[cfg(not(cargobuild))] -extern crate serialize as rustc_serialize; - #[macro_use] extern crate log; - -#[cfg(cargobuild)] extern crate env_logger; +extern crate filetime; use std::env; use std::ffi::OsString; @@ -39,6 +33,7 @@ use std::fs; use std::io; use std::path::{Path, PathBuf}; use std::process::Command; +use filetime::FileTime; use getopts::{optopt, optflag, reqopt}; use common::Config; use common::{Pretty, DebugInfoGdb, DebugInfoLldb, Mode}; @@ -58,11 +53,7 @@ mod raise_fd_limit; mod uidiff; fn main() { - #[cfg(cargobuild)] - fn log_init() { env_logger::init().unwrap(); } - #[cfg(not(cargobuild))] - fn log_init() {} - log_init(); + env_logger::init().unwrap(); let config = parse_config(env::args().collect()); @@ -478,7 +469,7 @@ pub fn make_test(config: &Config, testpaths: &TestPaths) -> test::TestDescAndFn }; // Debugging emscripten code doesn't make sense today - let mut ignore = early_props.ignore; + let mut ignore = early_props.ignore || !up_to_date(config, testpaths, &early_props); if (config.mode == DebugInfoGdb || config.mode == DebugInfoLldb) && config.target.contains("emscripten") { ignore = true; @@ -494,6 +485,42 @@ pub fn make_test(config: &Config, testpaths: &TestPaths) -> test::TestDescAndFn } } +fn stamp(config: &Config, testpaths: &TestPaths) -> PathBuf { + let stamp_name = format!("{}-H-{}-T-{}-S-{}.stamp", + testpaths.file.file_name().unwrap() + .to_str().unwrap(), + config.host, + config.target, + config.stage_id); + config.build_base.canonicalize() + .unwrap_or(config.build_base.clone()) + .join(stamp_name) +} + +fn up_to_date(config: &Config, testpaths: &TestPaths, props: &EarlyProps) -> bool { + let stamp = mtime(&stamp(config, testpaths)); + let mut inputs = vec![ + mtime(&testpaths.file), + mtime(&config.rustc_path), + ]; + for aux in props.aux.iter() { + inputs.push(mtime(&testpaths.file.parent().unwrap() + .join("auxiliary") + .join(aux))); + } + for lib in config.run_lib_path.read_dir().unwrap() { + let lib = lib.unwrap(); + inputs.push(mtime(&lib.path())); + } + inputs.iter().any(|input| *input > stamp) +} + +fn mtime(path: &Path) -> FileTime { + fs::metadata(path).map(|f| { + FileTime::from_last_modification_time(&f) + }).unwrap_or(FileTime::zero()) +} + pub fn make_test_name(config: &Config, testpaths: &TestPaths) -> test::TestName { // Convert a complete path to something like // diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 9f7d4157931..bcec1f63bc0 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -80,6 +80,8 @@ pub fn run(config: Config, testpaths: &TestPaths) { } base_cx.complete_all(); + + File::create(::stamp(&config, &testpaths)).unwrap(); } struct TestCx<'test> { |
