Auto merge of #49379 - TimNN:rollup, r=TimNN

Rollup of 7 pull requests

- Successful merges: #48693, #48932, #49103, #49170, #49187, #49346, #49353
- Failed merges:
This commit is contained in:
bors 2018-03-26 15:48:06 +00:00
commit ab8b961677
31 changed files with 181 additions and 37 deletions

View File

@ -98,7 +98,7 @@ impl Step for Std {
copy_musl_third_party_objects(build, target, &libdir);
}
let out_dir = build.stage_out(compiler, Mode::Libstd);
let out_dir = build.cargo_out(compiler, Mode::Libstd, target);
build.clear_if_dirty(&out_dir, &builder.rustc(compiler));
let mut cargo = builder.cargo(compiler, Mode::Libstd, target, "build");
std_cargo(builder, &compiler, target, &mut cargo);
@ -360,7 +360,7 @@ impl Step for Test {
return;
}
let out_dir = build.stage_out(compiler, Mode::Libtest);
let out_dir = build.cargo_out(compiler, Mode::Libtest, target);
build.clear_if_dirty(&out_dir, &libstd_stamp(build, compiler, target));
let mut cargo = builder.cargo(compiler, Mode::Libtest, target, "build");
test_cargo(build, &compiler, target, &mut cargo);
@ -482,10 +482,9 @@ impl Step for Rustc {
compiler: builder.compiler(self.compiler.stage, build.build),
target: build.build,
});
let stage_out = builder.stage_out(compiler, Mode::Librustc);
build.clear_if_dirty(&stage_out, &libstd_stamp(build, compiler, target));
build.clear_if_dirty(&stage_out, &libtest_stamp(build, compiler, target));
let cargo_out = builder.cargo_out(compiler, Mode::Librustc, target);
build.clear_if_dirty(&cargo_out, &libstd_stamp(build, compiler, target));
build.clear_if_dirty(&cargo_out, &libtest_stamp(build, compiler, target));
let mut cargo = builder.cargo(compiler, Mode::Librustc, target, "build");
rustc_cargo(build, &mut cargo);

View File

@ -338,6 +338,10 @@ impl Step for Rustdoc {
};
builder.ensure(compile::Rustc { compiler: build_compiler, target });
builder.ensure(compile::Rustc {
compiler: build_compiler,
target: builder.build.build,
});
let mut cargo = prepare_tool_cargo(builder,
build_compiler,

View File

@ -32,5 +32,5 @@ ENV CC_aarch64_unknown_linux_gnu=aarch64-unknown-linux-gnueabi-gcc \
ENV HOSTS=aarch64-unknown-linux-gnu
ENV RUST_CONFIGURE_ARGS --enable-extended
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS

View File

@ -26,7 +26,8 @@ ENV RUST_CONFIGURE_ARGS \
--armv7-linux-androideabi-ndk=/android/ndk/arm-14 \
--i686-linux-android-ndk=/android/ndk/x86-14 \
--aarch64-linux-android-ndk=/android/ndk/arm64-21 \
--x86_64-linux-android-ndk=/android/ndk/x86_64-21
--x86_64-linux-android-ndk=/android/ndk/x86_64-21 \
--disable-docs
ENV SCRIPT python2.7 ../x.py dist --target $TARGETS

View File

@ -32,5 +32,5 @@ ENV CC_arm_unknown_linux_gnueabi=arm-unknown-linux-gnueabi-gcc \
ENV HOSTS=arm-unknown-linux-gnueabi
ENV RUST_CONFIGURE_ARGS --enable-extended
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS

View File

@ -32,5 +32,5 @@ ENV CC_arm_unknown_linux_gnueabihf=arm-unknown-linux-gnueabihf-gcc \
ENV HOSTS=arm-unknown-linux-gnueabihf
ENV RUST_CONFIGURE_ARGS --enable-extended
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS

View File

@ -32,5 +32,5 @@ ENV CC_armv7_unknown_linux_gnueabihf=armv7-unknown-linux-gnueabihf-gcc \
ENV HOSTS=armv7-unknown-linux-gnueabihf
ENV RUST_CONFIGURE_ARGS --enable-extended
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS

View File

@ -32,7 +32,8 @@ RUN sh /scripts/sccache.sh
ENV RUST_CONFIGURE_ARGS \
--musl-root-i586=/musl-i586 \
--musl-root-i686=/musl-i686 \
--enable-extended
--enable-extended \
--disable-docs
# Newer binutils broke things on some vms/distros (i.e., linking against
# unknown relocs disabled by the following flag), so we need to go out of our

View File

@ -29,5 +29,5 @@ ENV \
ENV HOSTS=i686-unknown-freebsd
ENV RUST_CONFIGURE_ARGS --enable-extended
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS

View File

@ -22,5 +22,5 @@ RUN sh /scripts/sccache.sh
ENV HOSTS=mips-unknown-linux-gnu
ENV RUST_CONFIGURE_ARGS --enable-extended
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS

View File

@ -21,5 +21,5 @@ RUN sh /scripts/sccache.sh
ENV HOSTS=mips64-unknown-linux-gnuabi64
ENV RUST_CONFIGURE_ARGS --enable-extended
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS

View File

@ -22,5 +22,5 @@ RUN sh /scripts/sccache.sh
ENV HOSTS=mips64el-unknown-linux-gnuabi64
ENV RUST_CONFIGURE_ARGS --enable-extended
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS

View File

@ -21,5 +21,5 @@ RUN sh /scripts/sccache.sh
ENV HOSTS=mipsel-unknown-linux-gnu
ENV RUST_CONFIGURE_ARGS --enable-extended
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS

View File

@ -34,7 +34,7 @@ ENV \
ENV HOSTS=powerpc-unknown-linux-gnu
ENV RUST_CONFIGURE_ARGS --enable-extended
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
# FIXME(#36150) this will fail the bootstrap. Probably means something bad is

View File

@ -35,5 +35,5 @@ ENV \
ENV HOSTS=powerpc64-unknown-linux-gnu
ENV RUST_CONFIGURE_ARGS --enable-extended
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS

View File

@ -32,5 +32,5 @@ ENV \
ENV HOSTS=powerpc64le-unknown-linux-gnu
ENV RUST_CONFIGURE_ARGS --enable-extended
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS

View File

@ -34,5 +34,5 @@ ENV \
ENV HOSTS=s390x-unknown-linux-gnu
ENV RUST_CONFIGURE_ARGS --enable-extended
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS

View File

@ -95,7 +95,8 @@ ENV RUST_CONFIGURE_ARGS \
--musl-root-aarch64=/musl-aarch64 \
--musl-root-mips=/musl-mips \
--musl-root-mipsel=/musl-mipsel \
--enable-emscripten
--enable-emscripten \
--disable-docs
ENV SCRIPT python2.7 ../x.py dist --target $TARGETS

View File

@ -55,5 +55,5 @@ ENV TARGETS=$TARGETS,x86_64-sun-solaris
ENV TARGETS=$TARGETS,x86_64-unknown-linux-gnux32
ENV TARGETS=$TARGETS,x86_64-unknown-cloudabi
ENV RUST_CONFIGURE_ARGS --enable-extended
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
ENV SCRIPT python2.7 ../x.py dist --target $TARGETS

View File

@ -29,5 +29,5 @@ ENV \
ENV HOSTS=x86_64-unknown-freebsd
ENV RUST_CONFIGURE_ARGS --enable-extended
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS

View File

@ -31,7 +31,8 @@ RUN sh /scripts/sccache.sh
ENV RUST_CONFIGURE_ARGS \
--musl-root-x86_64=/musl-x86_64 \
--enable-extended
--enable-extended \
--disable-docs
# Newer binutils broke things on some vms/distros (i.e., linking against
# unknown relocs disabled by the following flag), so we need to go out of our

View File

@ -33,5 +33,5 @@ ENV \
ENV HOSTS=x86_64-unknown-netbsd
ENV RUST_CONFIGURE_ARGS --enable-extended
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS

View File

@ -576,6 +576,33 @@ impl<K: Ord, V> BTreeMap<K, V> {
}
}
/// Returns the key-value pair corresponding to the supplied key.
///
/// The supplied key may be any borrowed form of the map's key type, but the ordering
/// on the borrowed form *must* match the ordering on the key type.
///
/// # Examples
///
/// ```
/// #![feature(map_get_key_value)]
/// use std::collections::BTreeMap;
///
/// let mut map = BTreeMap::new();
/// map.insert(1, "a");
/// assert_eq!(map.get_key_value(&1), Some((&1, &"a")));
/// assert_eq!(map.get_key_value(&2), None);
/// ```
#[unstable(feature = "map_get_key_value", issue = "49347")]
pub fn get_key_value<Q: ?Sized>(&self, k: &Q) -> Option<(&K, &V)>
where K: Borrow<Q>,
Q: Ord
{
match search::search_tree(self.root.as_ref(), k) {
Found(handle) => Some(handle.into_kv()),
GoDown(_) => None,
}
}
/// Returns `true` if the map contains a value for the specified key.
///
/// The key may be any borrowed form of the map's key type, but the ordering

View File

@ -63,7 +63,7 @@ trait GenericRadix {
// characters for a base 2 number.
let zero = T::zero();
let is_nonnegative = x >= zero;
let mut buf = [0; 128];
let mut buf: [u8; 128] = unsafe { mem::uninitialized() };
let mut curr = buf.len();
let base = T::from_u8(Self::BASE);
if is_nonnegative {

View File

@ -974,13 +974,13 @@ pub trait Iterator {
/// // each iteration, we'll multiply the state by the element
/// *state = *state * x;
///
/// // the value passed on to the next iteration
/// Some(*state)
/// // then, we'll yield the negation of the state
/// Some(-*state)
/// });
///
/// assert_eq!(iter.next(), Some(1));
/// assert_eq!(iter.next(), Some(2));
/// assert_eq!(iter.next(), Some(6));
/// assert_eq!(iter.next(), Some(-1));
/// assert_eq!(iter.next(), Some(-2));
/// assert_eq!(iter.next(), Some(-6));
/// assert_eq!(iter.next(), None);
/// ```
#[inline]

View File

@ -205,8 +205,11 @@ pub enum Ordering {
/// [`Release`]: http://llvm.org/docs/Atomics.html#release
#[stable(feature = "rust1", since = "1.0.0")]
Acquire,
/// When coupled with a load, uses [`Acquire`] ordering, and with a store
/// [`Release`] ordering.
/// Has the effects of both [`Acquire`] and [`Release`] together.
///
/// This ordering is only applicable for operations that combine both loads and stores.
///
/// For loads it uses [`Acquire`] ordering. For stores it uses the [`Release`] ordering.
///
/// [`Acquire`]: http://llvm.org/docs/Atomics.html#acquire
/// [`Release`]: http://llvm.org/docs/Atomics.html#release

View File

@ -162,6 +162,10 @@ enum ResolutionError<'a> {
ForwardDeclaredTyParam,
}
/// Combines an error with provided span and emits it
///
/// This takes the error provided, combines it with the span and any additional spans inside the
/// error and emits it.
fn resolve_error<'sess, 'a>(resolver: &'sess Resolver,
span: Span,
resolution_error: ResolutionError<'a>) {
@ -486,7 +490,7 @@ struct BindingInfo {
binding_mode: BindingMode,
}
// Map from the name in a pattern to its binding mode.
/// Map from the name in a pattern to its binding mode.
type BindingMap = FxHashMap<Ident, BindingInfo>;
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
@ -681,6 +685,9 @@ impl<'a> PathSource<'a> {
}
}
/// Different kinds of symbols don't influence each other.
///
/// Therefore, they have a separate universe (namespace).
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
pub enum Namespace {
TypeNS,
@ -688,6 +695,7 @@ pub enum Namespace {
MacroNS,
}
/// Just a helper separate structure for each namespace.
#[derive(Clone, Default, Debug)]
pub struct PerNS<T> {
value_ns: T,
@ -784,6 +792,7 @@ impl<'tcx> Visitor<'tcx> for UsePlacementFinder {
}
}
/// This thing walks the whole crate in DFS manner, visiting each item, resolving names as it goes.
impl<'a, 'tcx> Visitor<'tcx> for Resolver<'a> {
fn visit_item(&mut self, item: &'tcx Item) {
self.resolve_item(item);
@ -910,7 +919,9 @@ impl<'a, 'tcx> Visitor<'tcx> for Resolver<'a> {
fn visit_generics(&mut self, generics: &'tcx Generics) {
// For type parameter defaults, we have to ban access
// to following type parameters, as the Substs can only
// provide previous type parameters as they're built.
// provide previous type parameters as they're built. We
// put all the parameters on the ban list and then remove
// them one by one as they are processed and become available.
let mut default_ban_rib = Rib::new(ForwardTyParamBanRibKind);
default_ban_rib.bindings.extend(generics.params.iter()
.filter_map(|p| if let GenericParam::Type(ref tp) = *p { Some(tp) } else { None })
@ -986,6 +997,17 @@ enum RibKind<'a> {
}
/// One local scope.
///
/// A rib represents a scope names can live in. Note that these appear in many places, not just
/// around braces. At any place where the list of accessible names (of the given namespace)
/// changes or a new restrictions on the name accessibility are introduced, a new rib is put onto a
/// stack. This may be, for example, a `let` statement (because it introduces variables), a macro,
/// etc.
///
/// Different [rib kinds](enum.RibKind) are transparent for different names.
///
/// The resolution keeps a separate stack of ribs as it traverses the AST for each namespace. When
/// resolving, the name is looked up from inside out.
#[derive(Debug)]
struct Rib<'a> {
bindings: FxHashMap<Ident, Def>,
@ -1001,6 +1023,11 @@ impl<'a> Rib<'a> {
}
}
/// An intermediate resolution result.
///
/// This refers to the thing referred by a name. The difference between `Def` and `Item` is that
/// items are visible in their whole block, while defs only from the place they are defined
/// forward.
enum LexicalScopeBinding<'a> {
Item(&'a NameBinding<'a>),
Def(Def),
@ -1031,7 +1058,26 @@ enum PathResult<'a> {
}
enum ModuleKind {
/// An anonymous module, eg. just a block.
///
/// ```
/// fn main() {
/// fn f() {} // (1)
/// { // This is an anonymous module
/// f(); // This resolves to (2) as we are inside the block.
/// fn f() {} // (2)
/// }
/// f(); // Resolves to (1)
/// }
/// ```
Block(NodeId),
/// Any module with a name.
///
/// This could be:
///
/// * A normal module either `mod from_file;` or `mod from_block { }`.
/// * A trait or an enum (it implicitly contains associated types, methods and variant
/// constructors).
Def(Def, Name),
}
@ -1316,6 +1362,9 @@ impl<'a> NameBinding<'a> {
}
/// Interns the names of the primitive types.
///
/// All other types are defined somewhere and possibly imported, but the primitive ones need
/// special handling, since they have no place of origin.
struct PrimitiveTypeTable {
primitive_types: FxHashMap<Name, PrimTy>,
}
@ -1350,6 +1399,8 @@ impl PrimitiveTypeTable {
}
/// The main resolver class.
///
/// This is the visitor that walks the whole crate.
pub struct Resolver<'a> {
session: &'a Session,
cstore: &'a CrateStore,
@ -1481,6 +1532,7 @@ pub struct Resolver<'a> {
injected_crate: Option<Module<'a>>,
}
/// Nothing really interesting here, it just provides memory for the rest of the crate.
pub struct ResolverArenas<'a> {
modules: arena::TypedArena<ModuleData<'a>>,
local_modules: RefCell<Vec<Module<'a>>>,
@ -1526,10 +1578,12 @@ impl<'a, 'b: 'a> ty::DefIdTree for &'a Resolver<'b> {
match id.krate {
LOCAL_CRATE => self.definitions.def_key(id.index).parent,
_ => self.cstore.def_key(id).parent,
}.map(|index| DefId { index: index, ..id })
}.map(|index| DefId { index, ..id })
}
}
/// This interface is used through the AST→HIR step, to embed full paths into the HIR. After that
/// the resolver is no longer needed as all the relevant information is inline.
impl<'a> hir::lowering::Resolver for Resolver<'a> {
fn resolve_hir_path(&mut self, path: &mut hir::Path, is_value: bool) {
self.resolve_hir_path_cb(path, is_value,
@ -1752,6 +1806,7 @@ impl<'a> Resolver<'a> {
}
}
/// Runs the function on each namespace.
fn per_ns<T, F: FnMut(&mut Self, Namespace) -> T>(&mut self, mut f: F) -> PerNS<T> {
PerNS {
type_ns: f(self, TypeNS),

View File

@ -1184,6 +1184,34 @@ impl<K, V, S> HashMap<K, V, S>
self.search(k).map(|bucket| bucket.into_refs().1)
}
/// Returns the key-value pair corresponding to the supplied key.
///
/// The supplied key may be any borrowed form of the map's key type, but
/// [`Hash`] and [`Eq`] on the borrowed form *must* match those for
/// the key type.
///
/// [`Eq`]: ../../std/cmp/trait.Eq.html
/// [`Hash`]: ../../std/hash/trait.Hash.html
///
/// # Examples
///
/// ```
/// #![feature(map_get_key_value)]
/// use std::collections::HashMap;
///
/// let mut map = HashMap::new();
/// map.insert(1, "a");
/// assert_eq!(map.get_key_value(&1), Some((&1, &"a")));
/// assert_eq!(map.get_key_value(&2), None);
/// ```
#[unstable(feature = "map_get_key_value", issue = "49347")]
pub fn get_key_value<Q: ?Sized>(&self, k: &Q) -> Option<(&K, &V)>
where K: Borrow<Q>,
Q: Hash + Eq
{
self.search(k).map(|bucket| bucket.into_refs())
}
/// Returns true if the map contains a value for the specified key.
///
/// The key may be any borrowed form of the map's key type, but

View File

@ -28,6 +28,9 @@ use slice;
/// as possibly some version-dependent additional information. See [`SocketAddrV4`]'s and
/// [`SocketAddrV6`]'s respective documentation for more details.
///
/// The size of a `SocketAddr` instance may vary depending on the target operating
/// system.
///
/// [IP address]: ../../std/net/enum.IpAddr.html
/// [`SocketAddrV4`]: ../../std/net/struct.SocketAddrV4.html
/// [`SocketAddrV6`]: ../../std/net/struct.SocketAddrV6.html
@ -61,6 +64,9 @@ pub enum SocketAddr {
///
/// See [`SocketAddr`] for a type encompassing both IPv4 and IPv6 socket addresses.
///
/// The size of a `SocketAddrV4` struct may vary depending on the target operating
/// system.
///
/// [IETF RFC 793]: https://tools.ietf.org/html/rfc793
/// [IPv4 address]: ../../std/net/struct.Ipv4Addr.html
/// [`SocketAddr`]: ../../std/net/enum.SocketAddr.html
@ -88,6 +94,9 @@ pub struct SocketAddrV4 { inner: c::sockaddr_in }
///
/// See [`SocketAddr`] for a type encompassing both IPv4 and IPv6 socket addresses.
///
/// The size of a `SocketAddrV6` struct may vary depending on the target operating
/// system.
///
/// [IETF RFC 2553, Section 3.3]: https://tools.ietf.org/html/rfc2553#section-3.3
/// [IPv6 address]: ../../std/net/struct.Ipv6Addr.html
/// [`SocketAddr`]: ../../std/net/enum.SocketAddr.html

View File

@ -26,6 +26,9 @@ use sys_common::{AsInner, FromInner};
/// This enum can contain either an [`Ipv4Addr`] or an [`Ipv6Addr`], see their
/// respective documentation for more details.
///
/// The size of an `IpAddr` instance may vary depending on the target operating
/// system.
///
/// [`Ipv4Addr`]: ../../std/net/struct.Ipv4Addr.html
/// [`Ipv6Addr`]: ../../std/net/struct.Ipv6Addr.html
///
@ -61,6 +64,9 @@ pub enum IpAddr {
///
/// See [`IpAddr`] for a type encompassing both IPv4 and IPv6 addresses.
///
/// The size of an `Ipv4Addr` struct may vary depending on the target operating
/// system.
///
/// [IETF RFC 791]: https://tools.ietf.org/html/rfc791
/// [`IpAddr`]: ../../std/net/enum.IpAddr.html
///
@ -93,6 +99,9 @@ pub struct Ipv4Addr {
///
/// See [`IpAddr`] for a type encompassing both IPv4 and IPv6 addresses.
///
/// The size of an `Ipv6Addr` struct may vary depending on the target operating
/// system.
///
/// [IETF RFC 4291]: https://tools.ietf.org/html/rfc4291
/// [`IpAddr`]: ../../std/net/enum.IpAddr.html
///

View File

@ -49,6 +49,9 @@ pub use core::time::Duration;
/// allows measuring the duration between two instants (or comparing two
/// instants).
///
/// The size of an `Instant` struct may vary depending on the target operating
/// system.
///
/// Example:
///
/// ```no_run
@ -88,6 +91,9 @@ pub struct Instant(time::Instant);
/// fixed point in time, a `SystemTime` can be converted to a human-readable time,
/// or perhaps some other string representation.
///
/// The size of a `SystemTime` struct may vary depending on the target operating
/// system.
///
/// [`Instant`]: ../../std/time/struct.Instant.html
/// [`Result`]: ../../std/result/enum.Result.html
/// [`Duration`]: ../../std/time/struct.Duration.html