Auto merge of #47522 - kennytm:rollup, r=kennytm
Rollup of 21 pull requests - Successful merges: #47302, #47333, #47387, #47404, #47407, #47426, #47427, #47436, #47444, #47456, #47458, #47467, #47479, #47481, #47483, #47487, #47497, #47498, #47505, #47509, #47514 - Failed merges:
This commit is contained in:
commit
0f9c784751
14
RELEASES.md
14
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<T>`, 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`,
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 <LICENSE-APACHE or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
# option. This file may not be copied, modified, or distributed
|
||||
# except according to those terms.
|
||||
|
||||
set -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
|
|
@ -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)]`
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -407,9 +407,7 @@ impl<T> Option<T> {
|
|||
}
|
||||
|
||||
/// 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<T> Option<T> {
|
|||
}
|
||||
|
||||
/// 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<T: Default> Option<T> {
|
|||
/// 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<T: Default> Option<T> {
|
|||
///
|
||||
/// [`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]
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<P>(&mut self, mut predicate: P) -> Option<usize> 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<P>(&mut self, mut predicate: P) -> Option<usize> 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")]
|
||||
|
|
|
@ -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] = [];
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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! {
|
||||
|
|
|
@ -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 ),*) => (
|
||||
{
|
||||
macro_rules! lint_array {
|
||||
($( $lint:expr ),*,) => { lint_array!( $( $lint ),* ) };
|
||||
($( $lint:expr ),*) => {{
|
||||
static ARRAY: LintArray = &[ $( &$lint ),* ];
|
||||
ARRAY
|
||||
}
|
||||
) }
|
||||
}}
|
||||
}
|
||||
|
||||
pub type LintArray = &'static [&'static &'static Lint];
|
||||
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
|
||||
|
|
|
@ -1172,7 +1172,7 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
|
|||
"emit noalias metadata for mutable references"),
|
||||
dump_mir: Option<String> = (None, parse_opt_string, [UNTRACKED],
|
||||
"dump MIR state at various points in translation"),
|
||||
dump_mir_dir: Option<String> = (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());
|
||||
|
|
|
@ -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(),
|
||||
]);
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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());
|
||||
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());
|
||||
if it.vis == hir::Visibility::Inherited {
|
||||
err.span_suggestion(insertion_span,
|
||||
"try making it public",
|
||||
"pub ".to_owned());
|
||||
}
|
||||
err.emit();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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(_) => {}
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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<String> {
|
||||
let mut names = Vec::new();
|
||||
|
||||
fn collect_mod(names: &mut Vec<Ident>, 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::<Vec<_>>())
|
||||
.collect::<Vec<_>>()))
|
||||
}
|
||||
|
||||
fn err_path_resolution() -> PathResolution {
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -46,8 +46,8 @@ pub enum ImportDirectiveSubclass<'a> {
|
|||
},
|
||||
GlobImport {
|
||||
is_prelude: bool,
|
||||
max_vis: Cell<ty::Visibility>, // The visibility of the greatest reexport.
|
||||
// n.b. `max_vis` is only used in `finalize_import` to check for reexport errors.
|
||||
max_vis: Cell<ty::Visibility>, // 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<Name>),
|
||||
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());
|
||||
|
|
|
@ -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 let Some(linker) = linker.to_str() {
|
||||
if cfg!(windows) && linker.ends_with(".bat") {
|
||||
let mut cmd = Command::new("cmd");
|
||||
cmd.arg("/c").arg(linker);
|
||||
cmd
|
||||
} else {
|
||||
Command::new(linker)
|
||||
return cmd
|
||||
}
|
||||
}
|
||||
Command::new(linker)
|
||||
};
|
||||
|
||||
if let Some(ref linker) = sess.opts.cg.linker {
|
||||
|
|
|
@ -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))));
|
||||
|
|
|
@ -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"];
|
||||
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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<clean::Item>) {
|
||||
// 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();
|
||||
|
|
|
@ -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!("<li><a href=\"#{id}\">{name}</a></li>",
|
||||
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"),
|
||||
|
|
|
@ -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,
|
||||
};
|
||||
|
||||
|
|
|
@ -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")]
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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")]
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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")]
|
||||
|
|
|
@ -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,20 +754,20 @@ impl<'a> ExtCtxt<'a> {
|
|||
last_macro
|
||||
}
|
||||
|
||||
pub fn struct_span_warn(&self,
|
||||
sp: Span,
|
||||
pub fn struct_span_warn<S: Into<MultiSpan>>(&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,
|
||||
pub fn struct_span_err<S: Into<MultiSpan>>(&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,
|
||||
pub fn struct_span_fatal<S: Into<MultiSpan>>(&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<S: Into<MultiSpan>>(&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<S: Into<MultiSpan>>(&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<S: Into<MultiSpan>>(&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<S: Into<MultiSpan>>(&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<S: Into<MultiSpan>>(&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<S: Into<MultiSpan>>(&self, sp: S, msg: &str) -> ! {
|
||||
self.parse_sess.span_diagnostic.span_bug(sp, msg);
|
||||
}
|
||||
pub fn trace_macros_diag(&mut self) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<S: Into<MultiSpan>>(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<S: Into<MultiSpan>>(&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<S: Into<MultiSpan>>(&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<S: Into<MultiSpan>>(&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<S: Into<MultiSpan>>(&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<S: Into<MultiSpan>>(&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<S: Into<MultiSpan>>(&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<S: Into<MultiSpan>>(&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<S: Into<MultiSpan>>(&self, sp: S, m: &str) -> ! {
|
||||
self.sess.span_diagnostic.span_bug(sp, m)
|
||||
}
|
||||
pub fn abort_if_errors(&self) {
|
||||
|
|
|
@ -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::<Vec<Span>>(),
|
||||
"multiple unused formatting arguments"
|
||||
);
|
||||
diag.span_label(cx.fmtsp, "multiple unused arguments in this statement");
|
||||
diag
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// 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 {};
|
||||
}
|
|
@ -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;
|
||||
|
|
|
@ -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() {}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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`
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 }
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
|
@ -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 Pass {
|
||||
impl LintPass for $struct {
|
||||
fn get_lints(&self) -> LintArray {
|
||||
lint_array!(CRATE_NOT_OKAY)
|
||||
$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<'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);
|
||||
}
|
||||
|
|
|
@ -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() { }
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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 {}
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
// ignore-tidy-tab
|
||||
fn main() {
|
||||
let b = "hello";
|
||||
let _a = b + ", World!";
|
||||
//~^ ERROR E0369
|
||||
}
|
|
@ -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
|
||||
|
|
@ -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 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
fn main() {
|
||||
let b = "hello";
|
||||
println!("🦀🦀🦀🦀🦀"); let _a = b + ", World!";
|
||||
//~^ ERROR E0369
|
||||
}
|
|
@ -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
|
||||
|
|
@ -24,6 +24,16 @@ pub fn defiant<T>(_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,
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 `{}`
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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`
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// Regression test for issue #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;
|
||||
}
|
|
@ -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
|
||||
|
|
@ -41,9 +41,13 @@ impl EarlyProps {
|
|||
iter_header(testfile,
|
||||
None,
|
||||
&mut |ln| {
|
||||
// we should check if any only-<platform> 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".
|
||||
|
|
|
@ -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); }
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 745a020e924c0532b01e8f017ed72820913642ee
|
||||
Subproject commit b55e0fc77590cf5d23a01dedeb2104d8cbb48efc
|
Loading…
Reference in New Issue