os: osx
osx_image: xcode8.2
install: &osx_install_sccache >
- travis_retry curl -o /usr/local/bin/sccache https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-16-sccache-x86_64-apple-darwin &&
+ travis_retry curl -o /usr/local/bin/sccache https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-22-sccache-x86_64-apple-darwin &&
chmod +x /usr/local/bin/sccache &&
travis_retry curl -o /usr/local/bin/stamp https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-17-stamp-x86_64-apple-darwin &&
chmod +x /usr/local/bin/stamp
echo "#### Build failed; Disk usage after running script:";
df -h;
du . | sort -nr | head -n100
+
+ # One of these is the linux sccache log, one is the OSX sccache log. Instead
+ # of worrying about what system we are just cat both. One of these commands
+ # will fail but that's ok, they'll both get executed.
- cat obj/tmp/sccache.log
- cat /tmp/sccache.log
+ # Random attempt at debugging currently. Just poking around in here to see if
+ # anything shows up.
+ - ls $HOME/Library/Logs/DiagnosticReports/
+
+ # attempt to debug anything killed by the oom killer on linux, just to see if
+ # it happened
+ - dmesg | grep -i kill
+
# Save tagged docker images we created and load them if they're available
before_cache:
- docker history -q rust-ci |
- MSYS_BITS: 32
RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu --enable-ninja
SCRIPT: python x.py test
- MINGW_URL: https://s3.amazonaws.com/rust-lang-ci
- MINGW_ARCHIVE: i686-4.9.2-release-win32-dwarf-rt_v4-rev4.7z
+ MINGW_URL: https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror
+ MINGW_ARCHIVE: i686-6.3.0-release-win32-dwarf-rt_v5-rev1.7z
MINGW_DIR: mingw32
- MSYS_BITS: 64
SCRIPT: python x.py test
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu --enable-ninja
- MINGW_URL: https://s3.amazonaws.com/rust-lang-ci
- MINGW_ARCHIVE: x86_64-4.9.2-release-win32-seh-rt_v4-rev4.7z
+ MINGW_URL: https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror
+ MINGW_ARCHIVE: x86_64-6.3.0-release-win32-seh-rt_v5-rev1.7z
MINGW_DIR: mingw64
# 32/64 bit MSVC and GNU deployment
- MSYS_BITS: 32
RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu --enable-extended --enable-ninja
SCRIPT: python x.py dist
- MINGW_URL: https://s3.amazonaws.com/rust-lang-ci
- MINGW_ARCHIVE: i686-4.9.2-release-win32-dwarf-rt_v4-rev4.7z
+ MINGW_URL: https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror
+ MINGW_ARCHIVE: i686-6.3.0-release-win32-dwarf-rt_v5-rev1.7z
MINGW_DIR: mingw32
DEPLOY: 1
- MSYS_BITS: 64
SCRIPT: python x.py dist
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu --enable-extended --enable-ninja
- MINGW_URL: https://s3.amazonaws.com/rust-lang-ci
- MINGW_ARCHIVE: x86_64-4.9.2-release-win32-seh-rt_v4-rev4.7z
+ MINGW_URL: https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror
+ MINGW_ARCHIVE: x86_64-6.3.0-release-win32-seh-rt_v5-rev1.7z
MINGW_DIR: mingw64
DEPLOY: 1
- set PATH=C:\Python27;%PATH%
# Download and install sccache
- - appveyor-retry appveyor DownloadFile https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-16-sccache-x86_64-pc-windows-msvc
- - mv 2017-03-16-sccache-x86_64-pc-windows-msvc sccache.exe
+ - appveyor-retry appveyor DownloadFile https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-22-sccache-x86_64-pc-windows-msvc
+ - mv 2017-03-22-sccache-x86_64-pc-windows-msvc sccache.exe
- set PATH=%PATH%;%CD%
# Download and install ninja
RUN curl -O http://ftp.nl.debian.org/debian/dists/jessie/main/installer-armhf/current/images/device-tree/vexpress-v2p-ca15-tc1.dtb
RUN curl -o /usr/local/bin/sccache \
- https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-16-sccache-x86_64-unknown-linux-musl && \
+ https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-22-sccache-x86_64-unknown-linux-musl && \
chmod +x /usr/local/bin/sccache
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
pkg-config
RUN curl -o /usr/local/bin/sccache \
- https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-16-sccache-x86_64-unknown-linux-musl && \
+ https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-22-sccache-x86_64-unknown-linux-musl && \
chmod +x /usr/local/bin/sccache
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
RUN curl -o /usr/local/bin/sccache \
- https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-16-sccache-x86_64-unknown-linux-musl && \
+ https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-22-sccache-x86_64-unknown-linux-musl && \
chmod +x /usr/local/bin/sccache
ENV TARGETS=arm-linux-androideabi
libssl-dev \
pkg-config
-RUN curl -o /usr/local/bin/sccache \
- https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-16-sccache-x86_64-unknown-linux-musl && \
- chmod +x /usr/local/bin/sccache
-
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
USER root
+RUN curl -o /usr/local/bin/sccache \
+ https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-22-sccache-x86_64-unknown-linux-musl && \
+ chmod +x /usr/local/bin/sccache
+
ENV PATH=$PATH:/x-tools/arm-unknown-linux-gnueabi/bin
ENV PATH=$PATH:/x-tools/arm-unknown-linux-gnueabihf/bin
libssl-dev \
pkg-config
-RUN curl -o /usr/local/bin/sccache \
- https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-16-sccache-x86_64-unknown-linux-musl && \
- chmod +x /usr/local/bin/sccache
-
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
USER root
+RUN curl -o /usr/local/bin/sccache \
+ https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-22-sccache-x86_64-unknown-linux-musl && \
+ chmod +x /usr/local/bin/sccache
+
ENV PATH=$PATH:/x-tools/aarch64-unknown-linux-gnueabi/bin
ENV PATH=$PATH:/x-tools/armv7-unknown-linux-gnueabihf/bin
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
RUN curl -o /usr/local/bin/sccache \
- https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-16-sccache-x86_64-unknown-linux-musl && \
+ https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-22-sccache-x86_64-unknown-linux-musl && \
chmod +x /usr/local/bin/sccache
ENV \
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
RUN curl -o /usr/local/bin/sccache \
- https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-16-sccache-x86_64-unknown-linux-musl && \
+ https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-22-sccache-x86_64-unknown-linux-musl && \
chmod +x /usr/local/bin/sccache
ENV \
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
RUN curl -o /usr/local/bin/sccache \
- https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-16-sccache-x86_64-unknown-linux-musl && \
+ https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-22-sccache-x86_64-unknown-linux-musl && \
chmod +x /usr/local/bin/sccache
ENV RUST_CONFIGURE_ARGS \
pkg-config
RUN curl -o /usr/local/bin/sccache \
- https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-16-sccache-x86_64-unknown-linux-musl && \
+ https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-22-sccache-x86_64-unknown-linux-musl && \
chmod +x /usr/local/bin/sccache
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
pkg-config
RUN curl -o /usr/local/bin/sccache \
- https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-16-sccache-x86_64-unknown-linux-musl && \
+ https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-22-sccache-x86_64-unknown-linux-musl && \
chmod +x /usr/local/bin/sccache
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
libssl-dev \
pkg-config
-RUN curl -o /usr/local/bin/sccache \
- https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-16-sccache-x86_64-unknown-linux-musl && \
- chmod +x /usr/local/bin/sccache
-
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
USER root
+RUN curl -o /usr/local/bin/sccache \
+ https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-22-sccache-x86_64-unknown-linux-musl && \
+ chmod +x /usr/local/bin/sccache
+
ENV PATH=$PATH:/x-tools/powerpc-unknown-linux-gnu/bin
ENV \
wget \
xz-utils \
libssl-dev \
- pkg-config
-
-RUN curl -o /usr/local/bin/sccache \
- https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-16-sccache-x86_64-unknown-linux-musl && \
- chmod +x /usr/local/bin/sccache
+ pkg-config
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 && \
COPY build-powerpc64le-toolchain.sh /tmp/
RUN ./build-powerpc64le-toolchain.sh
+RUN curl -o /usr/local/bin/sccache \
+ https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-22-sccache-x86_64-unknown-linux-musl && \
+ chmod +x /usr/local/bin/sccache
+
ENV PATH=$PATH:/x-tools/powerpc64-unknown-linux-gnu/bin
ENV \
libssl-dev \
pkg-config
-RUN curl -o /usr/local/bin/sccache \
- https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-16-sccache-x86_64-unknown-linux-musl && \
- chmod +x /usr/local/bin/sccache
-
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
USER root
+RUN curl -o /usr/local/bin/sccache \
+ https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-22-sccache-x86_64-unknown-linux-musl && \
+ chmod +x /usr/local/bin/sccache
+
ENV PATH=$PATH:/x-tools/s390x-ibm-linux-gnu/bin:/x-tools/x86_64-unknown-netbsd/bin
ENV \
ENTRYPOINT ["/rustroot/dumb-init", "--"]
RUN curl -o /usr/local/bin/sccache \
- https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-16-sccache-x86_64-unknown-linux-musl && \
+ https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-22-sccache-x86_64-unknown-linux-musl && \
chmod +x /usr/local/bin/sccache
ENV HOSTS=i686-unknown-linux-gnu
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
RUN curl -o /usr/local/bin/sccache \
- https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-16-sccache-x86_64-unknown-linux-musl && \
+ https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-22-sccache-x86_64-unknown-linux-musl && \
chmod +x /usr/local/bin/sccache
ENV RUST_CONFIGURE_ARGS \
lib32stdc++6
RUN curl -o /usr/local/bin/sccache \
- https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-16-sccache-x86_64-unknown-linux-musl && \
+ https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-22-sccache-x86_64-unknown-linux-musl && \
chmod +x /usr/local/bin/sccache
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
xz-utils
RUN curl -o /usr/local/bin/sccache \
- https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-16-sccache-x86_64-unknown-linux-musl && \
+ https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-22-sccache-x86_64-unknown-linux-musl && \
chmod +x /usr/local/bin/sccache
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
xz-utils
RUN curl -o /usr/local/bin/sccache \
- https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-16-sccache-x86_64-unknown-linux-musl && \
+ https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-22-sccache-x86_64-unknown-linux-musl && \
chmod +x /usr/local/bin/sccache
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
pkg-config
RUN curl -o /usr/local/bin/sccache \
- https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-16-sccache-x86_64-unknown-linux-musl && \
+ https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-22-sccache-x86_64-unknown-linux-musl && \
chmod +x /usr/local/bin/sccache
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
xz-utils
RUN curl -o /usr/local/bin/sccache \
- https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-16-sccache-x86_64-unknown-linux-musl && \
+ https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-22-sccache-x86_64-unknown-linux-musl && \
chmod +x /usr/local/bin/sccache
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
pkg-config
RUN curl -o /usr/local/bin/sccache \
- https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-16-sccache-x86_64-unknown-linux-musl && \
+ https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-22-sccache-x86_64-unknown-linux-musl && \
chmod +x /usr/local/bin/sccache
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
xz-utils
RUN curl -o /usr/local/bin/sccache \
- https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-16-sccache-x86_64-unknown-linux-musl && \
+ https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-22-sccache-x86_64-unknown-linux-musl && \
chmod +x /usr/local/bin/sccache
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
xz-utils
RUN curl -o /usr/local/bin/sccache \
- https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-16-sccache-x86_64-unknown-linux-musl && \
+ https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-22-sccache-x86_64-unknown-linux-musl && \
chmod +x /usr/local/bin/sccache
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
xz-utils
RUN curl -o /usr/local/bin/sccache \
- https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-16-sccache-x86_64-unknown-linux-musl && \
+ https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-22-sccache-x86_64-unknown-linux-musl && \
chmod +x /usr/local/bin/sccache
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
xz-utils
RUN curl -o /usr/local/bin/sccache \
- https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-16-sccache-x86_64-unknown-linux-musl && \
+ https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-22-sccache-x86_64-unknown-linux-musl && \
chmod +x /usr/local/bin/sccache
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
xz-utils
RUN curl -o /usr/local/bin/sccache \
- https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-16-sccache-x86_64-unknown-linux-musl && \
+ https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-03-22-sccache-x86_64-unknown-linux-musl && \
chmod +x /usr/local/bin/sccache
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
unsafe impl<#[may_dangle] K, #[may_dangle] V> Drop for BTreeMap<K, V> {
fn drop(&mut self) {
unsafe {
- for _ in ptr::read(self).into_iter() {
- }
+ drop(ptr::read(self).into_iter());
}
}
}
///
/// # Current implementation
///
- /// The current algorithm is based on Orson Peters' [pdqsort][pattern-defeating quicksort],
+ /// The current algorithm is based on Orson Peters' [pattern-defeating quicksort][pdqsort],
/// which is a quicksort variant designed to be very fast on certain kinds of patterns,
/// sometimes achieving linear time. It is randomized but deterministic, and falls back to
/// heapsort on degenerate inputs.
///
/// # Current implementation
///
- /// The current algorithm is based on Orson Peters' [pdqsort][pattern-defeating quicksort],
+ /// The current algorithm is based on Orson Peters' [pattern-defeating quicksort][pdqsort],
/// which is a quicksort variant designed to be very fast on certain kinds of patterns,
/// sometimes achieving linear time. It is randomized but deterministic, and falls back to
/// heapsort on degenerate inputs.
///
/// # Current implementation
///
- /// The current algorithm is based on Orson Peters' [pdqsort][pattern-defeating quicksort],
+ /// The current algorithm is based on Orson Peters' [pattern-defeating quicksort][pdqsort],
/// which is a quicksort variant designed to be very fast on certain kinds of patterns,
/// sometimes achieving linear time. It is randomized but deterministic, and falls back to
/// heapsort on degenerate inputs.
}
impl<'tcx> Operand<'tcx> {
- pub fn item<'a>(tcx: ty::TyCtxt<'a, 'tcx, 'tcx>,
- def_id: DefId,
- substs: &'tcx Substs<'tcx>,
- span: Span)
- -> Self
- {
+ pub fn function_handle<'a>(
+ tcx: ty::TyCtxt<'a, 'tcx, 'tcx>,
+ def_id: DefId,
+ substs: &'tcx Substs<'tcx>,
+ span: Span,
+ ) -> Self {
Operand::Constant(Constant {
span: span,
ty: tcx.item_type(def_id).subst(tcx, substs),
- literal: Literal::Item { def_id, substs }
+ literal: Literal::Value { value: ConstVal::Function(def_id, substs) },
})
}
use build::{BlockAnd, BlockAndExtension, Builder, CFG};
use rustc::middle::region::{CodeExtent, CodeExtentData};
use rustc::middle::lang_items;
+use rustc::middle::const_val::ConstVal;
use rustc::ty::subst::{Kind, Subst};
use rustc::ty::{Ty, TyCtxt};
use rustc::mir::*;
func: Operand::Constant(Constant {
span: data.span,
ty: tcx.item_type(free_func).subst(tcx, substs),
- literal: Literal::Item {
- def_id: free_func,
- substs: substs
+ literal: Literal::Value {
+ value: ConstVal::Function(free_func, substs),
}
}),
args: vec![Operand::Consume(data.value.clone())],
ty: callee.ty,
span: expr.span,
kind: ExprKind::Literal {
- literal: Literal::Item {
- def_id: callee.def_id,
- substs: callee.substs,
+ literal: Literal::Value {
+ value: ConstVal::Function(callee.def_id, callee.substs),
},
},
}
-> ExprKind<'tcx> {
let substs = cx.tables().node_id_item_substs(expr.id)
.unwrap_or_else(|| cx.tcx.intern_substs(&[]));
- let def_id = match def {
+ match def {
// A regular function, constructor function or a constant.
Def::Fn(def_id) |
Def::Method(def_id) |
Def::StructCtor(def_id, CtorKind::Fn) |
- Def::VariantCtor(def_id, CtorKind::Fn) |
+ Def::VariantCtor(def_id, CtorKind::Fn) => ExprKind::Literal {
+ literal: Literal::Value {
+ value: ConstVal::Function(def_id, substs),
+ },
+ },
+
Def::Const(def_id) |
- Def::AssociatedConst(def_id) => def_id,
+ Def::AssociatedConst(def_id) => ExprKind::Literal {
+ literal: Literal::Item {
+ def_id: def_id,
+ substs: substs,
+ },
+ },
Def::StructCtor(def_id, CtorKind::Const) |
Def::VariantCtor(def_id, CtorKind::Const) => {
// A unit struct/variant which is used as a value.
// We return a completely different ExprKind here to account for this special case.
ty::TyAdt(adt_def, substs) => {
- return ExprKind::Adt {
+ ExprKind::Adt {
adt_def: adt_def,
variant_index: adt_def.variant_index_with_id(def_id),
substs: substs,
}
}
- Def::Static(node_id, _) => return ExprKind::StaticRef { id: node_id },
+ Def::Static(node_id, _) => ExprKind::StaticRef { id: node_id },
- Def::Local(..) | Def::Upvar(..) => return convert_var(cx, expr, def),
+ Def::Local(..) | Def::Upvar(..) => convert_var(cx, expr, def),
_ => span_bug!(expr.span, "def `{:?}` not yet implemented", def),
- };
- ExprKind::Literal {
- literal: Literal::Item {
- def_id: def_id,
- substs: substs,
- },
}
}
let method_ty = self.tcx.item_type(item.def_id);
let method_ty = method_ty.subst(self.tcx, substs);
return (method_ty,
- Literal::Item {
- def_id: item.def_id,
- substs: substs,
+ Literal::Value {
+ value: ConstVal::Function(item.def_id, substs),
});
}
}
use rustc::hir::def_id::DefId;
use rustc::infer;
use rustc::middle::region::ROOT_CODE_EXTENT;
+use rustc::middle::const_val::ConstVal;
use rustc::mir::*;
use rustc::mir::transform::MirSource;
use rustc::ty::{self, Ty};
Operand::Constant(Constant {
span: span,
ty: tcx.item_type(def_id).subst(tcx, param_env.free_substs),
- literal: Literal::Item { def_id, substs: param_env.free_substs },
+ literal: Literal::Value {
+ value: ConstVal::Function(def_id, param_env.free_substs),
+ },
}),
vec![rcvr]
)
});
}
Operand::Constant(ref constant) => {
- // Only functions and methods can have these types.
- if let ty::TyFnDef(..) = constant.ty.sty {
- return;
- }
-
if let Literal::Item { def_id, substs } = constant.literal {
// Don't peek inside generic (associated) constants.
if substs.types().next().is_some() {
use rustc::traits::{self, Reveal};
use rustc::ty::fold::TypeFoldable;
use rustc::ty::{self, Ty, TyCtxt, TypeVariants};
+use rustc::middle::const_val::ConstVal;
use rustc::mir::*;
use rustc::mir::tcx::LvalueTy;
use rustc::mir::transform::{MirPass, MirSource, Pass};
fn is_box_free(&self, operand: &Operand<'tcx>) -> bool {
match operand {
&Operand::Constant(Constant {
- literal: Literal::Item { def_id, .. }, ..
+ literal: Literal::Value {
+ value: ConstVal::Function(def_id, _), ..
+ }, ..
}) => {
Some(def_id) == self.tcx().lang_items.box_free_fn()
}
}],
terminator: Some(Terminator {
kind: TerminatorKind::Call {
- func: Operand::item(tcx, drop_fn.def_id, substs,
- self.source_info.span),
+ func: Operand::function_handle(tcx, drop_fn.def_id, substs,
+ self.source_info.span),
args: vec![Operand::Consume(Lvalue::Local(ref_lvalue))],
destination: Some((unit_temp, succ)),
cleanup: unwind,
let substs = tcx.mk_substs(iter::once(Kind::from(ty)));
let call = TerminatorKind::Call {
- func: Operand::item(tcx, free_func, substs, self.source_info.span),
+ func: Operand::function_handle(tcx, free_func, substs, self.source_info.span),
args: vec![Operand::Consume(self.lvalue.clone())],
destination: Some((unit_temp, target)),
cleanup: None
use rustc_data_structures::bitvec::BitVector;
use rustc_data_structures::indexed_vec::{Idx, IndexVec};
-use rustc::mir::{self, Location, TerminatorKind};
+use rustc::middle::const_val::ConstVal;
+use rustc::mir::{self, Location, TerminatorKind, Literal};
use rustc::mir::visit::{Visitor, LvalueContext};
use rustc::mir::traversal;
use common;
match *kind {
mir::TerminatorKind::Call {
func: mir::Operand::Constant(mir::Constant {
- literal: mir::Literal::Item { def_id, .. }, ..
+ literal: Literal::Value {
+ value: ConstVal::Function(def_id, _), ..
+ }, ..
}),
ref args, ..
} if Some(def_id) == self.cx.ccx.tcx().lang_items.box_free_fn() => {
ConstVal::Str(ref v) => C_str_slice(ccx, v.clone()),
ConstVal::ByteStr(ref v) => consts::addr_of(ccx, C_bytes(ccx, v), 1, "byte_str"),
ConstVal::Struct(_) | ConstVal::Tuple(_) |
- ConstVal::Array(..) | ConstVal::Repeat(..) |
+ ConstVal::Array(..) | ConstVal::Repeat(..) => {
+ bug!("MIR must not use `{:?}` (aggregates are expanded to MIR rvalues)", cv)
+ }
ConstVal::Function(..) => {
- bug!("MIR must not use `{:?}` (which refers to a local ID)", cv)
+ let llty = type_of::type_of(ccx, ty);
+ return Const::new(C_null(llty), ty);
}
ConstVal::Char(c) => C_integral(Type::char(ccx), c as u64, false),
};
let ty = self.monomorphize(&constant.ty);
match constant.literal.clone() {
mir::Literal::Item { def_id, substs } => {
- // Shortcut for zero-sized types, including function item
- // types, which would not work with MirConstContext.
- if common::type_is_zero_size(self.ccx, ty) {
- let llty = type_of::type_of(self.ccx, ty);
- return Ok(Const::new(C_null(llty), ty));
- }
-
let substs = self.monomorphize(&substs);
MirConstContext::trans_def(self.ccx, def_id, substs, IndexVec::new())
}
let ty = self.monomorphize(&constant.ty);
let result = match constant.literal.clone() {
mir::Literal::Item { def_id, substs } => {
- // Shortcut for zero-sized types, including function item
- // types, which would not work with MirConstContext.
- if common::type_is_zero_size(bcx.ccx, ty) {
- let llty = type_of::type_of(bcx.ccx, ty);
- return Const::new(C_null(llty), ty);
- }
-
let substs = self.monomorphize(&substs);
MirConstContext::trans_def(bcx.ccx, def_id, substs, IndexVec::new())
}
};
if self.diverges.get().always() {
+ if let ExpectHasType(ety) = expected {
+ // Avoid forcing a type (only `!` for now) in unreachable code.
+ // FIXME(aburka) do we need this special case? and should it be is_uninhabited?
+ if !ety.is_never() {
+ if let Some(ref e) = blk.expr {
+ // Coerce the tail expression to the right type.
+ self.demand_coerce(e, ty, ety);
+ }
+ }
+ }
+
ty = self.next_diverging_ty_var(TypeVariableOrigin::DivergingBlockExpr(blk.span));
} else if let ExpectHasType(ety) = expected {
if let Some(ref e) = blk.expr {
Ok(())
}
+fn name_key(name: &str) -> (&str, u64, usize) {
+ // find number at end
+ let split = name.bytes().rposition(|b| b < b'0' || b'9' < b).map_or(0, |s| s + 1);
+
+ // count leading zeroes
+ let after_zeroes =
+ name[split..].bytes().position(|b| b != b'0').map_or(name.len(), |extra| split + extra);
+
+ // sort leading zeroes last
+ let num_zeroes = after_zeroes - split;
+
+ match name[split..].parse() {
+ Ok(n) => (&name[..split], n, num_zeroes),
+ Err(_) => (name, 0, num_zeroes),
+ }
+}
+
fn item_module(w: &mut fmt::Formatter, cx: &Context,
item: &clean::Item, items: &[clean::Item]) -> fmt::Result {
document(w, cx, item)?;
(Some(stability::Stable), Some(stability::Unstable)) => return Ordering::Less,
_ => {}
}
- i1.name.cmp(&i2.name)
+ let lhs = i1.name.as_ref().map_or("", |s| &**s);
+ let rhs = i2.name.as_ref().map_or("", |s| &**s);
+ name_key(lhs).cmp(&name_key(rhs))
}
indices.sort_by(|&i1, &i2| cmp(&items[i1], &items[i2], i1, i2));
reset_ids(true);
test();
}
+
+#[cfg(test)]
+#[test]
+fn test_name_key() {
+ assert_eq!(name_key("0"), ("", 0, 1));
+ assert_eq!(name_key("123"), ("", 123, 0));
+ assert_eq!(name_key("Fruit"), ("Fruit", 0, 0));
+ assert_eq!(name_key("Fruit0"), ("Fruit", 0, 1));
+ assert_eq!(name_key("Fruit0000"), ("Fruit", 0, 4));
+ assert_eq!(name_key("Fruit01"), ("Fruit", 1, 1));
+ assert_eq!(name_key("Fruit10"), ("Fruit", 10, 0));
+ assert_eq!(name_key("Fruit123"), ("Fruit", 123, 0));
+}
+
+#[cfg(test)]
+#[test]
+fn test_name_sorting() {
+ let names = ["Apple",
+ "Banana",
+ "Fruit", "Fruit0", "Fruit00",
+ "Fruit1", "Fruit01",
+ "Fruit2", "Fruit02",
+ "Fruit20",
+ "Fruit100",
+ "Pear"];
+ let mut sorted = names.to_owned();
+ sorted.sort_by_key(|&s| name_key(s));
+ assert_eq!(names, sorted);
+}
}
}
- /// Returns an iterator that copies out each entry. Used while the table
- /// is being dropped.
- unsafe fn rev_move_buckets(&mut self) -> RevMoveBuckets<K, V> {
- let raw_bucket = self.first_bucket_raw();
- RevMoveBuckets {
- raw: raw_bucket.offset(self.capacity as isize),
- hashes_end: raw_bucket.hash,
- elems_left: self.size,
- marker: marker::PhantomData,
+ /// Drops buckets in reverse order. It leaves the table in an inconsistent
+ /// state and should only be used for dropping the table's remaining
+ /// entries. It's used in the implementation of Drop.
+ unsafe fn rev_drop_buckets(&mut self) {
+ let first_raw = self.first_bucket_raw();
+ let mut raw = first_raw.offset(self.capacity as isize);
+ let mut elems_left = self.size;
+
+ while elems_left != 0 {
+ debug_assert!(raw.hash != first_raw.hash);
+
+ raw = raw.offset(-1);
+
+ if *raw.hash != EMPTY_BUCKET {
+ elems_left -= 1;
+ ptr::drop_in_place(raw.pair as *mut (K, V));
+ }
}
}
}
}
-/// An iterator that moves out buckets in reverse order. It leaves the table
-/// in an inconsistent state and should only be used for dropping
-/// the table's remaining entries. It's used in the implementation of Drop.
-struct RevMoveBuckets<'a, K, V> {
- raw: RawBucket<K, V>,
- hashes_end: *mut HashUint,
- elems_left: usize,
-
- // As above, `&'a (K,V)` would seem better, but we often use
- // 'static for the lifetime, and this is not a publicly exposed
- // type.
- marker: marker::PhantomData<&'a ()>,
-}
-
-impl<'a, K, V> Iterator for RevMoveBuckets<'a, K, V> {
- type Item = (K, V);
-
- fn next(&mut self) -> Option<(K, V)> {
- if self.elems_left == 0 {
- return None;
- }
-
- loop {
- debug_assert!(self.raw.hash != self.hashes_end);
-
- unsafe {
- self.raw = self.raw.offset(-1);
-
- if *self.raw.hash != EMPTY_BUCKET {
- self.elems_left -= 1;
- return Some(ptr::read(self.raw.pair));
- }
- }
- }
- }
-}
-
/// Iterator over shared references to entries in a table.
pub struct Iter<'a, K: 'a, V: 'a> {
iter: RawBuckets<'a, K, V>,
unsafe {
if needs_drop::<(K, V)>() {
// avoid linear runtime for types that don't need drop
- for _ in self.rev_move_buckets() {}
+ self.rev_drop_buckets();
}
}
--- /dev/null
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn f() -> isize {
+ (return 1, return 2)
+//~^ ERROR mismatched types
+//~| expected type `isize`
+//~| found type `(_, _)`
+//~| expected isize, found tuple
+}
+
+fn main() {}
--- /dev/null
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+ &panic!()
+ //~^ ERROR mismatched types
+ //~| expected type `()`
+ //~| found type `&_`
+ //~| expected (), found reference
+}
+++ /dev/null
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn g() {
- &panic!()
-}
-
-fn f() -> isize {
- (return 1, return 2)
-}
-
-fn main() {}
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![allow(unused_features)]
-#![allow(unreachable_code)]
+#![allow(unknown_features)]
#![feature(box_syntax)]
#[derive(PartialEq, Debug)]
}
fn foo() -> Result<Foo, isize> {
- return Ok::<Foo, isize>(Foo {
+ return Ok(Foo {
x: Bar { x: 22 },
a: return Err(32)
});
}
fn baz() -> Result<Foo, isize> {
- Ok::<Foo, isize>(Foo {
+ Ok(Foo {
x: Bar { x: 22 },
a: return Err(32)
})
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-// DON'T REENABLE THIS UNLESS YOU'VE ACTUALLY FIXED THE UNDERLYING ISSUE
-// ignore-android seems to block forever
+#![deny(warnings)]
-// ignore-emscripten no threads support
+fn foo<F: FnOnce()>(_f: F) { }
-#![forbid(warnings)]
-
-// Pretty printing tests complain about `use std::predule::*`
-#![allow(unused_imports)]
-
-// A var moved into a proc, that has a mutable loan path should
-// not trigger a misleading unused_mut warning.
-
-use std::io::prelude::*;
-use std::thread;
-
-pub fn main() {
- let mut stdin = std::io::stdin();
- thread::spawn(move|| {
- let mut v = Vec::new();
- let _ = stdin.read_to_end(&mut v);
- }).join().ok().unwrap();
+fn main() {
+ let mut var = Vec::new();;
+ foo(move|| {
+ var.push(1);
+ });
}
--- /dev/null
+// 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.
+
+// Regression test for issue #39984.
+//
+// The key here is that the error type of the `Ok` call ought to be
+// constrained to `String`, even though it is dead-code.
+
+fn main() {}
+
+fn t() -> Result<(), String> {
+ return Err("".into());
+ Ok(())
+}
// A regression test extracted from image-0.3.11. The point of
// failure was in `index_colors` below.
-#![allow(unused)]
-
use std::ops::{Deref, DerefMut};
#[derive(Copy, Clone)]
-> ImageBuffer<Luma<u8>, Vec<u8>>
where Pix: Pixel<Subpixel=u8> + 'static,
{
- let mut indices: ImageBuffer<Luma<u8>, Vec<u8>> = loop { };
+ let mut indices: ImageBuffer<_,Vec<_>> = loop { };
for (pixel, idx) in image.pixels().zip(indices.pixels_mut()) {
// failured occurred here ^^ because we were requiring that we
// could project Pixel or Subpixel from `T_indices` (type of
let mut cmd = Command::new(prog);
cmd.args(args)
- .stdin(Stdio::piped())
.stdout(Stdio::piped())
.stderr(Stdio::piped());
+
+ // Why oh why do we sometimes make a pipe and sometimes inherit the stdin
+ // stream, well that's an excellent question! In theory it should suffice to
+ // always create a pipe here and be done with it. Unfortunately though
+ // there's apparently something odd with the gdb that comes with gcc 6.3.0
+ // on MinGW. Tracked at rust-lang/rust#40184 when stdin is piped here
+ // (unconditionally) then all gdb tests will fail on MinGW when using gcc
+ // 6.3.0. WHen using an inherited stdin though they happen to all work!
+ //
+ // As to why this fixes the issue, well, I have no idea. If you can remove
+ // this branch and unconditionally use `piped` and it gets past @bors please
+ // feel free to send a PR!
+ if input.is_some() || !cfg!(windows) {
+ cmd.stdin(Stdio::piped());
+ } else {
+ cmd.stdin(Stdio::inherit());
+ }
+
add_target_env(&mut cmd, lib_path, aux_path);
for (key, val) in env {
cmd.env(&key, &val);