diff --git a/RELEASES.md b/RELEASES.md index a4e6f22ba3d..45c389d72af 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -577,7 +577,7 @@ Compatibility Notes a warning. - [From the pound escape, lines consisting of multiple `#`s are now visible][41785] -- [It is an error to reexport private enum variants][42460]. This is +- [It is an error to re-export private enum variants][42460]. This is known to break a number of crates that depend on an older version of mustache. - [On Windows, if `VCINSTALLDIR` is set incorrectly, `rustc` will try @@ -2251,10 +2251,10 @@ Rustdoc ------- * [Fix empty implementation section on some module pages](https://github.com/rust-lang/rust/pull/34536) -* [Fix inlined renamed reexports in import lists](https://github.com/rust-lang/rust/pull/34479) +* [Fix inlined renamed re-exports in import lists](https://github.com/rust-lang/rust/pull/34479) * [Fix search result layout for enum variants and struct fields](https://github.com/rust-lang/rust/pull/34477) * [Fix issues with source links to external crates](https://github.com/rust-lang/rust/pull/34387) -* [Fix redirect pages for renamed reexports](https://github.com/rust-lang/rust/pull/34245) +* [Fix redirect pages for renamed re-exports](https://github.com/rust-lang/rust/pull/34245) Tooling ------- @@ -4988,7 +4988,7 @@ Version 0.10 (2014-04-03) * std: The `vec` module has been renamed to `slice`. * std: A new vector type, `Vec`, has been added in preparation for DST. This will become the only growable vector in the future. - * std: `std::io` now has more public-reexports. Types such as `BufferedReader` + * std: `std::io` now has more public re-exports. Types such as `BufferedReader` are now found at `std::io::BufferedReader` instead of `std::io::buffered::BufferedReader`. * std: `print` and `println` are no longer in the prelude, the `print!` and @@ -5079,8 +5079,8 @@ Version 0.10 (2014-04-03) * render standalone markdown files. * the --test flag tests all code blocks by default. * exported macros are displayed. - * reexported types have their documentation inlined at the location of the - first reexport. + * re-exported types have their documentation inlined at the location of the + first re-export. * search works across crates that have been rendered to the same output directory. @@ -5467,7 +5467,7 @@ Version 0.7 (2013-07-03) incl. `any`, `all`. removed. * std: The `finalize` method of `Drop` renamed to `drop`. * std: The `drop` method now takes `&mut self` instead of `&self`. - * std: The prelude no longer reexports any modules, only types and traits. + * std: The prelude no longer re-exports any modules, only types and traits. * std: Prelude additions: `print`, `println`, `FromStr`, `ApproxEq`, `Equiv`, `Iterator`, `IteratorUtil`, many numeric traits, many tuple traits. * std: New numeric traits: `Fractional`, `Real`, `RealExt`, `Integer`, `Ratio`, diff --git a/src/Cargo.lock b/src/Cargo.lock index 8fbf3535264..1e37237ac9c 100644 --- a/src/Cargo.lock +++ b/src/Cargo.lock @@ -838,7 +838,7 @@ dependencies = [ [[package]] name = "html-diff" -version = "0.0.5" +version = "0.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "kuchiki 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -907,10 +907,11 @@ dependencies = [ "flate2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "rayon 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "tar 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)", "walkdir 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "xz2 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "xz2 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2127,7 +2128,7 @@ version = "0.0.0" dependencies = [ "build_helper 0.1.0", "cc 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "html-diff 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "html-diff 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "pulldown-cmark 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2776,7 +2777,7 @@ dependencies = [ [[package]] name = "xz2" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lzma-sys 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2855,7 +2856,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum handlebars 0.29.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fb04af2006ea09d985fef82b81e0eb25337e51b691c76403332378a53d521edc" "checksum hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d6a22814455d41612f41161581c2883c0c6a1c41852729b17d5ed88f01e153aa" "checksum home 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9f25ae61099d8f3fee8b483df0bd4ecccf4b2731897aad40d50eca1b641fe6db" -"checksum html-diff 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "9778743e3b3c3679f471f0ed1833c690f19f4a0919e33b281f12ef5f77ad64c6" +"checksum html-diff 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ee4cfdf62a484a3ac0d9b80f562d37f99366db08a63621b917ea3056565345f7" "checksum html5ever 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5bfb46978eb757a603b7dfe2dafb1c62cb4dee3428d8ac1de734d83d6b022d06" "checksum idna 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "014b298351066f1512874135335d62a789ffe78a9974f94b43ed5621951eaf7d" "checksum if_chain 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "61bb90bdd39e3af69b0172dfc6130f6cd6332bf040fbb9bdd4401d37adbd48b8" @@ -3005,5 +3006,5 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum wincolor 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a39ee4464208f6430992ff20154216ab2357772ac871d994c51628d60e58b8b0" "checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" "checksum xattr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "5f04de8a1346489a2f9e9bd8526b73d135ec554227b17568456e86aa35b6f3fc" -"checksum xz2 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e9510bdf100731599107c61f77daf46713a69a568f75458999c1f9dbf6ba25b0" +"checksum xz2 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "98df591c3504d014dd791d998123ed00a476c7e26dc6b2e873cb55c6ac9e59fa" "checksum yaml-rust 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e66366e18dc58b46801afbf2ca7661a9f59cc8c5962c29892b6039b4f86fa992" diff --git a/src/ci/docker/dist-various-2/Dockerfile b/src/ci/docker/dist-various-2/Dockerfile index c7885db559a..d8f09bf47a4 100644 --- a/src/ci/docker/dist-various-2/Dockerfile +++ b/src/ci/docker/dist-various-2/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:16.04 +FROM ubuntu:17.10 COPY scripts/cross-apt-packages.sh /scripts/ RUN sh /scripts/cross-apt-packages.sh @@ -21,9 +21,12 @@ RUN apt-key adv --batch --yes --keyserver keyserver.ubuntu.com --recv-keys 74DA7 RUN add-apt-repository -y 'deb http://apt.dilos.org/dilos dilos2-testing main' WORKDIR /tmp -COPY dist-various-2/shared.sh dist-various-2/build-fuchsia-toolchain.sh /tmp/ -COPY dist-various-2/build-solaris-toolchain.sh /tmp/ +COPY dist-various-2/shared.sh /tmp/ +COPY dist-various-2/build-cloudabi-toolchain.sh /tmp/ +RUN /tmp/build-cloudabi-toolchain.sh x86_64-unknown-cloudabi +COPY dist-various-2/build-fuchsia-toolchain.sh /tmp/ RUN /tmp/build-fuchsia-toolchain.sh +COPY dist-various-2/build-solaris-toolchain.sh /tmp/ RUN /tmp/build-solaris-toolchain.sh x86_64 amd64 solaris-i386 RUN /tmp/build-solaris-toolchain.sh sparcv9 sparcv9 solaris-sparc @@ -44,12 +47,20 @@ ENV \ CC_x86_64_sun_solaris=x86_64-sun-solaris2.10-gcc \ CXX_x86_64_sun_solaris=x86_64-sun-solaris2.10-g++ +# FIXME(EdSchouten): Remove this once cc ≥1.0.4 has been merged. It can +# automatically pick the right compiler path. +ENV \ + AR_x86_64_unknown_cloudabi=x86_64-unknown-cloudabi-ar \ + CC_x86_64_unknown_cloudabi=x86_64-unknown-cloudabi-clang \ + CXX_x86_64_unknown_cloudabi=x86_64-unknown-cloudabi-clang++ + ENV TARGETS=x86_64-unknown-fuchsia ENV TARGETS=$TARGETS,aarch64-unknown-fuchsia ENV TARGETS=$TARGETS,sparcv9-sun-solaris ENV TARGETS=$TARGETS,wasm32-unknown-unknown 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 --target=$TARGETS --enable-extended ENV SCRIPT python2.7 ../x.py dist --target $TARGETS diff --git a/src/ci/docker/dist-various-2/build-cloudabi-toolchain.sh b/src/ci/docker/dist-various-2/build-cloudabi-toolchain.sh new file mode 100755 index 00000000000..d64da436639 --- /dev/null +++ b/src/ci/docker/dist-various-2/build-cloudabi-toolchain.sh @@ -0,0 +1,55 @@ +#!/bin/bash +# Copyright 2018 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 or the MIT license +# , at your +# option. This file may not be copied, modified, or distributed +# except according to those terms. + +set -eux + +# Install prerequisites. +apt-get update +apt-get install -y --no-install-recommends \ + apt-transport-https \ + ca-certificates \ + clang-5.0 \ + cmake \ + curl \ + file \ + g++ \ + gdb \ + git \ + lld-5.0 \ + make \ + python \ + sudo \ + xz-utils + +# Set up a Clang-based cross compiler toolchain. +# Based on the steps described at https://nuxi.nl/cloudabi/debian/ +target=$1 +for tool in ar nm objdump ranlib size; do + ln -s ../lib/llvm-5.0/bin/llvm-${tool} /usr/bin/${target}-${tool} +done +ln -s ../lib/llvm-5.0/bin/clang /usr/bin/${target}-cc +ln -s ../lib/llvm-5.0/bin/clang /usr/bin/${target}-c++ +ln -s ../lib/llvm-5.0/bin/lld /usr/bin/${target}-ld +ln -s ../../${target} /usr/lib/llvm-5.0/${target} + +# FIXME(EdSchouten): Remove this once cc ≥1.0.4 has been merged. It +# can make use of ${target}-cc and ${target}-c++, without incorrectly +# assuming it's MSVC. +ln -s ../lib/llvm-5.0/bin/clang /usr/bin/${target}-clang +ln -s ../lib/llvm-5.0/bin/clang /usr/bin/${target}-clang++ + +# Install the C++ runtime libraries from CloudABI Ports. +echo deb https://nuxi.nl/distfiles/cloudabi-ports/debian/ cloudabi cloudabi > \ + /etc/apt/sources.list.d/cloudabi.list +curl 'https://pgp.mit.edu/pks/lookup?op=get&search=0x0DA51B8531344B15' | \ + apt-key add - +apt-get update +apt-get install -y $(echo ${target} | sed -e s/_/-/g)-cxx-runtime diff --git a/src/doc/rustdoc/src/the-doc-attribute.md b/src/doc/rustdoc/src/the-doc-attribute.md index aadd72d1c90..296422744fa 100644 --- a/src/doc/rustdoc/src/the-doc-attribute.md +++ b/src/doc/rustdoc/src/the-doc-attribute.md @@ -1,7 +1,7 @@ # The `#[doc]` attribute The `#[doc]` attribute lets you control various aspects of how `rustdoc` does -its job. +its job. The most basic function of `#[doc]` is to handle the actual documentation text. That is, `///` is syntax sugar for `#[doc]`. This means that these two @@ -143,7 +143,7 @@ pub mod bar { } ``` -The documentation will generate a "Reexports" section, and say `pub use bar::Bar;`, where +The documentation will generate a "Re-exports" section, and say `pub use bar::Bar;`, where `Bar` is a link to its page. If we change the `use` line like this: @@ -184,7 +184,7 @@ mod bar { } ``` -Now we'll have a `Reexports` line, and `Bar` will not link to anywhere. +Now we'll have a `Re-exports` line, and `Bar` will not link to anywhere. ## `#[doc(hidden)]` diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index d8ce28695ab..6ee4f802802 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -15,7 +15,7 @@ //! //! This library, like libcore, is not intended for general usage, but rather as //! a building block of other libraries. The types and interfaces in this -//! library are reexported through the [standard library](../std/index.html), +//! library are re-exported through the [standard library](../std/index.html), //! and should not be used through this library. //! //! ## Boxed values @@ -52,7 +52,7 @@ //! ## Collections //! //! Implementations of the most common general purpose data structures are -//! defined in this library. They are reexported through the +//! defined in this library. They are re-exported through the //! [standard collections library](../std/collections/index.html). //! //! ## Heap interfaces diff --git a/src/libcore/option.rs b/src/libcore/option.rs index d8f3ec38cf3..15181dab853 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -407,9 +407,7 @@ impl Option { } /// Applies a function to the contained value (if any), - /// or returns a [`default`][] (if not). - /// - /// [`default`]: ../default/trait.Default.html#tymethod.default + /// or returns the provided default (if not). /// /// # Examples /// @@ -430,9 +428,7 @@ impl Option { } /// Applies a function to the contained value (if any), - /// or computes a [`default`][] (if not). - /// - /// [`default`]: ../default/trait.Default.html#tymethod.default + /// or computes a default (if not). /// /// # Examples /// @@ -850,7 +846,7 @@ impl Option { /// Returns the contained value or a default /// /// Consumes the `self` argument then, if [`Some`], returns the contained - /// value, otherwise if [`None`], returns the default value for that + /// value, otherwise if [`None`], returns the [default value] for that /// type. /// /// # Examples @@ -872,6 +868,7 @@ impl Option { /// /// [`Some`]: #variant.Some /// [`None`]: #variant.None + /// [default value]: ../default/trait.Default.html#tymethod.default /// [`parse`]: ../../std/primitive.str.html#method.parse /// [`FromStr`]: ../../std/str/trait.FromStr.html #[inline] diff --git a/src/libcore/prelude/v1.rs b/src/libcore/prelude/v1.rs index 3fa6a97d4cd..d43496c387c 100644 --- a/src/libcore/prelude/v1.rs +++ b/src/libcore/prelude/v1.rs @@ -16,7 +16,7 @@ #![stable(feature = "core_prelude", since = "1.4.0")] -// Reexported core operators +// Re-exported core operators #[stable(feature = "core_prelude", since = "1.4.0")] #[doc(no_inline)] pub use marker::{Copy, Send, Sized, Sync}; @@ -24,12 +24,12 @@ pub use marker::{Copy, Send, Sized, Sync}; #[doc(no_inline)] pub use ops::{Drop, Fn, FnMut, FnOnce}; -// Reexported functions +// Re-exported functions #[stable(feature = "core_prelude", since = "1.4.0")] #[doc(no_inline)] pub use mem::drop; -// Reexported types and traits +// Re-exported types and traits #[stable(feature = "core_prelude", since = "1.4.0")] #[doc(no_inline)] pub use clone::Clone; @@ -55,7 +55,7 @@ pub use option::Option::{self, Some, None}; #[doc(no_inline)] pub use result::Result::{self, Ok, Err}; -// Reexported extension traits for primitive types +// Re-exported extension traits for primitive types #[stable(feature = "core_prelude", since = "1.4.0")] #[doc(no_inline)] pub use slice::SliceExt; diff --git a/src/libcore/slice/mod.rs b/src/libcore/slice/mod.rs index 48e82666d35..244bf476caf 100644 --- a/src/libcore/slice/mod.rs +++ b/src/libcore/slice/mod.rs @@ -22,7 +22,7 @@ // a lot of stuff defined here. Let's keep it clean. // // Since slices don't support inherent methods; all operations -// on them are defined on traits, which are then reexported from +// on them are defined on traits, which are then re-exported from // the prelude for convenience. So there are a lot of traits here. // // The layout of this file is thus: @@ -1237,6 +1237,43 @@ macro_rules! iterator { } accum } + + #[inline] + #[rustc_inherit_overflow_checks] + fn position

(&mut self, mut predicate: P) -> Option where + Self: Sized, + P: FnMut(Self::Item) -> bool, + { + // The addition might panic on overflow + let n = self.len(); + self.try_fold(0, move |i, x| { + if predicate(x) { Err(i) } + else { Ok(i + 1) } + }).err() + .map(|i| { + unsafe { assume(i < n) }; + i + }) + } + + #[inline] + fn rposition

(&mut self, mut predicate: P) -> Option where + P: FnMut(Self::Item) -> bool, + Self: Sized + ExactSizeIterator + DoubleEndedIterator + { + // No need for an overflow check here, because `ExactSizeIterator` + // implies that the number of elements fits into a `usize`. + let n = self.len(); + self.try_rfold(n, move |i, x| { + let i = i - 1; + if predicate(x) { Err(i) } + else { Ok(i) } + }).err() + .map(|i| { + unsafe { assume(i < n) }; + i + }) + } } #[stable(feature = "rust1", since = "1.0.0")] diff --git a/src/libcore/tests/slice.rs b/src/libcore/tests/slice.rs index f7a4a71e5cf..13740b95802 100644 --- a/src/libcore/tests/slice.rs +++ b/src/libcore/tests/slice.rs @@ -10,6 +10,25 @@ use core::result::Result::{Ok, Err}; + +#[test] +fn test_position() { + let b = [1, 2, 3, 5, 5]; + assert!(b.iter().position(|&v| v == 9) == None); + assert!(b.iter().position(|&v| v == 5) == Some(3)); + assert!(b.iter().position(|&v| v == 3) == Some(2)); + assert!(b.iter().position(|&v| v == 0) == None); +} + +#[test] +fn test_rposition() { + let b = [1, 2, 3, 5, 5]; + assert!(b.iter().rposition(|&v| v == 9) == None); + assert!(b.iter().rposition(|&v| v == 5) == Some(4)); + assert!(b.iter().rposition(|&v| v == 3) == Some(2)); + assert!(b.iter().rposition(|&v| v == 0) == None); +} + #[test] fn test_binary_search() { let b: [i32; 0] = []; diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index 1af7bd46ad4..238145a061f 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -2119,7 +2119,7 @@ impl<'a> LoweringContext<'a> { // Privatize the degenerate import base, used only to check // the stability of `use a::{};`, to avoid it showing up as - // a reexport by accident when `pub`, e.g. in documentation. + // a re-export by accident when `pub`, e.g. in documentation. let path = P(self.lower_path(id, &prefix, ParamMode::Explicit, true)); *vis = hir::Inherited; hir::ItemUse(path, hir::UseKind::ListStem) diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs index 7410386c6f4..143d2c2ea28 100644 --- a/src/librustc/lint/builtin.rs +++ b/src/librustc/lint/builtin.rs @@ -127,7 +127,7 @@ declare_lint! { declare_lint! { pub PUB_USE_OF_PRIVATE_EXTERN_CRATE, Deny, - "detect public reexports of private extern crates" + "detect public re-exports of private extern crates" } declare_lint! { diff --git a/src/librustc/lint/mod.rs b/src/librustc/lint/mod.rs index f4abc54ad2e..b2a9859f68a 100644 --- a/src/librustc/lint/mod.rs +++ b/src/librustc/lint/mod.rs @@ -97,12 +97,13 @@ macro_rules! declare_lint { /// Declare a static `LintArray` and return it as an expression. #[macro_export] -macro_rules! lint_array { ($( $lint:expr ),*) => ( - { - static ARRAY: LintArray = &[ $( &$lint ),* ]; - ARRAY - } -) } +macro_rules! lint_array { + ($( $lint:expr ),*,) => { lint_array!( $( $lint ),* ) }; + ($( $lint:expr ),*) => {{ + static ARRAY: LintArray = &[ $( &$lint ),* ]; + ARRAY + }} +} pub type LintArray = &'static [&'static &'static Lint]; diff --git a/src/librustc/middle/privacy.rs b/src/librustc/middle/privacy.rs index 1376886968f..e2de0b6bd01 100644 --- a/src/librustc/middle/privacy.rs +++ b/src/librustc/middle/privacy.rs @@ -26,9 +26,9 @@ pub enum AccessLevel { // public, then type `T` is reachable. Its values can be obtained by other crates // even if the type itself is not nameable. Reachable, - // Public items + items accessible to other crates with help of `pub use` reexports + // Public items + items accessible to other crates with help of `pub use` re-exports Exported, - // Items accessible to other crates directly, without help of reexports + // Items accessible to other crates directly, without help of re-exports Public, } diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index eb1a84b9dc7..69b86416afa 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -1172,7 +1172,7 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options, "emit noalias metadata for mutable references"), dump_mir: Option = (None, parse_opt_string, [UNTRACKED], "dump MIR state at various points in translation"), - dump_mir_dir: Option = (None, parse_opt_string, [UNTRACKED], + dump_mir_dir: String = (String::from("mir_dump"), parse_string, [UNTRACKED], "the directory the MIR is dumped into"), dump_mir_graphviz: bool = (false, parse_bool, [UNTRACKED], "in addition to `.mir` files, create graphviz `.dot` files"), @@ -2796,7 +2796,7 @@ mod tests { assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash()); opts.debugging_opts.dump_mir = Some(String::from("abc")); assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash()); - opts.debugging_opts.dump_mir_dir = Some(String::from("abc")); + opts.debugging_opts.dump_mir_dir = String::from("abc"); assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash()); opts.debugging_opts.dump_mir_graphviz = true; assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash()); diff --git a/src/librustc_back/target/windows_base.rs b/src/librustc_back/target/windows_base.rs index e6aa745d54e..cc40b8b0529 100644 --- a/src/librustc_back/target/windows_base.rs +++ b/src/librustc_back/target/windows_base.rs @@ -59,6 +59,15 @@ pub fn opts() -> TargetOptions { "-lmingw32".to_string(), "-lgcc".to_string(), // alas, mingw* libraries above depend on libgcc "-lmsvcrt".to_string(), + // mingw's msvcrt is a weird hybrid import library and static library. + // And it seems that the linker fails to use import symbols from msvcrt + // that are required from functions in msvcrt in certain cases. For example + // `_fmode` that is used by an implementation of `__p__fmode` in x86_64. + // Listing the library twice seems to fix that, and seems to also be done + // by mingw's gcc (Though not sure if it's done on purpose, or by mistake). + // + // See https://github.com/rust-lang/rust/pull/47483 + "-lmsvcrt".to_string(), "-luser32".to_string(), "-lkernel32".to_string(), ]); diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs index 1c3d4af9e18..58f851aea38 100644 --- a/src/librustc_errors/emitter.rs +++ b/src/librustc_errors/emitter.rs @@ -1187,8 +1187,8 @@ impl EmitterWriter { let sub_len = parts[0].snippet.trim().chars().fold(0, |acc, ch| { acc + unicode_width::UnicodeWidthChar::width(ch).unwrap_or(0) }); - let underline_start = span_start_pos.col.0 + start; - let underline_end = span_start_pos.col.0 + start + sub_len; + let underline_start = span_start_pos.col_display + start; + let underline_end = span_start_pos.col_display + start + sub_len; for p in underline_start..underline_end { buffer.putc(row_num, max_line_num_len + 3 + p, diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index c5c27c92ab4..de55710bdf3 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -1154,9 +1154,11 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for InvalidNoMangleItems { let msg = "function is marked #[no_mangle], but not exported"; let mut err = cx.struct_span_lint(PRIVATE_NO_MANGLE_FNS, it.span, msg); let insertion_span = it.span.with_hi(it.span.lo()); - err.span_suggestion(insertion_span, - "try making it public", - "pub ".to_owned()); + if it.vis == hir::Visibility::Inherited { + err.span_suggestion(insertion_span, + "try making it public", + "pub ".to_owned()); + } err.emit(); } if generics.is_type_parameterized() { @@ -1177,9 +1179,11 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for InvalidNoMangleItems { let msg = "static is marked #[no_mangle], but not exported"; let mut err = cx.struct_span_lint(PRIVATE_NO_MANGLE_STATICS, it.span, msg); let insertion_span = it.span.with_hi(it.span.lo()); - err.span_suggestion(insertion_span, - "try making it public", - "pub ".to_owned()); + if it.vis == hir::Visibility::Inherited { + err.span_suggestion(insertion_span, + "try making it public", + "pub ".to_owned()); + } err.emit(); } } diff --git a/src/librustc_metadata/decoder.rs b/src/librustc_metadata/decoder.rs index bd63396cd35..06728b2e625 100644 --- a/src/librustc_metadata/decoder.rs +++ b/src/librustc_metadata/decoder.rs @@ -702,8 +702,8 @@ impl<'a, 'tcx> CrateMetadata { let vis = self.get_visibility(child_index); let is_import = false; callback(def::Export { def, ident, vis, span, is_import }); - // For non-reexport structs and variants add their constructors to children. - // Reexport lists automatically contain constructors when necessary. + // For non-re-export structs and variants add their constructors to children. + // Re-export lists automatically contain constructors when necessary. match def { Def::Struct(..) => { if let Some(ctor_def_id) = self.get_struct_ctor_def_id(child_index) { diff --git a/src/librustc_mir/shim.rs b/src/librustc_mir/shim.rs index 89e3e7e0b60..c206d0ea9b5 100644 --- a/src/librustc_mir/shim.rs +++ b/src/librustc_mir/shim.rs @@ -28,7 +28,7 @@ use std::fmt; use std::iter; use transform::{add_moves_for_packed_drops, add_call_guards}; -use transform::{no_landing_pads, simplify}; +use transform::{remove_noop_landing_pads, no_landing_pads, simplify}; use util::elaborate_drops::{self, DropElaborator, DropStyle, DropFlagMode}; use util::patch::MirPatch; @@ -118,6 +118,7 @@ fn make_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, add_moves_for_packed_drops::add_moves_for_packed_drops( tcx, &mut result, instance.def_id()); no_landing_pads::no_landing_pads(tcx, &mut result); + remove_noop_landing_pads::remove_noop_landing_pads(tcx, &mut result); simplify::simplify_cfg(&mut result); add_call_guards::CriticalCallEdges.add_call_guards(&mut result); debug!("make_shim({:?}) = {:?}", instance, result); diff --git a/src/librustc_mir/transform/remove_noop_landing_pads.rs b/src/librustc_mir/transform/remove_noop_landing_pads.rs index 23274cdedf2..e7cab469bc2 100644 --- a/src/librustc_mir/transform/remove_noop_landing_pads.rs +++ b/src/librustc_mir/transform/remove_noop_landing_pads.rs @@ -20,17 +20,24 @@ use util::patch::MirPatch; /// code for these. pub struct RemoveNoopLandingPads; +pub fn remove_noop_landing_pads<'a, 'tcx>( + tcx: TyCtxt<'a, 'tcx, 'tcx>, + mir: &mut Mir<'tcx>) +{ + if tcx.sess.no_landing_pads() { + return + } + debug!("remove_noop_landing_pads({:?})", mir); + + RemoveNoopLandingPads.remove_nop_landing_pads(mir) +} + impl MirPass for RemoveNoopLandingPads { fn run_pass<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, _src: MirSource, mir: &mut Mir<'tcx>) { - if tcx.sess.no_landing_pads() { - return - } - - debug!("remove_noop_landing_pads({:?})", mir); - self.remove_nop_landing_pads(mir); + remove_noop_landing_pads(tcx, mir); } } diff --git a/src/librustc_mir/util/liveness.rs b/src/librustc_mir/util/liveness.rs index 765d50b4006..6251b64bb27 100644 --- a/src/librustc_mir/util/liveness.rs +++ b/src/librustc_mir/util/liveness.rs @@ -407,10 +407,7 @@ fn dump_matched_mir_node<'a, 'tcx>( result: &LivenessResult, ) { let mut file_path = PathBuf::new(); - if let Some(ref file_dir) = tcx.sess.opts.debugging_opts.dump_mir_dir { - let p = Path::new(file_dir); - file_path.push(p); - }; + file_path.push(Path::new(&tcx.sess.opts.debugging_opts.dump_mir_dir)); let item_id = tcx.hir.as_local_node_id(source.def_id).unwrap(); let file_name = format!("rustc.node{}{}-liveness.mir", item_id, pass_name); file_path.push(&file_name); diff --git a/src/librustc_mir/util/pretty.rs b/src/librustc_mir/util/pretty.rs index 37f59773cd6..78d55ad34ed 100644 --- a/src/librustc_mir/util/pretty.rs +++ b/src/librustc_mir/util/pretty.rs @@ -189,11 +189,7 @@ fn dump_path( }; let mut file_path = PathBuf::new(); - - if let Some(ref file_dir) = tcx.sess.opts.debugging_opts.dump_mir_dir { - let p = Path::new(file_dir); - file_path.push(p); - }; + file_path.push(Path::new(&tcx.sess.opts.debugging_opts.dump_mir_dir)); let item_name = tcx.hir .def_path(source.def_id) diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index b525ab852a7..b46882f054d 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -219,7 +219,7 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> { hir::ItemExternCrate(..) => {} // All nested items are checked by visit_item hir::ItemMod(..) => {} - // Reexports are handled in visit_mod + // Re-exports are handled in visit_mod hir::ItemUse(..) => {} // The interface is empty hir::ItemGlobalAsm(..) => {} @@ -1049,7 +1049,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { fn visit_item(&mut self, item: &'tcx hir::Item) { match item.node { - // contents of a private mod can be reexported, so we need + // contents of a private mod can be re-exported, so we need // to check internals. hir::ItemMod(_) => {} diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs index 10bd72ac4a0..c55bf395d71 100644 --- a/src/librustc_resolve/build_reduced_graph.rs +++ b/src/librustc_resolve/build_reduced_graph.rs @@ -683,7 +683,7 @@ impl<'a> Resolver<'a> { let (def, vis) = (binding.def(), binding.vis); self.macro_exports.push(Export { ident, def, vis, span, is_import: true }); } else { - span_err!(self.session, span, E0470, "reexported macro not found"); + span_err!(self.session, span, E0470, "re-exported macro not found"); } } used @@ -729,7 +729,7 @@ impl<'a> Resolver<'a> { } } else if attr.check_name("macro_reexport") { let bad_macro_reexport = |this: &mut Self, span| { - span_err!(this.session, span, E0467, "bad macro reexport"); + span_err!(this.session, span, E0467, "bad macro re-export"); }; if let Some(names) = attr.meta_item_list() { for attr in names { diff --git a/src/librustc_resolve/diagnostics.rs b/src/librustc_resolve/diagnostics.rs index 564626ac398..3f0f1a1a4cb 100644 --- a/src/librustc_resolve/diagnostics.rs +++ b/src/librustc_resolve/diagnostics.rs @@ -1374,7 +1374,7 @@ arguments. "##, E0467: r##" -Macro reexport declarations were empty or malformed. +Macro re-export declarations were empty or malformed. Erroneous code examples: @@ -1389,12 +1389,12 @@ extern crate core as other_macros_for_good; This is a syntax error at the level of attribute declarations. Currently, `macro_reexport` requires at least one macro name to be listed. -Unlike `macro_use`, listing no names does not reexport all macros from the +Unlike `macro_use`, listing no names does not re-export all macros from the given crate. Decide which macros you would like to export and list them properly. -These are proper reexport declarations: +These are proper re-export declarations: ```ignore (cannot-doctest-multicrate-project) #[macro_reexport(some_macro, another_macro)] @@ -1475,7 +1475,7 @@ extern crate some_crate; //ok! "##, E0470: r##" -A macro listed for reexport was not found. +A macro listed for re-export was not found. Erroneous code example: @@ -1493,7 +1493,7 @@ exported from the given crate. This could be caused by a typo. Did you misspell the macro's name? -Double-check the names of the macros listed for reexport, and that the crate +Double-check the names of the macros listed for re-export, and that the crate in question exports them. A working version: diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 0a29441cef7..5b9b3767cb6 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -2751,7 +2751,7 @@ impl<'a> Resolver<'a> { let lint = lint::builtin::LEGACY_CONSTRUCTOR_VISIBILITY; self.session.buffer_lint(lint, id, span, "private struct constructors are not usable through \ - reexports in outer modules", + re-exports in outer modules", ); res = Some(PathResolution::new(ctor_def)); } @@ -4062,7 +4062,7 @@ fn show_candidates(err: &mut DiagnosticBuilder, } /// A somewhat inefficient routine to obtain the name of a module. -fn module_to_string(module: Module) -> String { +fn module_to_string(module: Module) -> Option { let mut names = Vec::new(); fn collect_mod(names: &mut Vec, module: Module) { @@ -4080,12 +4080,12 @@ fn module_to_string(module: Module) -> String { collect_mod(&mut names, module); if names.is_empty() { - return "???".to_string(); + return None; } - names_to_string(&names.into_iter() + Some(names_to_string(&names.into_iter() .rev() .map(|n| dummy_spanned(n)) - .collect::>()) + .collect::>())) } fn err_path_resolution() -> PathResolution { diff --git a/src/librustc_resolve/macros.rs b/src/librustc_resolve/macros.rs index 2b0c839152c..ceb39aea108 100644 --- a/src/librustc_resolve/macros.rs +++ b/src/librustc_resolve/macros.rs @@ -691,8 +691,7 @@ impl<'a> Resolver<'a> { if let Some(suggestion) = suggestion { if suggestion != name { if let MacroKind::Bang = kind { - err.span_suggestion(span, "you could try the macro", - format!("{}!", suggestion)); + err.span_suggestion(span, "you could try the macro", suggestion.to_string()); } else { err.span_suggestion(span, "try", suggestion.to_string()); } diff --git a/src/librustc_resolve/resolve_imports.rs b/src/librustc_resolve/resolve_imports.rs index 132119e961b..07b08e2e61a 100644 --- a/src/librustc_resolve/resolve_imports.rs +++ b/src/librustc_resolve/resolve_imports.rs @@ -46,8 +46,8 @@ pub enum ImportDirectiveSubclass<'a> { }, GlobImport { is_prelude: bool, - max_vis: Cell, // The visibility of the greatest reexport. - // n.b. `max_vis` is only used in `finalize_import` to check for reexport errors. + max_vis: Cell, // The visibility of the greatest re-export. + // n.b. `max_vis` is only used in `finalize_import` to check for re-export errors. }, ExternCrate(Option), MacroUse, @@ -524,7 +524,7 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> { fn resolve_import(&mut self, directive: &'b ImportDirective<'b>) -> bool { debug!("(resolving import for module) resolving import `{}::...` in `{}`", names_to_string(&directive.module_path[..]), - module_to_string(self.current_module)); + module_to_string(self.current_module).unwrap_or("???".to_string())); self.current_module = directive.parent; @@ -773,10 +773,10 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> { None => "".to_owned(), }; let module_str = module_to_string(module); - let msg = if &module_str == "???" { - format!("no `{}` in the root{}", ident, lev_suggestion) - } else { + let msg = if let Some(module_str) = module_str { format!("no `{}` in `{}`{}", ident, module_str, lev_suggestion) + } else { + format!("no `{}` in the root{}", ident, lev_suggestion) }; Some((span, msg)) } else { @@ -803,8 +803,9 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> { if !any_successful_reexport { let (ns, binding) = reexport_error.unwrap(); if ns == TypeNS && binding.is_extern_crate() { - let msg = format!("extern crate `{}` is private, and cannot be reexported \ - (error E0365), consider declaring with `pub`", + let msg = format!("extern crate `{}` is private, and cannot be \ + re-exported (error E0365), consider declaring with \ + `pub`", ident); self.session.buffer_lint(PUB_USE_OF_PRIVATE_EXTERN_CRATE, directive.id, @@ -812,12 +813,12 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> { &msg); } else if ns == TypeNS { struct_span_err!(self.session, directive.span, E0365, - "`{}` is private, and cannot be reexported", ident) - .span_label(directive.span, format!("reexport of private `{}`", ident)) + "`{}` is private, and cannot be re-exported", ident) + .span_label(directive.span, format!("re-export of private `{}`", ident)) .note(&format!("consider declaring type or module `{}` with `pub`", ident)) .emit(); } else { - let msg = format!("`{}` is private, and cannot be reexported", ident); + let msg = format!("`{}` is private, and cannot be re-exported", ident); let note_msg = format!("consider marking `{}` as `pub` in the imported module", ident); struct_span_err!(self.session, directive.span, E0364, "{}", &msg) @@ -876,7 +877,7 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> { self.record_def(directive.id, PathResolution::new(module.def().unwrap())); } - // Miscellaneous post-processing, including recording reexports, + // Miscellaneous post-processing, including recording re-exports, // reporting conflicts, and reporting unresolved imports. fn finalize_resolutions_in(&mut self, module: Module<'b>) { // Since import resolution is finished, globs will not define any more names. @@ -932,12 +933,12 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> { !orig_binding.vis.is_at_least(binding.vis, &*self) { let msg = match directive.subclass { ImportDirectiveSubclass::SingleImport { .. } => { - format!("variant `{}` is private and cannot be reexported", + format!("variant `{}` is private and cannot be re-exported", ident) }, ImportDirectiveSubclass::GlobImport { .. } => { let msg = "enum is private and its variants \ - cannot be reexported".to_owned(); + cannot be re-exported".to_owned(); let error_id = (DiagnosticMessageId::ErrorId(0), // no code?! Some(binding.span), msg.clone()); diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs index 13a319d31bf..f53c5b3f581 100644 --- a/src/librustc_trans/back/link.rs +++ b/src/librustc_trans/back/link.rs @@ -69,13 +69,14 @@ pub fn get_linker(sess: &Session) -> (PathBuf, Command, Vec<(OsString, OsString) // was tagged as #42791) and some more info can be found on #44443 for // emscripten itself. let cmd = |linker: &Path| { - if cfg!(windows) && linker.ends_with(".bat") { - let mut cmd = Command::new("cmd"); - cmd.arg("/c").arg(linker); - cmd - } else { - Command::new(linker) + if let Some(linker) = linker.to_str() { + if cfg!(windows) && linker.ends_with(".bat") { + let mut cmd = Command::new("cmd"); + cmd.arg("/c").arg(linker); + return cmd + } } + Command::new(linker) }; if let Some(ref linker) = sess.opts.cg.linker { diff --git a/src/librustc_trans/back/write.rs b/src/librustc_trans/back/write.rs index 1ee04a46243..db0b045ef1e 100644 --- a/src/librustc_trans/back/write.rs +++ b/src/librustc_trans/back/write.rs @@ -1360,15 +1360,10 @@ fn start_executing_work(tcx: TyCtxt, let sess = tcx.sess; // First up, convert our jobserver into a helper thread so we can use normal - // mpsc channels to manage our messages and such. Once we've got the helper - // thread then request `n-1` tokens because all of our work items are ready - // to go. - // - // Note that the `n-1` is here because we ourselves have a token (our - // process) and we'll use that token to execute at least one unit of work. - // - // After we've requested all these tokens then we'll, when we can, get - // tokens on `rx` above which will get managed in the main loop below. + // mpsc channels to manage our messages and such. + // After we've requested tokens then we'll, when we can, + // get tokens on `coordinator_receive` which will + // get managed in the main loop below. let coordinator_send2 = coordinator_send.clone(); let helper = jobserver.into_helper_thread(move |token| { drop(coordinator_send2.send(Box::new(Message::Token(token)))); diff --git a/src/librustc_trans/llvm_util.rs b/src/librustc_trans/llvm_util.rs index 8112a9eeab1..214fdbded4e 100644 --- a/src/librustc_trans/llvm_util.rs +++ b/src/librustc_trans/llvm_util.rs @@ -85,7 +85,8 @@ const X86_WHITELIST: &'static [&'static str] = &["avx\0", "avx2\0", "bmi\0", "bm "avx512dq\0", "avx512er\0", "avx512f\0", "avx512ifma\0", "avx512pf\0", "avx512vbmi\0", - "avx512vl\0", "avx512vpopcntdq\0", "mmx\0"]; + "avx512vl\0", "avx512vpopcntdq\0", + "mmx\0", "fxsr\0"]; const HEXAGON_WHITELIST: &'static [&'static str] = &["hvx\0", "hvx-double\0"]; diff --git a/src/librustdoc/Cargo.toml b/src/librustdoc/Cargo.toml index 1e574964b12..608adcb43d6 100644 --- a/src/librustdoc/Cargo.toml +++ b/src/librustdoc/Cargo.toml @@ -12,7 +12,7 @@ doctest = false [dependencies] pulldown-cmark = { version = "0.1.0", default-features = false } -html-diff = "0.0.5" +html-diff = "0.0.6" tempdir = "0.3" [build-dependencies] diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs index 496389da7f2..d284757df63 100644 --- a/src/librustdoc/clean/inline.rs +++ b/src/librustdoc/clean/inline.rs @@ -82,9 +82,9 @@ pub fn try_inline(cx: &DocContext, def: Def, name: ast::Name) ret.extend(build_impls(cx, did)); clean::ForeignTypeItem } - // Never inline enum variants but leave them shown as reexports. + // Never inline enum variants but leave them shown as re-exports. Def::Variant(..) => return None, - // Assume that enum variants and struct types are reexported next to + // Assume that enum variants and struct types are re-exported next to // their constructors. Def::VariantCtor(..) | Def::StructCtor(..) => return Some(Vec::new()), @@ -365,7 +365,7 @@ fn build_module(cx: &DocContext, did: DefId) -> clean::Module { }; fn fill_in(cx: &DocContext, did: DefId, items: &mut Vec) { - // If we're reexporting a reexport it may actually reexport something in + // If we're re-exporting a re-export it may actually re-export something in // two namespaces, so the target may be listed twice. Make sure we only // visit each node at most once. let mut visited = FxHashSet(); diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 6e4980c9e91..2293e31b579 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -1286,9 +1286,9 @@ impl DocFolder for Cache { clean::ConstantItem(..) | clean::StaticItem(..) | clean::UnionItem(..) | clean::ForeignTypeItem if !self.stripped_mod => { - // Reexported items mean that the same id can show up twice + // Re-exported items mean that the same id can show up twice // in the rustdoc ast that we're looking at. We know, - // however, that a reexported item doesn't show up in the + // however, that a re-exported item doesn't show up in the // `public_items` map, so we can skip inserting into the // paths map if there was already an entry present and we're // not a public item. @@ -1545,7 +1545,7 @@ impl Context { { // Stripped modules survive the rustdoc passes (i.e. `strip-private`) // if they contain impls for public types. These modules can also - // contain items such as publicly reexported structures. + // contain items such as publicly re-exported structures. // // External crates will provide links to these structures, so // these modules are recursed into, but not rendered normally @@ -2008,7 +2008,7 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context, if cx.shared.sort_modules_alphabetically { indices.sort_by(|&i1, &i2| cmp(&items[i1], &items[i2], i1, i2)); } - // This call is to remove reexport duplicates in cases such as: + // This call is to remove re-export duplicates in cases such as: // // ``` // pub mod foo { @@ -2059,7 +2059,7 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context, curty = myty; let (short, name) = match myty.unwrap() { ItemType::ExternCrate | - ItemType::Import => ("reexports", "Reexports"), + ItemType::Import => ("reexports", "Re-exports"), ItemType::Module => ("modules", "Modules"), ItemType::Struct => ("structs", "Structs"), ItemType::Union => ("unions", "Unions"), @@ -3959,7 +3959,7 @@ fn sidebar_module(fmt: &mut fmt::Formatter, _it: &clean::Item, it.type_() == ItemType::Import) { sidebar.push_str(&format!("

  • {name}
  • ", id = "reexports", - name = "Reexports")); + name = "Re-exports")); } // ordering taken from item_module, reorder, where it prioritized elements in a certain order @@ -3972,7 +3972,7 @@ fn sidebar_module(fmt: &mut fmt::Formatter, _it: &clean::Item, if items.iter().any(|it| !it.is_stripped() && it.type_() == myty) { let (short, name) = match myty { ItemType::ExternCrate | - ItemType::Import => ("reexports", "Reexports"), + ItemType::Import => ("reexports", "Re-exports"), ItemType::Module => ("modules", "Modules"), ItemType::Struct => ("structs", "Structs"), ItemType::Union => ("unions", "Unions"), diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs index 95531b468f4..1cb52d735bb 100644 --- a/src/librustdoc/visit_ast.rs +++ b/src/librustdoc/visit_ast.rs @@ -55,7 +55,7 @@ pub struct RustdocVisitor<'a, 'tcx: 'a> { impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { pub fn new(cstore: &'tcx CrateStore, cx: &'a core::DocContext<'a, 'tcx>) -> RustdocVisitor<'a, 'tcx> { - // If the root is reexported, terminate all recursion. + // If the root is re-exported, terminate all recursion. let mut stack = FxHashSet(); stack.insert(ast::CRATE_NODE_ID); RustdocVisitor { @@ -214,7 +214,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { let imported_from = self.cx.tcx.original_crate_name(def_id.krate); let def = match self.cstore.load_macro_untracked(def_id, self.cx.sess()) { LoadedMacro::MacroDef(macro_def) => macro_def, - // FIXME(jseyfried): document proc macro reexports + // FIXME(jseyfried): document proc macro re-exports LoadedMacro::ProcMacro(..) => continue, }; diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 28040bc20e2..bb38fc55091 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -351,9 +351,9 @@ use prelude::v1::*; #[cfg(test)] extern crate test; #[cfg(test)] extern crate rand; -// We want to reexport a few macros from core but libcore has already been +// We want to re-export a few macros from core but libcore has already been // imported by the compiler (via our #[no_std] attribute) In this case we just -// add a new crate name so we can attach the reexports to it. +// add a new crate name so we can attach the re-exports to it. #[macro_reexport(assert, assert_eq, assert_ne, debug_assert, debug_assert_eq, debug_assert_ne, unreachable, unimplemented, write, writeln, try)] extern crate core as __core; @@ -390,7 +390,7 @@ mod macros; // The Rust prelude pub mod prelude; -// Public module declarations and reexports +// Public module declarations and re-exports #[stable(feature = "rust1", since = "1.0.0")] pub use core::any; #[stable(feature = "rust1", since = "1.0.0")] diff --git a/src/libstd/prelude/mod.rs b/src/libstd/prelude/mod.rs index 538753d8692..919e033f2b4 100644 --- a/src/libstd/prelude/mod.rs +++ b/src/libstd/prelude/mod.rs @@ -52,7 +52,7 @@ //! # Prelude contents //! //! The current version of the prelude (version 1) lives in -//! [`std::prelude::v1`], and reexports the following. +//! [`std::prelude::v1`], and re-exports the following. //! //! * [`std::marker`]::{[`Copy`], [`Send`], [`Sized`], [`Sync`]}. The marker //! traits indicate fundamental properties of types. diff --git a/src/libstd/prelude/v1.rs b/src/libstd/prelude/v1.rs index 9ca5b445c86..feedd4e1abe 100644 --- a/src/libstd/prelude/v1.rs +++ b/src/libstd/prelude/v1.rs @@ -14,17 +14,17 @@ #![stable(feature = "rust1", since = "1.0.0")] -// Reexported core operators +// Re-exported core operators #[stable(feature = "rust1", since = "1.0.0")] #[doc(no_inline)] pub use marker::{Copy, Send, Sized, Sync}; #[stable(feature = "rust1", since = "1.0.0")] #[doc(no_inline)] pub use ops::{Drop, Fn, FnMut, FnOnce}; -// Reexported functions +// Re-exported functions #[stable(feature = "rust1", since = "1.0.0")] #[doc(no_inline)] pub use mem::drop; -// Reexported types and traits +// Re-exported types and traits #[stable(feature = "rust1", since = "1.0.0")] #[doc(no_inline)] pub use boxed::Box; #[stable(feature = "rust1", since = "1.0.0")] diff --git a/src/libstd/rt.rs b/src/libstd/rt.rs index af414d25b5f..9dbaf784f89 100644 --- a/src/libstd/rt.rs +++ b/src/libstd/rt.rs @@ -23,7 +23,7 @@ #![doc(hidden)] -// Reexport some of our utilities which are expected by other crates. +// Re-export some of our utilities which are expected by other crates. pub use panicking::{begin_panic, begin_panic_fmt, update_panic_count}; // To reduce the generated code of the new `lang_start`, this function is doing diff --git a/src/libstd_unicode/char.rs b/src/libstd_unicode/char.rs index c1daf643986..b4be4a96911 100644 --- a/src/libstd_unicode/char.rs +++ b/src/libstd_unicode/char.rs @@ -33,7 +33,7 @@ use core::iter::FusedIterator; use core::fmt::{self, Write}; use tables::{conversions, derived_property, general_category, property}; -// stable reexports +// stable re-exports #[stable(feature = "rust1", since = "1.0.0")] pub use core::char::{MAX, from_digit, from_u32, from_u32_unchecked}; #[stable(feature = "rust1", since = "1.0.0")] @@ -41,7 +41,7 @@ pub use core::char::{EscapeDebug, EscapeDefault, EscapeUnicode}; #[stable(feature = "char_from_str", since = "1.20.0")] pub use core::char::ParseCharError; -// unstable reexports +// unstable re-exports #[unstable(feature = "try_from", issue = "33417")] pub use core::char::CharTryFromError; #[unstable(feature = "decode_utf8", issue = "33906")] diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 0d3be28ffef..612d8501fb2 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -13,7 +13,7 @@ pub use self::SyntaxExtension::*; use ast::{self, Attribute, Name, PatKind, MetaItem}; use attr::HasAttrs; use codemap::{self, CodeMap, Spanned, respan}; -use syntax_pos::{Span, DUMMY_SP}; +use syntax_pos::{Span, MultiSpan, DUMMY_SP}; use errors::DiagnosticBuilder; use ext::expand::{self, Expansion, Invocation}; use ext::hygiene::{Mark, SyntaxContext}; @@ -754,22 +754,22 @@ impl<'a> ExtCtxt<'a> { last_macro } - pub fn struct_span_warn(&self, - sp: Span, - msg: &str) - -> DiagnosticBuilder<'a> { + pub fn struct_span_warn>(&self, + sp: S, + msg: &str) + -> DiagnosticBuilder<'a> { self.parse_sess.span_diagnostic.struct_span_warn(sp, msg) } - pub fn struct_span_err(&self, - sp: Span, - msg: &str) - -> DiagnosticBuilder<'a> { + pub fn struct_span_err>(&self, + sp: S, + msg: &str) + -> DiagnosticBuilder<'a> { self.parse_sess.span_diagnostic.struct_span_err(sp, msg) } - pub fn struct_span_fatal(&self, - sp: Span, - msg: &str) - -> DiagnosticBuilder<'a> { + pub fn struct_span_fatal>(&self, + sp: S, + msg: &str) + -> DiagnosticBuilder<'a> { self.parse_sess.span_diagnostic.struct_span_fatal(sp, msg) } @@ -785,7 +785,7 @@ impl<'a> ExtCtxt<'a> { /// in most cases one can construct a dummy expression/item to /// substitute; we never hit resolve/type-checking so the dummy /// value doesn't have to match anything) - pub fn span_fatal(&self, sp: Span, msg: &str) -> ! { + pub fn span_fatal>(&self, sp: S, msg: &str) -> ! { panic!(self.parse_sess.span_diagnostic.span_fatal(sp, msg)); } @@ -794,20 +794,20 @@ impl<'a> ExtCtxt<'a> { /// /// Compilation will be stopped in the near future (at the end of /// the macro expansion phase). - pub fn span_err(&self, sp: Span, msg: &str) { + pub fn span_err>(&self, sp: S, msg: &str) { self.parse_sess.span_diagnostic.span_err(sp, msg); } - pub fn mut_span_err(&self, sp: Span, msg: &str) + pub fn mut_span_err>(&self, sp: S, msg: &str) -> DiagnosticBuilder<'a> { self.parse_sess.span_diagnostic.mut_span_err(sp, msg) } - pub fn span_warn(&self, sp: Span, msg: &str) { + pub fn span_warn>(&self, sp: S, msg: &str) { self.parse_sess.span_diagnostic.span_warn(sp, msg); } - pub fn span_unimpl(&self, sp: Span, msg: &str) -> ! { + pub fn span_unimpl>(&self, sp: S, msg: &str) -> ! { self.parse_sess.span_diagnostic.span_unimpl(sp, msg); } - pub fn span_bug(&self, sp: Span, msg: &str) -> ! { + pub fn span_bug>(&self, sp: S, msg: &str) -> ! { self.parse_sess.span_diagnostic.span_bug(sp, msg); } pub fn trace_macros_diag(&mut self) { diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index be0bfd6677b..7f7ff56fd7f 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -17,7 +17,7 @@ use ext::base::ExtCtxt; use ptr::P; use symbol::{Symbol, keywords}; -// Transitional reexports so qquote can find the paths it is looking for +// Transitional re-exports so qquote can find the paths it is looking for mod syntax { pub use ext; pub use parse; diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 196fadcc997..0c4bcf4f6c7 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -155,7 +155,7 @@ declare_features! ( // OIBIT specific features (active, optin_builtin_traits, "1.0.0", Some(13231)), - // macro reexport needs more discussion and stabilization + // macro re-export needs more discussion and stabilization (active, macro_reexport, "1.0.0", Some(29638)), // Allows use of #[staged_api] @@ -1479,7 +1479,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { ast::ItemKind::ExternCrate(_) => { if let Some(attr) = attr::find_by_name(&i.attrs[..], "macro_reexport") { gate_feature_post!(&self, macro_reexport, attr.span, - "macros reexports are experimental \ + "macros re-exports are experimental \ and possibly buggy"); } } diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index e7565d35739..3d58104260f 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -42,7 +42,7 @@ use ast::{BinOpKind, UnOp}; use ast::{RangeEnd, RangeSyntax}; use {ast, attr}; use codemap::{self, CodeMap, Spanned, respan}; -use syntax_pos::{self, Span, BytePos, FileName, DUMMY_SP}; +use syntax_pos::{self, Span, MultiSpan, BytePos, FileName, DUMMY_SP}; use errors::{self, DiagnosticBuilder}; use parse::{self, classify, token}; use parse::common::SeqSep; @@ -447,7 +447,9 @@ pub enum Error { } impl Error { - pub fn span_err(self, sp: Span, handler: &errors::Handler) -> DiagnosticBuilder { + pub fn span_err>(self, + sp: S, + handler: &errors::Handler) -> DiagnosticBuilder { match self { Error::FileNotFoundForModule { ref mod_name, ref default_path, @@ -1266,13 +1268,16 @@ impl<'a> Parser<'a> { pub fn fatal(&self, m: &str) -> DiagnosticBuilder<'a> { self.sess.span_diagnostic.struct_span_fatal(self.span, m) } - pub fn span_fatal(&self, sp: Span, m: &str) -> DiagnosticBuilder<'a> { + pub fn span_fatal>(&self, sp: S, m: &str) -> DiagnosticBuilder<'a> { self.sess.span_diagnostic.struct_span_fatal(sp, m) } - pub fn span_fatal_err(&self, sp: Span, err: Error) -> DiagnosticBuilder<'a> { + pub fn span_fatal_err>(&self, sp: S, err: Error) -> DiagnosticBuilder<'a> { err.span_err(sp, self.diagnostic()) } - pub fn span_fatal_help(&self, sp: Span, m: &str, help: &str) -> DiagnosticBuilder<'a> { + pub fn span_fatal_help>(&self, + sp: S, + m: &str, + help: &str) -> DiagnosticBuilder<'a> { let mut err = self.sess.span_diagnostic.struct_span_fatal(sp, m); err.help(help); err @@ -1283,21 +1288,21 @@ impl<'a> Parser<'a> { pub fn warn(&self, m: &str) { self.sess.span_diagnostic.span_warn(self.span, m) } - pub fn span_warn(&self, sp: Span, m: &str) { + pub fn span_warn>(&self, sp: S, m: &str) { self.sess.span_diagnostic.span_warn(sp, m) } - pub fn span_err(&self, sp: Span, m: &str) { + pub fn span_err>(&self, sp: S, m: &str) { self.sess.span_diagnostic.span_err(sp, m) } - pub fn struct_span_err(&self, sp: Span, m: &str) -> DiagnosticBuilder<'a> { + pub fn struct_span_err>(&self, sp: S, m: &str) -> DiagnosticBuilder<'a> { self.sess.span_diagnostic.struct_span_err(sp, m) } - pub fn span_err_help(&self, sp: Span, m: &str, h: &str) { + pub fn span_err_help>(&self, sp: S, m: &str, h: &str) { let mut err = self.sess.span_diagnostic.mut_span_err(sp, m); err.help(h); err.emit(); } - pub fn span_bug(&self, sp: Span, m: &str) -> ! { + pub fn span_bug>(&self, sp: S, m: &str) -> ! { self.sess.span_diagnostic.span_bug(sp, m) } pub fn abort_if_errors(&self) { diff --git a/src/libsyntax_ext/format.rs b/src/libsyntax_ext/format.rs index ad5bd39a453..a7822414c69 100644 --- a/src/libsyntax_ext/format.rs +++ b/src/libsyntax_ext/format.rs @@ -814,15 +814,11 @@ pub fn expand_preparsed_format_args(ecx: &mut ExtCtxt, let (sp, msg) = errs.into_iter().next().unwrap(); cx.ecx.struct_span_err(sp, msg) } else { - let mut diag = cx.ecx.struct_span_err(cx.fmtsp, - "multiple unused formatting arguments"); - - // Ignoring message, as it gets repetitive - // Then use MultiSpan to not clutter up errors - for (sp, _) in errs { - diag.span_label(sp, "unused"); - } - + let mut diag = cx.ecx.struct_span_err( + errs.iter().map(|&(sp, _)| sp).collect::>(), + "multiple unused formatting arguments" + ); + diag.span_label(cx.fmtsp, "multiple unused arguments in this statement"); diag } }; diff --git a/src/test/codegen/issue-47442.rs b/src/test/codegen/issue-47442.rs new file mode 100644 index 00000000000..d0c9932e4e2 --- /dev/null +++ b/src/test/codegen/issue-47442.rs @@ -0,0 +1,32 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// check that we don't emit unneeded `resume` cleanup blocks for every +// destructor. + +// CHECK-NOT: Unwind + +#![feature(test)] +#![crate_type="rlib"] + +extern crate test; + +struct Foo {} + +impl Drop for Foo { + fn drop(&mut self) { + test::black_box(()); + } +} + +#[no_mangle] +pub fn foo() { + let _foo = Foo {}; +} diff --git a/src/test/compile-fail-fulldeps/gated-macro-reexports.rs b/src/test/compile-fail-fulldeps/gated-macro-reexports.rs index 2a20c28cfb8..8b448e401bd 100644 --- a/src/test/compile-fail-fulldeps/gated-macro-reexports.rs +++ b/src/test/compile-fail-fulldeps/gated-macro-reexports.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// Test that macro reexports item are gated by `macro_reexport` feature gate. +// Test that macro re-exports item are gated by `macro_reexport` feature gate. // aux-build:macro_reexport_1.rs // gate-test-macro_reexport @@ -16,6 +16,6 @@ #![crate_type = "dylib"] #[macro_reexport(reexported)] -//~^ ERROR macros reexports are experimental and possibly buggy +//~^ ERROR macros re-exports are experimental and possibly buggy #[macro_use] #[no_link] extern crate macro_reexport_1; diff --git a/src/test/compile-fail/E0365.rs b/src/test/compile-fail/E0365.rs index a1efcde42b0..18a72b0ff9a 100644 --- a/src/test/compile-fail/E0365.rs +++ b/src/test/compile-fail/E0365.rs @@ -13,6 +13,6 @@ mod foo { } pub use foo as foo2; -//~^ ERROR `foo` is private, and cannot be reexported [E0365] +//~^ ERROR `foo` is private, and cannot be re-exported [E0365] fn main() {} diff --git a/src/test/compile-fail/auxiliary/static_priv_by_default.rs b/src/test/compile-fail/auxiliary/static_priv_by_default.rs index 859f38e809f..73597e51f08 100644 --- a/src/test/compile-fail/auxiliary/static_priv_by_default.rs +++ b/src/test/compile-fail/auxiliary/static_priv_by_default.rs @@ -32,7 +32,7 @@ mod foo { fn foo() {} } - // these are public so the parent can reexport them. + // these are public so the parent can re-export them. pub static reexported_a: isize = 0; pub fn reexported_b() {} pub struct reexported_c; diff --git a/src/test/compile-fail/imports/reexports.rs b/src/test/compile-fail/imports/reexports.rs index 65e6e8d01b0..f50b5b0e849 100644 --- a/src/test/compile-fail/imports/reexports.rs +++ b/src/test/compile-fail/imports/reexports.rs @@ -13,7 +13,7 @@ mod a { mod foo {} mod a { - pub use super::foo; //~ ERROR cannot be reexported + pub use super::foo; //~ ERROR cannot be re-exported pub use super::*; //~ ERROR must import something with the glob's visibility } } @@ -24,17 +24,17 @@ mod b { pub mod a { pub use super::foo; // This is OK since the value `foo` is visible enough. - fn f(_: foo::S) {} // `foo` is imported in the type namespace (but not `pub` reexported). + fn f(_: foo::S) {} // `foo` is imported in the type namespace (but not `pub` re-exported). } pub mod b { pub use super::*; // This is also OK since the value `foo` is visible enough. - fn f(_: foo::S) {} // Again, the module `foo` is imported (but not `pub` reexported). + fn f(_: foo::S) {} // Again, the module `foo` is imported (but not `pub` re-exported). } } mod c { - // Test that `foo` is not reexported. + // Test that `foo` is not re-exported. use b::a::foo::S; //~ ERROR `foo` use b::b::foo::S as T; //~ ERROR `foo` } diff --git a/src/test/compile-fail/issue-46209-private-enum-variant-reexport.rs b/src/test/compile-fail/issue-46209-private-enum-variant-reexport.rs index 5b23e5e8150..f5a20dd96dc 100644 --- a/src/test/compile-fail/issue-46209-private-enum-variant-reexport.rs +++ b/src/test/compile-fail/issue-46209-private-enum-variant-reexport.rs @@ -12,14 +12,14 @@ mod rank { pub use self::Professor::*; - //~^ ERROR enum is private and its variants cannot be reexported + //~^ ERROR enum is private and its variants cannot be re-exported pub use self::Lieutenant::{JuniorGrade, Full}; - //~^ ERROR variant `JuniorGrade` is private and cannot be reexported - //~| ERROR variant `Full` is private and cannot be reexported + //~^ ERROR variant `JuniorGrade` is private and cannot be re-exported + //~| ERROR variant `Full` is private and cannot be re-exported pub use self::PettyOfficer::*; - //~^ ERROR enum is private and its variants cannot be reexported + //~^ ERROR enum is private and its variants cannot be re-exported pub use self::Crewman::*; - //~^ ERROR enum is private and its variants cannot be reexported + //~^ ERROR enum is private and its variants cannot be re-exported enum Professor { Adjunct, diff --git a/src/test/compile-fail/lint-unused-extern-crate.rs b/src/test/compile-fail/lint-unused-extern-crate.rs index a3cfa134983..8f0b53fd599 100644 --- a/src/test/compile-fail/lint-unused-extern-crate.rs +++ b/src/test/compile-fail/lint-unused-extern-crate.rs @@ -20,7 +20,7 @@ extern crate lint_unused_extern_crate5; //~ ERROR: unused extern crate -pub extern crate lint_unused_extern_crate4; // no error, it is reexported +pub extern crate lint_unused_extern_crate4; // no error, it is re-exported extern crate lint_unused_extern_crate3; // no error, it is used diff --git a/src/test/compile-fail/macro-reexport-malformed-1.rs b/src/test/compile-fail/macro-reexport-malformed-1.rs index a2778a83130..36a6fce00a1 100644 --- a/src/test/compile-fail/macro-reexport-malformed-1.rs +++ b/src/test/compile-fail/macro-reexport-malformed-1.rs @@ -12,5 +12,5 @@ #![feature(macro_reexport)] #[allow(unused_extern_crates)] -#[macro_reexport] //~ ERROR bad macro reexport +#[macro_reexport] //~ ERROR bad macro re-export extern crate std; diff --git a/src/test/compile-fail/macro-reexport-malformed-2.rs b/src/test/compile-fail/macro-reexport-malformed-2.rs index c5af9e3799d..5f741d010de 100644 --- a/src/test/compile-fail/macro-reexport-malformed-2.rs +++ b/src/test/compile-fail/macro-reexport-malformed-2.rs @@ -12,5 +12,5 @@ #![feature(macro_reexport)] #[allow(unused_extern_crates)] -#[macro_reexport="foo"] //~ ERROR bad macro reexport +#[macro_reexport="foo"] //~ ERROR bad macro re-export extern crate std; diff --git a/src/test/compile-fail/macro-reexport-malformed-3.rs b/src/test/compile-fail/macro-reexport-malformed-3.rs index d72d1ee004e..1a7e3b918cd 100644 --- a/src/test/compile-fail/macro-reexport-malformed-3.rs +++ b/src/test/compile-fail/macro-reexport-malformed-3.rs @@ -12,5 +12,5 @@ #![feature(macro_reexport)] #[allow(unused_extern_crates)] -#[macro_reexport(foo="bar")] //~ ERROR bad macro reexport +#[macro_reexport(foo="bar")] //~ ERROR bad macro re-export extern crate std; diff --git a/src/test/compile-fail/macro-reexport-undef.rs b/src/test/compile-fail/macro-reexport-undef.rs index 5bb0b8759f4..50ac89e49e0 100644 --- a/src/test/compile-fail/macro-reexport-undef.rs +++ b/src/test/compile-fail/macro-reexport-undef.rs @@ -13,7 +13,7 @@ #![feature(macro_reexport)] #[macro_use(macro_two)] -#[macro_reexport(no_way)] //~ ERROR reexported macro not found +#[macro_reexport(no_way)] //~ ERROR re-exported macro not found extern crate two_macros; pub fn main() { diff --git a/src/test/compile-fail/privacy/legacy-ctor-visibility.rs b/src/test/compile-fail/privacy/legacy-ctor-visibility.rs index fb65af230ac..95144916fd7 100644 --- a/src/test/compile-fail/privacy/legacy-ctor-visibility.rs +++ b/src/test/compile-fail/privacy/legacy-ctor-visibility.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// ignore-tidy-linelength + #![allow(unused)] use m::S; @@ -19,7 +21,7 @@ mod m { use S; fn f() { S(10); - //~^ ERROR private struct constructors are not usable through reexports in outer modules + //~^ ERROR private struct constructors are not usable through re-exports in outer modules //~| WARN this was previously accepted } } diff --git a/src/test/compile-fail/privacy/restricted/test.rs b/src/test/compile-fail/privacy/restricted/test.rs index 7f076ebf287..8c1d609e244 100644 --- a/src/test/compile-fail/privacy/restricted/test.rs +++ b/src/test/compile-fail/privacy/restricted/test.rs @@ -28,7 +28,7 @@ mod foo { fn f() { use foo::bar::S; pub(self) use foo::bar::f; // ok - pub(super) use foo::bar::f as g; //~ ERROR cannot be reexported + pub(super) use foo::bar::f as g; //~ ERROR cannot be re-exported S::default().x; // ok S::default().f(); // ok S::g(); // ok diff --git a/src/test/compile-fail/private-variant-reexport.rs b/src/test/compile-fail/private-variant-reexport.rs index 1280aba3076..5d770f88155 100644 --- a/src/test/compile-fail/private-variant-reexport.rs +++ b/src/test/compile-fail/private-variant-reexport.rs @@ -9,19 +9,19 @@ // except according to those terms. mod m1 { - pub use ::E::V; //~ ERROR variant `V` is private and cannot be reexported + pub use ::E::V; //~ ERROR variant `V` is private and cannot be re-exported } mod m2 { - pub use ::E::{V}; //~ ERROR variant `V` is private and cannot be reexported + pub use ::E::{V}; //~ ERROR variant `V` is private and cannot be re-exported } mod m3 { - pub use ::E::V::{self}; //~ ERROR variant `V` is private and cannot be reexported + pub use ::E::V::{self}; //~ ERROR variant `V` is private and cannot be re-exported } mod m4 { - pub use ::E::*; //~ ERROR enum is private and its variants cannot be reexported + pub use ::E::*; //~ ERROR enum is private and its variants cannot be re-exported } enum E { V } diff --git a/src/test/compile-fail/pub-reexport-priv-extern-crate.rs b/src/test/compile-fail/pub-reexport-priv-extern-crate.rs index 5479be54533..2e71e007e9e 100644 --- a/src/test/compile-fail/pub-reexport-priv-extern-crate.rs +++ b/src/test/compile-fail/pub-reexport-priv-extern-crate.rs @@ -11,7 +11,7 @@ #![allow(unused)] extern crate core; -pub use core as reexported_core; //~ ERROR `core` is private, and cannot be reexported +pub use core as reexported_core; //~ ERROR `core` is private, and cannot be re-exported //~^ WARN this was previously accepted mod foo1 { @@ -19,7 +19,7 @@ mod foo1 { } mod foo2 { - use foo1::core; //~ ERROR `core` is private, and cannot be reexported + use foo1::core; //~ ERROR `core` is private, and cannot be re-exported //~^ WARN this was previously accepted pub mod bar { extern crate core; @@ -27,7 +27,7 @@ mod foo2 { } mod baz { - pub use foo2::bar::core; //~ ERROR `core` is private, and cannot be reexported + pub use foo2::bar::core; //~ ERROR `core` is private, and cannot be re-exported //~^ WARN this was previously accepted } diff --git a/src/test/run-make/type-mismatch-same-crate-name/crateC.rs b/src/test/run-make/type-mismatch-same-crate-name/crateC.rs index da869d2145f..210bc4c8320 100644 --- a/src/test/run-make/type-mismatch-same-crate-name/crateC.rs +++ b/src/test/run-make/type-mismatch-same-crate-name/crateC.rs @@ -18,7 +18,7 @@ // compile-fail/type-mismatch-same-crate-name.rs // but deals with the case where one of the crates // is only introduced as an indirect dependency. -// and the type is accessed via a reexport. +// and the type is accessed via a re-export. // This is similar to how the error can be introduced // when using cargo's automatic dependency resolution. diff --git a/src/test/run-pass-fulldeps/auxiliary/lint_for_crate.rs b/src/test/run-pass-fulldeps/auxiliary/lint_for_crate.rs index d3f921e0878..878d64c3473 100644 --- a/src/test/run-pass-fulldeps/auxiliary/lint_for_crate.rs +++ b/src/test/run-pass-fulldeps/auxiliary/lint_for_crate.rs @@ -23,26 +23,57 @@ use rustc_plugin::Registry; use rustc::hir; use syntax::attr; -declare_lint!(CRATE_NOT_OKAY, Warn, "crate not marked with #![crate_okay]"); +macro_rules! fake_lint_pass { + ($struct:ident, $lints:expr, $($attr:expr),*) => { + struct $struct; -struct Pass; + impl LintPass for $struct { + fn get_lints(&self) -> LintArray { + $lints + } + } + + impl<'a, 'tcx> LateLintPass<'a, 'tcx> for $struct { + fn check_crate(&mut self, cx: &LateContext, krate: &hir::Crate) { + $( + if !attr::contains_name(&krate.attrs, $attr) { + cx.span_lint(CRATE_NOT_OKAY, krate.span, + &format!("crate is not marked with #![{}]", $attr)); + } + )* + } + } -impl LintPass for Pass { - fn get_lints(&self) -> LintArray { - lint_array!(CRATE_NOT_OKAY) } } -impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { - fn check_crate(&mut self, cx: &LateContext, krate: &hir::Crate) { - if !attr::contains_name(&krate.attrs, "crate_okay") { - cx.span_lint(CRATE_NOT_OKAY, krate.span, - "crate is not marked with #![crate_okay]"); - } - } +declare_lint!(CRATE_NOT_OKAY, Warn, "crate not marked with #![crate_okay]"); +declare_lint!(CRATE_NOT_RED, Warn, "crate not marked with #![crate_red]"); +declare_lint!(CRATE_NOT_BLUE, Warn, "crate not marked with #![crate_blue]"); +declare_lint!(CRATE_NOT_GREY, Warn, "crate not marked with #![crate_grey]"); +declare_lint!(CRATE_NOT_GREEN, Warn, "crate not marked with #![crate_green]"); + +fake_lint_pass! { + PassOkay, + lint_array!(CRATE_NOT_OKAY), // Single lint + "crate_okay" +} + +fake_lint_pass! { + PassRedBlue, + lint_array!(CRATE_NOT_RED, CRATE_NOT_BLUE), // Multiple lints + "crate_red", "crate_blue" +} + +fake_lint_pass! { + PassGreyGreen, + lint_array!(CRATE_NOT_GREY, CRATE_NOT_GREEN, ), // Trailing comma + "crate_grey", "crate_green" } #[plugin_registrar] pub fn plugin_registrar(reg: &mut Registry) { - reg.register_late_lint_pass(box Pass); + reg.register_late_lint_pass(box PassOkay); + reg.register_late_lint_pass(box PassRedBlue); + reg.register_late_lint_pass(box PassGreyGreen); } diff --git a/src/test/run-pass-fulldeps/issue-15778-pass.rs b/src/test/run-pass-fulldeps/issue-15778-pass.rs index a767779687a..25800d40e71 100644 --- a/src/test/run-pass-fulldeps/issue-15778-pass.rs +++ b/src/test/run-pass-fulldeps/issue-15778-pass.rs @@ -15,5 +15,9 @@ #![feature(plugin, custom_attribute)] #![plugin(lint_for_crate)] #![crate_okay] +#![crate_blue] +#![crate_red] +#![crate_grey] +#![crate_green] pub fn main() { } diff --git a/src/test/run-pass/unboxed-closures-prelude.rs b/src/test/run-pass/unboxed-closures-prelude.rs index b7835324010..f82b04f37c5 100644 --- a/src/test/run-pass/unboxed-closures-prelude.rs +++ b/src/test/run-pass/unboxed-closures-prelude.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// Tests that the reexports of `FnOnce` et al from the prelude work. +// Tests that the re-exports of `FnOnce` et al from the prelude work. // pretty-expanded FIXME #23616 diff --git a/src/test/rustdoc/inline_cross/auxiliary/rustdoc-nonreachable-impls.rs b/src/test/rustdoc/inline_cross/auxiliary/rustdoc-nonreachable-impls.rs index 22a311d5797..5fee36959c2 100644 --- a/src/test/rustdoc/inline_cross/auxiliary/rustdoc-nonreachable-impls.rs +++ b/src/test/rustdoc/inline_cross/auxiliary/rustdoc-nonreachable-impls.rs @@ -36,7 +36,7 @@ pub mod hidden { pub struct Wobble; - // these should only be shown if they're reexported correctly + // these should only be shown if they're re-exported correctly impl Qux for ::Foo {} impl Qux for Wobble {} impl ::Bark for Wobble {} diff --git a/src/test/ui-fulldeps/resolve-error.stderr b/src/test/ui-fulldeps/resolve-error.stderr index be7ebae70ad..9121ce1720c 100644 --- a/src/test/ui-fulldeps/resolve-error.stderr +++ b/src/test/ui-fulldeps/resolve-error.stderr @@ -38,13 +38,13 @@ error: cannot find macro `FooWithLongNama!` in this scope --> $DIR/resolve-error.rs:62:5 | 62 | FooWithLongNama!(); - | ^^^^^^^^^^^^^^^ help: you could try the macro: `FooWithLongNam!` + | ^^^^^^^^^^^^^^^ help: you could try the macro: `FooWithLongNam` error: cannot find macro `attr_proc_macra!` in this scope --> $DIR/resolve-error.rs:65:5 | 65 | attr_proc_macra!(); - | ^^^^^^^^^^^^^^^ help: you could try the macro: `attr_proc_mac!` + | ^^^^^^^^^^^^^^^ help: you could try the macro: `attr_proc_mac` error: cannot find macro `Dlona!` in this scope --> $DIR/resolve-error.rs:68:5 @@ -56,7 +56,7 @@ error: cannot find macro `bang_proc_macrp!` in this scope --> $DIR/resolve-error.rs:71:5 | 71 | bang_proc_macrp!(); - | ^^^^^^^^^^^^^^^ help: you could try the macro: `bang_proc_macro!` + | ^^^^^^^^^^^^^^^ help: you could try the macro: `bang_proc_macro` error: aborting due to 10 previous errors diff --git a/src/test/ui/issue-46112.rs b/src/test/ui/issue-46112.rs index c292f73bf0b..698005b5d30 100644 --- a/src/test/ui/issue-46112.rs +++ b/src/test/ui/issue-46112.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// Issue 46112: An extern crate pub reexporting libcore was causing +// Issue 46112: An extern crate pub re-exporting libcore was causing // paths rooted from `std` to be misrendered in the diagnostic output. // ignore-windows diff --git a/src/test/ui/issue-47377.rs b/src/test/ui/issue-47377.rs new file mode 100644 index 00000000000..f294008cfd0 --- /dev/null +++ b/src/test/ui/issue-47377.rs @@ -0,0 +1,15 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +// ignore-tidy-tab +fn main() { + let b = "hello"; + let _a = b + ", World!"; + //~^ ERROR E0369 +} diff --git a/src/test/ui/issue-47377.stderr b/src/test/ui/issue-47377.stderr new file mode 100644 index 00000000000..13b3ff58697 --- /dev/null +++ b/src/test/ui/issue-47377.stderr @@ -0,0 +1,12 @@ +error[E0369]: binary operation `+` cannot be applied to type `&str` + --> $DIR/issue-47377.rs:13:12 + | +13 | let _a = b + ", World!"; + | ^^^^^^^^^^^^^^ `+` can't be used to concatenate two `&str` strings +help: `to_owned()` can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left + | +13 | let _a = b.to_owned() + ", World!"; + | ^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/issue-47380.rs b/src/test/ui/issue-47380.rs new file mode 100644 index 00000000000..e43a967253c --- /dev/null +++ b/src/test/ui/issue-47380.rs @@ -0,0 +1,14 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +fn main() { + let b = "hello"; + println!("🦀🦀🦀🦀🦀"); let _a = b + ", World!"; + //~^ ERROR E0369 +} diff --git a/src/test/ui/issue-47380.stderr b/src/test/ui/issue-47380.stderr new file mode 100644 index 00000000000..6c9f79b5a94 --- /dev/null +++ b/src/test/ui/issue-47380.stderr @@ -0,0 +1,12 @@ +error[E0369]: binary operation `+` cannot be applied to type `&str` + --> $DIR/issue-47380.rs:12:33 + | +12 | println!("🦀🦀🦀🦀🦀"); let _a = b + ", World!"; + | ^^^^^^^^^^^^^^ `+` can't be used to concatenate two `&str` strings +help: `to_owned()` can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left + | +12 | println!("🦀🦀🦀🦀🦀"); let _a = b.to_owned() + ", World!"; + | ^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/lint/suggestions.rs b/src/test/ui/lint/suggestions.rs index 3789b6dfc8b..dfcaede1402 100644 --- a/src/test/ui/lint/suggestions.rs +++ b/src/test/ui/lint/suggestions.rs @@ -24,6 +24,16 @@ pub fn defiant(_t: T) {} fn rio_grande() {} // should suggest `pub` //~^ WARN function is marked +mod badlands { + // The private-no-mangle lints shouldn't suggest inserting `pub` when the + // item is already `pub` (but triggered the lint because, e.g., it's in a + // private module). (Issue #47383) + #[no_mangle] pub static DAUNTLESS: bool = true; + //~^ WARN static is marked + #[no_mangle] pub fn val_jean() {} + //~^ WARN function is marked +} + struct Equinox { warp_factor: f32, } diff --git a/src/test/ui/lint/suggestions.stderr b/src/test/ui/lint/suggestions.stderr index 701a9522218..8b30f552d37 100644 --- a/src/test/ui/lint/suggestions.stderr +++ b/src/test/ui/lint/suggestions.stderr @@ -1,7 +1,7 @@ warning: unnecessary parentheses around assigned value - --> $DIR/suggestions.rs:36:21 + --> $DIR/suggestions.rs:46:21 | -36 | let mut a = (1); // should suggest no `mut`, no parens +46 | let mut a = (1); // should suggest no `mut`, no parens | ^^^ help: remove these parentheses | note: lint level defined here @@ -11,17 +11,17 @@ note: lint level defined here | ^^^^^^^^^^^^^ warning: use of deprecated attribute `no_debug`: the `#[no_debug]` attribute was an experimental feature that has been deprecated due to lack of demand. See https://github.com/rust-lang/rust/issues/29721 - --> $DIR/suggestions.rs:31:1 + --> $DIR/suggestions.rs:41:1 | -31 | #[no_debug] // should suggest removal of deprecated attribute +41 | #[no_debug] // should suggest removal of deprecated attribute | ^^^^^^^^^^^ help: remove this attribute | = note: #[warn(deprecated)] on by default warning: variable does not need to be mutable - --> $DIR/suggestions.rs:36:13 + --> $DIR/suggestions.rs:46:13 | -36 | let mut a = (1); // should suggest no `mut`, no parens +46 | let mut a = (1); // should suggest no `mut`, no parens | ---^^ | | | help: remove this `mut` @@ -72,18 +72,30 @@ warning: function is marked #[no_mangle], but not exported | = note: #[warn(private_no_mangle_fns)] on by default -warning: denote infinite loops with `loop { ... }` - --> $DIR/suggestions.rs:34:5 +warning: static is marked #[no_mangle], but not exported + --> $DIR/suggestions.rs:31:18 | -34 | while true { // should suggest `loop` +31 | #[no_mangle] pub static DAUNTLESS: bool = true; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: function is marked #[no_mangle], but not exported + --> $DIR/suggestions.rs:33:18 + | +33 | #[no_mangle] pub fn val_jean() {} + | ^^^^^^^^^^^^^^^^^^^^ + +warning: denote infinite loops with `loop { ... }` + --> $DIR/suggestions.rs:44:5 + | +44 | while true { // should suggest `loop` | ^^^^^^^^^^ help: use `loop` | = note: #[warn(while_true)] on by default warning: the `warp_factor:` in this pattern is redundant - --> $DIR/suggestions.rs:41:23 + --> $DIR/suggestions.rs:51:23 | -41 | Equinox { warp_factor: warp_factor } => {} // should suggest shorthand +51 | Equinox { warp_factor: warp_factor } => {} // should suggest shorthand | ------------^^^^^^^^^^^^ | | | help: remove this diff --git a/src/test/ui/macros/format-foreign.rs b/src/test/ui/macros/format-foreign.rs index 91ca8f5ff76..ec0eaed43ae 100644 --- a/src/test/ui/macros/format-foreign.rs +++ b/src/test/ui/macros/format-foreign.rs @@ -9,7 +9,7 @@ // except according to those terms. fn main() { - println!("%.*3$s %s!\n", "Hello,", "World", 4); + println!("%.*3$s %s!\n", "Hello,", "World", 4); //~ ERROR multiple unused formatting arguments println!("%1$*2$.*3$f", 123.456); //~ ERROR never used // This should *not* produce hints, on the basis that there's equally as diff --git a/src/test/ui/macros/format-foreign.stderr b/src/test/ui/macros/format-foreign.stderr index d0229957b68..f9852c54773 100644 --- a/src/test/ui/macros/format-foreign.stderr +++ b/src/test/ui/macros/format-foreign.stderr @@ -1,12 +1,8 @@ error: multiple unused formatting arguments - --> $DIR/format-foreign.rs:12:5 + --> $DIR/format-foreign.rs:12:30 | -12 | println!("%.*3$s %s!/n", "Hello,", "World", 4); - | ^^^^^^^^^^^^^^^^^^^^^^^^^--------^^-------^^-^^ - | | | | - | | | unused - | | unused - | unused +12 | println!("%.*3$s %s!/n", "Hello,", "World", 4); //~ ERROR multiple unused formatting arguments + | -------------------------^^^^^^^^--^^^^^^^--^-- multiple unused arguments in this statement | = help: `%.*3$s` should be written as `{:.2$}` = help: `%s` should be written as `{}` diff --git a/src/test/ui/macros/format-unused-lables.rs b/src/test/ui/macros/format-unused-lables.rs index 7a32d932ba3..3347a1215ce 100644 --- a/src/test/ui/macros/format-unused-lables.rs +++ b/src/test/ui/macros/format-unused-lables.rs @@ -10,9 +10,10 @@ fn main() { println!("Test", 123, 456, 789); + //~^ ERROR multiple unused formatting arguments println!("Test2", - 123, + 123, //~ ERROR multiple unused formatting arguments 456, 789 ); @@ -20,7 +21,7 @@ fn main() { println!("Some stuff", UNUSED="args"); //~ ERROR named argument never used println!("Some more $STUFF", - "woo!", + "woo!", //~ ERROR multiple unused formatting arguments STUFF= "things" , UNUSED="args"); diff --git a/src/test/ui/macros/format-unused-lables.stderr b/src/test/ui/macros/format-unused-lables.stderr index 9efdca12dea..64ea5626c1d 100644 --- a/src/test/ui/macros/format-unused-lables.stderr +++ b/src/test/ui/macros/format-unused-lables.stderr @@ -1,49 +1,43 @@ error: multiple unused formatting arguments - --> $DIR/format-unused-lables.rs:12:5 + --> $DIR/format-unused-lables.rs:12:22 | 12 | println!("Test", 123, 456, 789); - | ^^^^^^^^^^^^^^^^^---^^---^^---^^ - | | | | - | | | unused - | | unused - | unused + | -----------------^^^--^^^--^^^-- multiple unused arguments in this statement | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: multiple unused formatting arguments - --> $DIR/format-unused-lables.rs:14:5 + --> $DIR/format-unused-lables.rs:16:9 | -14 | / println!("Test2", -15 | | 123, - | | --- unused -16 | | 456, - | | --- unused -17 | | 789 - | | --- unused -18 | | ); - | |______^ +15 | / println!("Test2", +16 | | 123, //~ ERROR multiple unused formatting arguments + | | ^^^ +17 | | 456, + | | ^^^ +18 | | 789 + | | ^^^ +19 | | ); + | |______- multiple unused arguments in this statement | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: named argument never used - --> $DIR/format-unused-lables.rs:20:35 + --> $DIR/format-unused-lables.rs:21:35 | -20 | println!("Some stuff", UNUSED="args"); //~ ERROR named argument never used +21 | println!("Some stuff", UNUSED="args"); //~ ERROR named argument never used | ^^^^^^ error: multiple unused formatting arguments - --> $DIR/format-unused-lables.rs:22:5 + --> $DIR/format-unused-lables.rs:24:9 | -22 | / println!("Some more $STUFF", -23 | | "woo!", - | | ------ unused -24 | | STUFF= -25 | | "things" - | | -------- unused -26 | | , UNUSED="args"); - | |_______________________------_^ - | | - | unused +23 | / println!("Some more $STUFF", +24 | | "woo!", //~ ERROR multiple unused formatting arguments + | | ^^^^^^ +25 | | STUFF= +26 | | "things" + | | ^^^^^^^^ +27 | | , UNUSED="args"); + | |_______________________^^^^^^_- multiple unused arguments in this statement | = help: `$STUFF` should be written as `{STUFF}` = note: shell formatting not supported; see the documentation for `std::fmt` diff --git a/src/test/ui/macros/macro-name-typo.stderr b/src/test/ui/macros/macro-name-typo.stderr index 84851749c70..ebe95356c26 100644 --- a/src/test/ui/macros/macro-name-typo.stderr +++ b/src/test/ui/macros/macro-name-typo.stderr @@ -2,7 +2,7 @@ error: cannot find macro `printlx!` in this scope --> $DIR/macro-name-typo.rs:12:5 | 12 | printlx!("oh noes!"); //~ ERROR cannot find - | ^^^^^^^ help: you could try the macro: `println!` + | ^^^^^^^ help: you could try the macro: `println` error: aborting due to previous error diff --git a/src/test/ui/macros/macro_undefined.stderr b/src/test/ui/macros/macro_undefined.stderr index 6cfb05e7867..8d6da6a4732 100644 --- a/src/test/ui/macros/macro_undefined.stderr +++ b/src/test/ui/macros/macro_undefined.stderr @@ -10,7 +10,7 @@ error: cannot find macro `k!` in this scope --> $DIR/macro_undefined.rs:21:5 | 21 | k!(); //~ ERROR cannot find - | ^ help: you could try the macro: `kl!` + | ^ help: you could try the macro: `kl` error: aborting due to 2 previous errors diff --git a/src/test/ui/nll/borrowed-match-issue-45045.rs b/src/test/ui/nll/borrowed-match-issue-45045.rs new file mode 100644 index 00000000000..8688bfa86dc --- /dev/null +++ b/src/test/ui/nll/borrowed-match-issue-45045.rs @@ -0,0 +1,30 @@ +// Copyright 2018 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Regression test for issue #45045 + +#![feature(nll)] + +enum Xyz { + A, + B, +} + +fn main() { + let mut e = Xyz::A; + let f = &mut e; + let g = f; + match e { + Xyz::A => println!("a"), + //~^ cannot use `e` because it was mutably borrowed [E0503] + Xyz::B => println!("b"), + }; + *g = Xyz::B; +} diff --git a/src/test/ui/nll/borrowed-match-issue-45045.stderr b/src/test/ui/nll/borrowed-match-issue-45045.stderr new file mode 100644 index 00000000000..15ca30010a5 --- /dev/null +++ b/src/test/ui/nll/borrowed-match-issue-45045.stderr @@ -0,0 +1,11 @@ +error[E0503]: cannot use `e` because it was mutably borrowed + --> $DIR/borrowed-match-issue-45045.rs:25:9 + | +22 | let f = &mut e; + | ------ borrow of `e` occurs here +... +25 | Xyz::A => println!("a"), + | ^^^^^^ use of borrowed `e` + +error: aborting due to previous error + diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index 1f736e33c8b..ff662736bdd 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -41,9 +41,13 @@ impl EarlyProps { iter_header(testfile, None, &mut |ln| { + // we should check if any only- exists and if it exists + // and does not matches the current platform, skip the test props.ignore = props.ignore || config.parse_cfg_name_directive(ln, "ignore") || + (config.has_cfg_prefix(ln, "only") && + !config.parse_cfg_name_directive(ln, "only")) || ignore_gdb(config, ln) || ignore_lldb(config, ln) || ignore_llvm(config, ln); @@ -564,6 +568,13 @@ impl Config { } } + fn has_cfg_prefix(&self, line: &str, prefix: &str) -> bool { + // returns whether this line contains this prefix or not. For prefix + // "ignore", returns true if line says "ignore-x86_64", "ignore-arch", + // "ignore-andorid" etc. + line.starts_with(prefix) && line.as_bytes().get(prefix.len()) == Some(&b'-') + } + fn parse_name_directive(&self, line: &str, directive: &str) -> bool { // Ensure the directive is a whole word. Do not match "ignore-x86" when // the line says "ignore-x86_64". diff --git a/src/tools/linkchecker/main.rs b/src/tools/linkchecker/main.rs index 6458ec02669..f6eaa09f55d 100644 --- a/src/tools/linkchecker/main.rs +++ b/src/tools/linkchecker/main.rs @@ -192,7 +192,17 @@ fn check(cache: &mut Cache, for part in Path::new(base).join(url).components() { match part { Component::Prefix(_) | - Component::RootDir => panic!(), + Component::RootDir => { + // Avoid absolute paths as they make the docs not + // relocatable by making assumptions on where the docs + // are hosted relative to the site root. + *errors = true; + println!("{}:{}: absolute path - {}", + pretty_file.display(), + i + 1, + Path::new(base).join(url).display()); + return; + } Component::CurDir => {} Component::ParentDir => { path.pop(); } Component::Normal(s) => { path.push(s); } diff --git a/src/tools/rust-installer b/src/tools/rust-installer index 745a020e924..b55e0fc7759 160000 --- a/src/tools/rust-installer +++ b/src/tools/rust-installer @@ -1 +1 @@ -Subproject commit 745a020e924c0532b01e8f017ed72820913642ee +Subproject commit b55e0fc77590cf5d23a01dedeb2104d8cbb48efc