- env: IMAGE=x86_64-gnu-make
- env: IMAGE=x86_64-gnu-llvm-3.7 ALLOW_PR=1 RUST_BACKTRACE=1
- env: IMAGE=x86_64-gnu-distcheck
+ - env: IMAGE=x86_64-gnu-incremental
# OSX builders
- env: >
before_deploy:
- mkdir -p deploy/$TRAVIS_COMMIT
+ - rm -rf build/dist/doc
- >
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
- cp -r build/dist deploy/$TRAVIS_COMMIT;
+ cp -r build/dist/* deploy/$TRAVIS_COMMIT;
else
- cp -r obj/build/dist deploy/$TRAVIS_COMMIT;
+ cp -r obj/build/dist/* deploy/$TRAVIS_COMMIT;
fi
deploy:
before_deploy:
- ps: |
New-Item -Path deploy -ItemType directory
+ Remove-Item -Recurse -Force build\dist\doc
Get-ChildItem -Path build\dist | Move-Item -Destination deploy
Get-ChildItem -Path deploy | Foreach-Object {
Push-AppveyorArtifact $_.FullName -FileName ${env:APPVEYOR_REPO_COMMIT}/$_
"CFG_JEMALLOC_ROOT" if value.len() > 0 => {
let target = self.target_config.entry(self.build.clone())
.or_insert(Target::default());
- target.jemalloc = Some(parse_configure_path(value));
+ target.jemalloc = Some(parse_configure_path(value).join("libjemalloc_pic.a"));
}
"CFG_ARM_LINUX_ANDROIDEABI_NDK" if value.len() > 0 => {
let target = "arm-linux-androideabi".to_string();
cmd.arg("-nologo")
.arg("-ext").arg("WixUIExtension")
.arg("-ext").arg("WixUtilExtension")
- .arg("-out").arg(distdir(build).join(filename))
+ .arg("-out").arg(exe.join(&filename))
.arg("rust.wixobj")
.arg("ui.wixobj")
.arg("rustwelcomedlg.wixobj")
cmd.arg("-sice:ICE57");
build.run(&mut cmd);
+
+ t!(fs::rename(exe.join(&filename), distdir(build).join(&filename)));
}
}
- C-library > glibc version = 2.17 -- aarch64 support was introduced in this version
- C compiler > gcc version = 5.2.0
- C compiler > C++ = ENABLE -- to cross compile LLVM
+
+## `powerpc-linux-gnu.config`
+
+For targets: `powerpc-unknown-linux-gnu`
+
+- Path and misc options > Prefix directory = /x-tools/${CT\_TARGET}
+- Path and misc options > Patches origin = Bundled, then local
+- Path and misc options > Local patch directory = /tmp/patches
+- Target options > Target Architecture = powerpc
+- Target options > Emit assembly for CPU = power4 -- (+)
+- Target options > Tune for CPU = power6 -- (+)
+- Operating System > Target OS = linux
+- Operating System > Linux kernel version = 2.6.32.68 -- ~RHEL6 kernel
+- C-library > glibc version = 2.12.2 -- ~RHEL6 glibc
+- C compiler > gcc version = 4.9.3
+- C compiler > Core gcc extra config = --with-cpu-32=power4 --with-cpu=default32 -- (+)
+- C compiler > gcc extra config = --with-cpu-32=power4 --with-cpu=default32 -- (+)
+- C compiler > C++ = ENABLE -- to cross compile LLVM
+
+(+) These CPU options match the configuration of the toolchains in RHEL6.
+
+## `powerpc64-linux-gnu.config`
+
+For targets: `powerpc64-unknown-linux-gnu`
+
+- Path and misc options > Prefix directory = /x-tools/${CT\_TARGET}
+- Path and misc options > Patches origin = Bundled, then local
+- Path and misc options > Local patch directory = /tmp/patches
+- Target options > Target Architecture = powerpc
+- Target options > Bitness = 64-bit
+- Target options > Emit assembly for CPU = power4 -- (+)
+- Target options > Tune for CPU = power6 -- (+)
+- Operating System > Target OS = linux
+- Operating System > Linux kernel version = 2.6.32.68 -- ~RHEL6 kernel
+- C-library > glibc version = 2.12.2 -- ~RHEL6 glibc
+- C compiler > gcc version = 4.9.3
+- C compiler > C++ = ENABLE -- to cross compile LLVM
+
+(+) These CPU options match the configuration of the toolchains in RHEL6.
+
+## `s390x-linux-gnu.config`
+
+For targets: `s390x-unknown-linux-gnu`
+
+- Path and misc options > Prefix directory = /x-tools/${CT\_TARGET}
+- Path and misc options > Patches origin = Bundled, then local
+- Path and misc options > Local patch directory = /build/patches
+- Target options > Target Architecture = s390
+- Target options > Bitness = 64-bit
+- Operating System > Target OS = linux
+- Operating System > Linux kernel version = 2.6.32.68 -- ~RHEL6 kernel
+- C-library > glibc version = 2.12.2 -- ~RHEL6 glibc
+- C compiler > gcc version = 4.9.3
+- C compiler > gcc extra config = --with-arch=z10 -- LLVM's minimum support
+- C compiler > C++ = ENABLE -- to cross compile LLVM
FROM ubuntu:16.04
RUN apt-get update && apt-get install -y --no-install-recommends \
+ automake \
+ bison \
+ bzip2 \
+ ca-certificates \
+ cmake \
+ curl \
+ file \
+ flex \
g++ \
+ gawk \
+ gdb \
+ git \
+ gperf \
+ help2man \
+ libncurses-dev \
+ libtool-bin \
make \
- file \
- curl \
- ca-certificates \
+ patch \
python2.7 \
- git \
- cmake \
sudo \
- gdb \
- xz-utils \
- g++-powerpc-linux-gnu
+ texinfo \
+ wget \
+ xz-utils
ENV SCCACHE_DIGEST=7237e38e029342fa27b7ac25412cb9d52554008b12389727320bd533fd7f05b6a96d55485f305caf95e5c8f5f97c3313e10012ccad3e752aba2518f3522ba783
RUN curl -L https://api.pub.build.mozilla.org/tooltool/sha512/$SCCACHE_DIGEST | \
rm dumb-init_*.deb
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
+# Ubuntu 16.04 (this contianer) ships with make 4, but something in the
+# toolchains we build below chokes on that, so go back to make 3
+RUN curl https://ftp.gnu.org/gnu/make/make-3.81.tar.gz | tar xzf - && \
+ cd make-3.81 && \
+ ./configure --prefix=/usr && \
+ make && \
+ make install && \
+ cd .. && \
+ rm -rf make-3.81
+
+RUN curl http://crosstool-ng.org/download/crosstool-ng/crosstool-ng-1.22.0.tar.bz2 | \
+ tar xjf - && \
+ cd crosstool-ng && \
+ ./configure --prefix=/usr/local && \
+ make -j$(nproc) && \
+ make install && \
+ cd .. && \
+ rm -rf crosstool-ng
+
+RUN groupadd -r rustbuild && useradd -m -r -g rustbuild rustbuild
+RUN mkdir /x-tools && chown rustbuild:rustbuild /x-tools
+USER rustbuild
+WORKDIR /tmp
+
+COPY patches/ /tmp/patches/
+COPY powerpc-linux-gnu.config build-powerpc-toolchain.sh /tmp/
+RUN ./build-powerpc-toolchain.sh
+
+USER root
+
+ENV PATH=$PATH:/x-tools/powerpc-unknown-linux-gnu/bin
+
+ENV \
+ CC_powerpc_unknown_linux_gnu=powerpc-unknown-linux-gnu-gcc \
+ AR_powerpc_unknown_linux_gnu=powerpc-unknown-linux-gnu-ar \
+ CXX_powerpc_unknown_linux_gnu=powerpc-unknown-linux-gnu-g++
+
ENV HOSTS=powerpc-unknown-linux-gnu
ENV RUST_CONFIGURE_ARGS --host=$HOSTS --enable-extended
--- /dev/null
+#!/bin/bash
+# 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.
+
+set -ex
+
+hide_output() {
+ set +x
+ on_err="
+echo ERROR: An error was encountered with the build.
+cat /tmp/build.log
+exit 1
+"
+ trap "$on_err" ERR
+ bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
+ PING_LOOP_PID=$!
+ $@ &> /tmp/build.log
+ rm /tmp/build.log
+ trap - ERR
+ kill $PING_LOOP_PID
+ set -x
+}
+
+mkdir build
+cd build
+cp ../powerpc-linux-gnu.config .config
+hide_output ct-ng build
+cd ..
+rm -rf build
--- /dev/null
+From b3563932f85d60bb0d38b0a5f3b8f4abc133f890 Mon Sep 17 00:00:00 2001
+From: Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
+Date: Thu, 1 Nov 2012 18:00:06 -0500
+Subject: [PATCH] PowerPC: Remove unnecessary -mnew-mnemonics.
+
+---
+ sysdeps/powerpc/Makefile | 4 ----
+ 1 file changed, 4 deletions(-)
+
+diff --git a/sysdeps/powerpc/Makefile b/sysdeps/powerpc/Makefile
+index 79dd6fa976d5..7442b6709ad1 100644
+--- a/sysdeps/powerpc/Makefile
++++ b/sysdeps/powerpc/Makefile
+@@ -1,7 +1,3 @@
+-# We always want to use the new mnemonic syntax even if we are on a RS6000
+-# machine.
+-+cflags += -mnew-mnemonics
+-
+ ifeq ($(subdir),gmon)
+ sysdep_routines += ppc-mcount
+ endif
+--
+2.9.3
+
--- /dev/null
+#
+# Automatically generated file; DO NOT EDIT.
+# Crosstool-NG Configuration
+#
+CT_CONFIGURE_has_make381=y
+CT_CONFIGURE_has_xz=y
+CT_MODULES=y
+
+#
+# Paths and misc options
+#
+
+#
+# crosstool-NG behavior
+#
+# CT_OBSOLETE is not set
+# CT_EXPERIMENTAL is not set
+# CT_DEBUG_CT is not set
+
+#
+# Paths
+#
+CT_LOCAL_TARBALLS_DIR=""
+CT_WORK_DIR="${CT_TOP_DIR}/.build"
+CT_PREFIX_DIR="/x-tools/${CT_TARGET}"
+CT_INSTALL_DIR="${CT_PREFIX_DIR}"
+CT_RM_RF_PREFIX_DIR=y
+CT_REMOVE_DOCS=y
+CT_INSTALL_DIR_RO=y
+CT_STRIP_HOST_TOOLCHAIN_EXECUTABLES=y
+# CT_STRIP_TARGET_TOOLCHAIN_EXECUTABLES is not set
+
+#
+# Downloading
+#
+# CT_FORBID_DOWNLOAD is not set
+# CT_FORCE_DOWNLOAD is not set
+CT_CONNECT_TIMEOUT=10
+# CT_ONLY_DOWNLOAD is not set
+# CT_USE_MIRROR is not set
+
+#
+# Extracting
+#
+# CT_FORCE_EXTRACT is not set
+CT_OVERIDE_CONFIG_GUESS_SUB=y
+# CT_ONLY_EXTRACT is not set
+# CT_PATCH_BUNDLED is not set
+# CT_PATCH_LOCAL is not set
+CT_PATCH_BUNDLED_LOCAL=y
+# CT_PATCH_LOCAL_BUNDLED is not set
+# CT_PATCH_BUNDLED_FALLBACK_LOCAL is not set
+# CT_PATCH_LOCAL_FALLBACK_BUNDLED is not set
+# CT_PATCH_NONE is not set
+CT_PATCH_ORDER="bundled,local"
+CT_PATCH_USE_LOCAL=y
+CT_LOCAL_PATCH_DIR="/tmp/patches"
+
+#
+# Build behavior
+#
+CT_PARALLEL_JOBS=0
+CT_LOAD=""
+CT_USE_PIPES=y
+CT_EXTRA_CFLAGS_FOR_BUILD=""
+CT_EXTRA_LDFLAGS_FOR_BUILD=""
+CT_EXTRA_CFLAGS_FOR_HOST=""
+CT_EXTRA_LDFLAGS_FOR_HOST=""
+# CT_CONFIG_SHELL_SH is not set
+# CT_CONFIG_SHELL_ASH is not set
+CT_CONFIG_SHELL_BASH=y
+# CT_CONFIG_SHELL_CUSTOM is not set
+CT_CONFIG_SHELL="${bash}"
+
+#
+# Logging
+#
+# CT_LOG_ERROR is not set
+# CT_LOG_WARN is not set
+CT_LOG_INFO=y
+# CT_LOG_EXTRA is not set
+# CT_LOG_ALL is not set
+# CT_LOG_DEBUG is not set
+CT_LOG_LEVEL_MAX="INFO"
+# CT_LOG_SEE_TOOLS_WARN is not set
+CT_LOG_PROGRESS_BAR=y
+CT_LOG_TO_FILE=y
+CT_LOG_FILE_COMPRESS=y
+
+#
+# Target options
+#
+CT_ARCH="powerpc"
+CT_ARCH_SUPPORTS_BOTH_ENDIAN=y
+CT_ARCH_SUPPORTS_32=y
+CT_ARCH_SUPPORTS_64=y
+CT_ARCH_SUPPORTS_WITH_ABI=y
+CT_ARCH_SUPPORTS_WITH_CPU=y
+CT_ARCH_SUPPORTS_WITH_TUNE=y
+CT_ARCH_SUPPORTS_WITH_FLOAT=y
+CT_ARCH_DEFAULT_BE=y
+CT_ARCH_DEFAULT_32=y
+CT_ARCH_ABI=""
+CT_ARCH_CPU="power4"
+CT_ARCH_TUNE="power6"
+CT_ARCH_BE=y
+# CT_ARCH_LE is not set
+CT_ARCH_32=y
+# CT_ARCH_64 is not set
+CT_ARCH_BITNESS=32
+# CT_ARCH_FLOAT_HW is not set
+# CT_ARCH_FLOAT_SW is not set
+CT_TARGET_CFLAGS=""
+CT_TARGET_LDFLAGS=""
+# CT_ARCH_alpha is not set
+# CT_ARCH_arm is not set
+# CT_ARCH_avr is not set
+# CT_ARCH_m68k is not set
+# CT_ARCH_mips is not set
+# CT_ARCH_nios2 is not set
+CT_ARCH_powerpc=y
+# CT_ARCH_s390 is not set
+# CT_ARCH_sh is not set
+# CT_ARCH_sparc is not set
+# CT_ARCH_x86 is not set
+# CT_ARCH_xtensa is not set
+CT_ARCH_alpha_AVAILABLE=y
+CT_ARCH_arm_AVAILABLE=y
+CT_ARCH_avr_AVAILABLE=y
+CT_ARCH_m68k_AVAILABLE=y
+CT_ARCH_microblaze_AVAILABLE=y
+CT_ARCH_mips_AVAILABLE=y
+CT_ARCH_nios2_AVAILABLE=y
+CT_ARCH_powerpc_AVAILABLE=y
+CT_ARCH_s390_AVAILABLE=y
+CT_ARCH_sh_AVAILABLE=y
+CT_ARCH_sparc_AVAILABLE=y
+CT_ARCH_x86_AVAILABLE=y
+CT_ARCH_xtensa_AVAILABLE=y
+CT_ARCH_SUFFIX=""
+
+#
+# Generic target options
+#
+# CT_MULTILIB is not set
+CT_ARCH_USE_MMU=y
+CT_ARCH_ENDIAN="big"
+
+#
+# Target optimisations
+#
+CT_ARCH_FLOAT_AUTO=y
+CT_ARCH_FLOAT="auto"
+
+#
+# powerpc other options
+#
+CT_ARCH_powerpc_ABI=""
+CT_ARCH_powerpc_ABI_DEFAULT=y
+# CT_ARCH_powerpc_ABI_SPE is not set
+
+#
+# Toolchain options
+#
+
+#
+# General toolchain options
+#
+CT_FORCE_SYSROOT=y
+CT_USE_SYSROOT=y
+CT_SYSROOT_NAME="sysroot"
+CT_SYSROOT_DIR_PREFIX=""
+CT_WANTS_STATIC_LINK=y
+# CT_STATIC_TOOLCHAIN is not set
+CT_TOOLCHAIN_PKGVERSION=""
+CT_TOOLCHAIN_BUGURL=""
+
+#
+# Tuple completion and aliasing
+#
+CT_TARGET_VENDOR="unknown"
+CT_TARGET_ALIAS_SED_EXPR=""
+CT_TARGET_ALIAS=""
+
+#
+# Toolchain type
+#
+CT_CROSS=y
+# CT_CANADIAN is not set
+CT_TOOLCHAIN_TYPE="cross"
+
+#
+# Build system
+#
+CT_BUILD=""
+CT_BUILD_PREFIX=""
+CT_BUILD_SUFFIX=""
+
+#
+# Misc options
+#
+# CT_TOOLCHAIN_ENABLE_NLS is not set
+
+#
+# Operating System
+#
+CT_KERNEL_SUPPORTS_SHARED_LIBS=y
+CT_KERNEL="linux"
+CT_KERNEL_VERSION="2.6.32.68"
+# CT_KERNEL_bare_metal is not set
+CT_KERNEL_linux=y
+CT_KERNEL_bare_metal_AVAILABLE=y
+CT_KERNEL_linux_AVAILABLE=y
+# CT_KERNEL_V_4_3 is not set
+# CT_KERNEL_V_4_2 is not set
+# CT_KERNEL_V_4_1 is not set
+# CT_KERNEL_V_3_18 is not set
+# CT_KERNEL_V_3_14 is not set
+# CT_KERNEL_V_3_12 is not set
+# CT_KERNEL_V_3_10 is not set
+# CT_KERNEL_V_3_4 is not set
+# CT_KERNEL_V_3_2 is not set
+CT_KERNEL_V_2_6_32=y
+# CT_KERNEL_LINUX_CUSTOM is not set
+CT_KERNEL_windows_AVAILABLE=y
+
+#
+# Common kernel options
+#
+CT_SHARED_LIBS=y
+
+#
+# linux other options
+#
+CT_KERNEL_LINUX_VERBOSITY_0=y
+# CT_KERNEL_LINUX_VERBOSITY_1 is not set
+# CT_KERNEL_LINUX_VERBOSITY_2 is not set
+CT_KERNEL_LINUX_VERBOSE_LEVEL=0
+CT_KERNEL_LINUX_INSTALL_CHECK=y
+
+#
+# Binary utilities
+#
+CT_ARCH_BINFMT_ELF=y
+CT_BINUTILS="binutils"
+CT_BINUTILS_binutils=y
+
+#
+# GNU binutils
+#
+# CT_CC_BINUTILS_SHOW_LINARO is not set
+CT_BINUTILS_V_2_25_1=y
+# CT_BINUTILS_V_2_25 is not set
+# CT_BINUTILS_V_2_24 is not set
+# CT_BINUTILS_V_2_23_2 is not set
+# CT_BINUTILS_V_2_23_1 is not set
+# CT_BINUTILS_V_2_22 is not set
+# CT_BINUTILS_V_2_21_53 is not set
+# CT_BINUTILS_V_2_21_1a is not set
+# CT_BINUTILS_V_2_20_1a is not set
+# CT_BINUTILS_V_2_19_1a is not set
+# CT_BINUTILS_V_2_18a is not set
+CT_BINUTILS_VERSION="2.25.1"
+CT_BINUTILS_2_25_1_or_later=y
+CT_BINUTILS_2_25_or_later=y
+CT_BINUTILS_2_24_or_later=y
+CT_BINUTILS_2_23_or_later=y
+CT_BINUTILS_2_22_or_later=y
+CT_BINUTILS_2_21_or_later=y
+CT_BINUTILS_2_20_or_later=y
+CT_BINUTILS_2_19_or_later=y
+CT_BINUTILS_2_18_or_later=y
+CT_BINUTILS_HAS_HASH_STYLE=y
+CT_BINUTILS_HAS_GOLD=y
+CT_BINUTILS_HAS_PLUGINS=y
+CT_BINUTILS_HAS_PKGVERSION_BUGURL=y
+CT_BINUTILS_FORCE_LD_BFD=y
+CT_BINUTILS_LINKER_LD=y
+CT_BINUTILS_LINKERS_LIST="ld"
+CT_BINUTILS_LINKER_DEFAULT="bfd"
+# CT_BINUTILS_PLUGINS is not set
+CT_BINUTILS_EXTRA_CONFIG_ARRAY=""
+# CT_BINUTILS_FOR_TARGET is not set
+
+#
+# binutils other options
+#
+
+#
+# C-library
+#
+CT_LIBC="glibc"
+CT_LIBC_VERSION="2.12.2"
+CT_LIBC_glibc=y
+# CT_LIBC_musl is not set
+# CT_LIBC_uClibc is not set
+CT_LIBC_avr_libc_AVAILABLE=y
+CT_LIBC_glibc_AVAILABLE=y
+CT_THREADS="nptl"
+# CT_CC_GLIBC_SHOW_LINARO is not set
+# CT_LIBC_GLIBC_V_2_22 is not set
+# CT_LIBC_GLIBC_V_2_21 is not set
+# CT_LIBC_GLIBC_V_2_20 is not set
+# CT_LIBC_GLIBC_V_2_19 is not set
+# CT_LIBC_GLIBC_V_2_18 is not set
+# CT_LIBC_GLIBC_V_2_17 is not set
+# CT_LIBC_GLIBC_V_2_16_0 is not set
+# CT_LIBC_GLIBC_V_2_15 is not set
+# CT_LIBC_GLIBC_V_2_14_1 is not set
+# CT_LIBC_GLIBC_V_2_14 is not set
+# CT_LIBC_GLIBC_V_2_13 is not set
+CT_LIBC_GLIBC_V_2_12_2=y
+# CT_LIBC_GLIBC_V_2_12_1 is not set
+# CT_LIBC_GLIBC_V_2_11_1 is not set
+# CT_LIBC_GLIBC_V_2_11 is not set
+# CT_LIBC_GLIBC_V_2_10_1 is not set
+# CT_LIBC_GLIBC_V_2_9 is not set
+# CT_LIBC_GLIBC_V_2_8 is not set
+CT_LIBC_mingw_AVAILABLE=y
+CT_LIBC_musl_AVAILABLE=y
+CT_LIBC_newlib_AVAILABLE=y
+CT_LIBC_none_AVAILABLE=y
+CT_LIBC_uClibc_AVAILABLE=y
+CT_LIBC_SUPPORT_THREADS_ANY=y
+CT_LIBC_SUPPORT_THREADS_NATIVE=y
+
+#
+# Common C library options
+#
+CT_THREADS_NATIVE=y
+CT_LIBC_XLDD=y
+
+#
+# glibc other options
+#
+CT_LIBC_GLIBC_PORTS_EXTERNAL=y
+CT_LIBC_glibc_familly=y
+CT_LIBC_GLIBC_EXTRA_CONFIG_ARRAY=""
+CT_LIBC_GLIBC_CONFIGPARMS=""
+CT_LIBC_GLIBC_EXTRA_CFLAGS=""
+CT_LIBC_EXTRA_CC_ARGS=""
+# CT_LIBC_DISABLE_VERSIONING is not set
+CT_LIBC_OLDEST_ABI=""
+CT_LIBC_GLIBC_FORCE_UNWIND=y
+# CT_LIBC_GLIBC_USE_PORTS is not set
+CT_LIBC_ADDONS_LIST=""
+# CT_LIBC_LOCALES is not set
+# CT_LIBC_GLIBC_KERNEL_VERSION_NONE is not set
+CT_LIBC_GLIBC_KERNEL_VERSION_AS_HEADERS=y
+# CT_LIBC_GLIBC_KERNEL_VERSION_CHOSEN is not set
+CT_LIBC_GLIBC_MIN_KERNEL="2.6.32.68"
+
+#
+# C compiler
+#
+CT_CC="gcc"
+CT_CC_CORE_PASSES_NEEDED=y
+CT_CC_CORE_PASS_1_NEEDED=y
+CT_CC_CORE_PASS_2_NEEDED=y
+CT_CC_gcc=y
+# CT_CC_GCC_SHOW_LINARO is not set
+# CT_CC_GCC_V_5_2_0 is not set
+CT_CC_GCC_V_4_9_3=y
+# CT_CC_GCC_V_4_8_5 is not set
+# CT_CC_GCC_V_4_7_4 is not set
+# CT_CC_GCC_V_4_6_4 is not set
+# CT_CC_GCC_V_4_5_4 is not set
+# CT_CC_GCC_V_4_4_7 is not set
+# CT_CC_GCC_V_4_3_6 is not set
+# CT_CC_GCC_V_4_2_4 is not set
+CT_CC_GCC_4_2_or_later=y
+CT_CC_GCC_4_3_or_later=y
+CT_CC_GCC_4_4_or_later=y
+CT_CC_GCC_4_5_or_later=y
+CT_CC_GCC_4_6_or_later=y
+CT_CC_GCC_4_7_or_later=y
+CT_CC_GCC_4_8_or_later=y
+CT_CC_GCC_4_9=y
+CT_CC_GCC_4_9_or_later=y
+CT_CC_GCC_HAS_GRAPHITE=y
+CT_CC_GCC_USE_GRAPHITE=y
+CT_CC_GCC_HAS_LTO=y
+CT_CC_GCC_USE_LTO=y
+CT_CC_GCC_HAS_PKGVERSION_BUGURL=y
+CT_CC_GCC_HAS_BUILD_ID=y
+CT_CC_GCC_HAS_LNK_HASH_STYLE=y
+CT_CC_GCC_USE_GMP_MPFR=y
+CT_CC_GCC_USE_MPC=y
+CT_CC_GCC_HAS_LIBQUADMATH=y
+CT_CC_GCC_HAS_LIBSANITIZER=y
+CT_CC_GCC_VERSION="4.9.3"
+# CT_CC_LANG_FORTRAN is not set
+CT_CC_GCC_ENABLE_CXX_FLAGS=""
+CT_CC_GCC_CORE_EXTRA_CONFIG_ARRAY="--with-cpu-32=power4 --with-cpu=default32"
+CT_CC_GCC_EXTRA_CONFIG_ARRAY="--with-cpu-32=power4 --with-cpu=default32"
+CT_CC_GCC_EXTRA_ENV_ARRAY=""
+CT_CC_GCC_STATIC_LIBSTDCXX=y
+# CT_CC_GCC_SYSTEM_ZLIB is not set
+
+#
+# Optimisation features
+#
+
+#
+# Settings for libraries running on target
+#
+CT_CC_GCC_ENABLE_TARGET_OPTSPACE=y
+# CT_CC_GCC_LIBMUDFLAP is not set
+# CT_CC_GCC_LIBGOMP is not set
+# CT_CC_GCC_LIBSSP is not set
+# CT_CC_GCC_LIBQUADMATH is not set
+# CT_CC_GCC_LIBSANITIZER is not set
+
+#
+# Misc. obscure options.
+#
+CT_CC_CXA_ATEXIT=y
+# CT_CC_GCC_DISABLE_PCH is not set
+CT_CC_GCC_SJLJ_EXCEPTIONS=m
+CT_CC_GCC_LDBL_128=m
+# CT_CC_GCC_BUILD_ID is not set
+CT_CC_GCC_LNK_HASH_STYLE_DEFAULT=y
+# CT_CC_GCC_LNK_HASH_STYLE_SYSV is not set
+# CT_CC_GCC_LNK_HASH_STYLE_GNU is not set
+# CT_CC_GCC_LNK_HASH_STYLE_BOTH is not set
+CT_CC_GCC_LNK_HASH_STYLE=""
+CT_CC_GCC_DEC_FLOAT_AUTO=y
+# CT_CC_GCC_DEC_FLOAT_BID is not set
+# CT_CC_GCC_DEC_FLOAT_DPD is not set
+# CT_CC_GCC_DEC_FLOATS_NO is not set
+CT_CC_SUPPORT_CXX=y
+CT_CC_SUPPORT_FORTRAN=y
+CT_CC_SUPPORT_JAVA=y
+CT_CC_SUPPORT_ADA=y
+CT_CC_SUPPORT_OBJC=y
+CT_CC_SUPPORT_OBJCXX=y
+CT_CC_SUPPORT_GOLANG=y
+
+#
+# Additional supported languages:
+#
+CT_CC_LANG_CXX=y
+# CT_CC_LANG_JAVA is not set
+
+#
+# Debug facilities
+#
+# CT_DEBUG_dmalloc is not set
+# CT_DEBUG_duma is not set
+# CT_DEBUG_gdb is not set
+# CT_DEBUG_ltrace is not set
+# CT_DEBUG_strace is not set
+
+#
+# Companion libraries
+#
+CT_COMPLIBS_NEEDED=y
+CT_LIBICONV_NEEDED=y
+CT_GETTEXT_NEEDED=y
+CT_GMP_NEEDED=y
+CT_MPFR_NEEDED=y
+CT_ISL_NEEDED=y
+CT_CLOOG_NEEDED=y
+CT_MPC_NEEDED=y
+CT_COMPLIBS=y
+CT_LIBICONV=y
+CT_GETTEXT=y
+CT_GMP=y
+CT_MPFR=y
+CT_ISL=y
+CT_CLOOG=y
+CT_MPC=y
+CT_LIBICONV_V_1_14=y
+CT_LIBICONV_VERSION="1.14"
+CT_GETTEXT_V_0_19_6=y
+CT_GETTEXT_VERSION="0.19.6"
+CT_GMP_V_6_0_0=y
+# CT_GMP_V_5_1_3 is not set
+# CT_GMP_V_5_1_1 is not set
+# CT_GMP_V_5_0_2 is not set
+# CT_GMP_V_5_0_1 is not set
+# CT_GMP_V_4_3_2 is not set
+# CT_GMP_V_4_3_1 is not set
+# CT_GMP_V_4_3_0 is not set
+CT_GMP_5_0_2_or_later=y
+CT_GMP_VERSION="6.0.0a"
+CT_MPFR_V_3_1_3=y
+# CT_MPFR_V_3_1_2 is not set
+# CT_MPFR_V_3_1_0 is not set
+# CT_MPFR_V_3_0_1 is not set
+# CT_MPFR_V_3_0_0 is not set
+# CT_MPFR_V_2_4_2 is not set
+# CT_MPFR_V_2_4_1 is not set
+# CT_MPFR_V_2_4_0 is not set
+CT_MPFR_VERSION="3.1.3"
+CT_ISL_V_0_14=y
+CT_ISL_V_0_14_or_later=y
+CT_ISL_V_0_12_or_later=y
+CT_ISL_VERSION="0.14"
+CT_CLOOG_V_0_18_4=y
+# CT_CLOOG_V_0_18_1 is not set
+# CT_CLOOG_V_0_18_0 is not set
+CT_CLOOG_VERSION="0.18.4"
+CT_CLOOG_0_18_4_or_later=y
+CT_CLOOG_0_18_or_later=y
+CT_MPC_V_1_0_3=y
+# CT_MPC_V_1_0_2 is not set
+# CT_MPC_V_1_0_1 is not set
+# CT_MPC_V_1_0 is not set
+# CT_MPC_V_0_9 is not set
+# CT_MPC_V_0_8_2 is not set
+# CT_MPC_V_0_8_1 is not set
+# CT_MPC_V_0_7 is not set
+CT_MPC_VERSION="1.0.3"
+
+#
+# Companion libraries common options
+#
+# CT_COMPLIBS_CHECK is not set
+
+#
+# Companion tools
+#
+
+#
+# READ HELP before you say 'Y' below !!!
+#
+# CT_COMP_TOOLS is not set
FROM ubuntu:16.04
RUN apt-get update && apt-get install -y --no-install-recommends \
+ automake \
+ bison \
+ bzip2 \
+ ca-certificates \
+ cmake \
+ curl \
+ file \
+ flex \
g++ \
+ gawk \
+ gdb \
+ git \
+ gperf \
+ help2man \
+ libncurses-dev \
+ libtool-bin \
make \
- file \
- curl \
- ca-certificates \
+ patch \
python2.7 \
- git \
- cmake \
sudo \
- gdb \
- xz-utils \
- g++-powerpc64-linux-gnu \
- g++-powerpc64le-linux-gnu
+ texinfo \
+ wget \
+ xz-utils
ENV SCCACHE_DIGEST=7237e38e029342fa27b7ac25412cb9d52554008b12389727320bd533fd7f05b6a96d55485f305caf95e5c8f5f97c3313e10012ccad3e752aba2518f3522ba783
RUN curl -L https://api.pub.build.mozilla.org/tooltool/sha512/$SCCACHE_DIGEST | \
rm dumb-init_*.deb
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
+# Ubuntu 16.04 (this contianer) ships with make 4, but something in the
+# toolchains we build below chokes on that, so go back to make 3
+RUN curl https://ftp.gnu.org/gnu/make/make-3.81.tar.gz | tar xzf - && \
+ cd make-3.81 && \
+ ./configure --prefix=/usr && \
+ make && \
+ make install && \
+ cd .. && \
+ rm -rf make-3.81
+
+RUN curl http://crosstool-ng.org/download/crosstool-ng/crosstool-ng-1.22.0.tar.bz2 | \
+ tar xjf - && \
+ cd crosstool-ng && \
+ ./configure --prefix=/usr/local && \
+ make -j$(nproc) && \
+ make install && \
+ cd .. && \
+ rm -rf crosstool-ng
+
+RUN groupadd -r rustbuild && useradd -m -r -g rustbuild rustbuild
+RUN mkdir /x-tools && chown rustbuild:rustbuild /x-tools
+USER rustbuild
+WORKDIR /tmp
+
+COPY patches/ /tmp/patches/
+COPY powerpc64-linux-gnu.config build-powerpc64-toolchain.sh /tmp/
+RUN ./build-powerpc64-toolchain.sh
+
+USER root
+
+RUN apt-get install -y --no-install-recommends rpm2cpio cpio
+COPY build-powerpc64le-toolchain.sh /tmp/
+RUN ./build-powerpc64le-toolchain.sh
+
+ENV PATH=$PATH:/x-tools/powerpc64-unknown-linux-gnu/bin
+
ENV \
- AR_powerpc64_unknown_linux_gnu=powerpc64-linux-gnu-ar \
- CC_powerpc64_unknown_linux_gnu=powerpc64-linux-gnu-gcc \
- CXX_powerpc64_unknown_linux_gnu=powerpc64-linux-gnu-g++
+ AR_powerpc64_unknown_linux_gnu=powerpc64-unknown-linux-gnu-ar \
+ CC_powerpc64_unknown_linux_gnu=powerpc64-unknown-linux-gnu-gcc \
+ CXX_powerpc64_unknown_linux_gnu=powerpc64-unknown-linux-gnu-g++ \
+ AR_powerpc64le_unknown_linux_gnu=powerpc64le-linux-gnu-ar \
+ CC_powerpc64le_unknown_linux_gnu=powerpc64le-linux-gnu-gcc \
+ CXX_powerpc64le_unknown_linux_gnu=powerpc64le-linux-gnu-g++
ENV HOSTS=powerpc64-unknown-linux-gnu
ENV HOSTS=$HOSTS,powerpc64le-unknown-linux-gnu
--- /dev/null
+#!/bin/bash
+# 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.
+
+set -ex
+
+hide_output() {
+ set +x
+ on_err="
+echo ERROR: An error was encountered with the build.
+cat /tmp/build.log
+exit 1
+"
+ trap "$on_err" ERR
+ bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
+ PING_LOOP_PID=$!
+ $@ &> /tmp/build.log
+ rm /tmp/build.log
+ trap - ERR
+ kill $PING_LOOP_PID
+ set -x
+}
+
+mkdir build
+cd build
+cp ../powerpc64-linux-gnu.config .config
+hide_output ct-ng build
+cd ..
+rm -rf build
--- /dev/null
+#!/bin/bash
+# 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.
+
+set -ex
+
+BINUTILS=2.25.1
+GCC=5.3.0
+TARGET=powerpc64le-linux-gnu
+SYSROOT=/usr/local/$TARGET/sysroot
+
+# First, download the CentOS7 glibc.ppc64le and relevant header files.
+# (upstream ppc64le support wasn't added until 2.19, which el7 backported.)
+mkdir -p $SYSROOT
+pushd $SYSROOT
+
+centos_base=http://mirror.centos.org/altarch/7.3.1611/os/ppc64le/Packages
+glibc_v=2.17-157.el7
+kernel_v=3.10.0-514.el7
+for package in glibc{,-devel,-headers}-$glibc_v kernel-headers-$kernel_v; do
+ curl $centos_base/$package.ppc64le.rpm | \
+ rpm2cpio - | cpio -idm
+done
+
+ln -sT lib64 lib
+ln -sT lib64 usr/lib
+
+popd
+
+# Next, download and build binutils.
+mkdir binutils-$TARGET
+pushd binutils-$TARGET
+curl https://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS.tar.bz2 | tar xjf -
+mkdir binutils-build
+cd binutils-build
+../binutils-$BINUTILS/configure --target=$TARGET --with-sysroot=$SYSROOT
+make -j10
+make install
+popd
+rm -rf binutils-$TARGET
+
+# Finally, download and build gcc.
+mkdir gcc-$TARGET
+pushd gcc-$TARGET
+curl https://ftp.gnu.org/gnu/gcc/gcc-$GCC/gcc-$GCC.tar.bz2 | tar xjf -
+cd gcc-$GCC
+./contrib/download_prerequisites
+
+mkdir ../gcc-build
+cd ../gcc-build
+../gcc-$GCC/configure \
+ --enable-languages=c,c++ \
+ --target=$TARGET \
+ --with-cpu=power8 \
+ --with-sysroot=$SYSROOT \
+ --disable-libcilkrts \
+ --disable-multilib \
+ --disable-nls \
+ --disable-libgomp \
+ --disable-libquadmath \
+ --disable-libssp \
+ --disable-libvtv \
+ --disable-libcilkrt \
+ --disable-libada \
+ --disable-libsanitizer \
+ --disable-libquadmath-support \
+ --disable-lto
+make -j10
+make install
+
+popd
+rm -rf gcc-$TARGET
--- /dev/null
+From b3563932f85d60bb0d38b0a5f3b8f4abc133f890 Mon Sep 17 00:00:00 2001
+From: Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
+Date: Thu, 1 Nov 2012 18:00:06 -0500
+Subject: [PATCH] PowerPC: Remove unnecessary -mnew-mnemonics.
+
+---
+ sysdeps/powerpc/Makefile | 4 ----
+ 1 file changed, 4 deletions(-)
+
+diff --git a/sysdeps/powerpc/Makefile b/sysdeps/powerpc/Makefile
+index 79dd6fa976d5..7442b6709ad1 100644
+--- a/sysdeps/powerpc/Makefile
++++ b/sysdeps/powerpc/Makefile
+@@ -1,7 +1,3 @@
+-# We always want to use the new mnemonic syntax even if we are on a RS6000
+-# machine.
+-+cflags += -mnew-mnemonics
+-
+ ifeq ($(subdir),gmon)
+ sysdep_routines += ppc-mcount
+ endif
+--
+2.9.3
+
--- /dev/null
+From a4f388e111ce05e2ab7912cff3c9070334bb74ae Mon Sep 17 00:00:00 2001
+From: Josh Stone <jistone@redhat.com>
+Date: Fri, 20 Jan 2017 15:41:56 -0800
+Subject: [PATCH] Prevent inlining in PPC64 initfini.s
+
+Ref: https://sourceware.org/ml/libc-alpha/2012-01/msg00195.html
+---
+ sysdeps/powerpc/powerpc64/Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/sysdeps/powerpc/powerpc64/Makefile b/sysdeps/powerpc/powerpc64/Makefile
+index 78d4f07e575f..fe96aae4d43e 100644
+--- a/sysdeps/powerpc/powerpc64/Makefile
++++ b/sysdeps/powerpc/powerpc64/Makefile
+@@ -28,7 +28,7 @@ elide-routines.os += hp-timing
+ ifneq ($(elf),no)
+ # The initfini generation code doesn't work in the presence of -fPIC, so
+ # we use -fpic instead which is much better.
+-CFLAGS-initfini.s += -fpic -O1
++CFLAGS-initfini.s += -fpic -O1 -fno-inline
+ endif
+ endif
+
+--
+2.9.3
+
--- /dev/null
+#
+# Automatically generated file; DO NOT EDIT.
+# Crosstool-NG Configuration
+#
+CT_CONFIGURE_has_make381=y
+CT_CONFIGURE_has_xz=y
+CT_MODULES=y
+
+#
+# Paths and misc options
+#
+
+#
+# crosstool-NG behavior
+#
+# CT_OBSOLETE is not set
+# CT_EXPERIMENTAL is not set
+# CT_DEBUG_CT is not set
+
+#
+# Paths
+#
+CT_LOCAL_TARBALLS_DIR=""
+CT_WORK_DIR="${CT_TOP_DIR}/.build"
+CT_PREFIX_DIR="/x-tools/${CT_TARGET}"
+CT_INSTALL_DIR="${CT_PREFIX_DIR}"
+CT_RM_RF_PREFIX_DIR=y
+CT_REMOVE_DOCS=y
+CT_INSTALL_DIR_RO=y
+CT_STRIP_HOST_TOOLCHAIN_EXECUTABLES=y
+# CT_STRIP_TARGET_TOOLCHAIN_EXECUTABLES is not set
+
+#
+# Downloading
+#
+# CT_FORBID_DOWNLOAD is not set
+# CT_FORCE_DOWNLOAD is not set
+CT_CONNECT_TIMEOUT=10
+# CT_ONLY_DOWNLOAD is not set
+# CT_USE_MIRROR is not set
+
+#
+# Extracting
+#
+# CT_FORCE_EXTRACT is not set
+CT_OVERIDE_CONFIG_GUESS_SUB=y
+# CT_ONLY_EXTRACT is not set
+# CT_PATCH_BUNDLED is not set
+# CT_PATCH_LOCAL is not set
+CT_PATCH_BUNDLED_LOCAL=y
+# CT_PATCH_LOCAL_BUNDLED is not set
+# CT_PATCH_BUNDLED_FALLBACK_LOCAL is not set
+# CT_PATCH_LOCAL_FALLBACK_BUNDLED is not set
+# CT_PATCH_NONE is not set
+CT_PATCH_ORDER="bundled,local"
+CT_PATCH_USE_LOCAL=y
+CT_LOCAL_PATCH_DIR="/tmp/patches"
+
+#
+# Build behavior
+#
+CT_PARALLEL_JOBS=0
+CT_LOAD=""
+CT_USE_PIPES=y
+CT_EXTRA_CFLAGS_FOR_BUILD=""
+CT_EXTRA_LDFLAGS_FOR_BUILD=""
+CT_EXTRA_CFLAGS_FOR_HOST=""
+CT_EXTRA_LDFLAGS_FOR_HOST=""
+# CT_CONFIG_SHELL_SH is not set
+# CT_CONFIG_SHELL_ASH is not set
+CT_CONFIG_SHELL_BASH=y
+# CT_CONFIG_SHELL_CUSTOM is not set
+CT_CONFIG_SHELL="${bash}"
+
+#
+# Logging
+#
+# CT_LOG_ERROR is not set
+# CT_LOG_WARN is not set
+CT_LOG_INFO=y
+# CT_LOG_EXTRA is not set
+# CT_LOG_ALL is not set
+# CT_LOG_DEBUG is not set
+CT_LOG_LEVEL_MAX="INFO"
+# CT_LOG_SEE_TOOLS_WARN is not set
+CT_LOG_PROGRESS_BAR=y
+CT_LOG_TO_FILE=y
+CT_LOG_FILE_COMPRESS=y
+
+#
+# Target options
+#
+CT_ARCH="powerpc"
+CT_ARCH_SUPPORTS_BOTH_ENDIAN=y
+CT_ARCH_SUPPORTS_32=y
+CT_ARCH_SUPPORTS_64=y
+CT_ARCH_SUPPORTS_WITH_ABI=y
+CT_ARCH_SUPPORTS_WITH_CPU=y
+CT_ARCH_SUPPORTS_WITH_TUNE=y
+CT_ARCH_SUPPORTS_WITH_FLOAT=y
+CT_ARCH_DEFAULT_BE=y
+CT_ARCH_DEFAULT_32=y
+CT_ARCH_ABI=""
+CT_ARCH_CPU="power4"
+CT_ARCH_TUNE="power6"
+CT_ARCH_BE=y
+# CT_ARCH_LE is not set
+# CT_ARCH_32 is not set
+CT_ARCH_64=y
+CT_ARCH_BITNESS=64
+# CT_ARCH_FLOAT_HW is not set
+# CT_ARCH_FLOAT_SW is not set
+CT_TARGET_CFLAGS=""
+CT_TARGET_LDFLAGS=""
+# CT_ARCH_alpha is not set
+# CT_ARCH_arm is not set
+# CT_ARCH_avr is not set
+# CT_ARCH_m68k is not set
+# CT_ARCH_mips is not set
+# CT_ARCH_nios2 is not set
+CT_ARCH_powerpc=y
+# CT_ARCH_s390 is not set
+# CT_ARCH_sh is not set
+# CT_ARCH_sparc is not set
+# CT_ARCH_x86 is not set
+# CT_ARCH_xtensa is not set
+CT_ARCH_alpha_AVAILABLE=y
+CT_ARCH_arm_AVAILABLE=y
+CT_ARCH_avr_AVAILABLE=y
+CT_ARCH_m68k_AVAILABLE=y
+CT_ARCH_microblaze_AVAILABLE=y
+CT_ARCH_mips_AVAILABLE=y
+CT_ARCH_nios2_AVAILABLE=y
+CT_ARCH_powerpc_AVAILABLE=y
+CT_ARCH_s390_AVAILABLE=y
+CT_ARCH_sh_AVAILABLE=y
+CT_ARCH_sparc_AVAILABLE=y
+CT_ARCH_x86_AVAILABLE=y
+CT_ARCH_xtensa_AVAILABLE=y
+CT_ARCH_SUFFIX=""
+
+#
+# Generic target options
+#
+# CT_MULTILIB is not set
+CT_ARCH_USE_MMU=y
+CT_ARCH_ENDIAN="big"
+
+#
+# Target optimisations
+#
+CT_ARCH_FLOAT_AUTO=y
+CT_ARCH_FLOAT="auto"
+
+#
+# powerpc other options
+#
+CT_ARCH_powerpc_ABI=""
+CT_ARCH_powerpc_ABI_DEFAULT=y
+# CT_ARCH_powerpc_ABI_SPE is not set
+
+#
+# Toolchain options
+#
+
+#
+# General toolchain options
+#
+CT_FORCE_SYSROOT=y
+CT_USE_SYSROOT=y
+CT_SYSROOT_NAME="sysroot"
+CT_SYSROOT_DIR_PREFIX=""
+CT_WANTS_STATIC_LINK=y
+# CT_STATIC_TOOLCHAIN is not set
+CT_TOOLCHAIN_PKGVERSION=""
+CT_TOOLCHAIN_BUGURL=""
+
+#
+# Tuple completion and aliasing
+#
+CT_TARGET_VENDOR="unknown"
+CT_TARGET_ALIAS_SED_EXPR=""
+CT_TARGET_ALIAS=""
+
+#
+# Toolchain type
+#
+CT_CROSS=y
+# CT_CANADIAN is not set
+CT_TOOLCHAIN_TYPE="cross"
+
+#
+# Build system
+#
+CT_BUILD=""
+CT_BUILD_PREFIX=""
+CT_BUILD_SUFFIX=""
+
+#
+# Misc options
+#
+# CT_TOOLCHAIN_ENABLE_NLS is not set
+
+#
+# Operating System
+#
+CT_KERNEL_SUPPORTS_SHARED_LIBS=y
+CT_KERNEL="linux"
+CT_KERNEL_VERSION="2.6.32.68"
+# CT_KERNEL_bare_metal is not set
+CT_KERNEL_linux=y
+CT_KERNEL_bare_metal_AVAILABLE=y
+CT_KERNEL_linux_AVAILABLE=y
+# CT_KERNEL_V_4_3 is not set
+# CT_KERNEL_V_4_2 is not set
+# CT_KERNEL_V_4_1 is not set
+# CT_KERNEL_V_3_18 is not set
+# CT_KERNEL_V_3_14 is not set
+# CT_KERNEL_V_3_12 is not set
+# CT_KERNEL_V_3_10 is not set
+# CT_KERNEL_V_3_4 is not set
+# CT_KERNEL_V_3_2 is not set
+CT_KERNEL_V_2_6_32=y
+# CT_KERNEL_LINUX_CUSTOM is not set
+CT_KERNEL_windows_AVAILABLE=y
+
+#
+# Common kernel options
+#
+CT_SHARED_LIBS=y
+
+#
+# linux other options
+#
+CT_KERNEL_LINUX_VERBOSITY_0=y
+# CT_KERNEL_LINUX_VERBOSITY_1 is not set
+# CT_KERNEL_LINUX_VERBOSITY_2 is not set
+CT_KERNEL_LINUX_VERBOSE_LEVEL=0
+CT_KERNEL_LINUX_INSTALL_CHECK=y
+
+#
+# Binary utilities
+#
+CT_ARCH_BINFMT_ELF=y
+CT_BINUTILS="binutils"
+CT_BINUTILS_binutils=y
+
+#
+# GNU binutils
+#
+# CT_CC_BINUTILS_SHOW_LINARO is not set
+CT_BINUTILS_V_2_25_1=y
+# CT_BINUTILS_V_2_25 is not set
+# CT_BINUTILS_V_2_24 is not set
+# CT_BINUTILS_V_2_23_2 is not set
+# CT_BINUTILS_V_2_23_1 is not set
+# CT_BINUTILS_V_2_22 is not set
+# CT_BINUTILS_V_2_21_53 is not set
+# CT_BINUTILS_V_2_21_1a is not set
+# CT_BINUTILS_V_2_20_1a is not set
+# CT_BINUTILS_V_2_19_1a is not set
+# CT_BINUTILS_V_2_18a is not set
+CT_BINUTILS_VERSION="2.25.1"
+CT_BINUTILS_2_25_1_or_later=y
+CT_BINUTILS_2_25_or_later=y
+CT_BINUTILS_2_24_or_later=y
+CT_BINUTILS_2_23_or_later=y
+CT_BINUTILS_2_22_or_later=y
+CT_BINUTILS_2_21_or_later=y
+CT_BINUTILS_2_20_or_later=y
+CT_BINUTILS_2_19_or_later=y
+CT_BINUTILS_2_18_or_later=y
+CT_BINUTILS_HAS_HASH_STYLE=y
+CT_BINUTILS_HAS_GOLD=y
+CT_BINUTILS_HAS_PLUGINS=y
+CT_BINUTILS_HAS_PKGVERSION_BUGURL=y
+CT_BINUTILS_FORCE_LD_BFD=y
+CT_BINUTILS_LINKER_LD=y
+CT_BINUTILS_LINKERS_LIST="ld"
+CT_BINUTILS_LINKER_DEFAULT="bfd"
+# CT_BINUTILS_PLUGINS is not set
+CT_BINUTILS_EXTRA_CONFIG_ARRAY=""
+# CT_BINUTILS_FOR_TARGET is not set
+
+#
+# binutils other options
+#
+
+#
+# C-library
+#
+CT_LIBC="glibc"
+CT_LIBC_VERSION="2.12.2"
+CT_LIBC_glibc=y
+# CT_LIBC_musl is not set
+# CT_LIBC_uClibc is not set
+CT_LIBC_avr_libc_AVAILABLE=y
+CT_LIBC_glibc_AVAILABLE=y
+CT_THREADS="nptl"
+# CT_CC_GLIBC_SHOW_LINARO is not set
+# CT_LIBC_GLIBC_V_2_22 is not set
+# CT_LIBC_GLIBC_V_2_21 is not set
+# CT_LIBC_GLIBC_V_2_20 is not set
+# CT_LIBC_GLIBC_V_2_19 is not set
+# CT_LIBC_GLIBC_V_2_18 is not set
+# CT_LIBC_GLIBC_V_2_17 is not set
+# CT_LIBC_GLIBC_V_2_16_0 is not set
+# CT_LIBC_GLIBC_V_2_15 is not set
+# CT_LIBC_GLIBC_V_2_14_1 is not set
+# CT_LIBC_GLIBC_V_2_14 is not set
+# CT_LIBC_GLIBC_V_2_13 is not set
+CT_LIBC_GLIBC_V_2_12_2=y
+# CT_LIBC_GLIBC_V_2_12_1 is not set
+# CT_LIBC_GLIBC_V_2_11_1 is not set
+# CT_LIBC_GLIBC_V_2_11 is not set
+# CT_LIBC_GLIBC_V_2_10_1 is not set
+# CT_LIBC_GLIBC_V_2_9 is not set
+# CT_LIBC_GLIBC_V_2_8 is not set
+CT_LIBC_mingw_AVAILABLE=y
+CT_LIBC_musl_AVAILABLE=y
+CT_LIBC_newlib_AVAILABLE=y
+CT_LIBC_none_AVAILABLE=y
+CT_LIBC_uClibc_AVAILABLE=y
+CT_LIBC_SUPPORT_THREADS_ANY=y
+CT_LIBC_SUPPORT_THREADS_NATIVE=y
+
+#
+# Common C library options
+#
+CT_THREADS_NATIVE=y
+CT_LIBC_XLDD=y
+
+#
+# glibc other options
+#
+CT_LIBC_GLIBC_PORTS_EXTERNAL=y
+CT_LIBC_glibc_familly=y
+CT_LIBC_GLIBC_EXTRA_CONFIG_ARRAY=""
+CT_LIBC_GLIBC_CONFIGPARMS=""
+CT_LIBC_GLIBC_EXTRA_CFLAGS=""
+CT_LIBC_EXTRA_CC_ARGS=""
+# CT_LIBC_DISABLE_VERSIONING is not set
+CT_LIBC_OLDEST_ABI=""
+CT_LIBC_GLIBC_FORCE_UNWIND=y
+# CT_LIBC_GLIBC_USE_PORTS is not set
+CT_LIBC_ADDONS_LIST=""
+# CT_LIBC_LOCALES is not set
+# CT_LIBC_GLIBC_KERNEL_VERSION_NONE is not set
+CT_LIBC_GLIBC_KERNEL_VERSION_AS_HEADERS=y
+# CT_LIBC_GLIBC_KERNEL_VERSION_CHOSEN is not set
+CT_LIBC_GLIBC_MIN_KERNEL="2.6.32.68"
+
+#
+# C compiler
+#
+CT_CC="gcc"
+CT_CC_CORE_PASSES_NEEDED=y
+CT_CC_CORE_PASS_1_NEEDED=y
+CT_CC_CORE_PASS_2_NEEDED=y
+CT_CC_gcc=y
+# CT_CC_GCC_SHOW_LINARO is not set
+# CT_CC_GCC_V_5_2_0 is not set
+CT_CC_GCC_V_4_9_3=y
+# CT_CC_GCC_V_4_8_5 is not set
+# CT_CC_GCC_V_4_7_4 is not set
+# CT_CC_GCC_V_4_6_4 is not set
+# CT_CC_GCC_V_4_5_4 is not set
+# CT_CC_GCC_V_4_4_7 is not set
+# CT_CC_GCC_V_4_3_6 is not set
+# CT_CC_GCC_V_4_2_4 is not set
+CT_CC_GCC_4_2_or_later=y
+CT_CC_GCC_4_3_or_later=y
+CT_CC_GCC_4_4_or_later=y
+CT_CC_GCC_4_5_or_later=y
+CT_CC_GCC_4_6_or_later=y
+CT_CC_GCC_4_7_or_later=y
+CT_CC_GCC_4_8_or_later=y
+CT_CC_GCC_4_9=y
+CT_CC_GCC_4_9_or_later=y
+CT_CC_GCC_HAS_GRAPHITE=y
+CT_CC_GCC_USE_GRAPHITE=y
+CT_CC_GCC_HAS_LTO=y
+CT_CC_GCC_USE_LTO=y
+CT_CC_GCC_HAS_PKGVERSION_BUGURL=y
+CT_CC_GCC_HAS_BUILD_ID=y
+CT_CC_GCC_HAS_LNK_HASH_STYLE=y
+CT_CC_GCC_USE_GMP_MPFR=y
+CT_CC_GCC_USE_MPC=y
+CT_CC_GCC_HAS_LIBQUADMATH=y
+CT_CC_GCC_HAS_LIBSANITIZER=y
+CT_CC_GCC_VERSION="4.9.3"
+# CT_CC_LANG_FORTRAN is not set
+CT_CC_GCC_ENABLE_CXX_FLAGS=""
+CT_CC_GCC_CORE_EXTRA_CONFIG_ARRAY=""
+CT_CC_GCC_EXTRA_CONFIG_ARRAY=""
+CT_CC_GCC_EXTRA_ENV_ARRAY=""
+CT_CC_GCC_STATIC_LIBSTDCXX=y
+# CT_CC_GCC_SYSTEM_ZLIB is not set
+
+#
+# Optimisation features
+#
+
+#
+# Settings for libraries running on target
+#
+CT_CC_GCC_ENABLE_TARGET_OPTSPACE=y
+# CT_CC_GCC_LIBMUDFLAP is not set
+# CT_CC_GCC_LIBGOMP is not set
+# CT_CC_GCC_LIBSSP is not set
+# CT_CC_GCC_LIBQUADMATH is not set
+# CT_CC_GCC_LIBSANITIZER is not set
+
+#
+# Misc. obscure options.
+#
+CT_CC_CXA_ATEXIT=y
+# CT_CC_GCC_DISABLE_PCH is not set
+CT_CC_GCC_SJLJ_EXCEPTIONS=m
+CT_CC_GCC_LDBL_128=m
+# CT_CC_GCC_BUILD_ID is not set
+CT_CC_GCC_LNK_HASH_STYLE_DEFAULT=y
+# CT_CC_GCC_LNK_HASH_STYLE_SYSV is not set
+# CT_CC_GCC_LNK_HASH_STYLE_GNU is not set
+# CT_CC_GCC_LNK_HASH_STYLE_BOTH is not set
+CT_CC_GCC_LNK_HASH_STYLE=""
+CT_CC_GCC_DEC_FLOAT_AUTO=y
+# CT_CC_GCC_DEC_FLOAT_BID is not set
+# CT_CC_GCC_DEC_FLOAT_DPD is not set
+# CT_CC_GCC_DEC_FLOATS_NO is not set
+CT_CC_SUPPORT_CXX=y
+CT_CC_SUPPORT_FORTRAN=y
+CT_CC_SUPPORT_JAVA=y
+CT_CC_SUPPORT_ADA=y
+CT_CC_SUPPORT_OBJC=y
+CT_CC_SUPPORT_OBJCXX=y
+CT_CC_SUPPORT_GOLANG=y
+
+#
+# Additional supported languages:
+#
+CT_CC_LANG_CXX=y
+# CT_CC_LANG_JAVA is not set
+
+#
+# Debug facilities
+#
+# CT_DEBUG_dmalloc is not set
+# CT_DEBUG_duma is not set
+# CT_DEBUG_gdb is not set
+# CT_DEBUG_ltrace is not set
+# CT_DEBUG_strace is not set
+
+#
+# Companion libraries
+#
+CT_COMPLIBS_NEEDED=y
+CT_LIBICONV_NEEDED=y
+CT_GETTEXT_NEEDED=y
+CT_GMP_NEEDED=y
+CT_MPFR_NEEDED=y
+CT_ISL_NEEDED=y
+CT_CLOOG_NEEDED=y
+CT_MPC_NEEDED=y
+CT_COMPLIBS=y
+CT_LIBICONV=y
+CT_GETTEXT=y
+CT_GMP=y
+CT_MPFR=y
+CT_ISL=y
+CT_CLOOG=y
+CT_MPC=y
+CT_LIBICONV_V_1_14=y
+CT_LIBICONV_VERSION="1.14"
+CT_GETTEXT_V_0_19_6=y
+CT_GETTEXT_VERSION="0.19.6"
+CT_GMP_V_6_0_0=y
+# CT_GMP_V_5_1_3 is not set
+# CT_GMP_V_5_1_1 is not set
+# CT_GMP_V_5_0_2 is not set
+# CT_GMP_V_5_0_1 is not set
+# CT_GMP_V_4_3_2 is not set
+# CT_GMP_V_4_3_1 is not set
+# CT_GMP_V_4_3_0 is not set
+CT_GMP_5_0_2_or_later=y
+CT_GMP_VERSION="6.0.0a"
+CT_MPFR_V_3_1_3=y
+# CT_MPFR_V_3_1_2 is not set
+# CT_MPFR_V_3_1_0 is not set
+# CT_MPFR_V_3_0_1 is not set
+# CT_MPFR_V_3_0_0 is not set
+# CT_MPFR_V_2_4_2 is not set
+# CT_MPFR_V_2_4_1 is not set
+# CT_MPFR_V_2_4_0 is not set
+CT_MPFR_VERSION="3.1.3"
+CT_ISL_V_0_14=y
+CT_ISL_V_0_14_or_later=y
+CT_ISL_V_0_12_or_later=y
+CT_ISL_VERSION="0.14"
+CT_CLOOG_V_0_18_4=y
+# CT_CLOOG_V_0_18_1 is not set
+# CT_CLOOG_V_0_18_0 is not set
+CT_CLOOG_VERSION="0.18.4"
+CT_CLOOG_0_18_4_or_later=y
+CT_CLOOG_0_18_or_later=y
+CT_MPC_V_1_0_3=y
+# CT_MPC_V_1_0_2 is not set
+# CT_MPC_V_1_0_1 is not set
+# CT_MPC_V_1_0 is not set
+# CT_MPC_V_0_9 is not set
+# CT_MPC_V_0_8_2 is not set
+# CT_MPC_V_0_8_1 is not set
+# CT_MPC_V_0_7 is not set
+CT_MPC_VERSION="1.0.3"
+
+#
+# Companion libraries common options
+#
+# CT_COMPLIBS_CHECK is not set
+
+#
+# Companion tools
+#
+
+#
+# READ HELP before you say 'Y' below !!!
+#
+# CT_COMP_TOOLS is not set
FROM ubuntu:16.04
RUN apt-get update && apt-get install -y --no-install-recommends \
+ automake \
+ bison \
+ bzip2 \
+ ca-certificates \
+ cmake \
+ curl \
+ file \
+ flex \
g++ \
+ gawk \
+ gdb \
+ git \
+ gperf \
+ help2man \
+ libncurses-dev \
+ libtool-bin \
make \
- file \
- curl \
- ca-certificates \
+ patch \
python2.7 \
- git \
- cmake \
sudo \
- bzip2 \
- xz-utils \
+ texinfo \
wget \
- patch \
- g++-s390x-linux-gnu
+ xz-utils
-COPY build-toolchain.sh /tmp/
-RUN sh /tmp/build-toolchain.sh
+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 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
+# Ubuntu 16.04 (this contianer) ships with make 4, but something in the
+# toolchains we build below chokes on that, so go back to make 3
+RUN curl https://ftp.gnu.org/gnu/make/make-3.81.tar.gz | tar xzf - && \
+ cd make-3.81 && \
+ ./configure --prefix=/usr && \
+ make && \
+ make install && \
+ cd .. && \
+ rm -rf make-3.81
+
+RUN curl http://crosstool-ng.org/download/crosstool-ng/crosstool-ng-1.22.0.tar.bz2 | \
+ tar xjf - && \
+ cd crosstool-ng && \
+ ./configure --prefix=/usr/local && \
+ make -j$(nproc) && \
+ make install && \
+ cd .. && \
+ rm -rf crosstool-ng
+
+RUN groupadd -r rustbuild && useradd -m -r -g rustbuild rustbuild
+RUN mkdir /x-tools && chown rustbuild:rustbuild /x-tools
+USER rustbuild
+WORKDIR /tmp
+
+COPY patches/ /tmp/patches/
+COPY s390x-linux-gnu.config build-s390x-toolchain.sh /tmp/
+RUN ./build-s390x-toolchain.sh
+
+USER root
+
+COPY build-netbsd-toolchain.sh /tmp/
+RUN ./build-netbsd-toolchain.sh
+
+ENV PATH=$PATH:/x-tools/s390x-ibm-linux-gnu/bin
ENV \
AR_x86_64_unknown_netbsd=x86_64-unknown-netbsd-ar \
CC_x86_64_unknown_netbsd=x86_64-unknown-netbsd-gcc \
- CXX_x86_64_unknown_netbsd=x86_64-unknown-netbsd-g++
+ CXX_x86_64_unknown_netbsd=x86_64-unknown-netbsd-g++ \
+ CC_s390x_unknown_linux_gnu=s390x-ibm-linux-gnu-gcc \
+ AR_s390x_unknown_linux_gnu=s390x-ibm-linux-gnu-ar \
+ CXX_s390x_unknown_linux_gnu=s390x-ibm-linux-gnu-g++
ENV HOSTS=x86_64-unknown-netbsd
ENV HOSTS=$HOSTS,s390x-unknown-linux-gnu
--- /dev/null
+#!/bin/bash
+# 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
+
+set -ex
+
+BINUTILS=2.25.1
+GCC=5.3.0
+
+# First up, build binutils
+mkdir binutils
+cd binutils
+curl https://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS.tar.bz2 | tar xjf -
+mkdir binutils-build
+cd binutils-build
+../binutils-$BINUTILS/configure \
+ --target=x86_64-unknown-netbsd
+make -j10
+make install
+cd ../..
+rm -rf binutils
+
+# Next, download the NetBSD libc and relevant header files
+mkdir netbsd
+# originally from:
+# https://ftp.netbsd.org/pub/NetBSD/NetBSD-7.0/amd64/binary/sets/base.tgz
+curl https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-01-16-netbsd-base.tgz | \
+ tar xzf - -C netbsd ./usr/include ./usr/lib ./lib
+# originally from:
+# https://ftp.netbsd.org/pub/NetBSD/NetBSD-7.0/amd64/binary/sets/comp.tgz
+curl https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-01-16-netbsd-comp.tgz | \
+ tar xzf - -C netbsd ./usr/include ./usr/lib
+
+dst=/usr/local/x86_64-unknown-netbsd
+cp -r netbsd/usr/include $dst
+cp netbsd/usr/lib/crt0.o $dst/lib
+cp netbsd/usr/lib/crti.o $dst/lib
+cp netbsd/usr/lib/crtn.o $dst/lib
+cp netbsd/usr/lib/crtbeginS.o $dst/lib
+cp netbsd/usr/lib/crtendS.o $dst/lib
+cp netbsd/usr/lib/crtbegin.o $dst/lib
+cp netbsd/usr/lib/crtend.o $dst/lib
+cp netbsd/usr/lib/gcrt0.o $dst/lib
+cp netbsd/usr/lib/libc.a $dst/lib
+cp netbsd/usr/lib/libc_p.a $dst/lib
+cp netbsd/usr/lib/libc_pic.a $dst/lib
+cp netbsd/lib/libc.so.12.193.1 $dst/lib
+cp netbsd/lib/libutil.so.7.21 $dst/lib
+cp netbsd/usr/lib/libm.a $dst/lib
+cp netbsd/usr/lib/libm_p.a $dst/lib
+cp netbsd/usr/lib/libm_pic.a $dst/lib
+cp netbsd/lib/libm.so.0.11 $dst/lib
+cp netbsd/usr/lib/librt.so.1.1 $dst/lib
+cp netbsd/usr/lib/libpthread.a $dst/lib
+cp netbsd/usr/lib/libpthread_p.a $dst/lib
+cp netbsd/usr/lib/libpthread_pic.a $dst/lib
+cp netbsd/usr/lib/libpthread.so.1.2 $dst/lib
+
+ln -s libc.so.12.193.1 $dst/lib/libc.so
+ln -s libc.so.12.193.1 $dst/lib/libc.so.12
+ln -s libm.so.0.11 $dst/lib/libm.so
+ln -s libm.so.0.11 $dst/lib/libm.so.0
+ln -s libutil.so.7.21 $dst/lib/libutil.so
+ln -s libutil.so.7.21 $dst/lib/libutil.so.7
+ln -s libpthread.so.1.2 $dst/lib/libpthread.so
+ln -s libpthread.so.1.2 $dst/lib/libpthread.so.1
+ln -s librt.so.1.1 $dst/lib/librt.so
+
+rm -rf netbsd
+
+# Finally, download and build gcc to target NetBSD
+mkdir gcc
+cd gcc
+curl https://ftp.gnu.org/gnu/gcc/gcc-$GCC/gcc-$GCC.tar.bz2 | tar xjf -
+cd gcc-$GCC
+./contrib/download_prerequisites
+
+# Originally from
+# ftp://ftp.netbsd.org/pub/pkgsrc/pkgsrc-2016Q4/pkgsrc/lang/gcc5/patches/patch-libstdc%2B%2B-v3_config_os_bsd_netbsd_ctype__base.h
+PATCHES="https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-01-13-netbsd-patch1.patch"
+
+# Originally from
+# ftp://ftp.netbsd.org/pub/pkgsrc/pkgsrc-2016Q4/pkgsrc/lang/gcc5/patches/patch-libstdc%2B%2B-v3_config_os_bsd_netbsd_ctype__configure__char.cc
+PATCHES="$PATCHES https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-01-13-netbsd-patch2.patch"
+
+for patch in $PATCHES; do
+ curl $patch | patch -Np0
+done
+
+mkdir ../gcc-build
+cd ../gcc-build
+../gcc-$GCC/configure \
+ --enable-languages=c,c++ \
+ --target=x86_64-unknown-netbsd \
+ --disable-libcilkrts \
+ --disable-multilib \
+ --disable-nls \
+ --disable-libgomp \
+ --disable-libquadmath \
+ --disable-libssp \
+ --disable-libvtv \
+ --disable-libcilkrt \
+ --disable-libada \
+ --disable-libsanitizer \
+ --disable-libquadmath-support \
+ --disable-lto
+make -j10
+make install
+
+cd ../..
+rm -rf gcc
--- /dev/null
+#!/bin/bash
+# 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.
+
+set -ex
+
+hide_output() {
+ set +x
+ on_err="
+echo ERROR: An error was encountered with the build.
+cat /tmp/build.log
+exit 1
+"
+ trap "$on_err" ERR
+ bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
+ PING_LOOP_PID=$!
+ $@ &> /tmp/build.log
+ rm /tmp/build.log
+ trap - ERR
+ kill $PING_LOOP_PID
+ set -x
+}
+
+mkdir build
+cd build
+cp ../s390x-linux-gnu.config .config
+hide_output ct-ng build
+cd ..
+rm -rf build
+++ /dev/null
-#!/bin/bash
-# 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
-
-set -ex
-
-BINUTILS=2.25.1
-GCC=5.3.0
-
-# First up, build binutils
-mkdir binutils
-cd binutils
-curl https://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS.tar.bz2 | tar xjf -
-mkdir binutils-build
-cd binutils-build
-../binutils-$BINUTILS/configure \
- --target=x86_64-unknown-netbsd
-make -j10
-make install
-cd ../..
-rm -rf binutils
-
-# Next, download the NetBSD libc and relevant header files
-mkdir netbsd
-# originally from:
-# https://ftp.netbsd.org/pub/NetBSD/NetBSD-7.0/amd64/binary/sets/base.tgz
-curl https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-01-16-netbsd-base.tgz | \
- tar xzf - -C netbsd ./usr/include ./usr/lib ./lib
-# originally from:
-# https://ftp.netbsd.org/pub/NetBSD/NetBSD-7.0/amd64/binary/sets/comp.tgz
-curl https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-01-16-netbsd-comp.tgz | \
- tar xzf - -C netbsd ./usr/include ./usr/lib
-
-dst=/usr/local/x86_64-unknown-netbsd
-cp -r netbsd/usr/include $dst
-cp netbsd/usr/lib/crt0.o $dst/lib
-cp netbsd/usr/lib/crti.o $dst/lib
-cp netbsd/usr/lib/crtn.o $dst/lib
-cp netbsd/usr/lib/crtbeginS.o $dst/lib
-cp netbsd/usr/lib/crtendS.o $dst/lib
-cp netbsd/usr/lib/crtbegin.o $dst/lib
-cp netbsd/usr/lib/crtend.o $dst/lib
-cp netbsd/usr/lib/gcrt0.o $dst/lib
-cp netbsd/usr/lib/libc.a $dst/lib
-cp netbsd/usr/lib/libc_p.a $dst/lib
-cp netbsd/usr/lib/libc_pic.a $dst/lib
-cp netbsd/lib/libc.so.12.193.1 $dst/lib
-cp netbsd/lib/libutil.so.7.21 $dst/lib
-cp netbsd/usr/lib/libm.a $dst/lib
-cp netbsd/usr/lib/libm_p.a $dst/lib
-cp netbsd/usr/lib/libm_pic.a $dst/lib
-cp netbsd/lib/libm.so.0.11 $dst/lib
-cp netbsd/usr/lib/librt.so.1.1 $dst/lib
-cp netbsd/usr/lib/libpthread.a $dst/lib
-cp netbsd/usr/lib/libpthread_p.a $dst/lib
-cp netbsd/usr/lib/libpthread_pic.a $dst/lib
-cp netbsd/usr/lib/libpthread.so.1.2 $dst/lib
-
-ln -s libc.so.12.193.1 $dst/lib/libc.so
-ln -s libc.so.12.193.1 $dst/lib/libc.so.12
-ln -s libm.so.0.11 $dst/lib/libm.so
-ln -s libm.so.0.11 $dst/lib/libm.so.0
-ln -s libutil.so.7.21 $dst/lib/libutil.so
-ln -s libutil.so.7.21 $dst/lib/libutil.so.7
-ln -s libpthread.so.1.2 $dst/lib/libpthread.so
-ln -s libpthread.so.1.2 $dst/lib/libpthread.so.1
-ln -s librt.so.1.1 $dst/lib/librt.so
-
-rm -rf netbsd
-
-# Finally, download and build gcc to target NetBSD
-mkdir gcc
-cd gcc
-curl https://ftp.gnu.org/gnu/gcc/gcc-$GCC/gcc-$GCC.tar.bz2 | tar xjf -
-cd gcc-$GCC
-./contrib/download_prerequisites
-
-# Originally from
-# ftp://ftp.netbsd.org/pub/pkgsrc/pkgsrc-2016Q4/pkgsrc/lang/gcc5/patches/patch-libstdc%2B%2B-v3_config_os_bsd_netbsd_ctype__base.h
-PATCHES="https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-01-13-netbsd-patch1.patch"
-
-# Originally from
-# ftp://ftp.netbsd.org/pub/pkgsrc/pkgsrc-2016Q4/pkgsrc/lang/gcc5/patches/patch-libstdc%2B%2B-v3_config_os_bsd_netbsd_ctype__configure__char.cc
-PATCHES="$PATCHES https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-01-13-netbsd-patch2.patch"
-
-for patch in $PATCHES; do
- curl $patch | patch -Np0
-done
-
-mkdir ../gcc-build
-cd ../gcc-build
-../gcc-$GCC/configure \
- --enable-languages=c,c++ \
- --target=x86_64-unknown-netbsd \
- --disable-libcilkrts \
- --disable-multilib \
- --disable-nls \
- --disable-libgomp \
- --disable-libquadmath \
- --disable-libssp \
- --disable-libvtv \
- --disable-libcilkrt \
- --disable-libada \
- --disable-libsanitizer \
- --disable-libquadmath-support \
- --disable-lto
-make -j10
-make install
-
-cd ../..
-rm -rf gcc
--- /dev/null
+From 2739047682590b1df473401b4febf424f857fccf Mon Sep 17 00:00:00 2001
+From: Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
+Date: Sun, 17 Apr 2011 20:43:59 -0400
+Subject: [PATCH] Use .machine to prevent AS from complaining about z9-109
+ instructions in iconv modules
+
+---
+ sysdeps/s390/s390-64/utf16-utf32-z9.c | 5 ++++-
+ sysdeps/s390/s390-64/utf8-utf16-z9.c | 5 ++++-
+ sysdeps/s390/s390-64/utf8-utf32-z9.c | 5 ++++-
+ 3 files changed, 12 insertions(+), 3 deletions(-)
+
+diff --git a/sysdeps/s390/s390-64/utf16-utf32-z9.c b/sysdeps/s390/s390-64/utf16-utf32-z9.c
+index 14daf2118fe5..5bcaaaedec9c 100644
+--- a/sysdeps/s390/s390-64/utf16-utf32-z9.c
++++ b/sysdeps/s390/s390-64/utf16-utf32-z9.c
+@@ -169,7 +169,10 @@ gconv_end (struct __gconv_step *data)
+ register unsigned long long outlen asm("11") = outend - outptr; \
+ uint64_t cc = 0; \
+ \
+- asm volatile ("0: " INSTRUCTION " \n\t" \
++ asm volatile (".machine push \n\t" \
++ ".machine \"z9-109\" \n\t" \
++ "0: " INSTRUCTION " \n\t" \
++ ".machine pop \n\t" \
+ " jo 0b \n\t" \
+ " ipm %2 \n" \
+ : "+a" (pOutput), "+a" (pInput), "+d" (cc), \
+diff --git a/sysdeps/s390/s390-64/utf8-utf16-z9.c b/sysdeps/s390/s390-64/utf8-utf16-z9.c
+index 5f73f3c59e21..812a42fae44c 100644
+--- a/sysdeps/s390/s390-64/utf8-utf16-z9.c
++++ b/sysdeps/s390/s390-64/utf8-utf16-z9.c
+@@ -151,7 +151,10 @@ gconv_end (struct __gconv_step *data)
+ register unsigned long long outlen asm("11") = outend - outptr; \
+ uint64_t cc = 0; \
+ \
+- asm volatile ("0: " INSTRUCTION " \n\t" \
++ asm volatile (".machine push \n\t" \
++ ".machine \"z9-109\" \n\t" \
++ "0: " INSTRUCTION " \n\t" \
++ ".machine pop \n\t" \
+ " jo 0b \n\t" \
+ " ipm %2 \n" \
+ : "+a" (pOutput), "+a" (pInput), "+d" (cc), \
+diff --git a/sysdeps/s390/s390-64/utf8-utf32-z9.c b/sysdeps/s390/s390-64/utf8-utf32-z9.c
+index 17ef8bc890c3..0ffd848c8124 100644
+--- a/sysdeps/s390/s390-64/utf8-utf32-z9.c
++++ b/sysdeps/s390/s390-64/utf8-utf32-z9.c
+@@ -155,7 +155,10 @@ gconv_end (struct __gconv_step *data)
+ register unsigned long long outlen asm("11") = outend - outptr; \
+ uint64_t cc = 0; \
+ \
+- asm volatile ("0: " INSTRUCTION " \n\t" \
++ asm volatile (".machine push \n\t" \
++ ".machine \"z9-109\" \n\t" \
++ "0: " INSTRUCTION " \n\t" \
++ ".machine pop \n\t" \
+ " jo 0b \n\t" \
+ " ipm %2 \n" \
+ : "+a" (pOutput), "+a" (pInput), "+d" (cc), \
+--
+2.9.3
+
--- /dev/null
+#
+# Automatically generated file; DO NOT EDIT.
+# Crosstool-NG Configuration
+#
+CT_CONFIGURE_has_make381=y
+CT_CONFIGURE_has_xz=y
+CT_MODULES=y
+
+#
+# Paths and misc options
+#
+
+#
+# crosstool-NG behavior
+#
+# CT_OBSOLETE is not set
+# CT_EXPERIMENTAL is not set
+# CT_DEBUG_CT is not set
+
+#
+# Paths
+#
+CT_LOCAL_TARBALLS_DIR=""
+CT_WORK_DIR="${CT_TOP_DIR}/.build"
+CT_PREFIX_DIR="/x-tools/${CT_TARGET}"
+CT_INSTALL_DIR="${CT_PREFIX_DIR}"
+CT_RM_RF_PREFIX_DIR=y
+CT_REMOVE_DOCS=y
+CT_INSTALL_DIR_RO=y
+CT_STRIP_HOST_TOOLCHAIN_EXECUTABLES=y
+# CT_STRIP_TARGET_TOOLCHAIN_EXECUTABLES is not set
+
+#
+# Downloading
+#
+# CT_FORBID_DOWNLOAD is not set
+# CT_FORCE_DOWNLOAD is not set
+CT_CONNECT_TIMEOUT=10
+# CT_ONLY_DOWNLOAD is not set
+# CT_USE_MIRROR is not set
+
+#
+# Extracting
+#
+# CT_FORCE_EXTRACT is not set
+CT_OVERIDE_CONFIG_GUESS_SUB=y
+# CT_ONLY_EXTRACT is not set
+# CT_PATCH_BUNDLED is not set
+# CT_PATCH_LOCAL is not set
+CT_PATCH_BUNDLED_LOCAL=y
+# CT_PATCH_LOCAL_BUNDLED is not set
+# CT_PATCH_BUNDLED_FALLBACK_LOCAL is not set
+# CT_PATCH_LOCAL_FALLBACK_BUNDLED is not set
+# CT_PATCH_NONE is not set
+CT_PATCH_ORDER="bundled,local"
+CT_PATCH_USE_LOCAL=y
+CT_LOCAL_PATCH_DIR="/tmp/patches"
+
+#
+# Build behavior
+#
+CT_PARALLEL_JOBS=0
+CT_LOAD=""
+CT_USE_PIPES=y
+CT_EXTRA_CFLAGS_FOR_BUILD=""
+CT_EXTRA_LDFLAGS_FOR_BUILD=""
+CT_EXTRA_CFLAGS_FOR_HOST=""
+CT_EXTRA_LDFLAGS_FOR_HOST=""
+# CT_CONFIG_SHELL_SH is not set
+# CT_CONFIG_SHELL_ASH is not set
+CT_CONFIG_SHELL_BASH=y
+# CT_CONFIG_SHELL_CUSTOM is not set
+CT_CONFIG_SHELL="${bash}"
+
+#
+# Logging
+#
+# CT_LOG_ERROR is not set
+# CT_LOG_WARN is not set
+CT_LOG_INFO=y
+# CT_LOG_EXTRA is not set
+# CT_LOG_ALL is not set
+# CT_LOG_DEBUG is not set
+CT_LOG_LEVEL_MAX="INFO"
+# CT_LOG_SEE_TOOLS_WARN is not set
+CT_LOG_PROGRESS_BAR=y
+CT_LOG_TO_FILE=y
+CT_LOG_FILE_COMPRESS=y
+
+#
+# Target options
+#
+CT_ARCH="s390"
+CT_ARCH_SUPPORTS_32=y
+CT_ARCH_SUPPORTS_64=y
+CT_ARCH_SUPPORTS_WITH_FPU=y
+CT_ARCH_DEFAULT_32=y
+CT_ARCH_FPU=""
+# CT_ARCH_32 is not set
+CT_ARCH_64=y
+CT_ARCH_BITNESS=64
+CT_TARGET_CFLAGS=""
+CT_TARGET_LDFLAGS=""
+# CT_ARCH_alpha is not set
+# CT_ARCH_arm is not set
+# CT_ARCH_avr is not set
+# CT_ARCH_m68k is not set
+# CT_ARCH_mips is not set
+# CT_ARCH_nios2 is not set
+# CT_ARCH_powerpc is not set
+CT_ARCH_s390=y
+# CT_ARCH_sh is not set
+# CT_ARCH_sparc is not set
+# CT_ARCH_x86 is not set
+# CT_ARCH_xtensa is not set
+CT_ARCH_alpha_AVAILABLE=y
+CT_ARCH_arm_AVAILABLE=y
+CT_ARCH_avr_AVAILABLE=y
+CT_ARCH_m68k_AVAILABLE=y
+CT_ARCH_microblaze_AVAILABLE=y
+CT_ARCH_mips_AVAILABLE=y
+CT_ARCH_nios2_AVAILABLE=y
+CT_ARCH_powerpc_AVAILABLE=y
+CT_ARCH_s390_AVAILABLE=y
+CT_ARCH_sh_AVAILABLE=y
+CT_ARCH_sparc_AVAILABLE=y
+CT_ARCH_x86_AVAILABLE=y
+CT_ARCH_xtensa_AVAILABLE=y
+CT_ARCH_SUFFIX=""
+
+#
+# Generic target options
+#
+# CT_MULTILIB is not set
+CT_ARCH_USE_MMU=y
+
+#
+# Target optimisations
+#
+CT_ARCH_FLOAT=""
+
+#
+# Toolchain options
+#
+
+#
+# General toolchain options
+#
+CT_FORCE_SYSROOT=y
+CT_USE_SYSROOT=y
+CT_SYSROOT_NAME="sysroot"
+CT_SYSROOT_DIR_PREFIX=""
+CT_WANTS_STATIC_LINK=y
+# CT_STATIC_TOOLCHAIN is not set
+CT_TOOLCHAIN_PKGVERSION=""
+CT_TOOLCHAIN_BUGURL=""
+
+#
+# Tuple completion and aliasing
+#
+CT_TARGET_VENDOR="unknown"
+CT_TARGET_ALIAS_SED_EXPR=""
+CT_TARGET_ALIAS=""
+
+#
+# Toolchain type
+#
+CT_CROSS=y
+# CT_CANADIAN is not set
+CT_TOOLCHAIN_TYPE="cross"
+
+#
+# Build system
+#
+CT_BUILD=""
+CT_BUILD_PREFIX=""
+CT_BUILD_SUFFIX=""
+
+#
+# Misc options
+#
+# CT_TOOLCHAIN_ENABLE_NLS is not set
+
+#
+# Operating System
+#
+CT_KERNEL_SUPPORTS_SHARED_LIBS=y
+CT_KERNEL="linux"
+CT_KERNEL_VERSION="2.6.32.68"
+# CT_KERNEL_bare_metal is not set
+CT_KERNEL_linux=y
+CT_KERNEL_bare_metal_AVAILABLE=y
+CT_KERNEL_linux_AVAILABLE=y
+# CT_KERNEL_V_4_3 is not set
+# CT_KERNEL_V_4_2 is not set
+# CT_KERNEL_V_4_1 is not set
+# CT_KERNEL_V_3_18 is not set
+# CT_KERNEL_V_3_14 is not set
+# CT_KERNEL_V_3_12 is not set
+# CT_KERNEL_V_3_10 is not set
+# CT_KERNEL_V_3_4 is not set
+# CT_KERNEL_V_3_2 is not set
+CT_KERNEL_V_2_6_32=y
+# CT_KERNEL_LINUX_CUSTOM is not set
+CT_KERNEL_windows_AVAILABLE=y
+
+#
+# Common kernel options
+#
+CT_SHARED_LIBS=y
+
+#
+# linux other options
+#
+CT_KERNEL_LINUX_VERBOSITY_0=y
+# CT_KERNEL_LINUX_VERBOSITY_1 is not set
+# CT_KERNEL_LINUX_VERBOSITY_2 is not set
+CT_KERNEL_LINUX_VERBOSE_LEVEL=0
+CT_KERNEL_LINUX_INSTALL_CHECK=y
+
+#
+# Binary utilities
+#
+CT_ARCH_BINFMT_ELF=y
+CT_BINUTILS="binutils"
+CT_BINUTILS_binutils=y
+
+#
+# GNU binutils
+#
+# CT_CC_BINUTILS_SHOW_LINARO is not set
+CT_BINUTILS_V_2_25_1=y
+# CT_BINUTILS_V_2_25 is not set
+# CT_BINUTILS_V_2_24 is not set
+# CT_BINUTILS_V_2_23_2 is not set
+# CT_BINUTILS_V_2_23_1 is not set
+# CT_BINUTILS_V_2_22 is not set
+# CT_BINUTILS_V_2_21_53 is not set
+# CT_BINUTILS_V_2_21_1a is not set
+# CT_BINUTILS_V_2_20_1a is not set
+# CT_BINUTILS_V_2_19_1a is not set
+# CT_BINUTILS_V_2_18a is not set
+CT_BINUTILS_VERSION="2.25.1"
+CT_BINUTILS_2_25_1_or_later=y
+CT_BINUTILS_2_25_or_later=y
+CT_BINUTILS_2_24_or_later=y
+CT_BINUTILS_2_23_or_later=y
+CT_BINUTILS_2_22_or_later=y
+CT_BINUTILS_2_21_or_later=y
+CT_BINUTILS_2_20_or_later=y
+CT_BINUTILS_2_19_or_later=y
+CT_BINUTILS_2_18_or_later=y
+CT_BINUTILS_HAS_HASH_STYLE=y
+CT_BINUTILS_HAS_GOLD=y
+CT_BINUTILS_HAS_PLUGINS=y
+CT_BINUTILS_HAS_PKGVERSION_BUGURL=y
+CT_BINUTILS_FORCE_LD_BFD=y
+CT_BINUTILS_LINKER_LD=y
+CT_BINUTILS_LINKERS_LIST="ld"
+CT_BINUTILS_LINKER_DEFAULT="bfd"
+# CT_BINUTILS_PLUGINS is not set
+CT_BINUTILS_EXTRA_CONFIG_ARRAY=""
+# CT_BINUTILS_FOR_TARGET is not set
+
+#
+# binutils other options
+#
+
+#
+# C-library
+#
+CT_LIBC="glibc"
+CT_LIBC_VERSION="2.12.2"
+CT_LIBC_glibc=y
+# CT_LIBC_musl is not set
+# CT_LIBC_uClibc is not set
+CT_LIBC_avr_libc_AVAILABLE=y
+CT_LIBC_glibc_AVAILABLE=y
+CT_THREADS="nptl"
+# CT_CC_GLIBC_SHOW_LINARO is not set
+# CT_LIBC_GLIBC_V_2_22 is not set
+# CT_LIBC_GLIBC_V_2_21 is not set
+# CT_LIBC_GLIBC_V_2_20 is not set
+# CT_LIBC_GLIBC_V_2_19 is not set
+# CT_LIBC_GLIBC_V_2_18 is not set
+# CT_LIBC_GLIBC_V_2_17 is not set
+# CT_LIBC_GLIBC_V_2_16_0 is not set
+# CT_LIBC_GLIBC_V_2_15 is not set
+# CT_LIBC_GLIBC_V_2_14_1 is not set
+# CT_LIBC_GLIBC_V_2_14 is not set
+# CT_LIBC_GLIBC_V_2_13 is not set
+CT_LIBC_GLIBC_V_2_12_2=y
+# CT_LIBC_GLIBC_V_2_12_1 is not set
+# CT_LIBC_GLIBC_V_2_11_1 is not set
+# CT_LIBC_GLIBC_V_2_11 is not set
+# CT_LIBC_GLIBC_V_2_10_1 is not set
+# CT_LIBC_GLIBC_V_2_9 is not set
+# CT_LIBC_GLIBC_V_2_8 is not set
+CT_LIBC_mingw_AVAILABLE=y
+CT_LIBC_musl_AVAILABLE=y
+CT_LIBC_newlib_AVAILABLE=y
+CT_LIBC_none_AVAILABLE=y
+CT_LIBC_uClibc_AVAILABLE=y
+CT_LIBC_SUPPORT_THREADS_ANY=y
+CT_LIBC_SUPPORT_THREADS_NATIVE=y
+
+#
+# Common C library options
+#
+CT_THREADS_NATIVE=y
+CT_LIBC_XLDD=y
+
+#
+# glibc other options
+#
+CT_LIBC_GLIBC_PORTS_EXTERNAL=y
+CT_LIBC_glibc_familly=y
+CT_LIBC_GLIBC_EXTRA_CONFIG_ARRAY=""
+CT_LIBC_GLIBC_CONFIGPARMS=""
+CT_LIBC_GLIBC_EXTRA_CFLAGS=""
+CT_LIBC_EXTRA_CC_ARGS=""
+# CT_LIBC_DISABLE_VERSIONING is not set
+CT_LIBC_OLDEST_ABI=""
+CT_LIBC_GLIBC_FORCE_UNWIND=y
+# CT_LIBC_GLIBC_USE_PORTS is not set
+CT_LIBC_ADDONS_LIST=""
+# CT_LIBC_LOCALES is not set
+# CT_LIBC_GLIBC_KERNEL_VERSION_NONE is not set
+CT_LIBC_GLIBC_KERNEL_VERSION_AS_HEADERS=y
+# CT_LIBC_GLIBC_KERNEL_VERSION_CHOSEN is not set
+CT_LIBC_GLIBC_MIN_KERNEL="2.6.32.68"
+
+#
+# C compiler
+#
+CT_CC="gcc"
+CT_CC_CORE_PASSES_NEEDED=y
+CT_CC_CORE_PASS_1_NEEDED=y
+CT_CC_CORE_PASS_2_NEEDED=y
+CT_CC_gcc=y
+# CT_CC_GCC_SHOW_LINARO is not set
+# CT_CC_GCC_V_5_2_0 is not set
+CT_CC_GCC_V_4_9_3=y
+# CT_CC_GCC_V_4_8_5 is not set
+# CT_CC_GCC_V_4_7_4 is not set
+# CT_CC_GCC_V_4_6_4 is not set
+# CT_CC_GCC_V_4_5_4 is not set
+# CT_CC_GCC_V_4_4_7 is not set
+# CT_CC_GCC_V_4_3_6 is not set
+# CT_CC_GCC_V_4_2_4 is not set
+CT_CC_GCC_4_2_or_later=y
+CT_CC_GCC_4_3_or_later=y
+CT_CC_GCC_4_4_or_later=y
+CT_CC_GCC_4_5_or_later=y
+CT_CC_GCC_4_6_or_later=y
+CT_CC_GCC_4_7_or_later=y
+CT_CC_GCC_4_8_or_later=y
+CT_CC_GCC_4_9=y
+CT_CC_GCC_4_9_or_later=y
+CT_CC_GCC_HAS_GRAPHITE=y
+CT_CC_GCC_USE_GRAPHITE=y
+CT_CC_GCC_HAS_LTO=y
+CT_CC_GCC_USE_LTO=y
+CT_CC_GCC_HAS_PKGVERSION_BUGURL=y
+CT_CC_GCC_HAS_BUILD_ID=y
+CT_CC_GCC_HAS_LNK_HASH_STYLE=y
+CT_CC_GCC_USE_GMP_MPFR=y
+CT_CC_GCC_USE_MPC=y
+CT_CC_GCC_HAS_LIBQUADMATH=y
+CT_CC_GCC_HAS_LIBSANITIZER=y
+CT_CC_GCC_VERSION="4.9.3"
+# CT_CC_LANG_FORTRAN is not set
+CT_CC_GCC_ENABLE_CXX_FLAGS=""
+CT_CC_GCC_CORE_EXTRA_CONFIG_ARRAY=""
+CT_CC_GCC_EXTRA_CONFIG_ARRAY="--with-arch=z10"
+CT_CC_GCC_EXTRA_ENV_ARRAY=""
+CT_CC_GCC_STATIC_LIBSTDCXX=y
+# CT_CC_GCC_SYSTEM_ZLIB is not set
+
+#
+# Optimisation features
+#
+
+#
+# Settings for libraries running on target
+#
+CT_CC_GCC_ENABLE_TARGET_OPTSPACE=y
+# CT_CC_GCC_LIBMUDFLAP is not set
+# CT_CC_GCC_LIBGOMP is not set
+# CT_CC_GCC_LIBSSP is not set
+# CT_CC_GCC_LIBQUADMATH is not set
+# CT_CC_GCC_LIBSANITIZER is not set
+
+#
+# Misc. obscure options.
+#
+CT_CC_CXA_ATEXIT=y
+# CT_CC_GCC_DISABLE_PCH is not set
+CT_CC_GCC_SJLJ_EXCEPTIONS=m
+CT_CC_GCC_LDBL_128=m
+# CT_CC_GCC_BUILD_ID is not set
+CT_CC_GCC_LNK_HASH_STYLE_DEFAULT=y
+# CT_CC_GCC_LNK_HASH_STYLE_SYSV is not set
+# CT_CC_GCC_LNK_HASH_STYLE_GNU is not set
+# CT_CC_GCC_LNK_HASH_STYLE_BOTH is not set
+CT_CC_GCC_LNK_HASH_STYLE=""
+CT_CC_GCC_DEC_FLOAT_AUTO=y
+# CT_CC_GCC_DEC_FLOAT_BID is not set
+# CT_CC_GCC_DEC_FLOAT_DPD is not set
+# CT_CC_GCC_DEC_FLOATS_NO is not set
+CT_CC_SUPPORT_CXX=y
+CT_CC_SUPPORT_FORTRAN=y
+CT_CC_SUPPORT_JAVA=y
+CT_CC_SUPPORT_ADA=y
+CT_CC_SUPPORT_OBJC=y
+CT_CC_SUPPORT_OBJCXX=y
+CT_CC_SUPPORT_GOLANG=y
+
+#
+# Additional supported languages:
+#
+CT_CC_LANG_CXX=y
+# CT_CC_LANG_JAVA is not set
+
+#
+# Debug facilities
+#
+# CT_DEBUG_dmalloc is not set
+# CT_DEBUG_duma is not set
+# CT_DEBUG_gdb is not set
+# CT_DEBUG_ltrace is not set
+# CT_DEBUG_strace is not set
+
+#
+# Companion libraries
+#
+CT_COMPLIBS_NEEDED=y
+CT_LIBICONV_NEEDED=y
+CT_GETTEXT_NEEDED=y
+CT_GMP_NEEDED=y
+CT_MPFR_NEEDED=y
+CT_ISL_NEEDED=y
+CT_CLOOG_NEEDED=y
+CT_MPC_NEEDED=y
+CT_COMPLIBS=y
+CT_LIBICONV=y
+CT_GETTEXT=y
+CT_GMP=y
+CT_MPFR=y
+CT_ISL=y
+CT_CLOOG=y
+CT_MPC=y
+CT_LIBICONV_V_1_14=y
+CT_LIBICONV_VERSION="1.14"
+CT_GETTEXT_V_0_19_6=y
+CT_GETTEXT_VERSION="0.19.6"
+CT_GMP_V_6_0_0=y
+# CT_GMP_V_5_1_3 is not set
+# CT_GMP_V_5_1_1 is not set
+# CT_GMP_V_5_0_2 is not set
+# CT_GMP_V_5_0_1 is not set
+# CT_GMP_V_4_3_2 is not set
+# CT_GMP_V_4_3_1 is not set
+# CT_GMP_V_4_3_0 is not set
+CT_GMP_5_0_2_or_later=y
+CT_GMP_VERSION="6.0.0a"
+CT_MPFR_V_3_1_3=y
+# CT_MPFR_V_3_1_2 is not set
+# CT_MPFR_V_3_1_0 is not set
+# CT_MPFR_V_3_0_1 is not set
+# CT_MPFR_V_3_0_0 is not set
+# CT_MPFR_V_2_4_2 is not set
+# CT_MPFR_V_2_4_1 is not set
+# CT_MPFR_V_2_4_0 is not set
+CT_MPFR_VERSION="3.1.3"
+CT_ISL_V_0_14=y
+CT_ISL_V_0_14_or_later=y
+CT_ISL_V_0_12_or_later=y
+CT_ISL_VERSION="0.14"
+CT_CLOOG_V_0_18_4=y
+# CT_CLOOG_V_0_18_1 is not set
+# CT_CLOOG_V_0_18_0 is not set
+CT_CLOOG_VERSION="0.18.4"
+CT_CLOOG_0_18_4_or_later=y
+CT_CLOOG_0_18_or_later=y
+CT_MPC_V_1_0_3=y
+# CT_MPC_V_1_0_2 is not set
+# CT_MPC_V_1_0_1 is not set
+# CT_MPC_V_1_0 is not set
+# CT_MPC_V_0_9 is not set
+# CT_MPC_V_0_8_2 is not set
+# CT_MPC_V_0_8_1 is not set
+# CT_MPC_V_0_7 is not set
+CT_MPC_VERSION="1.0.3"
+
+#
+# Companion libraries common options
+#
+# CT_COMPLIBS_CHECK is not set
+
+#
+# Companion tools
+#
+
+#
+# READ HELP before you say 'Y' below !!!
+#
+# CT_COMP_TOOLS is not set
--- /dev/null
+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
+ENV RUSTFLAGS -Zincremental=/tmp/rust-incr-cache
+ENV RUST_CHECK_TARGET check
inputs since the pointer could be dangling, and raw pointers fall outside of
Rust's safe memory model.
-When declaring the argument types to a foreign function, the Rust compiler can
-not check if the declaration is correct, so specifying it correctly is part of
-keeping the binding correct at runtime.
+When declaring the argument types to a foreign function, the Rust compiler
+cannot check if the declaration is correct, so specifying it correctly is part
+of keeping the binding correct at runtime.
The `extern` block can be extended to cover the entire snappy API:
///
/// See the [module-level documentation](../../std/boxed/index.html) for more.
#[lang = "owned_box"]
+#[fundamental]
#[stable(feature = "rust1", since = "1.0.0")]
pub struct Box<T: ?Sized>(Unique<T>);
}
}
+#[cfg(not(stage0))]
+#[stable(feature = "rust1", since = "1.0.0")]
+unsafe impl<#[may_dangle] T: ?Sized> Drop for Box<T> {
+ fn drop(&mut self) {
+ // FIXME: Do nothing, drop is currently performed by compiler.
+ }
+}
+
#[stable(feature = "rust1", since = "1.0.0")]
impl<T: Default> Default for Box<T> {
/// Creates a `Box<T>`, with the `Default` value for T.
//! that the contained type `T` is shareable. Additionally, `Arc<T>` is itself
//! sendable while `Rc<T>` is not.
//!
-//! This types allows for shared access to the contained data, and is often
+//! This type allows for shared access to the contained data, and is often
//! paired with synchronization primitives such as mutexes to allow mutation of
//! shared resources.
//!
/// buf.push_back(3);
/// buf.push_back(4);
/// buf.push_back(5);
+ /// assert_eq!(buf, [3, 4, 5]);
/// buf.swap(0, 2);
- /// assert_eq!(buf[0], 5);
- /// assert_eq!(buf[2], 3);
+ /// assert_eq!(buf, [5, 4, 3]);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn swap(&mut self, i: usize, j: usize) {
/// buf.push_back(5);
/// buf.push_back(10);
/// buf.push_back(15);
+ /// assert_eq!(buf, [5, 10, 15]);
/// buf.truncate(1);
- /// assert_eq!(buf.len(), 1);
- /// assert_eq!(Some(&5), buf.get(0));
+ /// assert_eq!(buf, [5]);
/// ```
#[stable(feature = "deque_extras", since = "1.16.0")]
pub fn truncate(&mut self, len: usize) {
/// use std::collections::VecDeque;
///
/// let mut v: VecDeque<_> = vec![1, 2, 3].into_iter().collect();
- /// assert_eq!(vec![3].into_iter().collect::<VecDeque<_>>(), v.drain(2..).collect());
- /// assert_eq!(vec![1, 2].into_iter().collect::<VecDeque<_>>(), v);
+ /// let drained = v.drain(2..).collect::<VecDeque<_>>();
+ /// assert_eq!(drained, [3]);
+ /// assert_eq!(v, [1, 2]);
///
/// // A full range clears all contents
/// v.drain(..);
/// buf.push_back(1);
/// buf.push_back(2);
/// buf.push_back(3);
+ /// assert_eq!(buf, [1, 2, 3]);
///
/// assert_eq!(buf.swap_remove_back(0), Some(1));
- /// assert_eq!(buf.len(), 2);
- /// assert_eq!(buf[0], 3);
- /// assert_eq!(buf[1], 2);
+ /// assert_eq!(buf, [3, 2]);
/// ```
#[stable(feature = "deque_extras_15", since = "1.5.0")]
pub fn swap_remove_back(&mut self, index: usize) -> Option<T> {
/// buf.push_back(1);
/// buf.push_back(2);
/// buf.push_back(3);
+ /// assert_eq!(buf, [1, 2, 3]);
///
/// assert_eq!(buf.swap_remove_front(2), Some(3));
- /// assert_eq!(buf.len(), 2);
- /// assert_eq!(buf[0], 2);
- /// assert_eq!(buf[1], 1);
+ /// assert_eq!(buf, [2, 1]);
/// ```
#[stable(feature = "deque_extras_15", since = "1.5.0")]
pub fn swap_remove_front(&mut self, index: usize) -> Option<T> {
/// vec_deque.push_back('a');
/// vec_deque.push_back('b');
/// vec_deque.push_back('c');
+ /// assert_eq!(vec_deque, &['a', 'b', 'c']);
///
/// vec_deque.insert(1, 'd');
- ///
- /// let vec = vec_deque.into_iter().collect::<Vec<_>>();
- /// assert_eq!(vec, ['a', 'd', 'b', 'c']);
+ /// assert_eq!(vec_deque, &['a', 'd', 'b', 'c']);
/// ```
#[stable(feature = "deque_extras_15", since = "1.5.0")]
pub fn insert(&mut self, index: usize, value: T) {
/// buf.push_back(1);
/// buf.push_back(2);
/// buf.push_back(3);
+ /// assert_eq!(buf, [1, 2, 3]);
///
/// assert_eq!(buf.remove(1), Some(2));
- /// assert_eq!(buf.get(1), Some(&3));
+ /// assert_eq!(buf, [1, 3]);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn remove(&mut self, index: usize) -> Option<T> {
///
/// let mut buf: VecDeque<_> = vec![1,2,3].into_iter().collect();
/// let buf2 = buf.split_off(1);
- /// // buf = [1], buf2 = [2, 3]
- /// assert_eq!(buf.len(), 1);
- /// assert_eq!(buf2.len(), 2);
+ /// assert_eq!(buf, [1]);
+ /// assert_eq!(buf2, [2, 3]);
/// ```
#[inline]
#[stable(feature = "split_off", since = "1.4.0")]
/// ```
/// use std::collections::VecDeque;
///
- /// let mut buf: VecDeque<_> = vec![1, 2, 3].into_iter().collect();
- /// let mut buf2: VecDeque<_> = vec![4, 5, 6].into_iter().collect();
+ /// let mut buf: VecDeque<_> = vec![1, 2].into_iter().collect();
+ /// let mut buf2: VecDeque<_> = vec![3, 4].into_iter().collect();
/// buf.append(&mut buf2);
- /// assert_eq!(buf.len(), 6);
- /// assert_eq!(buf2.len(), 0);
+ /// assert_eq!(buf, [1, 2, 3, 4]);
+ /// assert_eq!(buf2, []);
/// ```
#[inline]
#[stable(feature = "append", since = "1.4.0")]
/// let mut buf = VecDeque::new();
/// buf.extend(1..5);
/// buf.retain(|&x| x%2 == 0);
- ///
- /// let v: Vec<_> = buf.into_iter().collect();
- /// assert_eq!(&v[..], &[2, 4]);
+ /// assert_eq!(buf, [2, 4]);
/// ```
#[stable(feature = "vec_deque_retain", since = "1.4.0")]
pub fn retain<F>(&mut self, mut f: F)
/// buf.push_back(5);
/// buf.push_back(10);
/// buf.push_back(15);
+ /// assert_eq!(buf, [5, 10, 15]);
+ ///
/// buf.resize(2, 0);
- /// buf.resize(6, 20);
- /// for (a, b) in [5, 10, 20, 20, 20, 20].iter().zip(&buf) {
- /// assert_eq!(a, b);
- /// }
+ /// assert_eq!(buf, [5, 10]);
+ ///
+ /// buf.resize(5, 20);
+ /// assert_eq!(buf, [5, 10, 20, 20, 20]);
/// ```
#[stable(feature = "deque_extras", since = "1.16.0")]
pub fn resize(&mut self, new_len: usize, value: T) {
#[stable(feature = "rust1", since = "1.0.0")]
impl<A: Eq> Eq for VecDeque<A> {}
+macro_rules! __impl_slice_eq1 {
+ ($Lhs: ty, $Rhs: ty) => {
+ __impl_slice_eq1! { $Lhs, $Rhs, Sized }
+ };
+ ($Lhs: ty, $Rhs: ty, $Bound: ident) => {
+ #[stable(feature = "vec-deque-partial-eq-slice", since = "1.16.0")]
+ impl<'a, 'b, A: $Bound, B> PartialEq<$Rhs> for $Lhs where A: PartialEq<B> {
+ fn eq(&self, other: &$Rhs) -> bool {
+ if self.len() != other.len() {
+ return false;
+ }
+ let (sa, sb) = self.as_slices();
+ let (oa, ob) = other[..].split_at(sa.len());
+ sa == oa && sb == ob
+ }
+ }
+ }
+}
+
+__impl_slice_eq1! { VecDeque<A>, Vec<B> }
+__impl_slice_eq1! { VecDeque<A>, &'b [B] }
+__impl_slice_eq1! { VecDeque<A>, &'b mut [B] }
+
+macro_rules! array_impls {
+ ($($N: expr)+) => {
+ $(
+ __impl_slice_eq1! { VecDeque<A>, [B; $N] }
+ __impl_slice_eq1! { VecDeque<A>, &'b [B; $N] }
+ __impl_slice_eq1! { VecDeque<A>, &'b mut [B; $N] }
+ )+
+ }
+}
+
+array_impls! {
+ 0 1 2 3 4 5 6 7 8 9
+ 10 11 12 13 14 15 16 17 18 19
+ 20 21 22 23 24 25 26 27 28 29
+ 30 31 32
+}
+
#[stable(feature = "rust1", since = "1.0.0")]
impl<A: PartialOrd> PartialOrd for VecDeque<A> {
fn partial_cmp(&self, other: &VecDeque<A>) -> Option<Ordering> {
let final_len = usable_cap / 2;
for len in 0..final_len {
- let expected = if back {
+ let expected: VecDeque<_> = if back {
(0..len).collect()
} else {
(0..len).rev().collect()
// len is the length *after* insertion
for len in 1..cap {
// 0, 1, 2, .., len - 1
- let expected = (0..).take(len).collect();
+ let expected = (0..).take(len).collect::<VecDeque<_>>();
for tail_pos in 0..cap {
for to_insert in 0..len {
tester.tail = tail_pos;
// len is the length *after* removal
for len in 0..cap - 1 {
// 0, 1, 2, .., len - 1
- let expected = (0..).take(len).collect();
+ let expected = (0..).take(len).collect::<VecDeque<_>>();
for tail_pos in 0..cap {
for to_remove in 0..len + 1 {
tester.tail = tail_pos;
for len in 0..cap + 1 {
// 0, 1, 2, .., len - 1
- let expected = (0..).take(len).collect();
+ let expected = (0..).take(len).collect::<VecDeque<_>>();
for tail_pos in 0..max_cap + 1 {
tester.tail = tail_pos;
tester.head = tail_pos;
// index to split at
for at in 0..len + 1 {
// 0, 1, 2, .., at - 1 (may be empty)
- let expected_self = (0..).take(at).collect();
+ let expected_self = (0..).take(at).collect::<VecDeque<_>>();
// at, at + 1, .., len - 1 (may be empty)
- let expected_other = (at..).take(len - at).collect();
+ let expected_other = (at..).take(len - at).collect::<VecDeque<_>>();
for tail_pos in 0..cap {
tester.tail = tail_pos;
assert!(e == VecDeque::new());
}
+#[test]
+fn test_partial_eq_array() {
+ let d = VecDeque::<char>::new();
+ assert!(d == []);
+
+ let mut d = VecDeque::new();
+ d.push_front('a');
+ assert!(d == ['a']);
+
+ let mut d = VecDeque::new();
+ d.push_back('a');
+ assert!(d == ['a']);
+
+ let mut d = VecDeque::new();
+ d.push_back('a');
+ d.push_back('b');
+ assert!(d == ['a', 'b']);
+}
+
#[test]
fn test_hash() {
let mut x = VecDeque::new();
//! support arguments of multiple types.
//!
//! - Impl the `As*` traits for reference-to-reference conversions
-//! - Impl the `Into` trait when you want to consume the value in the conversion
-//! - The `From` trait is the most flexible, useful for value _and_ reference conversions
-//! - The `TryFrom` and `TryInto` traits behave like `From` and `Into`, but allow for the
+//! - Impl the [`Into`] trait when you want to consume the value in the conversion
+//! - The [`From`] trait is the most flexible, useful for value _and_ reference conversions
+//! - The [`TryFrom`] and [`TryInto`] traits behave like [`From`] and [`Into`], but allow for the
//! conversion to fail
//!
-//! As a library author, you should prefer implementing `From<T>` or `TryFrom<T>` rather than
-//! `Into<U>` or `TryInto<U>`, as `From` and `TryFrom` provide greater flexibility and offer
-//! equivalent `Into` or `TryInto` implementations for free, thanks to a blanket implementation
+//! As a library author, you should prefer implementing [`From<T>`][`From`] or
+//! [`TryFrom<T>`][`TryFrom`] rather than [`Into<U>`][`Into`] or [`TryInto<U>`][`TryInto`],
+//! as [`From`] and [`TryFrom`] provide greater flexibility and offer
+//! equivalent [`Into`] or [`TryInto`] implementations for free, thanks to a blanket implementation
//! in the standard library.
//!
//! # Generic impl
//!
-//! - `AsRef` and `AsMut` auto-dereference if the inner type is a reference
-//! - `From<U> for T` implies `Into<T> for U`
-//! - `TryFrom<U> for T` implies `TryInto<T> for U`
-//! - `From` and `Into` are reflexive, which means that all types can `into()`
+//! - [`AsRef`] and [`AsMut`] auto-dereference if the inner type is a reference
+//! - [`From`]`<U> for T` implies [`Into`]`<T> for U`
+//! - [`TryFrom`]`<U> for T` implies [`TryInto`]`<T> for U`
+//! - [`From`] and [`Into`] are reflexive, which means that all types can `into()`
//! themselves and `from()` themselves
//!
//! See each trait for usage examples.
+//!
+//! [`Into`]: trait.Into.html
+//! [`From`]: trait.From.html
+//! [`TryFrom`]: trait.TryFrom.html
+//! [`TryInto`]: trait.TryInto.html
+//! [`AsRef`]: trait.AsRef.html
+//! [`AsMut`]: trait.AsMut.html
#![stable(feature = "rust1", since = "1.0.0")]
//! the optional owned box, [`Option`]`<`[`Box<T>`]`>`.
//!
//! The following example uses [`Option`] to create an optional box of
-//! [`i32`]. Notice that in order to use the inner [`i32`] value first the
+//! [`i32`]. Notice that in order to use the inner [`i32`] value first, the
//! `check_optional` function needs to use pattern matching to
//! determine whether the box has a value (i.e. it is [`Some(...)`][`Some`]) or
//! not ([`None`]).
//!
//! fn check_optional(optional: &Option<Box<i32>>) {
//! match *optional {
-//! Some(ref p) => println!("have value {}", p),
-//! None => println!("have no value"),
+//! Some(ref p) => println!("has value {}", p),
+//! None => println!("has no value"),
//! }
//! }
//! ```
ty::TyUint(..) |
ty::TyFloat(..) |
ty::TyAdt(..) |
- ty::TyBox(..) |
ty::TyStr |
ty::TyError |
ty::TyArray(..) |
-> cmt<'tcx>
{
let ptr = match base_cmt.ty.sty {
- ty::TyBox(..) => Unique,
+ ty::TyAdt(def, ..) if def.is_box() => Unique,
ty::TyRawPtr(ref mt) => UnsafePtr(mt.mutbl),
ty::TyRef(r, mt) => {
let bk = ty::BorrowKind::from_mutbl(mt.mutbl);
fn uncovered_tys<'tcx>(tcx: TyCtxt, ty: Ty<'tcx>, infer_is_local: InferIsLocal)
-> Vec<Ty<'tcx>> {
- if ty_is_local_constructor(tcx, ty, infer_is_local) {
+ if ty_is_local_constructor(ty, infer_is_local) {
vec![]
} else if fundamental_ty(tcx, ty) {
ty.walk_shallow()
}
fn ty_is_local(tcx: TyCtxt, ty: Ty, infer_is_local: InferIsLocal) -> bool {
- ty_is_local_constructor(tcx, ty, infer_is_local) ||
+ ty_is_local_constructor(ty, infer_is_local) ||
fundamental_ty(tcx, ty) && ty.walk_shallow().any(|t| ty_is_local(tcx, t, infer_is_local))
}
fn fundamental_ty(tcx: TyCtxt, ty: Ty) -> bool {
match ty.sty {
- ty::TyBox(..) | ty::TyRef(..) => true,
+ ty::TyRef(..) => true,
ty::TyAdt(def, _) => def.is_fundamental(),
ty::TyDynamic(ref data, ..) => {
data.principal().map_or(false, |p| tcx.has_attr(p.def_id(), "fundamental"))
}
}
-fn ty_is_local_constructor(tcx: TyCtxt, ty: Ty, infer_is_local: InferIsLocal)-> bool {
+fn ty_is_local_constructor(ty: Ty, infer_is_local: InferIsLocal)-> bool {
debug!("ty_is_local_constructor({:?})", ty);
match ty.sty {
def.did.is_local()
}
- ty::TyBox(_) => { // Box<T>
- let krate = tcx.lang_items.owned_box().map(|d| d.krate);
- krate == Some(LOCAL_CRATE)
- }
-
ty::TyDynamic(ref tt, ..) => {
tt.principal().map_or(false, |p| p.def_id().is_local())
}
ty::TyStr => Some(2),
ty::TyInt(..) | ty::TyUint(..) | ty::TyInfer(ty::IntVar(..)) => Some(3),
ty::TyFloat(..) | ty::TyInfer(ty::FloatVar(..)) => Some(4),
- ty::TyBox(..) | ty::TyRef(..) | ty::TyRawPtr(..) => Some(5),
+ ty::TyRef(..) | ty::TyRawPtr(..) => Some(5),
ty::TyArray(..) | ty::TySlice(..) => Some(6),
ty::TyFnDef(..) | ty::TyFnPtr(..) => Some(7),
ty::TyDynamic(..) => Some(8),
ty::TyInfer(ty::IntVar(_)) | ty::TyInfer(ty::FloatVar(_)) |
ty::TyUint(_) | ty::TyInt(_) | ty::TyBool | ty::TyFloat(_) |
ty::TyFnDef(..) | ty::TyFnPtr(_) | ty::TyRawPtr(..) |
- ty::TyChar | ty::TyBox(_) | ty::TyRef(..) |
+ ty::TyChar | ty::TyRef(..) |
ty::TyArray(..) | ty::TyClosure(..) | ty::TyNever |
ty::TyError => {
// safe for everything
Where(ty::Binder(Vec::new()))
}
- ty::TyBox(_) | ty::TyDynamic(..) | ty::TyStr | ty::TySlice(..) |
+ ty::TyDynamic(..) | ty::TyStr | ty::TySlice(..) |
ty::TyClosure(..) |
ty::TyRef(_, ty::TypeAndMut { ty: _, mutbl: hir::MutMutable }) => {
Never
t);
}
- ty::TyBox(referent_ty) => { // Box<T>
- vec![referent_ty]
- }
-
ty::TyRawPtr(ty::TypeAndMut { ty: element_ty, ..}) |
ty::TyRef(_, ty::TypeAndMut { ty: element_ty, ..}) => {
vec![element_ty]
// InteriorAll = 0b00000000__00000000__1111,
// Things that are owned by the value (second and third nibbles):
- OwnsOwned = 0b0000_0000__0000_0001__0000,
OwnsDtor = 0b0000_0000__0000_0010__0000,
- OwnsAll = 0b0000_0000__1111_1111__0000,
-
- // Things that mean drop glue is necessary
- NeedsDrop = 0b0000_0000__0000_0111__0000,
+ // OwnsAll = 0b0000_0000__1111_1111__0000,
// All bits
All = 0b1111_1111__1111_1111__1111
(self.bits & tc.bits) != 0
}
- pub fn owns_owned(&self) -> bool {
- self.intersects(TC::OwnsOwned)
- }
-
pub fn interior_param(&self) -> bool {
self.intersects(TC::InteriorParam)
}
}
pub fn needs_drop(&self, _: TyCtxt) -> bool {
- self.intersects(TC::NeedsDrop)
- }
-
- /// Includes only those bits that still apply when indirected through a `Box` pointer
- pub fn owned_pointer(&self) -> TypeContents {
- TC::OwnsOwned | (*self & TC::OwnsAll)
+ self.intersects(TC::OwnsDtor)
}
pub fn union<I, T, F>(v: I, mut f: F) -> TypeContents where
{
v.into_iter().fold(TC::None, |tc, ty| tc | f(ty))
}
-
- pub fn has_dtor(&self) -> bool {
- self.intersects(TC::OwnsDtor)
- }
}
impl ops::BitOr for TypeContents {
TC::None
}
- ty::TyBox(typ) => {
- tc_ty(tcx, typ, cache).owned_pointer()
- }
-
ty::TyDynamic(..) => {
TC::All - TC::InteriorParam
}
if def.is_union() {
// unions don't have destructors regardless of the child types
- res = res - TC::NeedsDrop;
+ res = res - TC::OwnsDtor;
}
if def.has_dtor() {
use hir::map as hir_map;
use hir::map::DisambiguatedDefPathData;
use middle::free_region::FreeRegionMap;
+use middle::lang_items;
use middle::region::RegionMaps;
use middle::resolve_lifetime;
use middle::stability;
pub fn print_debug_stats(self) {
sty_debug_print!(
self,
- TyAdt, TyBox, TyArray, TySlice, TyRawPtr, TyRef, TyFnDef, TyFnPtr,
+ TyAdt, TyArray, TySlice, TyRawPtr, TyRef, TyFnDef, TyFnPtr,
TyDynamic, TyClosure, TyTuple, TyParam, TyInfer, TyProjection, TyAnon);
println!("Substs interner: #{}", self.interners.substs.borrow().len());
}
pub fn mk_box(self, ty: Ty<'tcx>) -> Ty<'tcx> {
- self.mk_ty(TyBox(ty))
+ let def_id = self.require_lang_item(lang_items::OwnedBoxLangItem);
+ let adt_def = self.lookup_adt_def(def_id);
+ let substs = self.mk_substs(iter::once(Kind::from(ty)));
+ self.mk_ty(TyAdt(adt_def, substs))
}
pub fn mk_ptr(self, tm: TypeAndMut<'tcx>) -> Ty<'tcx> {
ty::TyTuple(ref tys) if tys.is_empty() => self.to_string(),
ty::TyAdt(def, _) => format!("{} `{}`", def.descr(), tcx.item_path_str(def.did)),
- ty::TyBox(_) => "box".to_string(),
ty::TyArray(_, n) => format!("array of {} elements", n),
ty::TySlice(_) => "slice".to_string(),
ty::TyRawPtr(_) => "*-ptr".to_string(),
use hir::def_id::DefId;
use ty::{self, Ty, TyCtxt};
use syntax::ast;
-use middle::lang_items::OwnedBoxLangItem;
use self::SimplifiedType::*;
// view of possibly unifying
simplify_type(tcx, mt.ty, can_simplify_params)
}
- ty::TyBox(_) => {
- // treat like we would treat `Box`
- Some(AdtSimplifiedType(tcx.require_lang_item(OwnedBoxLangItem)))
- }
ty::TyClosure(def_id, _) => {
Some(ClosureSimplifiedType(def_id))
}
self.add_region(r);
}
- &ty::TyBox(tt) | &ty::TyArray(tt, _) | &ty::TySlice(tt) => {
+ &ty::TyArray(tt, _) | &ty::TySlice(tt) => {
self.add_ty(tt)
}
ty::TyDynamic(data, ..) => data.principal().map(|p| p.def_id()),
ty::TyArray(subty, _) |
- ty::TySlice(subty) |
- ty::TyBox(subty) => characteristic_def_id_of_type(subty),
+ ty::TySlice(subty) => characteristic_def_id_of_type(subty),
ty::TyRawPtr(mt) |
ty::TyRef(_, mt) => characteristic_def_id_of_type(mt.ty),
let dl = &tcx.data_layout;
assert!(!ty.has_infer_types());
+ let ptr_layout = |pointee: Ty<'gcx>| {
+ let non_zero = !ty.is_unsafe_ptr();
+ let pointee = normalize_associated_type(infcx, pointee);
+ if pointee.is_sized(tcx, &infcx.parameter_environment, DUMMY_SP) {
+ Ok(Scalar { value: Pointer, non_zero: non_zero })
+ } else {
+ let unsized_part = tcx.struct_tail(pointee);
+ let meta = match unsized_part.sty {
+ ty::TySlice(_) | ty::TyStr => {
+ Int(dl.ptr_sized_integer())
+ }
+ ty::TyDynamic(..) => Pointer,
+ _ => return Err(LayoutError::Unknown(unsized_part))
+ };
+ Ok(FatPointer { metadata: meta, non_zero: non_zero })
+ }
+ };
let layout = match ty.sty {
// Basic scalars.
},
// Potentially-fat pointers.
- ty::TyBox(pointee) |
ty::TyRef(_, ty::TypeAndMut { ty: pointee, .. }) |
ty::TyRawPtr(ty::TypeAndMut { ty: pointee, .. }) => {
- let non_zero = !ty.is_unsafe_ptr();
- let pointee = normalize_associated_type(infcx, pointee);
- if pointee.is_sized(tcx, &infcx.parameter_environment, DUMMY_SP) {
- Scalar { value: Pointer, non_zero: non_zero }
- } else {
- let unsized_part = tcx.struct_tail(pointee);
- let meta = match unsized_part.sty {
- ty::TySlice(_) | ty::TyStr => {
- Int(dl.ptr_sized_integer())
- }
- ty::TyDynamic(..) => Pointer,
- _ => return Err(LayoutError::Unknown(unsized_part))
- };
- FatPointer { metadata: meta, non_zero: non_zero }
- }
+ ptr_layout(pointee)?
+ }
+ ty::TyAdt(def, _) if def.is_box() => {
+ ptr_layout(ty.boxed_ty())?
}
// Arrays and slices.
Err(err) => err
};
+ let ptr_skeleton = |pointee: Ty<'gcx>| {
+ let non_zero = !ty.is_unsafe_ptr();
+ let tail = tcx.struct_tail(pointee);
+ match tail.sty {
+ ty::TyParam(_) | ty::TyProjection(_) => {
+ assert!(tail.has_param_types() || tail.has_self_ty());
+ Ok(SizeSkeleton::Pointer {
+ non_zero: non_zero,
+ tail: tcx.erase_regions(&tail)
+ })
+ }
+ _ => {
+ bug!("SizeSkeleton::compute({}): layout errored ({}), yet \
+ tail `{}` is not a type parameter or a projection",
+ ty, err, tail)
+ }
+ }
+ };
+
match ty.sty {
- ty::TyBox(pointee) |
ty::TyRef(_, ty::TypeAndMut { ty: pointee, .. }) |
ty::TyRawPtr(ty::TypeAndMut { ty: pointee, .. }) => {
- let non_zero = !ty.is_unsafe_ptr();
- let tail = tcx.struct_tail(pointee);
- match tail.sty {
- ty::TyParam(_) | ty::TyProjection(_) => {
- assert!(tail.has_param_types() || tail.has_self_ty());
- Ok(SizeSkeleton::Pointer {
- non_zero: non_zero,
- tail: tcx.erase_regions(&tail)
- })
- }
- _ => {
- bug!("SizeSkeleton::compute({}): layout errored ({}), yet \
- tail `{}` is not a type parameter or a projection",
- ty, err, tail)
- }
- }
+ ptr_skeleton(pointee)
+ }
+ ty::TyAdt(def, _) if def.is_box() => {
+ ptr_skeleton(ty.boxed_ty())
}
ty::TyAdt(def, substs) => {
// except according to those terms.
pub use self::Variance::*;
-pub use self::DtorKind::*;
pub use self::AssociatedItemContainer::*;
pub use self::BorrowKind::*;
pub use self::IntVarValue::*;
pub maybe_unused_trait_imports: NodeSet,
}
-#[derive(Copy, Clone)]
-pub enum DtorKind {
- NoDtor,
- TraitDtor
-}
-
-impl DtorKind {
- pub fn is_present(&self) -> bool {
- match *self {
- TraitDtor => true,
- _ => false
- }
- }
-}
-
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
pub enum AssociatedItemContainer {
TraitContainer(DefId),
const IS_SIMD = 1 << 4,
const IS_FUNDAMENTAL = 1 << 5,
const IS_UNION = 1 << 6,
+ const IS_BOX = 1 << 7,
}
}
if Some(did) == tcx.lang_items.phantom_data() {
flags = flags | AdtFlags::IS_PHANTOM_DATA;
}
+ if Some(did) == tcx.lang_items.owned_box() {
+ flags = flags | AdtFlags::IS_BOX;
+ }
match kind {
AdtKind::Enum => flags = flags | AdtFlags::IS_ENUM,
AdtKind::Union => flags = flags | AdtFlags::IS_UNION,
self.flags.get().intersects(AdtFlags::IS_PHANTOM_DATA)
}
+ /// Returns true if this is Box<T>.
+ #[inline]
+ pub fn is_box(&self) -> bool {
+ self.flags.get().intersects(AdtFlags::IS_BOX)
+ }
+
/// Returns whether this type has a destructor.
pub fn has_dtor(&self) -> bool {
- self.dtor_kind().is_present()
+ self.destructor.get().is_some()
}
/// Asserts this is a struct and returns the struct's unique
self.destructor.set(Some(dtor));
}
- pub fn dtor_kind(&self) -> DtorKind {
- match self.destructor.get() {
- Some(_) => TraitDtor,
- None => NoDtor,
- }
- }
-
/// Returns a simpler type such that `Self: Sized` if and only
/// if that type is Sized, or `TyErr` if this type is recursive.
///
-> Vec<Ty<'tcx>> {
let result = match ty.sty {
TyBool | TyChar | TyInt(..) | TyUint(..) | TyFloat(..) |
- TyBox(..) | TyRawPtr(..) | TyRef(..) | TyFnDef(..) | TyFnPtr(_) |
+ TyRawPtr(..) | TyRef(..) | TyFnDef(..) | TyFnPtr(_) |
TyArray(..) | TyClosure(..) | TyNever => {
vec![]
}
ty::TyFloat(..) | // OutlivesScalar
ty::TyNever | // ...
ty::TyAdt(..) | // OutlivesNominalType
- ty::TyBox(..) | // OutlivesNominalType (ish)
ty::TyAnon(..) | // OutlivesNominalType (ish)
ty::TyStr | // OutlivesScalar (ish)
ty::TyArray(..) | // ...
Ok(tcx.mk_closure_from_closure_substs(a_id, substs))
}
- (&ty::TyBox(a_inner), &ty::TyBox(b_inner)) =>
- {
- let typ = relation.relate(&a_inner, &b_inner)?;
- Ok(tcx.mk_box(typ))
- }
-
(&ty::TyRawPtr(ref a_mt), &ty::TyRawPtr(ref b_mt)) =>
{
let mt = relation.relate(a_mt, b_mt)?;
impl<'tcx> TypeFoldable<'tcx> for Ty<'tcx> {
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Self {
let sty = match self.sty {
- ty::TyBox(typ) => ty::TyBox(typ.fold_with(folder)),
ty::TyRawPtr(tm) => ty::TyRawPtr(tm.fold_with(folder)),
ty::TyArray(typ, sz) => ty::TyArray(typ.fold_with(folder), sz),
ty::TySlice(typ) => ty::TySlice(typ.fold_with(folder)),
fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool {
match self.sty {
- ty::TyBox(typ) => typ.visit_with(visitor),
ty::TyRawPtr(ref tm) => tm.visit_with(visitor),
ty::TyArray(typ, _sz) => typ.visit_with(visitor),
ty::TySlice(typ) => typ.visit_with(visitor),
/// definition and not a concrete use of it.
TyAdt(&'tcx AdtDef, &'tcx Substs<'tcx>),
- /// `Box<T>`; this is nominally a struct in the documentation, but is
- /// special-cased internally. For example, it is possible to implicitly
- /// move the contents of a box out of that box, and methods of any type
- /// can have type `Box<Self>`.
- TyBox(Ty<'tcx>),
-
/// The pointee of a string slice. Written as `str`.
TyStr,
}
}
- pub fn is_unique(&self) -> bool {
+ pub fn is_box(&self) -> bool {
match self.sty {
- TyBox(_) => true,
- _ => false
+ TyAdt(def, _) => def.is_box(),
+ _ => false,
+ }
+ }
+
+ pub fn boxed_ty(&self) -> Ty<'tcx> {
+ match self.sty {
+ TyAdt(def, substs) if def.is_box() => substs.type_at(0),
+ _ => bug!("`boxed_ty` is called on non-box type {:?}", self),
}
}
-> Option<TypeAndMut<'tcx>>
{
match self.sty {
- TyBox(ty) => {
+ TyAdt(def, _) if def.is_box() => {
Some(TypeAndMut {
- ty: ty,
+ ty: self.boxed_ty(),
mutbl: if pref == ty::PreferMutLvalue {
hir::MutMutable
} else {
TyInt(_) |
TyUint(_) |
TyFloat(_) |
- TyBox(_) |
TyStr |
TyArray(..) |
TySlice(_) |
TyBool |
TyChar |
TyStr |
- TyBox(_) |
TySlice(_) => {}
TyError |
mutbl: hir::MutImmutable, ..
}) => Some(false),
- TyStr | TyBox(..) | TyRef(_, TypeAndMut {
+ TyStr | TyRef(_, TypeAndMut {
mutbl: hir::MutMutable, ..
}) => Some(true),
// Fast-path for primitive types
let result = match self.sty {
TyBool | TyChar | TyInt(..) | TyUint(..) | TyFloat(..) |
- TyBox(..) | TyRawPtr(..) | TyRef(..) | TyFnDef(..) | TyFnPtr(_) |
+ TyRawPtr(..) | TyRef(..) | TyFnDef(..) | TyFnPtr(_) |
TyArray(..) | TyTuple(..) | TyClosure(..) | TyNever => Some(true),
TyStr | TyDynamic(..) | TySlice(_) => Some(false),
ty::TyBool | ty::TyChar | ty::TyInt(_) | ty::TyUint(_) | ty::TyFloat(_) |
ty::TyStr | ty::TyInfer(_) | ty::TyParam(_) | ty::TyNever | ty::TyError => {
}
- ty::TyBox(ty) | ty::TyArray(ty, _) | ty::TySlice(ty) => {
+ ty::TyArray(ty, _) | ty::TySlice(ty) => {
stack.push(ty);
}
ty::TyRawPtr(ref mt) | ty::TyRef(_, ref mt) => {
}
}
- ty::TyBox(_) |
ty::TyRawPtr(_) => {
// simple cases that are WF if their type args are WF
}
use ty::{TyError, TyStr, TyArray, TySlice, TyFloat, TyFnDef, TyFnPtr};
use ty::{TyParam, TyRawPtr, TyRef, TyNever, TyTuple};
use ty::{TyClosure, TyProjection, TyAnon};
-use ty::{TyBox, TyDynamic, TyInt, TyUint, TyInfer};
+use ty::{TyDynamic, TyInt, TyUint, TyInfer};
use ty::{self, Ty, TyCtxt, TypeFoldable};
use std::cell::Cell;
TyInt(t) => write!(f, "{}", t.ty_to_string()),
TyUint(t) => write!(f, "{}", t.ty_to_string()),
TyFloat(t) => write!(f, "{}", t.ty_to_string()),
- TyBox(typ) => write!(f, "Box<{}>", typ),
TyRawPtr(ref tm) => {
write!(f, "*{} {}", match tm.mutbl {
hir::MutMutable => "mut",
let mut base = super::windows_base::opts();
base.cpu = "pentium4".to_string();
base.max_atomic_width = Some(64);
+ base.eliminate_frame_pointer = false; // Required for backtraces
// Mark all dynamic libraries and executables as compatible with the larger 4GiB address
// space available to x86 Windows binaries on x86_64.
fn open_drop<'a>(&mut self, c: &DropCtxt<'a, 'tcx>) -> BasicBlock {
let ty = c.lvalue.ty(self.mir, self.tcx).to_ty(self.tcx);
match ty.sty {
- ty::TyAdt(def, substs) => {
- self.open_drop_for_adt(c, def, substs)
- }
ty::TyClosure(def_id, substs) => {
let tys : Vec<_> = substs.upvar_tys(def_id, self.tcx).collect();
self.open_drop_for_tuple(c, &tys)
ty::TyTuple(tys) => {
self.open_drop_for_tuple(c, tys)
}
- ty::TyBox(ty) => {
- self.open_drop_for_box(c, ty)
+ ty::TyAdt(def, _) if def.is_box() => {
+ self.open_drop_for_box(c, ty.boxed_ty())
+ }
+ ty::TyAdt(def, substs) => {
+ self.open_drop_for_adt(c, def, substs)
}
_ => bug!("open drop from non-ADT `{:?}`", ty)
}
match ty.sty {
ty::TyAdt(def, _) => {
- if def.has_dtor() {
+ if def.has_dtor() && !def.is_box() {
self.tcx.sess.span_warn(
c.source_info.span,
&format!("dataflow bug??? moving out of type with dtor {:?}",
// error: can't move out of borrowed content
ty::TyRef(..) | ty::TyRawPtr(..) => return Err(MovePathError::IllegalMove),
// error: can't move out of struct with destructor
- ty::TyAdt(adt, _) if adt.has_dtor() =>
+ ty::TyAdt(adt, _) if adt.has_dtor() && !adt.is_box() =>
return Err(MovePathError::IllegalMove),
// move out of union - always move the entire union
ty::TyAdt(adt, _) if adt.is_union() =>
lv, ty);
true
}
- ty::TyAdt(def, _) if def.has_dtor() || def.is_union() => {
+ ty::TyAdt(def, _) if (def.has_dtor() && !def.is_box()) || def.is_union() => {
debug!("lvalue_contents_drop_state_cannot_differ lv: {:?} ty: {:?} Drop => true",
lv, ty);
true
debug!("constructor_arity({:?}, {:?})", ctor, ty);
match ty.sty {
ty::TyTuple(ref fs) => fs.len(),
- ty::TyBox(_) => 1,
ty::TySlice(..) | ty::TyArray(..) => match *ctor {
Slice(length) => length,
ConstantValue(_) => 0,
debug!("constructor_sub_pattern_tys({:?}, {:?})", ctor, ty);
match ty.sty {
ty::TyTuple(ref fs) => fs.into_iter().map(|t| *t).collect(),
- ty::TyBox(ty) => vec![ty],
ty::TySlice(ty) | ty::TyArray(ty, _) => match *ctor {
Slice(length) => repeat(ty).take(length).collect(),
ConstantValue(_) => vec![],
}
PatternKind::Deref { ref subpattern } => {
match self.ty.sty {
- ty::TyBox(_) => write!(f, "box ")?,
+ ty::TyAdt(def, _) if def.is_box() => write!(f, "box ")?,
ty::TyRef(_, mt) => {
write!(f, "&")?;
if mt.mutbl == hir::MutMutable {
use array_vec::{self, Array, ArrayVec};
-#[derive(PartialEq, Eq, Hash, Debug)]
+#[derive(Hash, Debug)]
pub enum AccumulateVec<A: Array> {
Array(ArrayVec<A>),
Heap(Vec<A::Element>)
}
}
-impl<A: Array> PartialEq for ArrayVec<A> {
- fn eq(&self, other: &Self) -> bool {
- self == other
- }
-}
-
-impl<A: Array> Eq for ArrayVec<A> {}
-
impl<A> Clone for ArrayVec<A>
where A: Array,
A::Element: Clone {
let uint_ty = tcx.types.usize;
let tup1_ty = tcx.intern_tup(&[int_ty, uint_ty, int_ty, uint_ty]);
let tup2_ty = tcx.intern_tup(&[tup1_ty, tup1_ty, uint_ty]);
- let uniq_ty = tcx.mk_box(tup2_ty);
- let walked: Vec<_> = uniq_ty.walk().collect();
+ let walked: Vec<_> = tup2_ty.walk().collect();
assert_eq!(walked,
- [uniq_ty, tup2_ty, tup1_ty, int_ty, uint_ty, int_ty, uint_ty, tup1_ty, int_ty,
+ [tup2_ty, tup1_ty, int_ty, uint_ty, int_ty, uint_ty, tup1_ty, int_ty,
uint_ty, int_ty, uint_ty, uint_ty]);
})
}
let uint_ty = tcx.types.usize;
let tup1_ty = tcx.intern_tup(&[int_ty, uint_ty, int_ty, uint_ty]);
let tup2_ty = tcx.intern_tup(&[tup1_ty, tup1_ty, uint_ty]);
- let uniq_ty = tcx.mk_box(tup2_ty);
// types we expect to see (in order), plus a boolean saying
// whether to skip the subtree.
- let mut expected = vec![(uniq_ty, false),
- (tup2_ty, false),
+ let mut expected = vec![(tup2_ty, false),
(tup1_ty, false),
(int_ty, false),
(uint_ty, false),
(uint_ty, false)];
expected.reverse();
- let mut walker = uniq_ty.walk();
+ let mut walker = tup2_ty.walk();
while let Some(t) = walker.next() {
debug!("walked to {:?}", t);
let (expected_ty, skip) = expected.pop().unwrap();
impl BoxPointers {
fn check_heap_type<'a, 'tcx>(&self, cx: &LateContext, span: Span, ty: Ty) {
for leaf_ty in ty.walk() {
- if let ty::TyBox(_) = leaf_ty.sty {
+ if leaf_ty.is_box() {
let m = format!("type uses owned (Box type) pointers: {}", ty);
cx.span_lint(BOX_POINTERS, span, &m);
}
// Primitive types with a stable representation.
ty::TyBool | ty::TyInt(..) | ty::TyUint(..) | ty::TyFloat(..) | ty::TyNever => FfiSafe,
- ty::TyBox(..) => {
- FfiUnsafe("found Rust type Box<_> in foreign module, \
- consider using a raw pointer instead")
- }
-
ty::TySlice(_) => {
FfiUnsafe("found Rust slice type in foreign module, \
consider using a raw pointer instead")
base: Lvalue::Local(index),
elem: ProjectionElem::Deref
}) if self.mir.local_kind(index) == LocalKind::Temp
- && self.mir.local_decls[index].ty.is_unique()
+ && self.mir.local_decls[index].ty.is_box()
&& self.temp_qualif[index].map_or(false, |qualif| {
qualif.intersects(Qualif::NOT_CONST)
}) => {
return;
}
- let arg_ty = match args[0].ty(mir, self.tcx()).sty {
+ let ty = args[0].ty(mir, self.tcx());
+ let arg_ty = match ty.sty {
ty::TyRawPtr(mt) => mt.ty,
- ty::TyBox(ty) => ty,
+ ty::TyAdt(def, _) if def.is_box() => ty.boxed_ty(),
_ => {
span_mirbug!(self, term, "box_free called with bad arg ty");
return;
if !type_is_fat_ptr(ccx, ret_ty) {
// The `noalias` attribute on the return value is useful to a
// function ptr caller.
- if let ty::TyBox(_) = ret_ty.sty {
+ if ret_ty.is_box() {
// `Box` pointer return values never alias because ownership
// is transferred
ret.attrs.set(ArgAttribute::NoAlias);
// We can also mark the return value as `dereferenceable` in certain cases
match ret_ty.sty {
// These are not really pointers but pairs, (pointer, len)
- ty::TyRef(_, ty::TypeAndMut { ty, .. }) |
- ty::TyBox(ty) => {
+ ty::TyRef(_, ty::TypeAndMut { ty, .. }) => {
let llty = type_of::sizing_type_of(ccx, ty);
let llsz = llsize_of_alloc(ccx, llty);
ret.attrs.set_dereferenceable(llsz);
}
+ ty::TyAdt(def, _) if def.is_box() => {
+ let llty = type_of::sizing_type_of(ccx, ret_ty.boxed_ty());
+ let llsz = llsize_of_alloc(ccx, llty);
+ ret.attrs.set_dereferenceable(llsz);
+ }
_ => {}
}
}
// Handle safe Rust thin and fat pointers.
let rust_ptr_attrs = |ty: Ty<'tcx>, arg: &mut ArgType| match ty.sty {
// `Box` pointer parameters never alias because ownership is transferred
- ty::TyBox(inner) => {
+ ty::TyAdt(def, _) if def.is_box() => {
arg.attrs.set(ArgAttribute::NoAlias);
- Some(inner)
+ Some(ty.boxed_ty())
}
ty::TyRef(b, mt) => {
) -> (ValueRef, ValueRef) {
debug!("unsize_thin_ptr: {:?} => {:?}", src_ty, dst_ty);
match (&src_ty.sty, &dst_ty.sty) {
- (&ty::TyBox(a), &ty::TyBox(b)) |
(&ty::TyRef(_, ty::TypeAndMut { ty: a, .. }),
&ty::TyRef(_, ty::TypeAndMut { ty: b, .. })) |
(&ty::TyRef(_, ty::TypeAndMut { ty: a, .. }),
let ptr_ty = type_of::in_memory_type_of(bcx.ccx, b).ptr_to();
(bcx.pointercast(src, ptr_ty), unsized_info(bcx.ccx, a, b, None))
}
+ (&ty::TyAdt(def_a, _), &ty::TyAdt(def_b, _)) if def_a.is_box() && def_b.is_box() => {
+ let (a, b) = (src_ty.boxed_ty(), dst_ty.boxed_ty());
+ assert!(bcx.ccx.shared().type_is_sized(a));
+ let ptr_ty = type_of::in_memory_type_of(bcx.ccx, b).ptr_to();
+ (bcx.pointercast(src, ptr_ty), unsized_info(bcx.ccx, a, b, None))
+ }
_ => bug!("unsize_thin_ptr: called on bad types"),
}
}
src_ty: Ty<'tcx>,
dst: ValueRef,
dst_ty: Ty<'tcx>) {
+ let coerce_ptr = || {
+ let (base, info) = if common::type_is_fat_ptr(bcx.ccx, src_ty) {
+ // fat-ptr to fat-ptr unsize preserves the vtable
+ // i.e. &'a fmt::Debug+Send => &'a fmt::Debug
+ // So we need to pointercast the base to ensure
+ // the types match up.
+ let (base, info) = load_fat_ptr(bcx, src, src_ty);
+ let llcast_ty = type_of::fat_ptr_base_ty(bcx.ccx, dst_ty);
+ let base = bcx.pointercast(base, llcast_ty);
+ (base, info)
+ } else {
+ let base = load_ty(bcx, src, src_ty);
+ unsize_thin_ptr(bcx, base, src_ty, dst_ty)
+ };
+ store_fat_ptr(bcx, base, info, dst, dst_ty);
+ };
match (&src_ty.sty, &dst_ty.sty) {
- (&ty::TyBox(..), &ty::TyBox(..)) |
(&ty::TyRef(..), &ty::TyRef(..)) |
(&ty::TyRef(..), &ty::TyRawPtr(..)) |
(&ty::TyRawPtr(..), &ty::TyRawPtr(..)) => {
- let (base, info) = if common::type_is_fat_ptr(bcx.ccx, src_ty) {
- // fat-ptr to fat-ptr unsize preserves the vtable
- // i.e. &'a fmt::Debug+Send => &'a fmt::Debug
- // So we need to pointercast the base to ensure
- // the types match up.
- let (base, info) = load_fat_ptr(bcx, src, src_ty);
- let llcast_ty = type_of::fat_ptr_base_ty(bcx.ccx, dst_ty);
- let base = bcx.pointercast(base, llcast_ty);
- (base, info)
- } else {
- let base = load_ty(bcx, src, src_ty);
- unsize_thin_ptr(bcx, base, src_ty, dst_ty)
- };
- store_fat_ptr(bcx, base, info, dst, dst_ty);
+ coerce_ptr()
+ }
+ (&ty::TyAdt(def_a, _), &ty::TyAdt(def_b, _)) if def_a.is_box() && def_b.is_box() => {
+ coerce_ptr()
}
(&ty::TyAdt(def_a, substs_a), &ty::TyAdt(def_b, substs_b)) => {
// a char is a Unicode codepoint, and so takes values from 0
// to 0x10FFFF inclusive only.
b.load_range_assert(ptr, 0, 0x10FFFF + 1, llvm::False)
- } else if (t.is_region_ptr() || t.is_unique()) && !common::type_is_fat_ptr(ccx, t) {
+ } else if (t.is_region_ptr() || t.is_box()) && !common::type_is_fat_ptr(ccx, t) {
b.load_nonnull(ptr)
} else {
b.load(ptr)
b: &Builder<'a, 'tcx>, src: ValueRef, t: Ty<'tcx>
) -> (ValueRef, ValueRef) {
let ptr = get_dataptr(b, src);
- let ptr = if t.is_region_ptr() || t.is_unique() {
+ let ptr = if t.is_region_ptr() || t.is_box() {
b.load_nonnull(ptr)
} else {
b.load(ptr)
//! the LLVM artifact produced for A references the LLVM artifact produced
//! for B.
//!
-//! - Translation items and the references between them for a directed graph,
+//! - Translation items and the references between them form a directed graph,
//! where the translation items are the nodes and references form the edges.
//! Let's call this graph the "translation item graph".
//!
debug!("find_drop_glue_neighbors: {}", type_to_string(scx.tcx(), ty));
// Make sure the BoxFreeFn lang-item gets translated if there is a boxed value.
- if let ty::TyBox(content_type) = ty.sty {
+ if ty.is_box() {
let def_id = scx.tcx().require_lang_item(BoxFreeFnLangItem);
-
if should_trans_locally(scx.tcx(), def_id) {
let box_free_fn_trans_item =
create_fn_trans_item(scx,
def_id,
- scx.tcx().mk_substs(iter::once(Kind::from(content_type))),
+ scx.tcx().mk_substs(iter::once(Kind::from(ty.boxed_ty()))),
scx.tcx().intern_substs(&[]));
output.push(box_free_fn_trans_item);
}
_ => None
};
- if let Some(destructor_did) = destructor_did {
+ if let (Some(destructor_did), false) = (destructor_did, ty.is_box()) {
use rustc::ty::ToPolyTraitRef;
let drop_trait_def_id = scx.tcx()
ty::TyDynamic(..) => {
/* nothing to do */
}
- ty::TyAdt(adt_def, substs) => {
- for field in adt_def.all_fields() {
+ ty::TyAdt(def, _) if def.is_box() => {
+ let inner_type = glue::get_drop_glue_type(scx, ty.boxed_ty());
+ if scx.type_needs_drop(inner_type) {
+ output.push(TransItem::DropGlue(DropGlueKind::Ty(inner_type)));
+ }
+ }
+ ty::TyAdt(def, substs) => {
+ for field in def.all_fields() {
let field_type = scx.tcx().item_type(field.did);
let field_type = monomorphize::apply_param_substs(scx,
substs,
}
}
}
- ty::TyBox(inner_type) |
ty::TySlice(inner_type) |
ty::TyArray(inner_type, _) => {
let inner_type = glue::get_drop_glue_type(scx, inner_type);
source_ty: ty::Ty<'tcx>,
target_ty: ty::Ty<'tcx>)
-> (ty::Ty<'tcx>, ty::Ty<'tcx>) {
+ let ptr_vtable = |inner_source: ty::Ty<'tcx>, inner_target: ty::Ty<'tcx>| {
+ if !scx.type_is_sized(inner_source) {
+ (inner_source, inner_target)
+ } else {
+ scx.tcx().struct_lockstep_tails(inner_source, inner_target)
+ }
+ };
match (&source_ty.sty, &target_ty.sty) {
- (&ty::TyBox(a), &ty::TyBox(b)) |
(&ty::TyRef(_, ty::TypeAndMut { ty: a, .. }),
&ty::TyRef(_, ty::TypeAndMut { ty: b, .. })) |
(&ty::TyRef(_, ty::TypeAndMut { ty: a, .. }),
&ty::TyRawPtr(ty::TypeAndMut { ty: b, .. })) |
(&ty::TyRawPtr(ty::TypeAndMut { ty: a, .. }),
&ty::TyRawPtr(ty::TypeAndMut { ty: b, .. })) => {
- let (inner_source, inner_target) = (a, b);
-
- if !scx.type_is_sized(inner_source) {
- (inner_source, inner_target)
- } else {
- scx.tcx().struct_lockstep_tails(inner_source, inner_target)
- }
+ ptr_vtable(a, b)
+ }
+ (&ty::TyAdt(def_a, _), &ty::TyAdt(def_b, _)) if def_a.is_box() && def_b.is_box() => {
+ ptr_vtable(source_ty.boxed_ty(), target_ty.boxed_ty())
}
(&ty::TyAdt(source_adt_def, source_substs),
debug!("type_metadata: {:?}", t);
let sty = &t.sty;
+ let ptr_metadata = |ty: Ty<'tcx>| {
+ match ty.sty {
+ ty::TySlice(typ) => {
+ Ok(vec_slice_metadata(cx, t, typ, unique_type_id, usage_site_span))
+ }
+ ty::TyStr => {
+ Ok(vec_slice_metadata(cx, t, cx.tcx().types.u8, unique_type_id, usage_site_span))
+ }
+ ty::TyDynamic(..) => {
+ Ok(MetadataCreationResult::new(
+ trait_pointer_metadata(cx, ty, Some(t), unique_type_id),
+ false))
+ }
+ _ => {
+ let pointee_metadata = type_metadata(cx, ty, usage_site_span);
+
+ match debug_context(cx).type_map
+ .borrow()
+ .find_metadata_for_unique_id(unique_type_id) {
+ Some(metadata) => return Err(metadata),
+ None => { /* proceed normally */ }
+ };
+
+ Ok(MetadataCreationResult::new(pointer_type_metadata(cx, t, pointee_metadata),
+ false))
+ }
+ }
+ };
+
let MetadataCreationResult { metadata, already_stored_in_typemap } = match *sty {
ty::TyNever |
ty::TyBool |
trait_pointer_metadata(cx, t, None, unique_type_id),
false)
}
- ty::TyBox(ty) |
ty::TyRawPtr(ty::TypeAndMut{ty, ..}) |
ty::TyRef(_, ty::TypeAndMut{ty, ..}) => {
- match ty.sty {
- ty::TySlice(typ) => {
- vec_slice_metadata(cx, t, typ, unique_type_id, usage_site_span)
- }
- ty::TyStr => {
- vec_slice_metadata(cx, t, cx.tcx().types.u8, unique_type_id, usage_site_span)
- }
- ty::TyDynamic(..) => {
- MetadataCreationResult::new(
- trait_pointer_metadata(cx, ty, Some(t), unique_type_id),
- false)
- }
- _ => {
- let pointee_metadata = type_metadata(cx, ty, usage_site_span);
-
- match debug_context(cx).type_map
- .borrow()
- .find_metadata_for_unique_id(unique_type_id) {
- Some(metadata) => return metadata,
- None => { /* proceed normally */ }
- };
-
- MetadataCreationResult::new(pointer_type_metadata(cx, t, pointee_metadata),
- false)
- }
+ match ptr_metadata(ty) {
+ Ok(res) => res,
+ Err(metadata) => return metadata,
+ }
+ }
+ ty::TyAdt(def, _) if def.is_box() => {
+ match ptr_metadata(t.boxed_ty()) {
+ Ok(res) => res,
+ Err(metadata) => return metadata,
}
}
ty::TyFnDef(.., ref barefnty) | ty::TyFnPtr(ref barefnty) => {
// Only "class" methods are generally understood by LLVM,
// so avoid methods on other types (e.g. `<*mut T>::null`).
match impl_self_ty.sty {
- ty::TyAdt(..) => {
+ ty::TyAdt(def, ..) if !def.is_box() => {
Some(type_metadata(cx, impl_self_ty, syntax_pos::DUMMY_SP))
}
_ => None
}
output.push(')');
},
- ty::TyBox(inner_type) => {
- output.push_str("Box<");
- push_debuginfo_type_name(cx, inner_type, true, output);
- output.push('>');
- },
ty::TyRawPtr(ty::TypeAndMut { ty: inner_type, mutbl } ) => {
output.push('*');
match mutbl {
return scx.tcx().types.i8;
}
match t.sty {
- ty::TyBox(typ) if !scx.type_needs_drop(typ) && scx.type_is_sized(typ) => {
- scx.tcx().infer_ctxt((), traits::Reveal::All).enter(|infcx| {
- let layout = t.layout(&infcx).unwrap();
- if layout.size(&scx.tcx().data_layout).bytes() == 0 {
- // `Box<ZeroSizeType>` does not allocate.
- scx.tcx().types.i8
- } else {
- t
- }
- })
+ ty::TyAdt(def, _) if def.is_box() => {
+ let typ = t.boxed_ty();
+ if !scx.type_needs_drop(typ) && scx.type_is_sized(typ) {
+ scx.tcx().infer_ctxt((), traits::Reveal::All).enter(|infcx| {
+ let layout = t.layout(&infcx).unwrap();
+ if layout.size(&scx.tcx().data_layout).bytes() == 0 {
+ // `Box<ZeroSizeType>` does not allocate.
+ scx.tcx().types.i8
+ } else {
+ t
+ }
+ })
+ } else {
+ t
+ }
}
_ => t
}
};
let bcx = match t.sty {
- ty::TyBox(content_ty) => {
- // Support for TyBox is built-in and its drop glue is
- // special. It may move to library and have Drop impl. As
- // a safe-guard, assert TyBox not used with TyContents.
+ ty::TyAdt(def, _) if def.is_box() => {
+ // Support for Box is built-in as yet and its drop glue is special
+ // despite having a dummy Drop impl in the library.
assert!(!skip_dtor);
+ let content_ty = t.boxed_ty();
let ptr = if !bcx.ccx.shared().type_is_sized(content_ty) {
let llbox = bcx.load(get_dataptr(&bcx, ptr.llval));
let info = bcx.load(get_meta(&bcx, ptr.llval));
bcx.call(dtor, &[ptr.llval], None);
bcx
}
- ty::TyAdt(def, ..) if def.dtor_kind().is_present() && !skip_dtor => {
+ ty::TyAdt(def, ..) if def.has_dtor() && !skip_dtor => {
let shallow_drop = def.is_union();
let tcx = bcx.tcx();
let ty = mircx.monomorphize(&ty);
debug!("local {} has type {:?}", index, ty);
if ty.is_scalar() ||
- ty.is_unique() ||
+ ty.is_box() ||
ty.is_region_ptr() ||
ty.is_simd() ||
common::type_is_zero_size(mircx.ccx, ty)
}
output.push(')');
},
- ty::TyBox(inner_type) => {
- output.push_str("Box<");
- self.push_type_name(inner_type, output);
- output.push('>');
- },
ty::TyRawPtr(ty::TypeAndMut { ty: inner_type, mutbl } ) => {
output.push('*');
match mutbl {
debug!("sizing_type_of {:?}", t);
let _recursion_lock = cx.enter_type_of(t);
+ let ptr_sizing_ty = |ty: Ty<'tcx>| {
+ if cx.shared().type_is_sized(ty) {
+ Type::i8p(cx)
+ } else {
+ Type::struct_(cx, &[Type::i8p(cx), unsized_info_ty(cx, ty)], false)
+ }
+ };
let llsizingty = match t.sty {
_ if !cx.shared().type_is_sized(t) => {
Type::struct_(cx, &[Type::i8p(cx), unsized_info_ty(cx, t)], false)
ty::TyFloat(t) => Type::float_from_ty(cx, t),
ty::TyNever => Type::nil(cx),
- ty::TyBox(ty) |
ty::TyRef(_, ty::TypeAndMut{ty, ..}) |
ty::TyRawPtr(ty::TypeAndMut{ty, ..}) => {
- if cx.shared().type_is_sized(ty) {
- Type::i8p(cx)
- } else {
- Type::struct_(cx, &[Type::i8p(cx), unsized_info_ty(cx, ty)], false)
- }
+ ptr_sizing_ty(ty)
+ }
+ ty::TyAdt(def, _) if def.is_box() => {
+ ptr_sizing_ty(t.boxed_ty())
}
ty::TyFnDef(..) => Type::nil(cx),
pub fn fat_ptr_base_ty<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, ty: Ty<'tcx>) -> Type {
match ty.sty {
- ty::TyBox(t) |
ty::TyRef(_, ty::TypeAndMut { ty: t, .. }) |
ty::TyRawPtr(ty::TypeAndMut { ty: t, .. }) if !ccx.shared().type_is_sized(t) => {
in_memory_type_of(ccx, t).ptr_to()
}
+ ty::TyAdt(def, _) if def.is_box() => {
+ in_memory_type_of(ccx, ty.boxed_ty()).ptr_to()
+ }
_ => bug!("expected fat ptr ty but got {:?}", ty)
}
}
return llty;
}
+ let ptr_ty = |ty: Ty<'tcx>| {
+ if !cx.shared().type_is_sized(ty) {
+ if let ty::TyStr = ty.sty {
+ // This means we get a nicer name in the output (str is always
+ // unsized).
+ cx.str_slice_type()
+ } else {
+ let ptr_ty = in_memory_type_of(cx, ty).ptr_to();
+ let info_ty = unsized_info_ty(cx, ty);
+ Type::struct_(cx, &[ptr_ty, info_ty], false)
+ }
+ } else {
+ in_memory_type_of(cx, ty).ptr_to()
+ }
+ };
+
let mut llty = match t.sty {
ty::TyBool => Type::bool(cx),
ty::TyChar => Type::char(cx),
adt::incomplete_type_of(cx, t, "closure")
}
- ty::TyBox(ty) |
ty::TyRef(_, ty::TypeAndMut{ty, ..}) |
ty::TyRawPtr(ty::TypeAndMut{ty, ..}) => {
- if !cx.shared().type_is_sized(ty) {
- if let ty::TyStr = ty.sty {
- // This means we get a nicer name in the output (str is always
- // unsized).
- cx.str_slice_type()
- } else {
- let ptr_ty = in_memory_type_of(cx, ty).ptr_to();
- let info_ty = unsized_info_ty(cx, ty);
- Type::struct_(cx, &[ptr_ty, info_ty], false)
- }
- } else {
- in_memory_type_of(cx, ty).ptr_to()
- }
+ ptr_ty(ty)
+ }
+ ty::TyAdt(def, _) if def.is_box() => {
+ ptr_ty(t.boxed_ty())
}
ty::TyArray(ty, size) => {
// If this was an enum or struct, fill in the type now.
match t.sty {
- ty::TyAdt(..) | ty::TyClosure(..) if !t.is_simd() => {
+ ty::TyAdt(..) | ty::TyClosure(..) if !t.is_simd() && !t.is_box() => {
adt::finish_type_of(cx, t, &mut llty);
}
_ => ()
}
};
- let substs = self.ast_path_substs_for_ty(span,
- did,
- item_segment);
-
- // FIXME(#12938): This is a hack until we have full support for DST.
- if Some(did) == self.tcx().lang_items.owned_box() {
- assert_eq!(substs.types().count(), 1);
- return self.tcx().mk_box(substs.type_at(0));
- }
-
+ let substs = self.ast_path_substs_for_ty(span, did, item_segment);
decl_ty.subst(self.tcx(), substs)
}
fn count_modifiers(ty: Ty) -> usize {
match ty.sty {
ty::TyRef(_, mt) => count_modifiers(mt.ty) + 1,
- ty::TyBox(t) => count_modifiers(t) + 1,
+ ty::TyAdt(def, _) if def.is_box() => count_modifiers(ty.boxed_ty()) + 1,
_ => 0,
}
}
} else {
match self_arg_ty.sty {
ty::TyRef(r, mt) => ExplicitSelf::ByReference(r, mt.mutbl),
- ty::TyBox(_) => ExplicitSelf::ByBox,
+ ty::TyAdt(def, _) if def.is_box() => ExplicitSelf::ByBox,
_ => ExplicitSelf::ByValue,
}
}
tstr);
}
}
- ty::TyBox(..) => {
+ ty::TyAdt(def, ..) if def.is_box() => {
match fcx.tcx.sess.codemap().span_to_snippet(self.cast_span) {
Ok(s) => {
err.span_suggestion(self.cast_span,
Ok(())
}
- ty::TyBox(ity) | ty::TyArray(ity, _) | ty::TySlice(ity) => {
+ ty::TyArray(ity, _) | ty::TySlice(ity) => {
// single-element containers, behave like their element
iterate_over_potentially_unsafe_regions_in_type(
cx, context, ity, depth+1)
ty::TyAdt(def, _) => {
self.assemble_inherent_impl_candidates_for_type(def.did);
}
- ty::TyBox(_) => {
- if let Some(box_did) = self.tcx.lang_items.owned_box() {
- self.assemble_inherent_impl_candidates_for_type(box_did);
- }
- }
ty::TyParam(p) => {
self.assemble_inherent_candidates_from_param(self_ty, p);
}
hir::ExprBox(ref subexpr) => {
let expected_inner = expected.to_option(self).map_or(NoExpectation, |ty| {
match ty.sty {
- ty::TyBox(ty) => Expectation::rvalue_hint(self, ty),
+ ty::TyAdt(def, _) if def.is_box()
+ => Expectation::rvalue_hint(self, ty.boxed_ty()),
_ => NoExpectation
}
});
self.type_must_outlive(infer::RelateObjectBound(cast_expr.span), from_ty, r);
}
- /*From:*/ (&ty::TyBox(from_referent_ty),
- /*To: */ &ty::TyBox(to_referent_ty)) => {
- self.walk_cast(cast_expr, from_referent_ty, to_referent_ty);
+ /*From:*/ (&ty::TyAdt(from_def, _),
+ /*To: */ &ty::TyAdt(to_def, _)) if from_def.is_box() && to_def.is_box() => {
+ self.walk_cast(cast_expr, from_ty.boxed_ty(), to_ty.boxed_ty());
}
_ => { }
(mt_a.ty, mt_b.ty, unsize_trait, None)
};
let (source, target, trait_def_id, kind) = match (&source.sty, &target.sty) {
- (&ty::TyBox(a), &ty::TyBox(b)) => (a, b, unsize_trait, None),
-
(&ty::TyRef(r_a, mt_a), &ty::TyRef(r_b, mt_b)) => {
infcx.sub_regions(infer::RelateObjectBound(span), r_b, r_a);
check_mutbl(mt_a, mt_b, &|ty| tcx.mk_imm_ref(r_b, ty))
use rustc::ty::{TyParam, TyRawPtr};
use rustc::ty::{TyRef, TyAdt, TyDynamic, TyNever, TyTuple};
use rustc::ty::{TyStr, TyArray, TySlice, TyFloat, TyInfer, TyInt};
-use rustc::ty::{TyUint, TyClosure, TyBox, TyFnDef, TyFnPtr};
+use rustc::ty::{TyUint, TyClosure, TyFnDef, TyFnPtr};
use rustc::ty::{TyProjection, TyAnon};
use CrateCtxt;
use syntax_pos::Span;
TyDynamic(ref t, ..) => t.principal().map(|p| p.def_id()),
- TyBox(_) => self.tcx.lang_items.owned_box(),
-
TyBool | TyChar | TyInt(..) | TyUint(..) | TyFloat(..) | TyStr | TyArray(..) |
TySlice(..) | TyFnDef(..) | TyFnPtr(_) | TyTuple(..) | TyParam(..) | TyError |
TyNever | TyRawPtr(_) | TyRef(..) | TyProjection(..) => None,
ty::TyDynamic(ref data, ..) if data.principal().is_some() => {
self.check_def_id(item, data.principal().unwrap().def_id());
}
- ty::TyBox(..) => {
- match self.tcx.lang_items.require_owned_box() {
- Ok(trait_id) => self.check_def_id(item, trait_id),
- Err(msg) => self.tcx.sess.span_fatal(item.span, &msg),
- }
- }
ty::TyChar => {
self.check_primitive_impl(def_id,
self.tcx.lang_items.char_impl(),
let self_ty = trait_ref.self_ty();
let opt_self_def_id = match self_ty.sty {
ty::TyAdt(self_def, _) => Some(self_def.did),
- ty::TyBox(..) => self.tcx.lang_items.owned_box(),
_ => None,
};
self.add_constraints_from_mt(generics, mt, variance);
}
- ty::TyBox(typ) |
ty::TyArray(typ, _) |
ty::TySlice(typ) => {
self.add_constraints_from_ty(generics, typ, variance);
ty::TyUint(uint_ty) => Primitive(uint_ty.into()),
ty::TyFloat(float_ty) => Primitive(float_ty.into()),
ty::TyStr => Primitive(PrimitiveType::Str),
- ty::TyBox(t) => {
- let box_did = cx.tcx.lang_items.owned_box();
- lang_struct(cx, box_did, t, "Box", Unique)
- }
ty::TySlice(ty) => Vector(box ty.clean(cx)),
ty::TyArray(ty, i) => FixedVector(box ty.clean(cx),
format!("{}", i)),
}
}
-fn lang_struct(cx: &DocContext, did: Option<DefId>,
- t: ty::Ty, name: &str,
- fallback: fn(Box<Type>) -> Type) -> Type {
- let did = match did {
- Some(did) => did,
- None => return fallback(box t.clean(cx)),
- };
- inline::record_extern_fqn(cx, did, TypeKind::Struct);
- ResolvedPath {
- typarams: None,
- did: did,
- path: Path {
- global: false,
- def: Def::Err,
- segments: vec![PathSegment {
- name: name.to_string(),
- params: PathParameters::AngleBracketed {
- lifetimes: vec![],
- types: vec![t.clean(cx)],
- bindings: vec![]
- }
- }],
- },
- is_generic: false,
- }
-}
-
/// An equality constraint on an associated type, e.g. `A=Bar` in `Foo<A=Bar>`
#[derive(Clone, PartialEq, RustcDecodable, RustcEncodable, Debug)]
pub struct TypeBinding {
should_panic: testing::ShouldPanic::No,
},
testfn: testing::DynTestFn(box move |()| {
+ let panic = io::set_panic(None);
+ let print = io::set_print(None);
match {
rustc_driver::in_rustc_thread(move || {
+ io::set_panic(panic);
+ io::set_print(print);
runtest(&test,
&cratename,
cfgs,
// Test that macro reexports item are gated by `macro_reexport` feature gate.
// aux-build:macro_reexport_1.rs
+// gate-test-macro_reexport
#![crate_type = "dylib"]
// FIXME the error message that is current emitted seems pretty bad.
+// gate-test-quote
+
#![feature(rustc_private)]
#![allow(dead_code, unused_imports, unused_variables)]
fn main() {
let a: clam = clam{x: box 1, y: box 2};
let b: clam = clam{x: box 10, y: box 20};
- let z: isize = a.x + b.y; //~ ERROR binary operation `+` cannot be applied to type `Box<isize>`
+ let z: isize = a.x + b.y;
+ //~^ ERROR binary operation `+` cannot be applied to type `std::boxed::Box<isize>`
println!("{}", z);
assert_eq!(z, 21);
let forty: fish = fish{a: box 40};
let two: fish = fish{a: box 2};
let answer: isize = forty.a + two.a;
- //~^ ERROR binary operation `+` cannot be applied to type `Box<isize>`
+ //~^ ERROR binary operation `+` cannot be applied to type `std::boxed::Box<isize>`
println!("{}", answer);
assert_eq!(answer, 42);
}
let _x = a.x;
//~^ value moved here
let _y = a.y; //~ ERROR use of moved
- //~^ move occurs because `a.x` has type `Box<isize>`
+ //~^ move occurs because `a.x` has type `std::boxed::Box<isize>`
//~| value used here after move
}
let _x = a.x;
//~^ value moved here
let _y = a.y; //~ ERROR use of moved
- //~^ move occurs because `a.x` has type `Box<isize>`
+ //~^ move occurs because `a.x` has type `std::boxed::Box<isize>`
//~| value used here after move
}
let _x = a.x;
//~^ value moved here
let _y = &a.y; //~ ERROR use of moved
- //~^ move occurs because `a.x` has type `Box<isize>`
+ //~^ move occurs because `a.x` has type `std::boxed::Box<isize>`
//~| value used here after move
}
let _x = a.x.x;
//~^ value moved here
let _y = a.y; //~ ERROR use of collaterally moved
- //~^ NOTE move occurs because `a.x.x` has type `Box<isize>`
+ //~^ NOTE move occurs because `a.x.x` has type `std::boxed::Box<isize>`
//~| value used here after move
}
let _x = a.x.x;
//~^ value moved here
let _y = a.y; //~ ERROR use of collaterally moved
- //~^ NOTE move occurs because `a.x.x` has type `Box<isize>`
+ //~^ NOTE move occurs because `a.x.x` has type `std::boxed::Box<isize>`
//~| value used here after move
}
let _x = a.x.x;
//~^ value moved here
let _y = &a.y; //~ ERROR use of collaterally moved
- //~^ NOTE move occurs because `a.x.x` has type `Box<isize>`
+ //~^ NOTE move occurs because `a.x.x` has type `std::boxed::Box<isize>`
//~| value used here after move
}
let x: Box<Trait> = Box::new(Foo);
let _y: &Trait = x; //~ ERROR mismatched types
//~| expected type `&Trait`
- //~| found type `Box<Trait>`
- //~| expected &Trait, found box
+ //~| found type `std::boxed::Box<Trait>`
}
let box box x = box 1isize as Box<T>;
//~^ ERROR mismatched types
//~| expected type `T`
- //~| found type `Box<_>`
- //~| expected trait T, found box
+ //~| found type `std::boxed::Box<_>`
}
let _: () = (box |_: isize| {}) as Box<FnOnce(isize)>;
//~^ ERROR mismatched types
//~| expected type `()`
- //~| found type `Box<std::ops::FnOnce(isize)>`
- //~| expected (), found box
+ //~| found type `std::boxed::Box<std::ops::FnOnce(isize)>`
let _: () = (box |_: isize, isize| {}) as Box<Fn(isize, isize)>;
//~^ ERROR mismatched types
//~| expected type `()`
- //~| found type `Box<std::ops::Fn(isize, isize)>`
- //~| expected (), found box
+ //~| found type `std::boxed::Box<std::ops::Fn(isize, isize)>`
let _: () = (box || -> isize { unimplemented!() }) as Box<FnMut() -> isize>;
//~^ ERROR mismatched types
//~| expected type `()`
- //~| found type `Box<std::ops::FnMut() -> isize>`
- //~| expected (), found box
+ //~| found type `std::boxed::Box<std::ops::FnMut() -> isize>`
needs_fn(1);
//~^ ERROR : std::ops::Fn<(isize,)>`
fn main() {
let x: Box<isize> = box 0;
- println!("{}", x + 1); //~ ERROR binary operation `+` cannot be applied to type `Box<isize>`
+ println!("{}", x + 1);
+ //~^ ERROR binary operation `+` cannot be applied to type `std::boxed::Box<isize>`
}
//~^ ERROR cast to unsized type: `&[usize; 2]` as `[usize]`
//~^^ HELP consider using an implicit coercion to `&[usize]` instead
- // FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
+ // FIXME (#22405): Replace `std::boxed::Box::new` with `box` here when/if possible.
let _bar = Box::new(1_usize) as std::fmt::Debug;
- //~^ ERROR cast to unsized type: `Box<usize>` as `std::fmt::Debug`
+ //~^ ERROR cast to unsized type: `std::boxed::Box<usize>` as `std::fmt::Debug`
//~^^ HELP try casting to a `Box` instead
let _baz = 1_usize as std::fmt::Debug;
box (true, false) => ()
//~^ ERROR mismatched types
//~| expected type `(bool, bool)`
-//~| found type `Box<_>`
-//~| expected tuple, found box
+//~| found type `std::boxed::Box<_>`
}
match (true, false) {
impl<'a> BarStruct {
fn foo(&'a mut self) -> Box<BarStruct> { self }
//~^ ERROR mismatched types
- //~| expected type `Box<BarStruct>`
+ //~| expected type `std::boxed::Box<BarStruct>`
//~| found type `&'a mut BarStruct`
- //~| expected box, found mutable reference
}
fn main() {}
fn main() {
let x: Box<_> = box 3;
take_param(&x);
- //~^ ERROR `Box<{integer}>: std::marker::Copy` is not satisfied
+ //~^ ERROR `std::boxed::Box<{integer}>: std::marker::Copy` is not satisfied
}
pub fn ptr_type2(size: *const Foo); //~ ERROR: found struct without
pub fn slice_type(p: &[u32]); //~ ERROR: found Rust slice type
pub fn str_type(p: &str); //~ ERROR: found Rust type
- pub fn box_type(p: Box<u32>); //~ ERROR found Rust type
+ pub fn box_type(p: Box<u32>); //~ ERROR found struct without
pub fn char_type(p: char); //~ ERROR found Rust type
pub fn trait_type(p: &Clone); //~ ERROR found Rust trait type
pub fn tuple_type(p: (i32, i32)); //~ ERROR found Rust tuple type
pub fn zero_size(p: ZeroSize); //~ ERROR found zero-size struct
pub fn fn_type(p: RustFn); //~ ERROR found function pointer with Rust
pub fn fn_type2(p: fn()); //~ ERROR found function pointer with Rust
- pub fn fn_contained(p: RustBadRet); //~ ERROR: found Rust type
+ pub fn fn_contained(p: RustBadRet); //~ ERROR: found struct without
pub fn good1(size: *const libc::c_int);
pub fn good2(size: *const libc::c_uint);
let x: Box<Map<isize, isize>> = x;
// FIXME (#22405): Replace `Box::new` with `box` here when/if possible.
let y: Box<Map<usize, isize>> = Box::new(x);
- //~^ ERROR `Box<Map<isize, isize>>: Map<usize, isize>` is not satisfied
+ //~^ ERROR `std::boxed::Box<Map<isize, isize>>: Map<usize, isize>` is not satisfied
}
trait Foo {}
fn take_foo<F:Foo>(f: F) {}
fn take_object(f: Box<Foo>) { take_foo(f); }
-//~^ ERROR `Box<Foo>: Foo` is not satisfied
+//~^ ERROR `std::boxed::Box<Foo>: Foo` is not satisfied
fn main() {}
f = box g;
//~^ ERROR mismatched types
//~| expected type `_`
- //~| found type `Box<_>`
+ //~| found type `std::boxed::Box<_>`
//~| cyclic type of infinite size
}
f = box f;
//~^ ERROR mismatched types
//~| expected type `_`
- //~| found type `Box<_>`
+ //~| found type `std::boxed::Box<_>`
//~| cyclic type of infinite size
}
fn set_f_bad(&mut self, b: Box<b>) {
self.f = b;
//~^ ERROR mismatched types
- //~| expected type `Box<Box<&'a isize>>`
- //~| found type `Box<Box<&isize>>`
+ //~| expected type `std::boxed::Box<std::boxed::Box<&'a isize>>`
+ //~| found type `std::boxed::Box<std::boxed::Box<&isize>>`
//~| lifetime mismatch
}
}
fn have_bar(b: bar) {
want_foo(b); //~ ERROR mismatched types
//~| expected type `foo`
- //~| found type `Box<foo>`
- //~| expected struct `foo`, found box
+ //~| found type `std::boxed::Box<foo>`
}
fn main() {}
let _: *mut [u32] = x;
let x: Box<[u32; 3]> = Box::new([42, 43, 44]);
- let _ = x as Box<[u32]>; //~ERROR trivial cast: `Box<[u32; 3]>` as `Box<[u32]>`
+ let _ = x as Box<[u32]>;
+ //~^ ERROR trivial cast: `std::boxed::Box<[u32; 3]>` as `std::boxed::Box<[u32]>`
let x: Box<[u32; 3]> = Box::new([42, 43, 44]);
let _: Box<[u32]> = x;
let _: *mut Foo = x;
let x: Box<Bar> = Box::new(Bar);
- let _ = x as Box<Foo>; //~ERROR trivial cast: `Box<Bar>` as `Box<Foo>`
+ let _ = x as Box<Foo>; //~ERROR trivial cast: `std::boxed::Box<Bar>` as `std::boxed::Box<Foo>`
let x: Box<Bar> = Box::new(Bar);
let _: Box<Foo> = x;
//~^ ERROR mismatched types
//~| Perhaps two different versions of crate `crate_a1`
//~| expected trait `main::a::Bar`
- //~| expected type `Box<main::a::Bar + 'static>`
- //~| found type `Box<main::a::Bar>`
+ //~| expected type `std::boxed::Box<main::a::Bar + 'static>`
+ //~| found type `std::boxed::Box<main::a::Bar>`
}
}
// BOX
// gdb-command:whatis box1
-// gdbg-check:type = struct (Box<f32>, i32)
-// gdbr-check:type = (Box<f32>, i32)
+// gdbg-check:type = struct (alloc::boxed::Box<f32>, i32)
+// gdbr-check:type = (alloc::boxed::Box<f32>, i32)
// gdb-command:whatis box2
-// gdbg-check:type = struct (Box<type_names::mod1::mod2::Enum3<f32>>, i32)
-// gdbr-check:type = (Box<type_names::mod1::mod2::Enum3<f32>>, i32)
+// gdbg-check:type = struct (alloc::boxed::Box<type_names::mod1::mod2::Enum3<f32>>, i32)
+// gdbr-check:type = (alloc::boxed::Box<type_names::mod1::mod2::Enum3<f32>>, i32)
// REFERENCES
// gdbr-check:type = (unsafe fn(type_names::GenericStruct<u16, u8>) -> type_names::mod1::Struct2, usize)
// gdb-command:whatis extern_stdcall_fn_with_return_value
-// gdbg-check:type = struct (extern "stdcall" fn(Box<isize>) -> usize, usize)
-// gdbr-check:type = (extern "stdcall" fn(Box<isize>) -> usize, usize)
+// gdbg-check:type = struct (extern "stdcall" fn(alloc::boxed::Box<isize>) -> usize, usize)
+// gdbr-check:type = (extern "stdcall" fn(alloc::boxed::Box<isize>) -> usize, usize)
// gdb-command:whatis generic_function_int
// gdbg-check:type = struct (fn(isize) -> isize, usize)
// Tests TySlice
pub type FooSlice = [u8];
- // Tests TyBox (of u8)
+ // Tests Box (of u8)
pub type FooBox = Box<u8>;
// Tests TyRawPtr
target_os = "ios",
target_os = "android",
all(target_os = "linux", target_arch = "arm"),
- all(target_os = "windows", target_pointer_width = "32"),
target_os = "freebsd",
target_os = "dragonfly",
target_os = "bitrig",
}
fn main() {
- if cfg!(windows) && cfg!(target_env = "gnu") && cfg!(target_pointer_width = "32") {
- return
- }
-
let args: Vec<String> = env::args().collect();
if args.len() >= 2 && args[1] == "fail" {
foo();
24 | a(x); //~ ERROR mismatched types [E0308]
| ^ expected trait `Foo + std::marker::Send`, found trait `Foo`
|
- = note: expected type `Box<Foo + std::marker::Send + 'static>`
- found type `Box<Foo + 'static>`
+ = note: expected type `std::boxed::Box<Foo + std::marker::Send + 'static>`
+ found type `std::boxed::Box<Foo + 'static>`
error: aborting due to previous error
| ^^^^^ cyclic type of infinite size
|
= note: expected type `_`
- found type `Box<_>`
+ found type `std::boxed::Box<_>`
error: aborting due to 5 previous errors
.env("LLVM_COMPONENTS", &self.config.llvm_components)
.env("LLVM_CXXFLAGS", &self.config.llvm_cxxflags);
+ // We don't want RUSTFLAGS set from the outside to interfere with
+ // compiler flags set in the test cases:
+ cmd.env_remove("RUSTFLAGS");
+
if self.config.target.contains("msvc") {
// We need to pass a path to `lib.exe`, so assume that `cc` is `cl.exe`
// and that `lib.exe` lives next to it.
// FIXME get this whitelist empty.
let whitelist = vec![
- "abi_ptx", "simd", "macro_reexport",
- "static_recursion", "quote",
+ "abi_ptx", "simd", "static_recursion",
"cfg_target_has_atomic", "staged_api", "const_indexing",
"unboxed_closures", "stmt_expr_attributes",
"cfg_target_thread_local", "unwind_attributes",