]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #38932 - petrochenkov:privctor, r=jseyfried
authorbors <bors@rust-lang.org>
Thu, 2 Feb 2017 05:10:40 +0000 (05:10 +0000)
committerbors <bors@rust-lang.org>
Thu, 2 Feb 2017 05:10:40 +0000 (05:10 +0000)
Privatize constructors of tuple structs with private fields

This PR implements the strictest version of such "privatization" - it just sets visibilities for struct constructors, this affects everything including imports.
```
visibility(struct_ctor) = min(visibility(struct), visibility(field_1), ..., visibility(field_N))
```
Needs crater run before proceeding.

Resolves https://github.com/rust-lang/rfcs/issues/902

r? @nikomatsakis

114 files changed:
.travis.yml
appveyor.yml
src/bootstrap/config.rs
src/bootstrap/dist.rs
src/ci/docker/README.md
src/ci/docker/dist-powerpc-linux/Dockerfile
src/ci/docker/dist-powerpc-linux/build-powerpc-toolchain.sh [new file with mode: 0755]
src/ci/docker/dist-powerpc-linux/patches/glibc/2.12.2/001-PowerPC-Remove-unnecessary-mnew-mnemonics.patch [new file with mode: 0644]
src/ci/docker/dist-powerpc-linux/powerpc-linux-gnu.config [new file with mode: 0644]
src/ci/docker/dist-powerpc64-linux/Dockerfile
src/ci/docker/dist-powerpc64-linux/build-powerpc64-toolchain.sh [new file with mode: 0755]
src/ci/docker/dist-powerpc64-linux/build-powerpc64le-toolchain.sh [new file with mode: 0755]
src/ci/docker/dist-powerpc64-linux/patches/glibc/2.12.2/001-PowerPC-Remove-unnecessary-mnew-mnemonics.patch [new file with mode: 0644]
src/ci/docker/dist-powerpc64-linux/patches/glibc/2.12.2/002-Prevent-inlining-in-PPC64-initfini.s.patch [new file with mode: 0644]
src/ci/docker/dist-powerpc64-linux/powerpc64-linux-gnu.config [new file with mode: 0644]
src/ci/docker/dist-s390x-linux-netbsd/Dockerfile
src/ci/docker/dist-s390x-linux-netbsd/build-netbsd-toolchain.sh [new file with mode: 0755]
src/ci/docker/dist-s390x-linux-netbsd/build-s390x-toolchain.sh [new file with mode: 0755]
src/ci/docker/dist-s390x-linux-netbsd/build-toolchain.sh [deleted file]
src/ci/docker/dist-s390x-linux-netbsd/patches/glibc/2.12.2/001-Use-.machine-to-prevent-AS-from-complaining-about-z9.patch [new file with mode: 0644]
src/ci/docker/dist-s390x-linux-netbsd/s390x-linux-gnu.config [new file with mode: 0644]
src/ci/docker/x86_64-gnu-incremental/Dockerfile [new file with mode: 0644]
src/doc/book/ffi.md
src/liballoc/boxed.rs
src/liballoc/lib.rs
src/libcollections/vec_deque.rs
src/libcollectionstest/vec_deque.rs
src/libcore/convert.rs
src/libcore/option.rs
src/librustc/infer/freshen.rs
src/librustc/middle/mem_categorization.rs
src/librustc/traits/coherence.rs
src/librustc/traits/error_reporting.rs
src/librustc/traits/select.rs
src/librustc/ty/contents.rs
src/librustc/ty/context.rs
src/librustc/ty/error.rs
src/librustc/ty/fast_reject.rs
src/librustc/ty/flags.rs
src/librustc/ty/item_path.rs
src/librustc/ty/layout.rs
src/librustc/ty/mod.rs
src/librustc/ty/outlives.rs
src/librustc/ty/relate.rs
src/librustc/ty/structural_impls.rs
src/librustc/ty/sty.rs
src/librustc/ty/util.rs
src/librustc/ty/walk.rs
src/librustc/ty/wf.rs
src/librustc/util/ppaux.rs
src/librustc_back/target/i686_pc_windows_gnu.rs
src/librustc_borrowck/borrowck/mir/elaborate_drops.rs
src/librustc_borrowck/borrowck/mir/gather_moves.rs
src/librustc_borrowck/borrowck/mir/mod.rs
src/librustc_const_eval/_match.rs
src/librustc_const_eval/pattern.rs
src/librustc_data_structures/accumulate_vec.rs
src/librustc_data_structures/array_vec.rs
src/librustc_driver/test.rs
src/librustc_lint/builtin.rs
src/librustc_lint/types.rs
src/librustc_mir/transform/qualify_consts.rs
src/librustc_mir/transform/type_check.rs
src/librustc_trans/abi.rs
src/librustc_trans/base.rs
src/librustc_trans/collector.rs
src/librustc_trans/debuginfo/metadata.rs
src/librustc_trans/debuginfo/mod.rs
src/librustc_trans/debuginfo/type_names.rs
src/librustc_trans/glue.rs
src/librustc_trans/mir/analyze.rs
src/librustc_trans/trans_item.rs
src/librustc_trans/type_of.rs
src/librustc_typeck/astconv.rs
src/librustc_typeck/check/cast.rs
src/librustc_typeck/check/dropck.rs
src/librustc_typeck/check/method/probe.rs
src/librustc_typeck/check/mod.rs
src/librustc_typeck/check/regionck.rs
src/librustc_typeck/coherence/builtin.rs
src/librustc_typeck/coherence/mod.rs
src/librustc_typeck/coherence/orphan.rs
src/librustc_typeck/variance/constraints.rs
src/librustdoc/clean/mod.rs
src/librustdoc/test.rs
src/test/compile-fail-fulldeps/gated-macro-reexports.rs
src/test/compile-fail-fulldeps/gated-quote.rs
src/test/compile-fail/autoderef-full-lval.rs
src/test/compile-fail/borrowck/borrowck-box-insensitivity.rs
src/test/compile-fail/cross-borrow-trait.rs
src/test/compile-fail/destructure-trait-ref.rs
src/test/compile-fail/fn-trait-formatting.rs
src/test/compile-fail/issue-14915.rs
src/test/compile-fail/issue-17441.rs
src/test/compile-fail/issue-5100.rs
src/test/compile-fail/issue-7061.rs
src/test/compile-fail/kindck-impl-type-params-2.rs
src/test/compile-fail/lint-ctypes.rs
src/test/compile-fail/map-types.rs
src/test/compile-fail/object-does-not-impl-trait.rs
src/test/compile-fail/occurs-check-2.rs
src/test/compile-fail/occurs-check.rs
src/test/compile-fail/regions-infer-paramd-indirect.rs
src/test/compile-fail/terr-sorts.rs
src/test/compile-fail/trivial_casts.rs
src/test/compile-fail/type-mismatch-same-crate-name.rs
src/test/debuginfo/type-names.rs
src/test/run-pass/auxiliary/issue13507.rs
src/test/run-pass/backtrace-debuginfo.rs
src/test/run-pass/backtrace.rs
src/test/ui/mismatched_types/trait-bounds-cant-coerce.stderr
src/test/ui/span/coerce-suggestions.stderr
src/tools/compiletest/src/runtest.rs
src/tools/tidy/src/features.rs

index 8a7dc96b34b2541b81c45d0edf4b7a8655878113..f138b0bed2b0282a94b69e73a41689d0e4a58578 100644 (file)
@@ -35,6 +35,7 @@ matrix:
     - 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: >
@@ -108,11 +109,12 @@ cache:
 
 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:
index 418cdcb07af4e507166f651236f05472ff954e95..c617ac8a4e342d061e97209403d25d582952f6aa 100644 (file)
@@ -137,6 +137,7 @@ branches:
 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}/$_
index e035f8157ffde9a6d6ecb22415fd97dbe8d139f5..6e077691b3a058fe7c91c0162dd738cfd516676a 100644 (file)
@@ -516,7 +516,7 @@ macro_rules! check {
                 "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();
index 71a5f313bbd26257d5b6f384dd60ca298399c222..5fac142f777ff2b71893a93e3b8f8ce7fad95b81 100644 (file)
@@ -827,7 +827,7 @@ pub fn extended(build: &Build, stage: u32, target: &str) {
         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")
@@ -844,6 +844,8 @@ pub fn extended(build: &Build, stage: u32, target: &str) {
         cmd.arg("-sice:ICE57");
 
         build.run(&mut cmd);
+
+        t!(fs::rename(exe.join(&filename), distdir(build).join(&filename)));
     }
 }
 
index 9a0a4c8cb530a3610628c966e56f4a840371befa..52f74ba90de6ef0787b96170d128cb1f56c515da 100644 (file)
@@ -143,3 +143,58 @@ For targets: `aarch64-unknown-linux-gnu`
 - 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
index ed4e9a35960f6f213c5cd5ad3d109b212903aa55..640bacc54eb30b1d8ba65233c45ec6a09535372b 100644 (file)
@@ -1,18 +1,29 @@
 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 | \
@@ -23,6 +34,43 @@ RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-ini
     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
diff --git a/src/ci/docker/dist-powerpc-linux/build-powerpc-toolchain.sh b/src/ci/docker/dist-powerpc-linux/build-powerpc-toolchain.sh
new file mode 100755 (executable)
index 0000000..90a4df0
--- /dev/null
@@ -0,0 +1,36 @@
+#!/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
diff --git a/src/ci/docker/dist-powerpc-linux/patches/glibc/2.12.2/001-PowerPC-Remove-unnecessary-mnew-mnemonics.patch b/src/ci/docker/dist-powerpc-linux/patches/glibc/2.12.2/001-PowerPC-Remove-unnecessary-mnew-mnemonics.patch
new file mode 100644 (file)
index 0000000..744eb18
--- /dev/null
@@ -0,0 +1,24 @@
+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
+
diff --git a/src/ci/docker/dist-powerpc-linux/powerpc-linux-gnu.config b/src/ci/docker/dist-powerpc-linux/powerpc-linux-gnu.config
new file mode 100644 (file)
index 0000000..26e2de8
--- /dev/null
@@ -0,0 +1,528 @@
+#
+# 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
index 6c04048f4ddf8ce5437c1ebeddf7036f6d6e9f39..624763ef5de6708a3b64dbb1126cab144a7dde39 100644 (file)
@@ -1,19 +1,29 @@
 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 | \
@@ -24,10 +34,49 @@ RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-ini
     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
diff --git a/src/ci/docker/dist-powerpc64-linux/build-powerpc64-toolchain.sh b/src/ci/docker/dist-powerpc64-linux/build-powerpc64-toolchain.sh
new file mode 100755 (executable)
index 0000000..d70947d
--- /dev/null
@@ -0,0 +1,36 @@
+#!/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
diff --git a/src/ci/docker/dist-powerpc64-linux/build-powerpc64le-toolchain.sh b/src/ci/docker/dist-powerpc64-linux/build-powerpc64le-toolchain.sh
new file mode 100755 (executable)
index 0000000..8b924ca
--- /dev/null
@@ -0,0 +1,79 @@
+#!/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
diff --git a/src/ci/docker/dist-powerpc64-linux/patches/glibc/2.12.2/001-PowerPC-Remove-unnecessary-mnew-mnemonics.patch b/src/ci/docker/dist-powerpc64-linux/patches/glibc/2.12.2/001-PowerPC-Remove-unnecessary-mnew-mnemonics.patch
new file mode 100644 (file)
index 0000000..744eb18
--- /dev/null
@@ -0,0 +1,24 @@
+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
+
diff --git a/src/ci/docker/dist-powerpc64-linux/patches/glibc/2.12.2/002-Prevent-inlining-in-PPC64-initfini.s.patch b/src/ci/docker/dist-powerpc64-linux/patches/glibc/2.12.2/002-Prevent-inlining-in-PPC64-initfini.s.patch
new file mode 100644 (file)
index 0000000..47cc8b2
--- /dev/null
@@ -0,0 +1,26 @@
+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
+
diff --git a/src/ci/docker/dist-powerpc64-linux/powerpc64-linux-gnu.config b/src/ci/docker/dist-powerpc64-linux/powerpc64-linux-gnu.config
new file mode 100644 (file)
index 0000000..c2d02ee
--- /dev/null
@@ -0,0 +1,528 @@
+#
+# 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
index ec38855fe3a0181a6de32fa1256908c33fb016ba..589b5fd530fc7cce13bd5bf4fd9a791ed52aa91f 100644 (file)
@@ -1,37 +1,81 @@
 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
diff --git a/src/ci/docker/dist-s390x-linux-netbsd/build-netbsd-toolchain.sh b/src/ci/docker/dist-s390x-linux-netbsd/build-netbsd-toolchain.sh
new file mode 100755 (executable)
index 0000000..654b458
--- /dev/null
@@ -0,0 +1,120 @@
+#!/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
diff --git a/src/ci/docker/dist-s390x-linux-netbsd/build-s390x-toolchain.sh b/src/ci/docker/dist-s390x-linux-netbsd/build-s390x-toolchain.sh
new file mode 100755 (executable)
index 0000000..b4995e2
--- /dev/null
@@ -0,0 +1,36 @@
+#!/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
diff --git a/src/ci/docker/dist-s390x-linux-netbsd/build-toolchain.sh b/src/ci/docker/dist-s390x-linux-netbsd/build-toolchain.sh
deleted file mode 100644 (file)
index 654b458..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-#!/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
diff --git a/src/ci/docker/dist-s390x-linux-netbsd/patches/glibc/2.12.2/001-Use-.machine-to-prevent-AS-from-complaining-about-z9.patch b/src/ci/docker/dist-s390x-linux-netbsd/patches/glibc/2.12.2/001-Use-.machine-to-prevent-AS-from-complaining-about-z9.patch
new file mode 100644 (file)
index 0000000..cba416e
--- /dev/null
@@ -0,0 +1,63 @@
+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
+
diff --git a/src/ci/docker/dist-s390x-linux-netbsd/s390x-linux-gnu.config b/src/ci/docker/dist-s390x-linux-netbsd/s390x-linux-gnu.config
new file mode 100644 (file)
index 0000000..fa5e451
--- /dev/null
@@ -0,0 +1,508 @@
+#
+# 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
diff --git a/src/ci/docker/x86_64-gnu-incremental/Dockerfile b/src/ci/docker/x86_64-gnu-incremental/Dockerfile
new file mode 100644 (file)
index 0000000..3e084f4
--- /dev/null
@@ -0,0 +1,27 @@
+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
index 8ab580e6aa9fd7a5a4850142eee35ab596292bc0..8d29f11aa051971956c5ffbfac8ca748d1272765 100644 (file)
@@ -56,9 +56,9 @@ almost any function that takes a pointer argument isn't valid for all possible
 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:
 
index 5409ade292360d31e96afed17d8ade6d39c5d0f2..b6f490e09cddf645b9daaa00864b87e6b63e1bf9 100644 (file)
@@ -103,6 +103,7 @@ pub struct ExchangeHeapSingleton {
 ///
 /// 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>);
 
@@ -292,6 +293,14 @@ pub fn into_raw(b: Box<T>) -> *mut 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.
index c67106cf57aaf0ea2ab83f573d45c324d5f540bd..0c01eabd593ff9743bc9fe206c32f5b8819b2498 100644 (file)
@@ -47,7 +47,7 @@
 //! 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.
 //!
index 5b1bc3a3ae4f14897d934c8c0f7d787903f405cc..5e1adb3d808ce1bb71cd0d38d7fdf618a9d5f589 100644 (file)
@@ -469,9 +469,9 @@ pub fn get_mut(&mut self, index: usize) -> Option<&mut T> {
     /// 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) {
@@ -649,9 +649,9 @@ pub fn shrink_to_fit(&mut self) {
     /// 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) {
@@ -826,8 +826,9 @@ pub fn is_empty(&self) -> bool {
     /// 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(..);
@@ -1179,11 +1180,10 @@ fn is_contiguous(&self) -> bool {
     /// 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> {
@@ -1215,11 +1215,10 @@ 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> {
@@ -1250,11 +1249,10 @@ 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) {
@@ -1478,9 +1476,10 @@ 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> {
@@ -1659,9 +1658,8 @@ 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")]
@@ -1718,11 +1716,11 @@ pub fn split_off(&mut self, at: usize) -> Self {
     /// ```
     /// 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")]
@@ -1745,9 +1743,7 @@ pub fn append(&mut self, other: &mut Self) {
     /// 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)
@@ -1781,11 +1777,13 @@ impl<T: Clone> VecDeque<T> {
     /// 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) {
@@ -2162,6 +2160,46 @@ fn eq(&self, other: &VecDeque<A>) -> bool {
 #[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> {
@@ -2434,7 +2472,7 @@ fn test(back: bool) {
             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()
@@ -2483,7 +2521,7 @@ fn test_insert() {
         // 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;
@@ -2516,7 +2554,7 @@ fn test_remove() {
         // 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;
@@ -2591,7 +2629,7 @@ fn test_shrink_to_fit() {
 
         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;
@@ -2624,9 +2662,9 @@ fn test_split_off() {
             // 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;
index cdf022e4f02f36ec4e4a623bc26a0d8131d92e06..bb60f888f8be6e80521610fc89fa3fb290d8c809 100644 (file)
@@ -603,6 +603,25 @@ fn test_eq() {
     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();
index 830bbc079ad1e81cc242c5dbf2f7771d16dc8f09..abd686b15e22b5f90a4603991b771a26d7007992 100644 (file)
 //! 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")]
 
index 8871e1fa840ef7cc6cc5b8a5593a785b23dca20b..c4d7b2dcf96fb258f38a88754387d2e4cda4ba9c 100644 (file)
@@ -60,7 +60,7 @@
 //! 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`]).
@@ -74,8 +74,8 @@
 //!
 //! 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"),
 //!     }
 //! }
 //! ```
index 19183892e4b0c16cb68629d14b3ad7212341e9d6..697a1ecadc456afe92b6702999aa1d8851aa3cd9 100644 (file)
@@ -156,7 +156,6 @@ fn fold_ty(&mut self, t: Ty<'tcx>) -> Ty<'tcx> {
             ty::TyUint(..) |
             ty::TyFloat(..) |
             ty::TyAdt(..) |
-            ty::TyBox(..) |
             ty::TyStr |
             ty::TyError |
             ty::TyArray(..) |
index dca85d7727a77d8add7bf612fc4877be2591ccf2..0e8e1921de700fc1f7a77161bbb9162d1c051c5f 100644 (file)
@@ -961,7 +961,7 @@ fn cat_deref_common<N:ast_node>(&self,
                                     -> 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);
index 58cb52e897786a5687a0fe6eb13ea2f1bfa1cd1a..383fab3fcd766cc1d40cd774c0f44f249b3cf792 100644 (file)
@@ -199,7 +199,7 @@ fn orphan_check_trait_ref<'tcx>(tcx: TyCtxt,
 
 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()
@@ -219,13 +219,13 @@ fn is_type_parameter(ty: Ty) -> bool {
 }
 
 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"))
@@ -234,7 +234,7 @@ fn fundamental_ty(tcx: TyCtxt, ty: Ty) -> bool {
     }
 }
 
-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 {
@@ -265,11 +265,6 @@ fn ty_is_local_constructor(tcx: TyCtxt, ty: Ty, infer_is_local: InferIsLocal)->
             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())
         }
index 1658efb03235a2405f6c6a153c5a10c1a249c65d..661d47199df13991861ca3023eeb302a4a9d6931 100644 (file)
@@ -154,7 +154,7 @@ fn type_category<'tcx>(t: Ty<'tcx>) -> Option<u32> {
                 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),
index 4990bb9f521d3490025094b3179462202e15458e..d51332f833d77cfdbefddc812c1092da8d7177c6 100644 (file)
@@ -1735,7 +1735,7 @@ fn sized_conditions(&mut self, obligation: &TraitObligation<'tcx>)
             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
@@ -1788,7 +1788,7 @@ fn copy_conditions(&mut self, obligation: &TraitObligation<'tcx>)
                 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
@@ -1865,10 +1865,6 @@ fn constituent_types_for_ty(&self, t: Ty<'tcx>) -> Vec<Ty<'tcx>> {
                      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]
index ed5b470849c41f4ef948c095443cee2ba0e974f2..00c6dca21b1ef4f5f2a031973b1008498785b420 100644 (file)
@@ -56,12 +56,8 @@ mod TC {
         // 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
@@ -77,10 +73,6 @@ pub fn intersects(&self, tc: TypeContents) -> bool {
         (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)
     }
@@ -90,12 +82,7 @@ pub fn interior_unsafe(&self) -> bool {
     }
 
     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
@@ -104,10 +91,6 @@ 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 {
@@ -191,10 +174,6 @@ fn tc_ty<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                     TC::None
                 }
 
-                ty::TyBox(typ) => {
-                    tc_ty(tcx, typ, cache).owned_pointer()
-                }
-
                 ty::TyDynamic(..) => {
                     TC::All - TC::InteriorParam
                 }
@@ -237,7 +216,7 @@ fn tc_ty<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
 
                     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() {
index 931d83f5e188a3f0a022ea600cb0d8211afcc29f..ce4a6a3182635d5aad030d99e5ef25474822d4f7 100644 (file)
@@ -19,6 +19,7 @@
 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;
@@ -1088,7 +1089,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> {
     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());
@@ -1336,7 +1337,10 @@ pub fn mk_adt(self, def: &'tcx AdtDef, substs: &'tcx Substs<'tcx>) -> Ty<'tcx> {
     }
 
     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> {
index 91087a3dcecd084dcb7b6b2d99acc3b5c4ba3bd2..29d855a7fcb78ebf9cc3362bc7e100060243b610 100644 (file)
@@ -181,7 +181,6 @@ pub fn sort_string(&self, tcx: TyCtxt<'a, 'gcx, 'lcx>) -> String {
             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(),
index 7b4d76ad4973e0ce7e3c635916cf559d025b07fd..94b9abc72025faed7f33357bdcd25610416ed7d8 100644 (file)
@@ -11,7 +11,6 @@
 use hir::def_id::DefId;
 use ty::{self, Ty, TyCtxt};
 use syntax::ast;
-use middle::lang_items::OwnedBoxLangItem;
 
 use self::SimplifiedType::*;
 
@@ -69,10 +68,6 @@ pub fn simplify_type<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
             // 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))
         }
index a06d3ed6cf4fb093b6352f18a1ccd94111021dd6..0de77526b5a46a2e934c36ee239a200f441ab05f 100644 (file)
@@ -138,7 +138,7 @@ fn add_sty(&mut self, st: &ty::TypeVariants) {
                 self.add_region(r);
             }
 
-            &ty::TyBox(tt) | &ty::TyArray(tt, _) | &ty::TySlice(tt) => {
+            &ty::TyArray(tt, _) | &ty::TySlice(tt) => {
                 self.add_ty(tt)
             }
 
index d488cd1c42711469419c45561ffd06cad105d602..b719911d18cf8706113805f6ccba94fe49f00b21 100644 (file)
@@ -314,8 +314,7 @@ pub fn characteristic_def_id_of_type(ty: Ty) -> Option<DefId> {
         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),
index ff95554dbbfcd6a36fac3b77c6c2f1ce0c590ee9..78364abdaecba9ee2a160cf811b53846687211d1 100644 (file)
@@ -1053,6 +1053,23 @@ pub fn compute_uncached(ty: Ty<'gcx>,
         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.
@@ -1082,24 +1099,12 @@ pub fn compute_uncached(ty: Ty<'gcx>,
             },
 
             // 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.
@@ -1560,26 +1565,32 @@ pub fn compute(ty: Ty<'gcx>, infcx: &InferCtxt<'a, 'gcx, 'tcx>)
             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) => {
index 702f3681a020cc1a656ca63e134fabf55fac1eb0..5ab45e746e7f25e67763af997ff915812cf60631 100644 (file)
@@ -9,7 +9,6 @@
 // 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::*;
@@ -120,21 +119,6 @@ pub struct Resolutions {
     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),
@@ -1302,6 +1286,7 @@ pub fn for_item(tcx: TyCtxt<'a, 'tcx, 'tcx>, id: NodeId)
         const IS_SIMD             = 1 << 4,
         const IS_FUNDAMENTAL      = 1 << 5,
         const IS_UNION            = 1 << 6,
+        const IS_BOX              = 1 << 7,
     }
 }
 
@@ -1376,6 +1361,9 @@ fn new(tcx: TyCtxt<'a, 'gcx, 'tcx>,
         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,
@@ -1468,9 +1456,15 @@ pub fn is_phantom_data(&self) -> bool {
         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
@@ -1533,13 +1527,6 @@ pub fn set_destructor(&self, dtor: DefId) {
         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.
     ///
@@ -1641,7 +1628,7 @@ fn sized_constraint_for_ty(&self,
                                -> 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![]
             }
index eb384eec6a6f1e3b583fcf5e0f355a023f0c6158..bc30f1fb71722b31f3df73be54f2885e9dede316 100644 (file)
@@ -167,7 +167,6 @@ fn compute_components(&self, ty: Ty<'tcx>, out: &mut Vec<Component<'tcx>>) {
             ty::TyFloat(..) |       // OutlivesScalar
             ty::TyNever |           // ...
             ty::TyAdt(..) |         // OutlivesNominalType
-            ty::TyBox(..) |         // OutlivesNominalType (ish)
             ty::TyAnon(..) |        // OutlivesNominalType (ish)
             ty::TyStr |             // OutlivesScalar (ish)
             ty::TyArray(..) |       // ...
index 76c26d01ac8e2051d1658fb21f06bb75806939c5..89514085e1c78601d1efd4582387df06ef1b4fff 100644 (file)
@@ -418,12 +418,6 @@ pub fn super_relate_tys<'a, 'gcx, 'tcx, R>(relation: &mut R,
             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)?;
index 06ba1b2a1fafc74a47abf190a8e974bd89e42bd5..05f4abad469213f41347de0013a71ae28d3423ff 100644 (file)
@@ -468,7 +468,6 @@ fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool {
 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)),
@@ -506,7 +505,6 @@ fn fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Se
 
     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),
index d6164e69ffd3a9656fea55571ac0e4209f011d12..113534e4529cdc6c87c8855cbd11c366b392bd76 100644 (file)
@@ -115,12 +115,6 @@ pub enum TypeVariants<'tcx> {
     /// 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,
 
@@ -1139,10 +1133,17 @@ pub fn is_unsafe_ptr(&self) -> bool {
         }
     }
 
-    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),
         }
     }
 
@@ -1247,9 +1248,9 @@ pub fn builtin_deref(&self, explicit: bool, pref: ty::LvaluePreference)
         -> 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 {
@@ -1349,7 +1350,6 @@ pub fn regions(&self) -> Vec<&'tcx ty::Region> {
             TyInt(_) |
             TyUint(_) |
             TyFloat(_) |
-            TyBox(_) |
             TyStr |
             TyArray(..) |
             TySlice(_) |
index c05375c47b03a1bc6c7fbadc4d9731da842dab8e..ba49aa1ef4866b97c8ffc5c211130ae5775a99a2 100644 (file)
@@ -481,7 +481,6 @@ fn visit_ty(&mut self, ty: Ty<'tcx>) -> bool {
             TyBool |
             TyChar |
             TyStr |
-            TyBox(_) |
             TySlice(_) => {}
 
             TyError |
@@ -563,7 +562,7 @@ pub fn moves_by_default(&'tcx self, tcx: TyCtxt<'a, 'tcx, 'tcx>,
                 mutbl: hir::MutImmutable, ..
             }) => Some(false),
 
-            TyStr | TyBox(..) | TyRef(_, TypeAndMut {
+            TyStr | TyRef(_, TypeAndMut {
                 mutbl: hir::MutMutable, ..
             }) => Some(true),
 
@@ -606,7 +605,7 @@ fn is_sized_uncached(&'tcx self, tcx: TyCtxt<'a, 'tcx, 'tcx>,
         // 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),
index 3fa7a803141d1d51eafd5993f3d84aff4f42fa43..0d1dc2e4d7c218c8ed3dabc3dcafca6d176eef87 100644 (file)
@@ -83,7 +83,7 @@ fn push_subtypes<'tcx>(stack: &mut TypeWalkerStack<'tcx>, parent_ty: Ty<'tcx>) {
         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) => {
index bab9964651dcacb4a1d48ff90e975542e9b5a26e..33b70b09dcb7b6d742ae1932e77079384fe574ae 100644 (file)
@@ -323,7 +323,6 @@ fn compute(&mut self, ty0: Ty<'tcx>) -> bool {
                     }
                 }
 
-                ty::TyBox(_) |
                 ty::TyRawPtr(_) => {
                     // simple cases that are WF if their type args are WF
                 }
index 74e27f84fddc24868db13580a413298ee7db1d4e..aa2eb2955debe69cbd278e39cb3b7319de362c7e 100644 (file)
@@ -16,7 +16,7 @@
 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;
@@ -708,7 +708,6 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
             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",
index 0c2c5433e6c41c2515de68e9a0bbbe5ac35b1ef0..29477261392079332e3e03ed3ba4b13c3fa3c992 100644 (file)
@@ -14,6 +14,7 @@ pub fn target() -> TargetResult {
     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.
index 8e0d9c147824d81642d2d16ba76e88292be141eb..9e89a3689c7acd23c7894a16270052336813d430 100644 (file)
@@ -709,9 +709,6 @@ fn open_drop_for_adt<'a>(&mut self, c: &DropCtxt<'a, 'tcx>,
     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)
@@ -719,8 +716,11 @@ fn open_drop<'a>(&mut self, c: &DropCtxt<'a, 'tcx>) -> BasicBlock {
             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)
         }
@@ -895,7 +895,7 @@ fn must_complete_drop<'a>(&self, c: &DropCtxt<'a, 'tcx>) -> bool {
 
         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 {:?}",
index 2a9acaf58b8f2bf091ccce29eb8aede48a6abb88..7cf6ab2999c05df88e809b115ae301d691dcb0c1 100644 (file)
@@ -289,7 +289,7 @@ fn move_path_for_projection(&mut self,
             // 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() =>
index 372eb1d5d64f018bad60a3a82fa940cebf125690..a0c36139ddcd2ec8c8eac363f737b58e0577ac9f 100644 (file)
@@ -248,7 +248,7 @@ fn lvalue_contents_drop_state_cannot_differ<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx
                    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
index 1770a112cdf231ab159d3782581f7902f50f55dc..94b2ba58c9aa539c776df5978597f95658365b93 100644 (file)
@@ -722,7 +722,6 @@ fn constructor_arity(_cx: &MatchCheckCtxt, ctor: &Constructor, ty: Ty) -> usize
     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,
@@ -747,7 +746,6 @@ fn constructor_sub_pattern_tys<'a, 'tcx: 'a>(cx: &MatchCheckCtxt<'a, 'tcx>,
     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![],
index a3b80ebddcf00d15472f7e6d7a7627fb462f9455..c6272613f4d09fd3695222e4523e40dde99e6f37 100644 (file)
@@ -215,7 +215,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
             }
             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 {
index 78af655852d1b0656ade7f7ce031ad0e38d71434..d4bd9e707fdcb9780a618a6ba30151061b479109 100644 (file)
@@ -25,7 +25,7 @@
 
 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>)
index c0b5b7f51733039da31e0dcb02cebb36b2cb7ef7..51e6e09ab5003fc212ddcee8189576bf8296b777 100644 (file)
@@ -52,14 +52,6 @@ fn hash<H>(&self, state: &mut H) where H: Hasher {
     }
 }
 
-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 {
index 59f6889ba4d94af645732e8af68cf004b56d0f30..1086d75f02cb4055c030b85c0077eb55fb349804 100644 (file)
@@ -805,10 +805,9 @@ fn walk_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);
-        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]);
     })
 }
@@ -821,12 +820,10 @@ fn walk_ty_skip_subtree() {
         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),
@@ -836,7 +833,7 @@ fn walk_ty_skip_subtree() {
                                 (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();
index 2892d61b8bd6fdf38204ffad45921ac1b4299376..1592d178176413622851fd0ce664e4863fde72e7 100644 (file)
@@ -95,7 +95,7 @@ fn check_expr(&mut self, cx: &LateContext, e: &hir::Expr) {
 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);
             }
index 532e602226450aed85fdefe7b8613bfbfe551213..9669efa2d86b3954250d944ad213dadfb30ce37e 100644 (file)
@@ -519,11 +519,6 @@ fn check_type_for_ffi(&self, cache: &mut FxHashSet<Ty<'tcx>>, ty: Ty<'tcx>) -> F
             // 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")
index af9f7fb5781386b6454d7e6efc32ef17de3365ce..9c1107344f241f077800f03deb48aab657d51dcf 100644 (file)
@@ -350,7 +350,7 @@ fn assign(&mut self, dest: &Lvalue<'tcx>, location: Location) {
                 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)
                }) => {
index 0fabbe6678ad8810c029db2a1434d810e494eca1..c9195f29f1784481e0774d8b23ccfaba7d61a523 100644 (file)
@@ -580,9 +580,10 @@ fn check_box_free_inputs(&mut self,
             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;
index 577744653f09bf5371dfdf1456d55b21a4d04ee1..d392ebaa33d422dfb045ee80a01f67155bdbd96f 100644 (file)
@@ -429,7 +429,7 @@ pub fn unadjusted<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
         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);
@@ -438,12 +438,16 @@ pub fn unadjusted<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
             // 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);
+                }
                 _ => {}
             }
         }
@@ -453,9 +457,9 @@ pub fn unadjusted<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
         // 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) => {
index 32fe3effcc9f8af57c2713eae5a25d2138373514..9bd19d5bbb3e47f050d7ffcbd19495e55cdaa6fb 100644 (file)
@@ -227,7 +227,6 @@ pub fn unsize_thin_ptr<'a, 'tcx>(
 ) -> (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, .. }),
@@ -238,6 +237,12 @@ pub fn unsize_thin_ptr<'a, 'tcx>(
             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"),
     }
 }
@@ -249,25 +254,30 @@ pub fn coerce_unsized_into<'a, 'tcx>(bcx: &Builder<'a, 'tcx>,
                                      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)) => {
@@ -414,7 +424,7 @@ pub fn load_ty<'a, 'tcx>(b: &Builder<'a, 'tcx>, ptr: ValueRef, t: Ty<'tcx>) -> V
         // 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)
@@ -449,7 +459,7 @@ pub fn load_fat_ptr<'a, 'tcx>(
     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)
index d30766dc5392a3015a2785c5d2043889bf7973c1..392c270c130a857b09886bc64e51ad349a910fb2 100644 (file)
@@ -52,7 +52,7 @@
 //!   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".
 //!
@@ -721,14 +721,13 @@ fn find_drop_glue_neighbors<'a, 'tcx>(scx: &SharedCrateContext<'a, 'tcx>,
     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);
         }
@@ -741,7 +740,7 @@ fn find_drop_glue_neighbors<'a, 'tcx>(scx: &SharedCrateContext<'a, 'tcx>,
         _ => 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()
@@ -790,8 +789,14 @@ fn find_drop_glue_neighbors<'a, 'tcx>(scx: &SharedCrateContext<'a, '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,
@@ -811,7 +816,6 @@ fn find_drop_glue_neighbors<'a, 'tcx>(scx: &SharedCrateContext<'a, 'tcx>,
                 }
             }
         }
-        ty::TyBox(inner_type)      |
         ty::TySlice(inner_type)    |
         ty::TyArray(inner_type, _) => {
             let inner_type = glue::get_drop_glue_type(scx, inner_type);
@@ -1008,21 +1012,24 @@ fn find_vtable_types_for_unsizing<'a, 'tcx>(scx: &SharedCrateContext<'a, 'tcx>,
                                             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),
index 0de3c13dc21a9864943d4bd352230ae889cbc5d7..b7e319f2de43431cf9ef8190611dc227b9aab659 100644 (file)
@@ -490,6 +490,35 @@ pub fn type_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
     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     |
@@ -516,34 +545,17 @@ pub fn type_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
                         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) => {
index f05d48566daaea4396044d34f130140db2ec3148..e9468e56637d22cf1859fe79ebc91a72c666bb08 100644 (file)
@@ -400,7 +400,7 @@ fn get_containing_scope<'ccx, 'tcx>(cx: &CrateContext<'ccx, 'tcx>,
                 // 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
index 788ce32937d847a8a9697ec9bd915eddc659aecc..8e11bf6b8976a8c3c822c18cec94de6966458fbc 100644 (file)
@@ -60,11 +60,6 @@ pub fn push_debuginfo_type_name<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
             }
             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 {
index b24f00ee6976d039c14c889d5507976193441709..1415ca6029f530f885a8f469243db2aaf4dc6dac 100644 (file)
@@ -79,16 +79,21 @@ pub fn get_drop_glue_type<'a, 'tcx>(scx: &SharedCrateContext<'a, 'tcx>, t: Ty<'t
         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
     }
@@ -205,11 +210,11 @@ pub fn implement_drop_glue<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, g: DropGlueKi
     };
 
     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));
@@ -230,7 +235,7 @@ pub fn implement_drop_glue<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, g: DropGlueKi
             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();
 
index 8df24da7135887e4ecdea99dfcf1467ce2d7bc5b..2a1ab10d74e16dbc4b944a163b264a63ef8a1e71 100644 (file)
@@ -30,7 +30,7 @@ pub fn lvalue_locals<'a, 'tcx>(mircx: &MirContext<'a, 'tcx>) -> BitVector {
         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)
index 43ea1e56a5a4d19e2112a0d98ccc7bde27bc3eb7..d58a93e3cb71c47d4ee758e7887b8648dc10ac28 100644 (file)
@@ -421,11 +421,6 @@ pub fn push_type_name(&self, t: Ty<'tcx>, output: &mut String) {
                 }
                 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 {
index 469214b466e1ae7b9c3ffeffaa5857703b4c63b2..4df0e989ada9975040bbe9eea3e350838f1f92af 100644 (file)
@@ -38,6 +38,13 @@ pub fn sizing_type_of<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, t: Ty<'tcx>) -> Typ
     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)
@@ -50,14 +57,12 @@ pub fn sizing_type_of<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, t: Ty<'tcx>) -> Typ
         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),
@@ -131,11 +136,13 @@ pub fn sizing_type_of<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, t: Ty<'tcx>) -> Typ
 
 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)
     }
 }
@@ -214,6 +221,22 @@ pub fn in_memory_type_of<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, t: Ty<'tcx>) ->
         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),
@@ -227,22 +250,12 @@ pub fn in_memory_type_of<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, t: Ty<'tcx>) ->
           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) => {
@@ -300,7 +313,7 @@ pub fn in_memory_type_of<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, t: Ty<'tcx>) ->
 
     // 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);
         }
         _ => ()
index 56de539cbfe99d5031073e362277b49a68e650a8..bb9a487802e7b686c207cdff0ed41be19a7ac154 100644 (file)
@@ -670,16 +670,7 @@ fn ast_path_to_ty(&self,
             }
         };
 
-        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)
     }
 
@@ -1674,7 +1665,7 @@ pub fn determine(untransformed_self_ty: Ty<'tcx>,
         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,
             }
         }
@@ -1687,7 +1678,7 @@ fn count_modifiers(ty: Ty) -> usize {
         } 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,
             }
         }
index 0218f1c70ba8e151666f3fad6066306492f62ecf..6215b4498dc684ee3a63454b1c8bf1d242abfc9f 100644 (file)
@@ -288,7 +288,7 @@ fn report_cast_to_unsized_type(&self, fcx: &FnCtxt<'a, 'gcx, 'tcx>) {
                                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,
index 91b772a748c72c28a6dc4ab11ff6a5da08769946..34aa4eda772ada2b1904be85f40ca05612a29648 100644 (file)
@@ -448,7 +448,7 @@ fn iterate_over_potentially_unsafe_regions_in_type<'a, 'b, 'gcx, 'tcx>(
             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)
index e2d7d31a8a890b0ca3586caa7809cef9821326e0..300caca30fec8c12927dc4f405e30a2fdab8b627 100644 (file)
@@ -391,11 +391,6 @@ fn assemble_probe(&mut self, self_ty: Ty<'tcx>) {
             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);
             }
index c2f32c2b52bbebbefbc1e452f855dffa67f0a118..c435f9341253e92920ff621ecc13e8fa26486eb2 100644 (file)
@@ -3438,7 +3438,8 @@ fn check_expr_kind(&self,
           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
                 }
             });
index 7d515a36cfdffa0f23e1a2c5027e7178a5380227..d84e9d3fd3731d642efee92e57d2565ef30badc2 100644 (file)
@@ -815,9 +815,9 @@ fn walk_cast(&mut self,
                 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());
             }
 
             _ => { }
index 086484c643ad1c238c5b5fa26acf3cd6504651e2..96875fce468d2e34473ddc0c2a7b25c37e3755de 100644 (file)
@@ -220,8 +220,6 @@ fn visit_implementation_of_coerce_unsized<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
             (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))
index 5af9ea29fafa76e49cffc8c400515c254585b8d0..e9c710d2fec4c38ca1173e2e302cb620f52102f5 100644 (file)
@@ -21,7 +21,7 @@
 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;
@@ -61,8 +61,6 @@ fn get_base_type_def_id(&self, span: Span, ty: Ty<'tcx>) -> Option<DefId> {
 
             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,
index a0d25abd14ce61eb963709c8f97479fd3799d167..9ef231499df5145c1fc0036624c60f769e9c4f4a 100644 (file)
@@ -91,12 +91,6 @@ fn visit_item(&mut self, item: &hir::Item) {
                     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(),
@@ -321,7 +315,6 @@ fn visit_item(&mut self, item: &hir::Item) {
                     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,
                     };
 
index ba00f237684e6b6766dd29a5d89cd34082c4bb14..40e82959336de4e654ecc7a95f0ee075a5232f0e 100644 (file)
@@ -329,7 +329,6 @@ fn add_constraints_from_ty(&mut self,
                 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);
index 7591475c5d3fa12022d3fe800a68f90b371500ec..cdb24a56367fc39749f20d213cf0faadd62ebbe4 100644 (file)
@@ -1808,10 +1808,6 @@ fn clean(&self, cx: &DocContext) -> Type {
             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)),
@@ -2888,33 +2884,6 @@ fn clean(&self, _: &DocContext) -> Deprecation {
     }
 }
 
-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 {
index 1f224cac9e91f98c43ded86d2055ff3fd179cac8..ab0ac02fd88f1fc6cdeaa97835e24b6090f63719 100644 (file)
@@ -429,8 +429,12 @@ pub fn add_test(&mut self, test: String,
                 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,
index b3dbcb743a135ecff2afdb56a3cc9b44d56e014f..22c92623e1c1944b9168b0ba2d7747eab2a00583 100644 (file)
@@ -11,6 +11,7 @@
 // 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"]
 
index dade0e946c5bf92587d042bf18e1679a523e46b5..51a9a87744a2058062afcdd7318d868ff2e21bef 100644 (file)
@@ -15,6 +15,8 @@
 
 // FIXME the error message that is current emitted seems pretty bad.
 
+// gate-test-quote
+
 #![feature(rustc_private)]
 #![allow(dead_code, unused_imports, unused_variables)]
 
index 0d666a4920038aa40254183d496ccf73c9a72af6..c152fdd9296828b590e80b32e0d3116cba94a02c 100644 (file)
@@ -22,13 +22,14 @@ struct fish {
 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);
 }
index 530822f6c5bafb1c387cae483b780d8536be33e8..d09cb73d6702a5536863185b88da86dced16ac73 100644 (file)
@@ -35,7 +35,7 @@ fn copy_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
 }
 
@@ -44,7 +44,7 @@ fn move_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
 }
 
@@ -53,7 +53,7 @@ fn borrow_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
 }
 
@@ -106,7 +106,7 @@ fn copy_after_move_nested() {
     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
 }
 
@@ -115,7 +115,7 @@ fn move_after_move_nested() {
     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
 }
 
@@ -124,7 +124,7 @@ fn borrow_after_move_nested() {
     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
 }
 
index 672ff464718f8b2a499f8bf8b8b433e92151ff66..f389380584b8469a850d8dc95d7ddc77a6148965 100644 (file)
@@ -20,6 +20,5 @@ pub fn main() {
     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>`
 }
index 89fb1e105900d7deac59d2a03ff33f263b31f8ab..835ec8e4a5e7e2060328e2a32e36eb948a056d2c 100644 (file)
@@ -51,6 +51,5 @@ fn main() {
     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<_>`
 }
index e01a0412cef4efe3081f6a512f91b4968e59a2db..6377550d3d22f9ed5297d366a7f5130a320ef4c6 100644 (file)
@@ -16,18 +16,15 @@ fn main() {
     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,)>`
index 18e4ccc331196f59483622aa78ef34325db3c367..810d6656a8f6216bbcbff41f7080332219a6673e 100644 (file)
@@ -13,5 +13,6 @@
 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>`
 }
index 7d300bfb1483161148dec1fb44e79362929da0a2..45ab9903532e73a399a18982bc1a48fb85c1f779 100644 (file)
@@ -13,9 +13,9 @@ fn main() {
     //~^ 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;
index a1f5d74b30e3677608892c4d9457555aec1a3bbd..9ef780aac8e274bdac62fe6c40651292c7fea658 100644 (file)
@@ -43,8 +43,7 @@ fn main() {
         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) {
index da6f49f3efe911b73895512be3ec9f69cf2ae590..b99f5b707ee2d0afbe5df1401acb17827fff7129 100644 (file)
@@ -13,9 +13,8 @@
 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() {}
index a455a7b2d5d0f7b190f06542bc91619c4cf919e4..21aefc4f9c1bc1b1e7a8098584d401114c00a570 100644 (file)
@@ -21,5 +21,5 @@ fn take_param<T:Foo>(foo: &T) { }
 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
 }
index 731c1edbfc00b7fdf0f70f0b9c1f1cc26b9bbe57..ccc25b58228bd66941036a5555072f2865cae0b1 100644 (file)
@@ -34,7 +34,7 @@ pub struct StructWithProjectionAndLifetime<'a>(
     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
@@ -42,7 +42,7 @@ pub struct StructWithProjectionAndLifetime<'a>(
     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);
index e24441c5497d512d1c605bb60c85fcf0365e21b0..eaafc312379c21168f1197bb33b2b8f7b69b9db2 100644 (file)
@@ -26,5 +26,5 @@ fn main() {
     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
 }
index 6fa261dea71cb83cbb39b4f3e6ca544d516e2716..8babc734c84cc13afdf33ec6fcaf74f757461362 100644 (file)
@@ -14,5 +14,5 @@
 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() {}
index 5cb60079fa4b8e8fb272346010c88ed3352f1298..a276af83dee25c13d74d77b8019a6be578846afb 100644 (file)
@@ -17,6 +17,6 @@ fn main() {
     f = box g;
     //~^  ERROR mismatched types
     //~| expected type `_`
-    //~| found type `Box<_>`
+    //~| found type `std::boxed::Box<_>`
     //~| cyclic type of infinite size
 }
index 499124cb0573b85ebf734717aa8e14098078ebcf..5b6a11e58c27c8059e0ff0b231e7588d1a395abd 100644 (file)
@@ -15,6 +15,6 @@ fn main() {
     f = box f;
     //~^ ERROR mismatched types
     //~| expected type `_`
-    //~| found type `Box<_>`
+    //~| found type `std::boxed::Box<_>`
     //~| cyclic type of infinite size
 }
index fad115c2aedf83a3d4515a37c4721b5c96d137dc..c559992c865316849674474a32a8e73be36804bd 100644 (file)
@@ -32,8 +32,8 @@ fn set_f_ok(&mut self, b: Box<b<'a>>) {
     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
     }
 }
index 592d7b3929bfc09129a07f294eec2a744f0a5ecf..fd92a26d0fcecb90ede0ee48a07942a702ff9501 100644 (file)
@@ -20,8 +20,7 @@ fn want_foo(f: foo) {}
 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() {}
index 7693d98a2f7b0c8f3927d531bcc7a5e8a438efd3..aabf0d26d5ba7db921d144fd43df73d2ab35edb5 100644 (file)
@@ -52,7 +52,8 @@ pub 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;
 
@@ -70,7 +71,7 @@ pub fn main() {
     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;
 
index e74acaa71b0f3d5f347955f5c75d93a3b5089ca3..4295d08a4709c701eaa8e63336ff5fac086e9e4d 100644 (file)
@@ -33,7 +33,7 @@ fn main() {
         //~^ 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>`
     }
 }
index 438a78743bb1ec6ee0168006a8223f5694a0ead6..57d40cccf2d808f1cbb19d5c1bdd18182c305055 100644 (file)
 
 // 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)
index ba50aed42c36f64f1f21fe4709517dc5f45759a7..ee7d45b77bf4d9afe9d7a361697b1acf5200e3a0 100644 (file)
@@ -58,7 +58,7 @@ pub fn type_ids() -> Vec<TypeId> {
     // Tests TySlice
     pub type FooSlice = [u8];
 
-    // Tests TyBox (of u8)
+    // Tests Box (of u8)
     pub type FooBox = Box<u8>;
 
     // Tests TyRawPtr
index 015ba75d432ad507a667ac34f7bf19f7bd0b601c..626eccfc9ec866ef56411ecc47245c6cc5522dd5 100644 (file)
@@ -37,7 +37,6 @@ macro_rules! dump_and_die {
                     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",
index e892f5e7728b34f13ecba91e994c22d66c4b7c4d..834ce984e6632e50678d4358f50947dafd333037 100644 (file)
@@ -104,10 +104,6 @@ fn runtest(me: &str) {
 }
 
 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();
index c47975b01355d4a72c4b51a833ac5bfdd60a844d..ccc9fb56772f5b4e1c6b67b5be3d7bf509caed8e 100644 (file)
@@ -4,8 +4,8 @@ error[E0308]: mismatched types
 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
 
index c32fefcd0d6a9b6a3fea50c8ff474d27d099b923..6a70b8ff851d7aecf1d7eb82380e4113d9e905f4 100644 (file)
@@ -49,7 +49,7 @@ error[E0308]: mismatched types
    |         ^^^^^ cyclic type of infinite size
    |
    = note: expected type `_`
-              found type `Box<_>`
+              found type `std::boxed::Box<_>`
 
 error: aborting due to 5 previous errors
 
index 05d6e21e9aaeae3aa3d0fed925393e2923d105ac..86fa5e70c9c28322f11d651af32f51408ae82028 100644 (file)
@@ -2175,6 +2175,10 @@ fn run_rmake_test(&self) {
            .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.
index 154ebd3649bcd0ec1aaa6df7c38505ee9584d922..2c3e57c8332623272afb278193914f98f4e905d7 100644 (file)
@@ -166,8 +166,7 @@ pub fn check(path: &Path, bad: &mut bool) {
 
     // 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",